5 ms·
Implementations of Cat(1) from Various Sources (2018)
- alpb 7y agoUnused variable in plan9 implementation? https://github.com/pete/cats/blob/master/plan9-cat.c#L22 https://github.com/pete/cats/blob/master/plan9-cat.c#L22
- ygra 7y agohttps://github.com/brho/plan9/blob/89d43d2262ad43eb4b26c2a8d6a27cfeddb33828/nix/sys/src/cmd/tcs/plan9.h https://github.com/brho/plan9/blob/89d43d2262ad43eb4b26c2a8d... seems to be a global variable. https://9fans.github.io/plan9port/man/man3/arg.html https://9fans.github.io/plan9port/man/man3/arg.html also references it.
- henesy 7y agoUsed by sysfatal(2): https://github.com/0intro/plan9-contrib/blob/master/sys/src/libc/9sys/sysfatal.c#L11 https://github.com/0intro/plan9-contrib/blob/master/sys/src/... Also mentioned in sysfatal(2)'s manual: http://man.cat-v.org/9front/2/perror http://man.cat-v.org/9front/2/perror
- g82918 7y agoThank you, that bit was very interesting. I like the idea for single threaded applications of having argv0 be a global.
- sherincall 7y agoDoesn't have to be single-threaded even. Main writes the pointer at the start, and no one else is going to change it, just read from it.
- Someone 7y agoAlso used in the beautiful (for those who like being creative with the preprocessor) options parser https://9fans.github.io/plan9port/man/man3/arg.html https://9fans.github.io/plan9port/man/man3/arg.html
- im3w1l 7y agoThe plan9 one is short and sweet, but what I don't like is that it doesn't support the dashdash thing that unambiguously marks that rest of the arguments should be interpreted as files and not flags. Needed for reliable defensive shell scripts imo. You may say "it has no options anyway" but other cats do. And you may want to add options in a future version.
- Someone 7y agoI thought that’s a GNU-ism that wasn’t in POSIX, but https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap12.html#tag_12_02 https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1... taught me differently. Now I think it made it into POSIX only fairly recently (corrections welcome) (it is a good idea, though)
- stevefan1999 7y agoaww, cats are cute
- pixelmonkey 7y agoHow this GitHub project missed the punning opportunity on calling itself "herding-cats" is beyond me. :-)
- deleted 7y ago[deleted]
- emiliovesprini 7y agoWoah: GNU 782 lines others 123 average lines counting only the UNIX cat with the most lines to keep them from messing with the average.