#include #include struct flaginfo { char *f; char *s ; }; static struct flaginfo flags[] = { { "ISTRIP" , "Strip character" }, { "INLCR" , "Map NL to CR on input" }, { "IGNCR" , "Ignore CR" }, { "ICRNL" , "Map CR to NL on input" }, { "IXON" , "Enable start/stop output control" }, { "IXOFF" , "Enable start/stop input control" }, { "ISIG" , "Enable signals" }, { "ICANON" , "Canonical input (erase and kill)"} , { "ECHO" , "echo" }, { "ECHOE" , "Echo ERASE as BS-SPACE-BS" }, { "ECHOK" , "Echo KILL by starting new line" }, {NULL , NULL } }; int main() { int i; for( i = 0; flags[i].f != NULL ; i++ ) { putchar('\n'); printf("\tif ( settings & %s )\n", flags[i].f); printf("\t\tprintf(\"ON %s\\n\");\n", flags[i].s); printf("\telse\n"); printf("\t\tprintf(\"OFF %s\\n\");\n", flags[i].s); } }