aboutsummaryrefslogtreecommitdiff
path: root/toys/posix/cut.c
diff options
context:
space:
mode:
authorRob Landley <rob@landley.net>2016-08-04 10:16:59 -0500
committerRob Landley <rob@landley.net>2016-08-04 10:16:59 -0500
commit027a73a903af306449710ce12bc09e0e3550c6c9 (patch)
treea415cb11fa6f2b34e63b8259fc52342aaa8fec75 /toys/posix/cut.c
parent145b7024b5fbb74f16d5e403fb004ff8209bc4a0 (diff)
downloadtoybox-027a73a903af306449710ce12bc09e0e3550c6c9.tar.gz
Make xopen() skip stdin/stdout/stderr, add xopen_stdio() if you want stdout,
add xopenro() that takes one argument and understands "-" means stdin, and switch over lots of users.
Diffstat (limited to 'toys/posix/cut.c')
-rw-r--r--toys/posix/cut.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/toys/posix/cut.c b/toys/posix/cut.c
index 1acefe2b..13be5e74 100644
--- a/toys/posix/cut.c
+++ b/toys/posix/cut.c
@@ -77,13 +77,13 @@ static void parse_list(char *list)
if (!ctoken) break;
if (!*ctoken) continue;
- //Get start position.
+ // Get start position.
if (*(dtoken = strsep(&ctoken, "-"))) {
start = atolx_range(dtoken, 0, INT_MAX);
start = (start?(start-1):start);
}
- //Get end position.
+ // Get end position.
if (!ctoken) end = -1; //case e.g. 1,2,3
else if (*ctoken) {//case e.g. N-M
end = atolx_range(ctoken, 0, INT_MAX);
@@ -94,7 +94,7 @@ static void parse_list(char *list)
add_to_list(start, end);
TT.nelem++;
}
- //if list is missing in command line.
+ // if list is missing in command line.
if (!TT.nelem) error_exit("missing positions list");
}
@@ -112,7 +112,7 @@ static void get_data(void)
if(strcmp(*argv, "-") == 0) TT.do_cut(0); //for stdin
else {
int fd = open(*argv, O_RDONLY, 0);
- if(fd < 0) {//if file not present then continue with other files.
+ if (fd < 0) {//if file not present then continue with other files.
perror_msg_raw(*argv);
continue;
}