aboutsummaryrefslogtreecommitdiff
path: root/cut.c
diff options
context:
space:
mode:
Diffstat (limited to 'cut.c')
-rw-r--r--cut.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/cut.c b/cut.c
index ed68657df..7e9a72e3f 100644
--- a/cut.c
+++ b/cut.c
@@ -54,12 +54,12 @@ static void decompose_list(const char *list)
54 /* the list must contain only digits and no more than one minus sign */ 54 /* the list must contain only digits and no more than one minus sign */
55 for (ptr = (char *)list; *ptr; ptr++) { 55 for (ptr = (char *)list; *ptr; ptr++) {
56 if (!isdigit(*ptr) && *ptr != '-') { 56 if (!isdigit(*ptr) && *ptr != '-') {
57 error_msg_and_die("invalid byte or field list\n"); 57 error_msg_and_die("invalid byte or field list");
58 } 58 }
59 if (*ptr == '-') { 59 if (*ptr == '-') {
60 nminus++; 60 nminus++;
61 if (nminus > 1) { 61 if (nminus > 1) {
62 error_msg_and_die("invalid byte or field list\n"); 62 error_msg_and_die("invalid byte or field list");
63 } 63 }
64 } 64 }
65 } 65 }
@@ -68,7 +68,7 @@ static void decompose_list(const char *list)
68 if (nminus == 0) { 68 if (nminus == 0) {
69 startpos = strtol(list, &ptr, 10); 69 startpos = strtol(list, &ptr, 10);
70 if (startpos == 0) { 70 if (startpos == 0) {
71 error_msg_and_die("missing list of fields\n"); 71 error_msg_and_die("missing list of fields");
72 } 72 }
73 endpos = startpos; 73 endpos = startpos;
74 } 74 }
@@ -188,14 +188,14 @@ extern int cut_main(int argc, char **argv)
188 case 'f': 188 case 'f':
189 /* make sure they didn't ask for two types of lists */ 189 /* make sure they didn't ask for two types of lists */
190 if (part != 0) { 190 if (part != 0) {
191 error_msg_and_die("only one type of list may be specified\n"); 191 error_msg_and_die("only one type of list may be specified");
192 } 192 }
193 part = (char)opt; 193 part = (char)opt;
194 decompose_list(optarg); 194 decompose_list(optarg);
195 break; 195 break;
196 case 'd': 196 case 'd':
197 if (strlen(optarg) > 1) { 197 if (strlen(optarg) > 1) {
198 error_msg_and_die("the delimiter must be a single character\n"); 198 error_msg_and_die("the delimiter must be a single character");
199 } 199 }
200 delim = optarg[0]; 200 delim = optarg[0];
201 break; 201 break;
@@ -209,17 +209,17 @@ extern int cut_main(int argc, char **argv)
209 } 209 }
210 210
211 if (part == 0) { 211 if (part == 0) {
212 error_msg_and_die("you must specify a list of bytes, characters, or fields\n"); 212 error_msg_and_die("you must specify a list of bytes, characters, or fields");
213 } 213 }
214 214
215 if (supress_non_delimited_lines && part != 'f') { 215 if (supress_non_delimited_lines && part != 'f') {
216 error_msg_and_die("suppressing non-delimited lines makes sense" 216 error_msg_and_die("suppressing non-delimited lines makes sense"
217 " only when operating on fields\n"); 217 " only when operating on fields");
218 218
219 } 219 }
220 220
221 if (delim != '\t' && part != 'f') { 221 if (delim != '\t' && part != 'f') {
222 error_msg_and_die("a delimiter may be specified only when operating on fields\n"); 222 error_msg_and_die("a delimiter may be specified only when operating on fields");
223 } 223 }
224 224
225 /* argv[(optind)..(argc-1)] should be names of file to process. If no 225 /* argv[(optind)..(argc-1)] should be names of file to process. If no