switch()
My suggestion would be to do the following:
1) Create a table which has a series of strings and constants:
struct TABLE { int value; char *string } look[] = {
{ 1, "option1"}, {2, "nopage"}, {3, "format"}, {4, "resize"} };
2) Write a routine that takes the string to compare and the based of the
table and searches for that string in the table. If found, it returns the
value associated with the string. Otherwise it returns an error.
3) In your main code, just switch on the value returned from this function.
The nice thing about this function is that you can teach it about
abbreviations without having to change any of your code.
John A. Toebes, VIII – via Whap!