Re: Command Line Interface (CLI): your recommendations
- From: "Roman Mashak" <mrv@xxxxxxxx>
- Date: Mon, 13 Feb 2006 15:01:31 +0700
Hello, Barry!
You wrote on Sun, 12 Feb 2006 11:08:48 -0800:
Thank you very much for useful tips.
[skip]
BS> But you are inconsistent. You actually copy the command but only
BS> store the argument addresses. What about the command is so special
BS> that you need to store the actual characters in cli->command rather
BS> than simply the address of the command in buf?
??>> while (1) {
??>> printf("%s", PROMPT);
BS> Use fflush here to force the output to your screen.
??>> if ( fgets(buf, BUFSIZ, stdin) ) {
??>> /* skip LF/CR/TAB/SP */
??>> if (buf[0] == '\n' || buf[0] == ' ' || buf[0] == '\r' ||
??>> buf[0] == '\t')
BS> Look up the isspace() function if you really want to do this. Are you
BS> sure you want to do this since the strtoken call in
BS> cliParseCommandLine() will very happily skip over leading white space
BS> for you?
Actually true, but my intention was to skip input consisting only of '\t',
'\n', ' ' and '\r'. That's isspace() is much better here.
With best regards, Roman Mashak. E-mail: mrv@xxxxxxxx
.
- References:
- Command Line Interface (CLI): your recommendations
- From: Roman Mashak
- Re: Command Line Interface (CLI): your recommendations
- From: Barry Schwarz
- Command Line Interface (CLI): your recommendations
- Prev by Date: Re: _tfopen()
- Next by Date: Re: _tfopen()
- Previous by thread: Re: Command Line Interface (CLI): your recommendations
- Next by thread: size_t and C90/C99
- Index(es):
Relevant Pages
|