$NetBSD: patch-src_input_c,v 1.1 2012/05/10 20:53:30 dholland Exp $ - don't use implicit int - silence gcc braces warning - silence initialization warning seen with gcc 4.1 - fix signed/unsigned pointer conversions --- src/input.c~ 2012-05-10 19:25:36.000000000 +0000 +++ src/input.c @@ -59,7 +59,7 @@ extern struct passwd *getpwnam(); */ #if !WINDOW_MSWIN /* for MS Windows, mlyesno is defined in mswsys.c */ -PASCAL NEAR mlyesno(prompt) +int PASCAL NEAR mlyesno(prompt) char *prompt; @@ -106,7 +106,7 @@ char *prompt; * return. Handle erase, kill, and abort keys. */ -PASCAL NEAR mlreply(prompt, buf, nbuf) +int PASCAL NEAR mlreply(prompt, buf, nbuf) char *prompt; char *buf; @@ -119,7 +119,7 @@ int nbuf; /* ectoc: expanded character to character collapse the CTRL and SPEC flags back into an ascii code */ -PASCAL NEAR ectoc(c) +int PASCAL NEAR ectoc(c) int c; @@ -136,7 +136,7 @@ int c; /* ctoec: character to extended character pull out the CTRL and SPEC prefixes (if possible) */ -PASCAL NEAR ctoec(c) +int PASCAL NEAR ctoec(c) int c; @@ -259,13 +259,14 @@ int maxlen; /* maximum length of input cpos = 0; /* if it exists, prompt the user for a buffer name */ - if (prompt) + if (prompt) { if (type == CMP_COMMAND) mlwrite("%s", prompt); else if (defval) mlwrite("%s[%s]: ", prompt, defval); else mlwrite("%s: ", prompt); + } /* build a name string from the keyboard */ while (TRUE) { @@ -737,6 +738,9 @@ int *cpos; /* ptr to position of next ch char longestmatch[NSTRING]; /* temp buffer for longest match */ int longestlen; /* length of longest match (always > *cpos) */ + /* required by gcc 4.1 */ + longestlen = 0; + /* everything (or nothing) matches an empty string */ if (*cpos == 0) return; @@ -986,13 +990,14 @@ int PASCAL NEAR getcmd() to specify the proper terminator. If the terminator is not a return('\r'), return will echo as "" */ -int PASCAL NEAR getstring(buf, nbuf, eolchar) +int PASCAL NEAR getstring(buf_c, nbuf, eolchar) -unsigned char *buf; +char *buf_c; int nbuf; int eolchar; { + unsigned char *buf; register int cpos; /* current character position in string */ register int c; /* current input character */ register int ec; /* extended current input character */ @@ -1000,6 +1005,8 @@ int eolchar; char *kp; /* pointer into key_name */ char key_name[10]; /* name of a quoted key */ + buf = (unsigned char *)buf_c; + cpos = 0; quotef = FALSE; @@ -1136,7 +1143,7 @@ int eolchar; } } -PASCAL NEAR outstring(s) /* output a string of input characters */ +VOID PASCAL NEAR outstring(s) /* output a string of input characters */ char *s; /* string to output */ @@ -1146,7 +1153,7 @@ char *s; /* string to output */ mlout(*s++); } -PASCAL NEAR ostring(s) /* output a string of output characters */ +VOID PASCAL NEAR ostring(s) /* output a string of output characters */ char *s; /* string to output */