1dd3cb568SWarner Losh /*- 25b81b6b3SRodney W. Grimes * Mach Operating System 35b81b6b3SRodney W. Grimes * Copyright (c) 1991,1990 Carnegie Mellon University 45b81b6b3SRodney W. Grimes * All Rights Reserved. 55b81b6b3SRodney W. Grimes * 65b81b6b3SRodney W. Grimes * Permission to use, copy, modify and distribute this software and its 75b81b6b3SRodney W. Grimes * documentation is hereby granted, provided that both the copyright 85b81b6b3SRodney W. Grimes * notice and this permission notice appear in all copies of the 95b81b6b3SRodney W. Grimes * software, derivative works or modified versions, and any portions 105b81b6b3SRodney W. Grimes * thereof, and that both notices appear in supporting documentation. 115b81b6b3SRodney W. Grimes * 125b81b6b3SRodney W. Grimes * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS 135b81b6b3SRodney W. Grimes * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR 145b81b6b3SRodney W. Grimes * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. 155b81b6b3SRodney W. Grimes * 165b81b6b3SRodney W. Grimes * Carnegie Mellon requests users of this software to return to 175b81b6b3SRodney W. Grimes * 185b81b6b3SRodney W. Grimes * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU 195b81b6b3SRodney W. Grimes * School of Computer Science 205b81b6b3SRodney W. Grimes * Carnegie Mellon University 215b81b6b3SRodney W. Grimes * Pittsburgh PA 15213-3890 225b81b6b3SRodney W. Grimes * 235b81b6b3SRodney W. Grimes * any improvements or extensions that they make and grant Carnegie the 245b81b6b3SRodney W. Grimes * rights to redistribute these changes. 255b81b6b3SRodney W. Grimes */ 265b81b6b3SRodney W. Grimes /* 275b81b6b3SRodney W. Grimes * Author: David B. Golub, Carnegie Mellon University 285b81b6b3SRodney W. Grimes * Date: 7/90 295b81b6b3SRodney W. Grimes */ 305b81b6b3SRodney W. Grimes 31753960f7SDavid E. O'Brien #include <sys/cdefs.h> 32753960f7SDavid E. O'Brien __FBSDID("$FreeBSD$"); 33753960f7SDavid E. O'Brien 34f540b106SGarrett Wollman #include <sys/param.h> 35f540b106SGarrett Wollman #include <sys/systm.h> 36ce9edcf5SPoul-Henning Kamp #include <sys/cons.h> 375ccbc3ccSBruce Evans 38f540b106SGarrett Wollman #include <ddb/ddb.h> 39f540b106SGarrett Wollman #include <ddb/db_output.h> 405b81b6b3SRodney W. Grimes 415b81b6b3SRodney W. Grimes /* 425b81b6b3SRodney W. Grimes * Character input and editing. 435b81b6b3SRodney W. Grimes */ 445b81b6b3SRodney W. Grimes 455b81b6b3SRodney W. Grimes /* 465b81b6b3SRodney W. Grimes * We don't track output position while editing input, 475b81b6b3SRodney W. Grimes * since input always ends with a new-line. We just 485b81b6b3SRodney W. Grimes * reset the line position at the end. 495b81b6b3SRodney W. Grimes */ 5025eb640dSPoul-Henning Kamp static char * db_lbuf_start; /* start of input line buffer */ 5125eb640dSPoul-Henning Kamp static char * db_lbuf_end; /* end of input line buffer */ 5225eb640dSPoul-Henning Kamp static char * db_lc; /* current character */ 5325eb640dSPoul-Henning Kamp static char * db_le; /* one past last character */ 545b81b6b3SRodney W. Grimes 55b4630773SJoerg Wunsch /* 56b4630773SJoerg Wunsch * Simple input line history support. 57b4630773SJoerg Wunsch */ 5841630a01SBruce Evans static char db_lhistory[2048]; 59b4630773SJoerg Wunsch static int db_lhistlsize, db_lhistidx, db_lhistcur; 60d984ae1eSMike Smith static int db_lhist_nlines; 61b4630773SJoerg Wunsch 625b81b6b3SRodney W. Grimes #define CTRL(c) ((c) & 0x1f) 635b81b6b3SRodney W. Grimes #define BLANK ' ' 645b81b6b3SRodney W. Grimes #define BACKUP '\b' 655b81b6b3SRodney W. Grimes 66c2718b42SMark Johnston static int cnmaygetc(void); 6714e10f99SAlfred Perlstein static void db_delete(int n, int bwd); 6814e10f99SAlfred Perlstein static int db_inputchar(int c); 6914e10f99SAlfred Perlstein static void db_putnchars(int c, int count); 7014e10f99SAlfred Perlstein static void db_putstring(char *s, int count); 71058284fcSBruce Evans 7237c84183SPoul-Henning Kamp static void 735b81b6b3SRodney W. Grimes db_putstring(s, count) 745b81b6b3SRodney W. Grimes char *s; 755b81b6b3SRodney W. Grimes int count; 765b81b6b3SRodney W. Grimes { 775b81b6b3SRodney W. Grimes while (--count >= 0) 785b81b6b3SRodney W. Grimes cnputc(*s++); 795b81b6b3SRodney W. Grimes } 805b81b6b3SRodney W. Grimes 8137c84183SPoul-Henning Kamp static void 825b81b6b3SRodney W. Grimes db_putnchars(c, count) 835b81b6b3SRodney W. Grimes int c; 845b81b6b3SRodney W. Grimes int count; 855b81b6b3SRodney W. Grimes { 865b81b6b3SRodney W. Grimes while (--count >= 0) 875b81b6b3SRodney W. Grimes cnputc(c); 885b81b6b3SRodney W. Grimes } 895b81b6b3SRodney W. Grimes 905b81b6b3SRodney W. Grimes /* 915b81b6b3SRodney W. Grimes * Delete N characters, forward or backward 925b81b6b3SRodney W. Grimes */ 935b81b6b3SRodney W. Grimes #define DEL_FWD 0 945b81b6b3SRodney W. Grimes #define DEL_BWD 1 9537c84183SPoul-Henning Kamp static void 965b81b6b3SRodney W. Grimes db_delete(n, bwd) 975b81b6b3SRodney W. Grimes int n; 985b81b6b3SRodney W. Grimes int bwd; 995b81b6b3SRodney W. Grimes { 1000a95ab74SPedro F. Giffuni char *p; 1015b81b6b3SRodney W. Grimes 1025b81b6b3SRodney W. Grimes if (bwd) { 1035b81b6b3SRodney W. Grimes db_lc -= n; 1045b81b6b3SRodney W. Grimes db_putnchars(BACKUP, n); 1055b81b6b3SRodney W. Grimes } 1065b81b6b3SRodney W. Grimes for (p = db_lc; p < db_le-n; p++) { 1075b81b6b3SRodney W. Grimes *p = *(p+n); 1085b81b6b3SRodney W. Grimes cnputc(*p); 1095b81b6b3SRodney W. Grimes } 1105b81b6b3SRodney W. Grimes db_putnchars(BLANK, n); 1115b81b6b3SRodney W. Grimes db_putnchars(BACKUP, db_le - db_lc); 1125b81b6b3SRodney W. Grimes db_le -= n; 1135b81b6b3SRodney W. Grimes } 1145b81b6b3SRodney W. Grimes 1152b490bc7SPedro F. Giffuni /* returns true at end-of-line */ 11637c84183SPoul-Henning Kamp static int 1175b81b6b3SRodney W. Grimes db_inputchar(c) 1185b81b6b3SRodney W. Grimes int c; 1195b81b6b3SRodney W. Grimes { 120eae6ab5eSJoerg Wunsch static int escstate; 121eae6ab5eSJoerg Wunsch 122eae6ab5eSJoerg Wunsch if (escstate == 1) { 123eae6ab5eSJoerg Wunsch /* ESC seen, look for [ or O */ 124eae6ab5eSJoerg Wunsch if (c == '[' || c == 'O') 125eae6ab5eSJoerg Wunsch escstate++; 126eae6ab5eSJoerg Wunsch else 127eae6ab5eSJoerg Wunsch escstate = 0; /* re-init state machine */ 128eae6ab5eSJoerg Wunsch return (0); 129eae6ab5eSJoerg Wunsch } else if (escstate == 2) { 130eae6ab5eSJoerg Wunsch escstate = 0; 131eae6ab5eSJoerg Wunsch /* 132eae6ab5eSJoerg Wunsch * If a valid cursor key has been found, translate 133eae6ab5eSJoerg Wunsch * into an emacs-style control key, and fall through. 134eae6ab5eSJoerg Wunsch * Otherwise, drop off. 135eae6ab5eSJoerg Wunsch */ 1365b81b6b3SRodney W. Grimes switch (c) { 137eae6ab5eSJoerg Wunsch case 'A': /* up */ 138eae6ab5eSJoerg Wunsch c = CTRL('p'); 139eae6ab5eSJoerg Wunsch break; 140eae6ab5eSJoerg Wunsch case 'B': /* down */ 141eae6ab5eSJoerg Wunsch c = CTRL('n'); 142eae6ab5eSJoerg Wunsch break; 143eae6ab5eSJoerg Wunsch case 'C': /* right */ 144eae6ab5eSJoerg Wunsch c = CTRL('f'); 145eae6ab5eSJoerg Wunsch break; 146eae6ab5eSJoerg Wunsch case 'D': /* left */ 147eae6ab5eSJoerg Wunsch c = CTRL('b'); 148eae6ab5eSJoerg Wunsch break; 149eae6ab5eSJoerg Wunsch default: 150eae6ab5eSJoerg Wunsch return (0); 151eae6ab5eSJoerg Wunsch } 152eae6ab5eSJoerg Wunsch } 153eae6ab5eSJoerg Wunsch 154eae6ab5eSJoerg Wunsch switch (c) { 155eae6ab5eSJoerg Wunsch case CTRL('['): 156eae6ab5eSJoerg Wunsch escstate = 1; 157eae6ab5eSJoerg Wunsch break; 1585b81b6b3SRodney W. Grimes case CTRL('b'): 1595b81b6b3SRodney W. Grimes /* back up one character */ 1605b81b6b3SRodney W. Grimes if (db_lc > db_lbuf_start) { 1615b81b6b3SRodney W. Grimes cnputc(BACKUP); 1625b81b6b3SRodney W. Grimes db_lc--; 1635b81b6b3SRodney W. Grimes } 1645b81b6b3SRodney W. Grimes break; 1655b81b6b3SRodney W. Grimes case CTRL('f'): 1665b81b6b3SRodney W. Grimes /* forward one character */ 1675b81b6b3SRodney W. Grimes if (db_lc < db_le) { 1685b81b6b3SRodney W. Grimes cnputc(*db_lc); 1695b81b6b3SRodney W. Grimes db_lc++; 1705b81b6b3SRodney W. Grimes } 1715b81b6b3SRodney W. Grimes break; 1725b81b6b3SRodney W. Grimes case CTRL('a'): 1735b81b6b3SRodney W. Grimes /* beginning of line */ 1745b81b6b3SRodney W. Grimes while (db_lc > db_lbuf_start) { 1755b81b6b3SRodney W. Grimes cnputc(BACKUP); 1765b81b6b3SRodney W. Grimes db_lc--; 1775b81b6b3SRodney W. Grimes } 1785b81b6b3SRodney W. Grimes break; 1795b81b6b3SRodney W. Grimes case CTRL('e'): 1805b81b6b3SRodney W. Grimes /* end of line */ 1815b81b6b3SRodney W. Grimes while (db_lc < db_le) { 1825b81b6b3SRodney W. Grimes cnputc(*db_lc); 1835b81b6b3SRodney W. Grimes db_lc++; 1845b81b6b3SRodney W. Grimes } 1855b81b6b3SRodney W. Grimes break; 1865b81b6b3SRodney W. Grimes case CTRL('h'): 1875b81b6b3SRodney W. Grimes case 0177: 1885b81b6b3SRodney W. Grimes /* erase previous character */ 1895b81b6b3SRodney W. Grimes if (db_lc > db_lbuf_start) 1905b81b6b3SRodney W. Grimes db_delete(1, DEL_BWD); 1915b81b6b3SRodney W. Grimes break; 1925b81b6b3SRodney W. Grimes case CTRL('d'): 1935b81b6b3SRodney W. Grimes /* erase next character */ 1945b81b6b3SRodney W. Grimes if (db_lc < db_le) 1955b81b6b3SRodney W. Grimes db_delete(1, DEL_FWD); 1965b81b6b3SRodney W. Grimes break; 19709ffa9adSYaroslav Tykhiy case CTRL('u'): 198*81e12dd1SEdward Tomasz Napierala case CTRL('c'): 19909ffa9adSYaroslav Tykhiy /* kill entire line: */ 20009ffa9adSYaroslav Tykhiy /* at first, delete to beginning of line */ 20109ffa9adSYaroslav Tykhiy if (db_lc > db_lbuf_start) 20209ffa9adSYaroslav Tykhiy db_delete(db_lc - db_lbuf_start, DEL_BWD); 20309ffa9adSYaroslav Tykhiy /* FALLTHROUGH */ 2045b81b6b3SRodney W. Grimes case CTRL('k'): 2055b81b6b3SRodney W. Grimes /* delete to end of line */ 2065b81b6b3SRodney W. Grimes if (db_lc < db_le) 2075b81b6b3SRodney W. Grimes db_delete(db_le - db_lc, DEL_FWD); 2085b81b6b3SRodney W. Grimes break; 2095b81b6b3SRodney W. Grimes case CTRL('t'): 2105b81b6b3SRodney W. Grimes /* twiddle last 2 characters */ 2115b81b6b3SRodney W. Grimes if (db_lc >= db_lbuf_start + 2) { 2125b81b6b3SRodney W. Grimes c = db_lc[-2]; 2135b81b6b3SRodney W. Grimes db_lc[-2] = db_lc[-1]; 2145b81b6b3SRodney W. Grimes db_lc[-1] = c; 2155b81b6b3SRodney W. Grimes cnputc(BACKUP); 2165b81b6b3SRodney W. Grimes cnputc(BACKUP); 2175b81b6b3SRodney W. Grimes cnputc(db_lc[-2]); 2185b81b6b3SRodney W. Grimes cnputc(db_lc[-1]); 2195b81b6b3SRodney W. Grimes } 2205b81b6b3SRodney W. Grimes break; 221eeb6101eSEdward Tomasz Napierala case CTRL('w'): 222eeb6101eSEdward Tomasz Napierala /* erase previous word */ 223eeb6101eSEdward Tomasz Napierala for (; db_lc > db_lbuf_start;) { 224eeb6101eSEdward Tomasz Napierala if (*(db_lc - 1) != ' ') 225eeb6101eSEdward Tomasz Napierala break; 226eeb6101eSEdward Tomasz Napierala db_delete(1, DEL_BWD); 227eeb6101eSEdward Tomasz Napierala } 228eeb6101eSEdward Tomasz Napierala for (; db_lc > db_lbuf_start;) { 229eeb6101eSEdward Tomasz Napierala if (*(db_lc - 1) == ' ') 230eeb6101eSEdward Tomasz Napierala break; 231eeb6101eSEdward Tomasz Napierala db_delete(1, DEL_BWD); 232eeb6101eSEdward Tomasz Napierala } 233eeb6101eSEdward Tomasz Napierala break; 2345b81b6b3SRodney W. Grimes case CTRL('r'): 2355b81b6b3SRodney W. Grimes db_putstring("^R\n", 3); 236b4630773SJoerg Wunsch redraw: 2375b81b6b3SRodney W. Grimes if (db_le > db_lbuf_start) { 2385b81b6b3SRodney W. Grimes db_putstring(db_lbuf_start, db_le - db_lbuf_start); 2395b81b6b3SRodney W. Grimes db_putnchars(BACKUP, db_le - db_lc); 2405b81b6b3SRodney W. Grimes } 2415b81b6b3SRodney W. Grimes break; 242b4630773SJoerg Wunsch case CTRL('p'): 243b4630773SJoerg Wunsch /* Make previous history line the active one. */ 244b4630773SJoerg Wunsch if (db_lhistcur >= 0) { 245b4630773SJoerg Wunsch bcopy(db_lhistory + db_lhistcur * db_lhistlsize, 246b4630773SJoerg Wunsch db_lbuf_start, db_lhistlsize); 247b4630773SJoerg Wunsch db_lhistcur--; 248b4630773SJoerg Wunsch goto hist_redraw; 249b4630773SJoerg Wunsch } 250b4630773SJoerg Wunsch break; 251b4630773SJoerg Wunsch case CTRL('n'): 252b4630773SJoerg Wunsch /* Make next history line the active one. */ 253b4630773SJoerg Wunsch if (db_lhistcur < db_lhistidx - 1) { 254b4630773SJoerg Wunsch db_lhistcur += 2; 255b4630773SJoerg Wunsch bcopy(db_lhistory + db_lhistcur * db_lhistlsize, 256b4630773SJoerg Wunsch db_lbuf_start, db_lhistlsize); 257b4630773SJoerg Wunsch } else { 258b4630773SJoerg Wunsch /* 259b4630773SJoerg Wunsch * ^N through tail of history, reset the 260b4630773SJoerg Wunsch * buffer to zero length. 261b4630773SJoerg Wunsch */ 262b4630773SJoerg Wunsch *db_lbuf_start = '\0'; 263b4630773SJoerg Wunsch db_lhistcur = db_lhistidx; 264b4630773SJoerg Wunsch } 265b4630773SJoerg Wunsch 266b4630773SJoerg Wunsch hist_redraw: 267ea1c6a39SRobert Watson db_putnchars(BACKUP, db_lc - db_lbuf_start); 268b4630773SJoerg Wunsch db_putnchars(BLANK, db_le - db_lbuf_start); 269b4630773SJoerg Wunsch db_putnchars(BACKUP, db_le - db_lbuf_start); 270dc15eac0SEd Schouten db_le = strchr(db_lbuf_start, '\0'); 271b4630773SJoerg Wunsch if (db_le[-1] == '\r' || db_le[-1] == '\n') 272b4630773SJoerg Wunsch *--db_le = '\0'; 273b4630773SJoerg Wunsch db_lc = db_le; 274b4630773SJoerg Wunsch goto redraw; 275b4630773SJoerg Wunsch 27675680b05SJulian Elischer case -1: 27775680b05SJulian Elischer /* 27875680b05SJulian Elischer * eek! the console returned eof. 27975680b05SJulian Elischer * probably that means we HAVE no console.. we should try bail 28075680b05SJulian Elischer * XXX 28175680b05SJulian Elischer */ 28275680b05SJulian Elischer c = '\r'; 2835b81b6b3SRodney W. Grimes case '\n': 2849a4b535cSPoul-Henning Kamp /* FALLTHROUGH */ 2855b81b6b3SRodney W. Grimes case '\r': 2865b81b6b3SRodney W. Grimes *db_le++ = c; 2875b81b6b3SRodney W. Grimes return (1); 2885b81b6b3SRodney W. Grimes default: 2895b81b6b3SRodney W. Grimes if (db_le == db_lbuf_end) { 2905b81b6b3SRodney W. Grimes cnputc('\007'); 2915b81b6b3SRodney W. Grimes } 2925b81b6b3SRodney W. Grimes else if (c >= ' ' && c <= '~') { 2930a95ab74SPedro F. Giffuni char *p; 2945b81b6b3SRodney W. Grimes 2955b81b6b3SRodney W. Grimes for (p = db_le; p > db_lc; p--) 2965b81b6b3SRodney W. Grimes *p = *(p-1); 2975b81b6b3SRodney W. Grimes *db_lc++ = c; 2985b81b6b3SRodney W. Grimes db_le++; 2995b81b6b3SRodney W. Grimes cnputc(c); 3005b81b6b3SRodney W. Grimes db_putstring(db_lc, db_le - db_lc); 3015b81b6b3SRodney W. Grimes db_putnchars(BACKUP, db_le - db_lc); 3025b81b6b3SRodney W. Grimes } 3035b81b6b3SRodney W. Grimes break; 3045b81b6b3SRodney W. Grimes } 3055b81b6b3SRodney W. Grimes return (0); 3065b81b6b3SRodney W. Grimes } 3075b81b6b3SRodney W. Grimes 308c2718b42SMark Johnston static int 309c2718b42SMark Johnston cnmaygetc() 310c2718b42SMark Johnston { 311c2718b42SMark Johnston return (-1); 312c2718b42SMark Johnston } 313c2718b42SMark Johnston 314f23b4c91SGarrett Wollman int 3155b81b6b3SRodney W. Grimes db_readline(lstart, lsize) 3165b81b6b3SRodney W. Grimes char * lstart; 3175b81b6b3SRodney W. Grimes int lsize; 3185b81b6b3SRodney W. Grimes { 319233f8184SRobert Watson 320233f8184SRobert Watson if (lsize < 2) 321233f8184SRobert Watson return (0); 32241630a01SBruce Evans if (lsize != db_lhistlsize) { 32341630a01SBruce Evans /* 32441630a01SBruce Evans * (Re)initialize input line history. Throw away any 32541630a01SBruce Evans * existing history. 32641630a01SBruce Evans */ 32741630a01SBruce Evans db_lhist_nlines = sizeof(db_lhistory) / lsize; 328b4630773SJoerg Wunsch db_lhistlsize = lsize; 329b4630773SJoerg Wunsch db_lhistidx = -1; 330b4630773SJoerg Wunsch } 331b4630773SJoerg Wunsch db_lhistcur = db_lhistidx; 332b4630773SJoerg Wunsch 3335b81b6b3SRodney W. Grimes db_force_whitespace(); /* synch output position */ 3345b81b6b3SRodney W. Grimes 3355b81b6b3SRodney W. Grimes db_lbuf_start = lstart; 336233f8184SRobert Watson db_lbuf_end = lstart + lsize - 2; /* Will append NL and NUL. */ 3375b81b6b3SRodney W. Grimes db_lc = lstart; 3385b81b6b3SRodney W. Grimes db_le = lstart; 3395b81b6b3SRodney W. Grimes 3405b81b6b3SRodney W. Grimes while (!db_inputchar(cngetc())) 3415b81b6b3SRodney W. Grimes continue; 3425b81b6b3SRodney W. Grimes 343086fec57SRobert Watson db_capture_write(lstart, db_le - db_lbuf_start); 3446ddbf1e2SGary Palmer db_printf("\n"); /* synch output position */ 3455b81b6b3SRodney W. Grimes *db_le = 0; 346b4630773SJoerg Wunsch 34741630a01SBruce Evans if (db_le - db_lbuf_start > 1) { 348b4630773SJoerg Wunsch /* Maintain input line history for non-empty lines. */ 349d984ae1eSMike Smith if (++db_lhistidx == db_lhist_nlines) { 350b4630773SJoerg Wunsch /* Rotate history. */ 3518543efaeSDag-Erling Smørgrav bcopy(db_lhistory + db_lhistlsize, db_lhistory, 352d984ae1eSMike Smith db_lhistlsize * (db_lhist_nlines - 1)); 353b4630773SJoerg Wunsch db_lhistidx--; 354b4630773SJoerg Wunsch } 35541630a01SBruce Evans bcopy(lstart, db_lhistory + db_lhistidx * db_lhistlsize, 356b4630773SJoerg Wunsch db_lhistlsize); 357b4630773SJoerg Wunsch } 358b4630773SJoerg Wunsch 3595b81b6b3SRodney W. Grimes return (db_le - db_lbuf_start); 3605b81b6b3SRodney W. Grimes } 3615b81b6b3SRodney W. Grimes 3625b81b6b3SRodney W. Grimes void 363a41dd031SPedro F. Giffuni db_check_interrupt(void) 3645b81b6b3SRodney W. Grimes { 3650a95ab74SPedro F. Giffuni int c; 3665b81b6b3SRodney W. Grimes 367c2718b42SMark Johnston c = cnmaygetc(); 3685b81b6b3SRodney W. Grimes switch (c) { 3695b81b6b3SRodney W. Grimes case -1: /* no character */ 3705b81b6b3SRodney W. Grimes return; 3715b81b6b3SRodney W. Grimes 3725b81b6b3SRodney W. Grimes case CTRL('c'): 3735b81b6b3SRodney W. Grimes db_error((char *)0); 3745b81b6b3SRodney W. Grimes /*NOTREACHED*/ 3755b81b6b3SRodney W. Grimes 3765b81b6b3SRodney W. Grimes case CTRL('s'): 3775b81b6b3SRodney W. Grimes do { 378c2718b42SMark Johnston c = cnmaygetc(); 3795b81b6b3SRodney W. Grimes if (c == CTRL('c')) 3805b81b6b3SRodney W. Grimes db_error((char *)0); 3815b81b6b3SRodney W. Grimes } while (c != CTRL('q')); 3825b81b6b3SRodney W. Grimes break; 3835b81b6b3SRodney W. Grimes 3845b81b6b3SRodney W. Grimes default: 3855b81b6b3SRodney W. Grimes /* drop on floor */ 3865b81b6b3SRodney W. Grimes break; 3875b81b6b3SRodney W. Grimes } 3885b81b6b3SRodney W. Grimes } 389