CVS: libraries/mspgcc lineeditor.c,1.1,1.2
Chris Liechti <[email protected]>
| Newsgroups | gmane.comp.hardware.texas-instruments.msp430.gcc.cvs |
|---|---|
| Message-ID | <[email protected]> |
Update of /cvsroot/mspgcc/libraries/mspgcc
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5706/libraries/mspgcc
Modified Files:
lineeditor.c
Log Message:
echo switchable
Index: lineeditor.c
===================================================================
RCS file: /cvsroot/mspgcc/libraries/mspgcc/lineeditor.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -w -d -r1.1 -r1.2
--- lineeditor.c 22 Aug 2005 11:23:20 -0000 1.1
+++ lineeditor.c 19 Sep 2005 12:23:05 -0000 1.2
@@ -9,26 +9,32 @@
break;
case '\n': // newline
+ if (state->flags.echo) {
putchar((unsigned char)key); // echo
+ }
return 1; // exit with true
case '\b': // backspace
case '\x7f': // backspace (alternative)
- if (state->position) { // only if line is nonempty
+ if (state->position) { // only if line is not empty
state->position--; // remove last character from the buffer
state->line[state->position] = '\0'; // ensure null termination
+ if (state->flags.echo) {
putchar('\b'); // overprint last character
putchar(' '); // with a space
putchar('\b'); // reposition cursor
}
+ }
break;
default: // text
if (state->position < (state->line_size - 1)) {
state->line[state->position++] = key; // store, advance in buffer
state->line[state->position] = '\0'; // ensure null termination
+ if (state->flags.echo) {
putchar((unsigned char)key); // echo
}
+ }
break;
}
return 0; // line not yet finished, return false
-------------------------------------------------------
SF.Net email is sponsored by:
Tame your development challenges with Apache's Geronimo App Server. Download
it for free - -and be entered to win a 42" plasma tv or your very own
Sony(tm)PSP. Click here to play: http://sourceforge.net/geronimo.php