aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--coreutils/cut.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/coreutils/cut.c b/coreutils/cut.c
index 2511befc8..54f74fc7e 100644
--- a/coreutils/cut.c
+++ b/coreutils/cut.c
@@ -33,14 +33,14 @@
33//usage: "\n -b LIST Output only bytes from LIST" 33//usage: "\n -b LIST Output only bytes from LIST"
34//usage: "\n -c LIST Output only characters from LIST" 34//usage: "\n -c LIST Output only characters from LIST"
35//usage: "\n -d SEP Field delimiter for input (default -f TAB, -F run of whitespace)" 35//usage: "\n -d SEP Field delimiter for input (default -f TAB, -F run of whitespace)"
36//usage: "\n -s Drop lines with no delimiter"
36//usage: "\n -O SEP Field delimeter for output (default = -d for -f, one space for -F)" 37//usage: "\n -O SEP Field delimeter for output (default = -d for -f, one space for -F)"
37//TODO: --output-delimiter=SEP 38//TODO: --output-delimiter=SEP
38//usage: "\n -D Don't sort/collate sections or match -fF lines without delimeter"
39//usage: "\n -f LIST Print only these fields (-d is single char)" 39//usage: "\n -f LIST Print only these fields (-d is single char)"
40//usage: IF_FEATURE_CUT_REGEX( 40//usage: IF_FEATURE_CUT_REGEX(
41//usage: "\n -F LIST Print only these fields (-d is regex)" 41//usage: "\n -F LIST Print only these fields (-d is regex)"
42//usage: ) 42//usage: )
43//usage: "\n -s Output only lines containing delimiter" 43//usage: "\n -D Don't sort/collate sections or match -fF lines without delimeter"
44//usage: "\n -n Ignored" 44//usage: "\n -n Ignored"
45//(manpage:-n with -b: don't split multibyte characters) 45//(manpage:-n with -b: don't split multibyte characters)
46//usage: 46//usage:
@@ -148,7 +148,7 @@ static void cut_file(FILE *file, const char *delim, const char *odelim,
148 /* Cut by fields */ 148 /* Cut by fields */
149 } else { 149 } else {
150 unsigned next = 0, start = 0, end = 0; 150 unsigned next = 0, start = 0, end = 0;
151 int dcount = 0; /* Nth delimiter we saw (0 - didn't see any yet) */ 151 int dcount = 0; /* we saw Nth delimiter (0 - didn't see any yet) */
152 int first_print = 1; 152 int first_print = 1;
153 153
154 /* Blank line? Check -s (later check for -s does not catch empty lines) */ 154 /* Blank line? Check -s (later check for -s does not catch empty lines) */
@@ -209,9 +209,9 @@ static void cut_file(FILE *file, const char *delim, const char *odelim,
209 if (line[end] != *delim) 209 if (line[end] != *delim)
210 continue; 210 continue;
211 } 211 }
212 212 /* Got delimiter */
213 /* Got delimiter. Loop if not yet within range. */
214 if (dcount++ < cut_list[cl_pos].startpos) { 213 if (dcount++ < cut_list[cl_pos].startpos) {
214 /* Not yet within range - loop */
215 start = next; 215 start = next;
216 continue; 216 continue;
217 } 217 }
@@ -224,8 +224,8 @@ static void cut_file(FILE *file, const char *delim, const char *odelim,
224 printf("%s%.*s", odelim, end - start, line + start); 224 printf("%s%.*s", odelim, end - start, line + start);
225 } 225 }
226 start = next; 226 start = next;
227 if (dcount == 0) 227 //if (dcount == 0)
228 break; 228 // break; - why?
229 } /* byte loop */ 229 } /* byte loop */
230 } 230 }
231 /* if we printed anything, finish with newline */ 231 /* if we printed anything, finish with newline */