--- Gnu-Mach/ddb/db_input.c 2020/09/02 04:36:57 1.1 +++ Gnu-Mach/ddb/db_input.c 2020/09/02 04:48:20 1.1.1.4 @@ -1,25 +1,25 @@ -/* +/* * Mach Operating System * Copyright (c) 1992,1991,1990 Carnegie Mellon University * All Rights Reserved. - * + * * Permission to use, copy, modify and distribute this software and its * documentation is hereby granted, provided that both the copyright * notice and this permission notice appear in all copies of the * software, derivative works or modified versions, and any portions * thereof, and that both notices appear in supporting documentation. - * + * * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. - * + * * Carnegie Mellon requests users of this software to return to - * + * * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU * School of Computer Science * Carnegie Mellon University * Pittsburgh PA 15213-3890 - * + * * any improvements or extensions that they make and grant Carnegie Mellon * the rights to redistribute these changes. */ @@ -27,18 +27,19 @@ * Author: David B. Golub, Carnegie Mellon University * Date: 7/90 */ -#include "mach_kdb.h" + #if MACH_KDB #include #include +#include +#include +#include #include - - #ifndef DB_HISTORY_SIZE #define DB_HISTORY_SIZE 4000 -#endif DB_HISTORY_SIZE +#endif /* DB_HISTORY_SIZE */ /* * Character input and editing. @@ -60,7 +61,7 @@ char * db_history_curr = db_history; /* char * db_history_last = db_history; /* start of last line */ char * db_history_prev = (char *) 0; /* start of previous line */ #endif - + #define CTRL(c) ((c) & 0x1f) #define isspace(c) ((c) == ' ' || (c) == '\t') #define BLANK ' ' @@ -68,8 +69,8 @@ char * db_history_prev = (char *) 0; /* void db_putstring(s, count) - char *s; - int count; + const char *s; + int count; { while (--count >= 0) cnputc(*s++); @@ -90,11 +91,11 @@ db_putnchars(c, count) #define DEL_FWD 0 #define DEL_BWD 1 void -db_delete(n, bwd) - int n; - int bwd; +db_delete( + int n, + int bwd) { - register char *p; + char *p; if (bwd) { db_lc -= n; @@ -110,7 +111,7 @@ db_delete(n, bwd) } void -db_delete_line() +db_delete_line(void) { db_delete(db_le - db_lc, DEL_FWD); db_delete(db_lc - db_lbuf_start, DEL_BWD); @@ -132,12 +133,11 @@ db_delete_line() db_history_curr = db_history + \ db_history_size - 1; \ } while (0) -#endif - +#endif /* DB_HISTORY_SIZE */ + /* returns TRUE at end-of-line */ boolean_t -db_inputchar(c) - int c; +db_inputchar(int c) { switch (c) { case CTRL('b'): @@ -213,7 +213,7 @@ db_inputchar(c) INC_DB_CURR(); db_le = db_lc = db_lbuf_start; } else { - register char *p; + char *p; INC_DB_CURR(); for (p = db_history_curr, db_le = db_lbuf_start; *p; ) { @@ -236,7 +236,7 @@ db_inputchar(c) INC_DB_CURR(); db_delete_line(); if (db_history_curr != db_history_last) { - register char *p; + char *p; for (p = db_history_curr, db_le = db_lbuf_start; *p;) { *db_le++ = *p++; @@ -250,7 +250,7 @@ db_inputchar(c) db_putstring(db_lbuf_start, db_le - db_lbuf_start); } break; -#endif +#endif /* DB_HISTORY_SIZE */ case CTRL('r'): db_putstring("^R\n", 3); if (db_le > db_lbuf_start) { @@ -267,7 +267,7 @@ db_inputchar(c) * save it. */ if (db_history_curr == db_history_prev) { - register char *pp, *pc; + char *pp, *pc; /* * Is it the same? @@ -291,7 +291,7 @@ db_inputchar(c) } } if (db_le != db_lbuf_start) { - register char *p; + char *p; db_history_prev = db_history_last; for (p = db_lbuf_start; p != db_le; p++) { *db_history_last++ = *p; @@ -303,7 +303,7 @@ db_inputchar(c) *db_history_last++ = '\0'; } db_history_curr = db_history_last; -#endif +#endif /* DB_HISTORY_SIZE */ *db_le++ = c; return (TRUE); default: @@ -311,7 +311,7 @@ db_inputchar(c) cnputc('\007'); } else if (c >= ' ' && c <= '~') { - register char *p; + char *p; for (p = db_le; p > db_lc; p--) *p = *(p-1); @@ -327,9 +327,9 @@ db_inputchar(c) } int -db_readline(lstart, lsize) - char * lstart; - int lsize; +db_readline( + char * lstart, + int lsize) { db_force_whitespace(); /* synch output position */ @@ -348,9 +348,9 @@ db_readline(lstart, lsize) } void -db_check_interrupt() +db_check_interrupt(void) { - register int c; + int c; c = cnmaygetc(); switch (c) { @@ -375,4 +375,4 @@ db_check_interrupt() } } -#endif MACH_KDB +#endif /* MACH_KDB */