2 * Functions which manipulate the command buffer.
3 * Used only by command() and related functions.
8 extern int erase_char, kill_char;
11 static char cmdbuf[120]; /* Buffer for holding a multi-char command */
12 static int cmd_col; /* Current column of the multi-char command */
13 static char *cp; /* Pointer into cmdbuf */
16 * Reset command buffer (to empty).
27 * How many characters are in the command buffer?
36 * Backspace in the command buffer.
45 * Backspace past beginning of the string:
46 * this usually means abort the command.
65 * Process a single character of a multi-character command, such as
66 * a number, or the pattern of a search command.
78 } else if (c == kill_char)
80 /* {{ Could do this faster, but who cares? }} */
81 while (cmd_erase() == 0)
83 } else if (cp >= &cmdbuf[sizeof(cmdbuf)-1])
86 * No room in the command buffer.
89 } else if (cmd_col >= sc_width-4)
92 * No room on the screen.
93 * {{ Could get fancy here; maybe shift the displayed
94 * line and make room for more chars, like ksh. }}
100 * Append the character to the string.
109 cmd_col += strlen(s);
115 * Return the number currently in the command buffer.
120 return (atoi(cmdbuf));
124 * Display a string, usually as a prompt for input into the command buffer.
131 cmd_col += strlen(s);
135 * Return a pointer to the command buffer.