From 3a01605b6b993446d54c20ce57df8f49e8b7bbb4 Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Sun, 7 Mar 1999 05:09:23 +0000 Subject: [PATCH] (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. --- src/cut.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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; -- 2.47.3