diff options
| -rw-r--r-- | bb.1 | 7 | ||||
| -rw-r--r-- | bb.c | 26 |
2 files changed, 25 insertions, 8 deletions
@@ -7,6 +7,7 @@ bb \- A bitty browser for command line file management .B bb [\fI-d\fR] [\fI-s\fR] +[\fI-0\fR] [\fIdirectory\fR] .SH DESCRIPTION \fBbb\fR is a tiny TUI console application for browsing and managing files. @@ -17,6 +18,10 @@ Print the current directory on exit. .B \-s Print the selected files on exit. +.B \-s +If printing the selected files on exit, use NULL-terminated strings instead of +newline-separated. + .B directory Open to this directory. @@ -48,7 +53,7 @@ Begin browsing in /usr/local/ .TP .B -bb -s | xargs zip archive.zip +bb -s -0 | xargs -0 zip archive.zip Select some files to add to a zip archive. .TP @@ -952,13 +952,25 @@ int main(int argc, char *argv[]) char sep = '\n'; int print_dir = 0, print_selection = 0; for (int i = 1; i < argc; i++) { - if (strcmp(argv[i], "-d") == 0) { - print_dir = 1; - } else if (strcmp(argv[i], "-0") == 0) { - sep = '\0'; - } else if (strcmp(argv[i], "-s") == 0) { - print_selection = 1; - } else if (path[0]) { + if (argv[i][0] == '-' && argv[i][1] == '-') + continue; + if (argv[i][0] == '-') { + for (char *c = &argv[i][1]; *c; c++) { + switch (*c) { + case 'd': + print_dir = 1; + break; + case '0': + sep = '\0'; + break; + case 's': + print_selection = 1; + break; + } + } + continue; + } + if (argv[i][0]) { path = argv[i]; break; } |
