WishList



+ DATE & TIME: An /D switch to display only the date/time, but don't
loop, don't even display the prompt.

+ time.c: parsetime(): Make this function really _parse_ the time, but
not setting the DOS time. This would make it available for other
uses in the future.

+ All these number scanning loops could be replaced strtol() or a self-made
function.

+ PROMPT: expansion of environment variables

+ COMMAND definitely requires a getopt()-like function and/or some
command line scanning functions. Every internal command
performs its own scanning with its own rules, that's bad.
Those functions could include (wild guess):
struct ScannerContext {
char *line;
char *currp; /* points to the remaining unchanged line */
char *optArgument;
char *optNextCharacter; /* != NULL where to read nxt opt from */
};

struct ScannerContext sc;
int opt;
char *p;

void scInit(&sc, rest);
do {
while((opt = scOption(&sc)) != EOF) {
printf("Next option: %c", opt);
if(sc.optArgument)
printf(" with argument: '%s'", sc.optArgument);
putchar('\n');
}

while((p = scToken(&sc)) != NULL) {
printf("Next non-option argument: '%s'\n", p);
}
} while(!scEOF(&sc));

scEOF(sc) := *sc.currp != 0;

Because only few internal commands break up all their command
line, the main(argc, argv)-style would not work efficiently.

Or just some functions th‘t:
1) skip numerous whitespaces
2) skip one word honoring quotes and options, e.g.
skipword("word/o") word return a poi to '/'
3) scanning option strings and its arguments
4) check if the next word is a given one (case-insentive
match of a string and check for a word boundary behind it)

Back