From: Jim Meyering Date: Sun, 7 Mar 1999 05:09:23 +0000 (+0000) Subject: (getstr): Change type of `delim' parameter from char to int. X-Git-Tag: FILEUTILS-4_0e~200 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3a01605b6b993446d54c20ce57df8f49e8b7bbb4;p=thirdparty%2Fcoreutils.git (getstr): Change type of `delim' parameter from char to int. (cut_fields): Cast to `unsigned char' before comparing. (main): Cast to `unsigned char' before assigning. --- diff --git a/src/cut.c b/src/cut.c index 2523789d1b..9a1d685b97 100644 --- a/src/cut.c +++ b/src/cut.c @@ -238,7 +238,7 @@ With no FILE, or when FILE is -, read standard input.\n\ including the null terminator), or -1 on error or EOF. */ static int -getstr (char **lineptr, int *n, FILE *stream, char terminator) +getstr (char **lineptr, int *n, FILE *stream, int terminator) { int nchars_avail; /* Allocated but unused chars in *LINEPTR. */ char *read_pos; /* Where we're reading into *LINEPTR. */ @@ -555,7 +555,7 @@ cut_fields (FILE *stream) /* If the first field extends to the end of line (it is not delimited) and we are printing all non-delimited lines, print this one. */ - if (field_1_buffer[len - 1] != delim) + if ((unsigned char) field_1_buffer[len - 1] != delim) { if (suppress_non_delimited) { @@ -731,7 +731,7 @@ main (int argc, char **argv) /* Interpret -d '' to mean `use the NUL byte as the delimiter.' */ if (optarg[0] != '\0' && optarg[1] != '\0') FATAL_ERROR (_("the delimiter must be a single character")); - delim = optarg[0]; + delim = (unsigned char) optarg[0]; delim_specified = 1; break;