Re: [hackers] [sbase] Audit printenv(1) || FRIGN
> On Sat, 28 Feb 2015 13:25:09 -0800 > Evan Gates wrote: > >> The arg loops can simply be for (; *argv; argv++) as the standard >> guarantees argv[argc] is NULL. > > Hey Evan, > > I discussed this with stateless and we came to the conclusion that > the argc-approach is more idiomatic. In this case I agree with Evan, and I see the argv loop idiomatic. I have seen in several books and in diferent sources. I usually do the argv loop: for (++argv; *argv; ++argc) or while (*++argv) and if I need do a test argc > something then I update the value of argc in the body. If I only need argc > 0 I use *argv != 0. Regards,
Re: [hackers] [sbase] Audit printenv(1) || FRIGN
On Sat, 28 Feb 2015 13:25:09 -0800 Evan Gates wrote: > The arg loops can simply be for (; *argv; argv++) as the standard > guarantees argv[argc] is NULL. Hey Evan, I discussed this with stateless and we came to the conclusion that the argc-approach is more idiomatic. I personally favor for-loops with guaranteed break-conditions, but you're right about the standard. Cheers FRIGN -- FRIGN
Re: [hackers] [sbase] Audit printenv(1) || FRIGN
> 2) safeguard argv-loop as already seen in echo(1) with argc-decrement. The arg loops can simply be for (; *argv; argv++) as the standard guarantees argv[argc] is NULL. -emg
[hackers] [sbase] Audit yes(1) || FRIGN
commit f0792e41e8654edfba4485ed84b9448010cb7f9d Author: FRIGN Date: Sat Feb 28 21:11:10 2015 +0100 Audit yes(1) Oh well, time to simplify the loop. Also, change the comment on unreachable code to something more clear. diff --git a/yes.c b/yes.c index 0ac224a..eddc0f0 100644 --- a/yes.c +++ b/yes.c @@ -19,14 +19,10 @@ main(int argc, char *argv[]) usage(); } ARGEND; - if (argc == 0) { - for (;;) - puts("y"); - } else { - for (i = 0; ; i++, i %= argc) { - printf("%s", argv[i]); - putchar(i == argc - 1 ? '\n' : ' '); - } + for (i = 0; ; i++, i %= argc ? argc : 1) { + fputs(argc ? argv[i] : "y", stdout); + putchar((!argc || i == argc - 1) ? '\n' : ' '); } - return 1; /* should not reach */ + + return 1; /* not reached */ }
[hackers] [sbase] Audit printenv(1) || FRIGN
commit 05198cfd27d927704b14f02dba17376c9e9c4268 Author: FRIGN Date: Sat Feb 28 21:47:17 2015 +0100 Audit printenv(1) 1) argc style 2) safeguard argv-loop as already seen in echo(1) with argc-decrement. diff --git a/README b/README index 4a2d7a2..7bccbf6 100644 --- a/README +++ b/README @@ -51,7 +51,7 @@ The following tools are implemented ('*' == finished, '#' == UTF-8 support, = nl no -d, -f, -h, -l, -p =* nohup yes none #* paste yes none -=* printenvnon-posixnone +=*| printenvnon-posixnone #* printf yes none =* pwd yes none = readlinknon-posixnone diff --git a/echo.c b/echo.c index 2ae8af9..8b58bcc 100644 --- a/echo.c +++ b/echo.c @@ -23,7 +23,7 @@ main(int argc, char *argv[]) } ARGEND; for (; argc > 0; argc--, argv++) - putword(argv[0]); + putword(*argv); if (!nflag) putchar('\n'); diff --git a/printenv.c b/printenv.c index 675a6f9..ff210cb 100644 --- a/printenv.c +++ b/printenv.c @@ -9,7 +9,7 @@ extern char **environ; static void usage(void) { - eprintf("usage: %s [variable...]\n", argv0); + eprintf("usage: %s [var ...]\n", argv0); } int @@ -23,16 +23,17 @@ main(int argc, char *argv[]) usage(); } ARGEND; - if (argc == 0) { + if (!argc) { while (*environ) printf("%s\n", *environ++); } else { - while (*argv) { - if ((var = getenv(*argv++))) + for (; argc > 0; argc--, argv++) { + if ((var = getenv(*argv))) printf("%s\n", var); else ret = 1; } } + return ret; }
[hackers] [sbase] Audit rm(1) || FRIGN
commit 9f17b00d883c64d25fe09f388109010ef1dce372 Author: FRIGN Date: Sat Feb 28 21:30:20 2015 +0100 Audit rm(1) 1) One small argc-style-matter 2) manpage cleanup 3) NOTE: The utility-functions will be evaluated separately. diff --git a/README b/README index 363536b..4a2d7a2 100644 --- a/README +++ b/README @@ -56,7 +56,7 @@ The following tools are implemented ('*' == finished, '#' == UTF-8 support, =* pwd yes none = readlinknon-posixnone =* renice yes none -=* rm yes none (-i) +=*| rm yes none (-i) =* rmdir yes none # sed seq non-posixnone diff --git a/rm.1 b/rm.1 index e5d0d3c..eb6a83e 100644 --- a/rm.1 +++ b/rm.1 @@ -1,4 +1,4 @@ -.Dd February 19, 2015 +.Dd February 28, 2015 .Dt RM 1 .Os sbase .Sh NAME @@ -23,9 +23,9 @@ is specified. .Sh OPTIONS .Bl -tag -width Ds .It Fl f -Do not prompt before removing. +Do not prompt before removing .Ar file . -In the former case, do not report when +Do not report when .Ar file doesn't exist or couldn't be removed. .It Fl Rr diff --git a/rm.c b/rm.c index aab3aad..73f3c31 100644 --- a/rm.c +++ b/rm.c @@ -23,7 +23,7 @@ main(int argc, char *argv[]) usage(); } ARGEND; - if (argc < 1) { + if (!argc) { if (!rm_fflag) usage(); else
[hackers] [sbase] Mark yes(1) as audited in README || FRIGN
commit 965dd4349864b083307184c5bfa48bf208216dfa Author: FRIGN Date: Sat Feb 28 21:12:27 2015 +0100 Mark yes(1) as audited in README diff --git a/README b/README index be3225e..870b497 100644 --- a/README +++ b/README @@ -87,7 +87,7 @@ The following tools are implemented ('*' == finished, '#' == UTF-8 support, =* uuencodeyes none #* wc yes none = xargs no -I, -L, -p, -s, -t, -x -=* yes non-posixnone +=*| yes non-posixnone The complement of sbase is ubase[1] which is Linux-specific and provides all the non-portable tools. Together they are intended to
[hackers] [sbase] Audit hostname(1) || FRIGN
commit dad8dec550b94b5db7dc97b77a34ca0a26ad44ca Author: FRIGN Date: Sat Feb 28 21:22:55 2015 +0100 Audit hostname(1) 1) Be strict about argc 2) Fix a small error in the manpage diff --git a/README b/README index 870b497..363536b 100644 --- a/README +++ b/README @@ -35,7 +35,7 @@ The following tools are implemented ('*' == finished, '#' == UTF-8 support, #* foldyes none =* grepyes none =* headyes none -=* hostnamenon-posixnone +=*| hostnamenon-posixnone =* killyes none =*| linkyes none =* ln yes none diff --git a/hostname.1 b/hostname.1 index 28dc4df..9be4b1d 100644 --- a/hostname.1 +++ b/hostname.1 @@ -1,4 +1,4 @@ -.Dd January 30, 2015 +.Dd February 28, 2015 .Dt HOSTNAME 1 .Os sbase .Sh NAME @@ -13,6 +13,6 @@ sets the current host name to .Ar name . If no .Ar name -is given, the current hostname is written to stdout. +is given, the current host name is written to stdout. .Sh SEE ALSO .Xr hostname 7 diff --git a/hostname.c b/hostname.c index 55ed0ca..2aad4ad 100644 --- a/hostname.c +++ b/hostname.c @@ -21,13 +21,16 @@ main(int argc, char *argv[]) usage(); } ARGEND; - if (argc < 1) { + if (!argc) { if (gethostname(host, sizeof(host)) < 0) eprintf("gethostname:"); puts(host); - } else { + } else if (argc == 1) { if (sethostname(argv[0], strlen(argv[0])) < 0) eprintf("sethostname:"); + } else { + usage(); } + return 0; }
[hackers] [sbase] Audit link(1) || FRIGN
commit de564af9ef55c6da4efc8c737c4da90cc7fd80c7 Author: FRIGN Date: Sat Feb 28 19:42:26 2015 +0100 Audit link(1) diff --git a/README b/README index b4b2d96..4e14de8 100644 --- a/README +++ b/README @@ -37,7 +37,7 @@ The following tools are implemented ('*' == finished, '#' == UTF-8 support, =* headyes none =* hostnamenon-posixnone =* killyes none -=* linkyes none +=*| linkyes none =* ln yes none =* logger yes none =* logname yes none diff --git a/link.c b/link.c index f84e4b5..5ef8e11 100644 --- a/link.c +++ b/link.c @@ -3,14 +3,24 @@ #include "util.h" +static void +usage(void) +{ + eprintf("usage: %s target name\n", argv0); +} + int main(int argc, char *argv[]) { - argv0 = argv[0]; + ARGBEGIN { + default: + usage(); + } ARGEND; - if (argc != 3) - eprintf("usage: %s target name\n", argv0); - if (link(argv[1], argv[2]) < 0) + if (argc != 2) + usage(); + if (link(argv[0], argv[1]) < 0) eprintf("link:"); + return 0; }
[hackers] [sbase] Audit tty(1) || FRIGN
commit 8741f98bb0ea9eea189daaac33aa491e2adac57e Author: FRIGN Date: Sat Feb 28 19:59:34 2015 +0100 Audit tty(1) 1) Be strict about number of arguments passed 2) Use a simpler logic while returning diff --git a/README b/README index 9833019..5edba2e 100644 --- a/README +++ b/README @@ -78,7 +78,7 @@ The following tools are implemented ('*' == finished, '#' == UTF-8 support, =* touch yes none #* tr yes none =*| trueyes none -=* tty yes none +=*| tty yes none =* uname yes none #* unexpandyes none =* uniqyes none diff --git a/tty.c b/tty.c index acfec01..1c23bf4 100644 --- a/tty.c +++ b/tty.c @@ -20,8 +20,11 @@ main(int argc, char *argv[]) usage(); } ARGEND; + if (argc) + usage(); + tty = ttyname(STDIN_FILENO); puts(tty ? tty : "not a tty"); - return tty ? 0 : 1; + return !tty; }
[hackers] [sbase] Audit echo(1) || FRIGN
commit ff506434df37188103d1f35efa47b5d7717b2184 Author: FRIGN Date: Sat Feb 28 20:16:10 2015 +0100 Audit echo(1) Just a small change in the manpage. diff --git a/README b/README index 7817c39..be3225e 100644 --- a/README +++ b/README @@ -26,7 +26,7 @@ The following tools are implemented ('*' == finished, '#' == UTF-8 support, =* dateyes -u =*| dirname yes none =* du yes none -=* echoyes none +=*| echoyes none =* env yes none #* expand yes none #* expryes none diff --git a/echo.1 b/echo.1 index 27ed4ac..717b2c6 100644 --- a/echo.1 +++ b/echo.1 @@ -1,4 +1,4 @@ -.Dd January 23, 2015 +.Dd February 28, 2015 .Dt ECHO 1 .Os sbase .Sh NAME @@ -10,7 +10,7 @@ .Op Ar string ... .Sh DESCRIPTION .Nm -prints each +writes each .Ar string to stdout, separated by spaces and terminated by a newline.
[hackers] [sbase] Audit sleep(1) || FRIGN
commit 7acfd9a4781e73d96c0464aed78f63b3755a683c Author: FRIGN Date: Sat Feb 28 20:10:25 2015 +0100 Audit sleep(1) 1) Be strict about argc 2) Use "unsigned" instead of "unsigned int" diff --git a/README b/README index ffcc382..7817c39 100644 --- a/README +++ b/README @@ -64,7 +64,7 @@ The following tools are implemented ('*' == finished, '#' == UTF-8 support, = sha1sum non-posixnone = sha256sum non-posixnone = sha512sum non-posixnone -=* sleep yes none +=*| sleep yes none sortno -m, -o, -d, -f, -i =* split yes none =* sponge non-posixnone diff --git a/sleep.c b/sleep.c index 7148718..ce20858 100644 --- a/sleep.c +++ b/sleep.c @@ -12,18 +12,19 @@ usage(void) int main(int argc, char *argv[]) { - unsigned int seconds; + unsigned seconds; ARGBEGIN { default: usage(); } ARGEND; - if (argc < 1) + if (argc != 1) usage(); seconds = estrtonum(argv[0], 0, UINT_MAX); while ((seconds = sleep(seconds)) > 0) ; + return 0; }
[hackers] [sbase] Audit dirname(1) || FRIGN
commit 2b8698f01ad049b4eb459e46b72c5c0ce0ccac39 Author: FRIGN Date: Sat Feb 28 19:50:12 2015 +0100 Audit dirname(1) Be stricter about the number of arguments passed to it. diff --git a/README b/README index 4e14de8..9833019 100644 --- a/README +++ b/README @@ -24,7 +24,7 @@ The following tools are implemented ('*' == finished, '#' == UTF-8 support, =* cronnon-posixnone #* cut yes none =* dateyes -u -=* dirname yes none +=*| dirname yes none =* du yes none =* echoyes none =* env yes none diff --git a/dirname.1 b/dirname.1 index 6258ae1..d45efcf 100644 --- a/dirname.1 +++ b/dirname.1 @@ -1,4 +1,4 @@ -.Dd January 23, 2015 +.Dd February 28, 2015 .Dt DIRNAME 1 .Os sbase .Sh NAME @@ -9,9 +9,9 @@ .Ar path .Sh DESCRIPTION .Nm -prints +writes .Ar path -with its final path component removed. +with its final path component removed to stdout. .Sh SEE ALSO .Xr basename 1 , .Xr dirname 3 diff --git a/dirname.c b/dirname.c index b055deb..501e5a0 100644 --- a/dirname.c +++ b/dirname.c @@ -18,7 +18,7 @@ main(int argc, char *argv[]) usage(); } ARGEND; - if (argc < 1) + if (argc != 1) usage(); puts(dirname(argv[0]));
[hackers] [sbase] Audit unlink(1) || FRIGN
commit 497da9d1ddb596da888b9b21c5bac429555c417c Author: FRIGN Date: Sat Feb 28 20:05:22 2015 +0100 Audit unlink(1) One small thing, use argv0 in usage. Also, add a blank line in link.c which I forgot earlier. diff --git a/README b/README index 5edba2e..ffcc382 100644 --- a/README +++ b/README @@ -82,7 +82,7 @@ The following tools are implemented ('*' == finished, '#' == UTF-8 support, =* uname yes none #* unexpandyes none =* uniqyes none -=* unlink yes none +=*| unlink yes none =* uudecodeyes none =* uuencodeyes none #* wc yes none diff --git a/link.c b/link.c index 5ef8e11..6af7544 100644 --- a/link.c +++ b/link.c @@ -19,6 +19,7 @@ main(int argc, char *argv[]) if (argc != 2) usage(); + if (link(argv[0], argv[1]) < 0) eprintf("link:"); diff --git a/unlink.c b/unlink.c index 077959c..797d18a 100644 --- a/unlink.c +++ b/unlink.c @@ -6,7 +6,7 @@ static void usage(void) { - eprintf("usage: unlink file\n"); + eprintf("usage: %s file\n", argv0); } int
[hackers] [sbase] README: document sbase-box-install rule || Hiltjo Posthuma
commit 5388a593a767b2b75b94b55521ed3b0409eb2bd6 Author: Hiltjo Posthuma Date: Sat Feb 28 15:40:16 2015 +0100 README: document sbase-box-install rule diff --git a/README b/README index de74acd..b4b2d96 100644 --- a/README +++ b/README @@ -101,7 +101,7 @@ config.mk depending on your system. You can also build sbase-box, which generates a single binary containing all the required tools.You can then symlink the -individual tools to sbase-box. +individual tools to sbase-box or run: make sbase-box-install Ideally you will want to statically link sbase. If you are on Linux we recommend using musl-libc[2].
[hackers] [sbase] Fix broken sbase-box due to multiple definitions of usage || sin
commit 66b047471bcca8cc85ec99b777d0ec01a1cd9f2f Author: sin Date: Sat Feb 28 18:33:33 2015 + Fix broken sbase-box due to multiple definitions of usage diff --git a/basename.c b/basename.c index 181fc8e..3e74590 100644 --- a/basename.c +++ b/basename.c @@ -5,7 +5,7 @@ #include "util.h" -void +static void usage(void) { eprintf("usage: %s path [suffix]\n", argv0); diff --git a/sed.c b/sed.c index f848025..bad7492 100644 --- a/sed.c +++ b/sed.c @@ -125,7 +125,7 @@ void stracpy(String *dst, char *src); void strnacpy(String *dst, char *src, size_t n); /* Cleanup and errors */ -void usage(void); +static void usage(void); /* Parsing functions and related utilities */ void compile(char *s, int isfile); @@ -365,7 +365,7 @@ leprintf(char *s) } /* FIXME: write usage message */ -void +static void usage(void) { eprintf("USAGE\n");
[hackers] [st] Small improvements to the FAQ || Roberto E. Vargas Caballero
commit 29619a1a35175fd79a743ed006af405ea586a0fd Author: Roberto E. Vargas Caballero Date: Sat Feb 28 16:13:47 2015 + Small improvements to the FAQ diff --git a/FAQ b/FAQ index a47c024..61f94a5 100644 --- a/FAQ +++ b/FAQ @@ -51,7 +51,7 @@ solution for them is to use the following command: $ printf '\033[?1h\033=' >/dev/tty or - $ echo $(tput smkx) >/dev/tty + $ tput smkx In the case of bash, readline is used. Readline has a different note in its manpage about this issue: @@ -86,9 +86,9 @@ Putting these lines into your .zshrc will fix the problems. ## How can I use meta in 8bit mode? - St supports meta in 8bit mode, but the default terminfo entry doesn't - use this capability. If you want it, you have to use the 'st-meta' value - in TERM. +St supports meta in 8bit mode, but the default terminfo entry doesn't +use this capability. If you want it, you have to use the 'st-meta' value +in TERM. ## I cannot compile st in OpenBSD @@ -155,3 +155,11 @@ This is an issue that was discussed in suckless mailing list [1] http://www.ibb.net/~anne/keyboard.html [2] http://www.tldp.org/HOWTO/Keyboard-and-Console-HOWTO-5.html +## But I really want a wrong backspace key and a wrong delete key + +If you really want emulate the errors of another terminal emulators +and have a backspace key that generates a DELETE and a delete key +that generates BACKSPACE, then you can apply the patch +found in [1], but please do not tell me it. + +[1] http://st.suckless.org/patches/delkey
[hackers] [sbase] Audit basename(1) || FRIGN
commit dc66b5314a9e42655ca9dc320a312d4af3d01a40 Author: FRIGN Date: Sat Feb 28 14:48:44 2015 +0100 Audit basename(1) 1) be stricter which number of arguments is accepted (1 or 2) 2) basename already returns a pointer to "." is argv[0] is "" 3) No need to check for *p != '/', because basename() only returns a string beginning with '/' which has length 1, so if strlen(p) == 1, the only way for suffix to be "evaluated" is for off to be > 0, being equal to suffix being "", but "" != "/". 4) don't calculate strlen twice for each string. Store it in a ssize_t and check if it's > 0. diff --git a/README b/README index dd3d727..6a1594d 100644 --- a/README +++ b/README @@ -7,9 +7,9 @@ across UNIX and UNIX-like systems. The following tools are implemented ('*' == finished, '#' == UTF-8 support, '=' == implicit UTF-8 support, '|' == audited): - UTILITY POSIX 2008 COMPLIANT MISSING OPTIONS - --- --- -=* basenameyes none +UTILITY POSIX 2008 COMPLIANT MISSING OPTIONS +--- --- +=*| basenameyes none =* cal yes none =* cat yes none =* chgrp yes none diff --git a/basename.c b/basename.c index fb30d0b..181fc8e 100644 --- a/basename.c +++ b/basename.c @@ -5,8 +5,6 @@ #include "util.h" -static void usage(void); - void usage(void) { @@ -16,25 +14,24 @@ usage(void) int main(int argc, char *argv[]) { + ssize_t off; char *p; - size_t off; ARGBEGIN { default: usage(); } ARGEND; - if (argc < 1) + if (argc != 1 && argc != 2) usage(); - p = strlen(argv[0]) ? basename(argv[0]) : "."; - if (argc == 2 && *p != '/') { - if (strlen(argv[1]) < strlen(p)) { - off = strlen(p) - strlen(argv[1]); - if (strcmp(&p[off], argv[1]) == 0) - p[off] = '\0'; - } + p = basename(argv[0]); + if (argc == 2) { + off = strlen(p) - strlen(argv[1]); + if (off > 0 && !strcmp(p + off, argv[1])) + p[off] = '\0'; } puts(p); + return 0; }
[hackers] [sbase] add find.1, sed.1, time.1 stubs || Hiltjo Posthuma
commit d627ea9f44bae4b985ef4bfcb4b49e04d2f0f49f Author: Hiltjo Posthuma Date: Sat Feb 28 13:46:20 2015 +0100 add find.1, sed.1, time.1 stubs all tools should have man pages. add stubs so make install and make sbase-box-install doesn't fail. diff --git a/find.1 b/find.1 new file mode 100644 index 000..fbf691e --- /dev/null +++ b/find.1 @@ -0,0 +1,6 @@ +.Dd February 28, 2015 +.Dt FIND 1 +.Os sbase +.Sh NAME +.Nm find +.Nd TODO diff --git a/sed.1 b/sed.1 new file mode 100644 index 000..b09cd4e --- /dev/null +++ b/sed.1 @@ -0,0 +1,6 @@ +.Dd February 28, 2015 +.Dt SED 1 +.Os sbase +.Sh NAME +.Nm sed +.Nd TODO diff --git a/time.1 b/time.1 new file mode 100644 index 000..5cab06b --- /dev/null +++ b/time.1 @@ -0,0 +1,6 @@ +.Dd February 28, 2015 +.Dt TIME 1 +.Os sbase +.Sh NAME +.Nm time +.Nd TODO
[hackers] [sbase] Mark false(1) and true(1) as audited || FRIGN
commit ea231fea2157db0491dc29dc093ba9611c7f7e8c Author: FRIGN Date: Sat Feb 28 15:12:19 2015 +0100 Mark false(1) and true(1) as audited Nothing to be done there. diff --git a/README b/README index 6a1594d..5dea2a0 100644 --- a/README +++ b/README @@ -30,7 +30,7 @@ The following tools are implemented ('*' == finished, '#' == UTF-8 support, =* env yes none #* expand yes none #* expryes none -=* false yes none +=*| false yes none = findyes none #* foldyes none =* grepyes none @@ -77,7 +77,7 @@ The following tools are implemented ('*' == finished, '#' == UTF-8 support, = timeno none (incorrect exit status) =* touch yes none #* tr yes none -=* trueyes none +=*| trueyes none =* tty yes none =* uname yes none #* unexpandyes none
[hackers] [sbase] make rule: sbase-box-install || Hiltjo Posthuma
commit 1c2166c4bbf47ed42dcdc07838615ec2069b55b0 Author: Hiltjo Posthuma Date: Sat Feb 28 13:23:15 2015 +0100 make rule: sbase-box-install rule to make sbase-box and setup symlinks for $BIN and /bin/[ some (maybe) interesting info: $ make LDFLAGS="-s -static" CFLAGS="-Os" PREFIX=/ DESTDIR=`pwd`/static-normal install $ make LDFLAGS="-s -static" CFLAGS="-Os" PREFIX=/ DESTDIR=`pwd`/static-box sbase-box-install $ du -sk static-normal/ static-box 2728static-normal/ 572 static-box diff --git a/Makefile b/Makefile index ef57715..6efa7f0 100644 --- a/Makefile +++ b/Makefile @@ -217,6 +217,16 @@ sbase-box: $(LIB) $(SRC) $(LD) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) -o $@ build/*.c $(LIB) rm -r build +sbase-box-install: sbase-box + mkdir -p $(DESTDIR)$(PREFIX)/bin + cp -f sbase-box $(DESTDIR)$(PREFIX)/bin + chmod 755 $(DESTDIR)$(PREFIX)/bin/sbase-box + for f in $(BIN); do ln -sf sbase-box $(DESTDIR)$(PREFIX)/bin/"$$f"; done + ln -sf sbase-box $(DESTDIR)$(PREFIX)/bin/[ + mkdir -p $(DESTDIR)$(MANPREFIX)/man1 + for m in $(MAN); do sed "s/^\.Os sbase/.Os sbase $(VERSION)/g" < "$$m" > $(DESTDIR)$(MANPREFIX)/man1/"$$m"; done + cd $(DESTDIR)$(MANPREFIX)/man1 && chmod 644 $(MAN) + clean: rm -f $(BIN) $(OBJ) $(LIB) sbase-box sbase-$(VERSION).tar.gz
[hackers] [sbase] time: errno is not guaranteed to be set for sysconf() || sin
commit cb0ef7feb2edd8cc1b87d34b3cdb7ffb97f4e2ca Author: sin Date: Sat Feb 28 11:16:53 2015 + time: errno is not guaranteed to be set for sysconf() 0 should be considered an invalid CLK_TCK. diff --git a/time.c b/time.c index a628021..e4be7b4 100644 --- a/time.c +++ b/time.c @@ -25,8 +25,6 @@ main(int argc, char *argv[]) ARGBEGIN { case 'p': - /* used to specify POSIX output format, but that's the only format we -* have for now */ break; default: usage(); @@ -35,8 +33,8 @@ main(int argc, char *argv[]) if (!*argv) usage(); - if ((ticks = sysconf(_SC_CLK_TCK)) < 0) - eprintf("sysconf() failed to retrieve clock ticks per second:"); + if ((ticks = sysconf(_SC_CLK_TCK)) <= 0) + eprintf("sysconf() failed to retrieve clock ticks per second\n"); if ((rbeg = times(&tms)) < 0) eprintf("times() failed to retrieve start times:");
[hackers] [sbase] Add audit-section to README || FRIGN
commit 09c3d796b162b0385e36251c12e6fdae20c04d81 Author: FRIGN Date: Sat Feb 28 14:42:26 2015 +0100 Add audit-section to README Okay, so why another section? The finished-section applies to general feature-completeness and manual status. It somehow is not an indicator for general code- clarity, so the audited-column reflects a thorough audit of the underlying code and optimization. Take a look at the upcoming basename(1)-patch for an example on how this goes. diff --git a/README b/README index 17a5f87..dd3d727 100644 --- a/README +++ b/README @@ -5,89 +5,89 @@ sbase is a collection of unix tools that are inherently portable across UNIX and UNIX-like systems. The following tools are implemented ('*' == finished, '#' == UTF-8 support, -'=' == implicit UTF-8 support): +'=' == implicit UTF-8 support, '|' == audited): UTILITY POSIX 2008 COMPLIANT MISSING OPTIONS --- --- -=* basenameyes none -=* cal yes none -=* cat yes none -=* chgrp yes none -=* chmod yes none -=* chown yes none -=* chroot non-posixnone -=* cksum yes none -=* cmp yes none -#* colsnon-posixnone -=* commyes none -= cp yes none (-i) -=* cronnon-posixnone -#* cut yes none -=* dateyes -u -=* dirname yes none -=* du yes none -=* echoyes none -=* env yes none -#* expand yes none -#* expryes none -=* false yes none -= findyes none -#* foldyes none -=* grepyes none -=* headyes none -=* hostnamenon-posixnone -=* killyes none -=* linkyes none -=* ln yes none -=* logger yes none -=* logname yes none -= ls no (-C), -S, -f, -m, -s, -x -=* md5sum non-posixnone -=* mkdir yes none -=* mkfifo yes none -=* mktemp non-posixnone -=* mv yes none (-i) -=* niceyes none -= nl no -d, -f, -h, -l, -p -=* nohup yes none -#* paste yes none -=* printenvnon-posixnone -#* printf yes none -=* pwd yes none -= readlinknon-posixnone -=* renice yes none -=* rm yes none (-i) -=* rmdir yes none -# sed - seq non-posixnone -=* setsid non-posixnone -= sha1sum non-posixnone -= sha256sum non-posixnone -= sha512sum non-posixnone -=* sleep yes none - sortno -m, -o, -d, -f, -i -=* split yes none -=* sponge non-posixnone -#* strings yes none -=* syncnon-posixnone -=* tailyes none -=* tar non-posixnone -=* tee yes none -=* testyes none -= timeno none (incorrect exit status) -=* touch yes none -#* tr yes none -=* trueyes none -=* tty yes none -=* uname yes none -#* unexpandyes none -=* uniqyes none -=* unlin
[hackers] [sbase] chown.1, strings.1: fix date || Hiltjo Posthuma
commit d87bc5d5fd802b3c1dc2e62d86e31ad2d584e53a Author: Hiltjo Posthuma Date: Sat Feb 28 13:43:29 2015 +0100 chown.1, strings.1: fix date diff --git a/chown.1 b/chown.1 index 7161cfe..0138769 100644 --- a/chown.1 +++ b/chown.1 @@ -1,4 +1,4 @@ -.Dd Feburary 17, 2015 +.Dd February 17, 2015 .Dt CHOWN 1 .Os sbase .Sh NAME diff --git a/strings.1 b/strings.1 index aa4b81f..cf628d3 100644 --- a/strings.1 +++ b/strings.1 @@ -1,4 +1,4 @@ -.Dd Februrary 17, 2015 +.Dd February 17, 2015 .Dt STRINGS 1 .Os sbase .Sh NAME
[hackers] [sbase] Update README for time(1) || sin
commit 1f1e09966315633da56079021b46fa1426183935 Author: sin Date: Sat Feb 28 14:42:11 2015 + Update README for time(1) diff --git a/README b/README index 5dea2a0..de74acd 100644 --- a/README +++ b/README @@ -74,7 +74,7 @@ The following tools are implemented ('*' == finished, '#' == UTF-8 support, =* tar non-posixnone =* tee yes none =* testyes none -= timeno none (incorrect exit status) += timeyes none =* touch yes none #* tr yes none =*| trueyes none
[hackers] [sbase] Refactor basename.1 || FRIGN
commit 5b81a8b360cbf885f4ca30a4596c3938074b1960 Author: FRIGN Date: Sat Feb 28 15:09:47 2015 +0100 Refactor basename.1 diff --git a/basename.1 b/basename.1 index 7b2cf2a..75e5bd3 100644 --- a/basename.1 +++ b/basename.1 @@ -1,19 +1,20 @@ -.Dd November 21, 2014 +.Dd February 28, 2015 .Dt BASENAME 1 .Os sbase .Sh NAME .Nm basename -.Nd strip leading path components +.Nd strip leading directory components of a path .Sh SYNOPSIS .Nm .Ar path .Op Ar suffix .Sh DESCRIPTION .Nm -prints the +writes .Ar path -without leading path components and -.Ar suffix . +without leading directory components and +.Ar suffix +to stdout. .Sh SEE ALSO .Xr dirname 1 , .Xr basename 3