static void switchEcho(int tokenCount, char **tokens) { int state; if (tokenCount < 2) { printText("Echo on or off?"); return; } switch (*(tokens[1])) { case '0': state = 0; oK(_echo(&state)); break; case '1': state = 1; oK(_echo(&state)); break; default: printText("Echo on or off?"); } }
static void printText(char *text) { if(_echo(NULL)) { writeMemo(text); } PUTS(text); }
/* main */ int main(int argc, char * argv[]) { int o; while((o = getopt(argc, argv, "")) != -1) switch(o) { default: return _usage(); } return _echo(argc - optind, &argv[optind]); }