Up to [local] / src / bin / cat
Request diff between arbitrary revisions
Default branch: MAIN
Revision 1.34 / (download) - annotate - [select for diffs], Wed Feb 9 01:58:57 2022 UTC (2 years, 4 months ago) by cheloha
Branch: MAIN
CVS Tags: OPENBSD_7_5_BASE,
OPENBSD_7_5,
OPENBSD_7_4_BASE,
OPENBSD_7_4,
OPENBSD_7_3_BASE,
OPENBSD_7_3,
OPENBSD_7_2_BASE,
OPENBSD_7_2,
OPENBSD_7_1_BASE,
OPENBSD_7_1,
HEAD
Changes since 1.33: +4 -1 lines
Diff to previous 1.33 (colored)
cat(1): drop "rpath" promise in no-file case If we're only working with the standard input we don't need "rpath". Tweaked by mestre@. Thread: https://marc.info/?l=openbsd-tech&m=163941848104274&w=2 No objections on tech@ after several weeks.
Revision 1.33 / (download) - annotate - [select for diffs], Wed Feb 9 01:56:28 2022 UTC (2 years, 4 months ago) by cheloha
Branch: MAIN
Changes since 1.32: +32 -47 lines
Diff to previous 1.32 (colored)
cat(1): refactor cook_args()/raw_args() into single function, cat_file() - Combine the open/close portions of cook_args()/raw_args() into a single function, cat_file(). - Push the flag-checking conditional in main() down into cat_file(). - Pull the argv loop in cat_file() up into main(). These changes -- especially pulling the argv look up into main() -- will allow us to drop the "rpath" promise in a single spot in a subsequent patch. Tweaked by mestre@. Descriptor leak in earlier version spotted by Matthew Martin. Thread: https://marc.info/?l=openbsd-tech&m=163941848104274&w=2 No objections on tech@ after several weeks.
Revision 1.32 / (download) - annotate - [select for diffs], Sun Oct 24 21:24:21 2021 UTC (2 years, 7 months ago) by deraadt
Branch: MAIN
Changes since 1.31: +2 -2 lines
Diff to previous 1.31 (colored)
For open/openat, if the flags parameter does not contain O_CREAT, the 3rd (variadic) mode_t parameter is irrelevant. Many developers in the past have passed mode_t (0, 044, 0644, or such), which might lead future people to copy this broken idiom, and perhaps even believe this parameter has some meaning or implication or application. Delete them all. This comes out of a conversation where tb@ noticed that a strange (but intentional) pledge behaviour is to always knock-out high-bits from mode_t on a number of system calls as a safety factor, and his bewilderment that this appeared to be happening against valid modes (at least visually), but no sorry, they are all irrelevant junk. They could all be 0xdeafbeef. ok millert
Revision 1.31 / (download) - annotate - [select for diffs], Fri Dec 11 05:48:22 2020 UTC (3 years, 5 months ago) by cheloha
Branch: MAIN
CVS Tags: OPENBSD_7_0_BASE,
OPENBSD_7_0,
OPENBSD_6_9_BASE,
OPENBSD_6_9
Changes since 1.30: +4 -3 lines
Diff to previous 1.30 (colored)
cat(1): -n flag: correctly enumerate files with more than INT_MAX lines If we bump 'lines' from an int to an unsigned long long we can trivially support files with more than INT_MAX lines. ok millert@
Revision 1.30 / (download) - annotate - [select for diffs], Fri Dec 4 02:25:56 2020 UTC (3 years, 6 months ago) by cheloha
Branch: MAIN
Changes since 1.29: +11 -11 lines
Diff to previous 1.29 (colored)
cat(1): misc. style(9) - Use getprogname(3) instead of __progname. - Sprinkle in some missing braces. - Prefer err(..., NULL) when malloc(3) fails. - Remove an unnecessary cast to from ssize_t to size_t.
Revision 1.29 / (download) - annotate - [select for diffs], Fri Dec 4 01:42:05 2020 UTC (3 years, 6 months ago) by cheloha
Branch: MAIN
Changes since 1.28: +36 -39 lines
Diff to previous 1.28 (colored)
cat(1): simplify argv processing loops cook_args() and raw_args() do some peculiar things in order to avoid calling cook_buf() and raw_cat(), respectively, in more than one place. The result is a convoluted. If we isolate the special cases from the normal case and just call these functions in multiple places the loops will be easier to read. Three things: 1. Pull the no-args case out of the loop. If *argv is NULL when we get into the argv processing function we just want to operate on the standard input and return early. It makes no sense to handle this case *in* the loop. 2. Isolate the "-" case from the filename case. If *argv is "-" we want to operate on the standard input. We can then do any stdin-specific cleanup within the same branch, which makes it easier to understand both the "-" case and the normal filename case. This also allows us to remove the 'filename' intermediate variable from both argv processing functions. 3. While we're here, use a for-loop and iterate argv in the loop header. Now argv is incremented in one place. ok martijn@
Revision 1.28 / (download) - annotate - [select for diffs], Thu Dec 3 22:37:12 2020 UTC (3 years, 6 months ago) by cheloha
Branch: MAIN
Changes since 1.27: +9 -8 lines
Diff to previous 1.27 (colored)
cat(1): remove global 'filename' variable There is no need for the global filename variable. Both cook_buf() and raw_cat() can accept a filename variable from the caller to use for printing warnings. ok martijn@
Revision 1.27 / (download) - annotate - [select for diffs], Fri Jun 28 13:34:58 2019 UTC (4 years, 11 months ago) by deraadt
Branch: MAIN
CVS Tags: OPENBSD_6_8_BASE,
OPENBSD_6_8,
OPENBSD_6_7_BASE,
OPENBSD_6_7,
OPENBSD_6_6_BASE,
OPENBSD_6_6
Changes since 1.26: +4 -4 lines
Diff to previous 1.26 (colored)
When system calls indicate an error they return -1, not some arbitrary value < 0. errno is only updated in this case. Change all (most?) callers of syscalls to follow this better, and let's see if this strictness helps us in the future.
Revision 1.26 / (download) - annotate - [select for diffs], Wed Oct 19 18:20:25 2016 UTC (7 years, 7 months ago) by schwarze
Branch: MAIN
CVS Tags: OPENBSD_6_5_BASE,
OPENBSD_6_5,
OPENBSD_6_4_BASE,
OPENBSD_6_4,
OPENBSD_6_3_BASE,
OPENBSD_6_3,
OPENBSD_6_2_BASE,
OPENBSD_6_2,
OPENBSD_6_1_BASE,
OPENBSD_6_1
Changes since 1.25: +3 -8 lines
Diff to previous 1.25 (colored)
Delete useless setlocale(3) in src/bin/. Minor cleanup while here: return from main, static void __dead usage, etc. Based on a patch from Jan Stary <hans at stare dot cz>. Feedback and OK tb@, OK millert@.
Revision 1.25 / (download) - annotate - [select for diffs], Fri Jul 1 22:40:44 2016 UTC (7 years, 11 months ago) by schwarze
Branch: MAIN
CVS Tags: OPENBSD_6_0_BASE,
OPENBSD_6_0
Changes since 1.24: +11 -5 lines
Diff to previous 1.24 (colored)
For -be, indent the $ on blank lines. Patch from Giles Lean (NetBSD PR bin/4841), tweaked by kleink at NetBSD (rev. 1.17 1998-01-27), version for OpenBSD sent in by Sevan Janiyan <venture37 at geeklan dot co dot uk>. OK deraadt@
Revision 1.24 / (download) - annotate - [select for diffs], Wed Nov 4 21:28:01 2015 UTC (8 years, 7 months ago) by tedu
Branch: MAIN
CVS Tags: OPENBSD_5_9_BASE,
OPENBSD_5_9
Changes since 1.23: +2 -2 lines
Diff to previous 1.23 (colored)
replace setbuf with setvbuf, from Frederic Nowak
Revision 1.23 / (download) - annotate - [select for diffs], Fri Oct 9 01:37:06 2015 UTC (8 years, 8 months ago) by deraadt
Branch: MAIN
Changes since 1.22: +3 -3 lines
Diff to previous 1.22 (colored)
Change all tame callers to namechange to pledge(2).
Revision 1.22 / (download) - annotate - [select for diffs], Sat Oct 3 18:56:20 2015 UTC (8 years, 8 months ago) by deraadt
Branch: MAIN
Changes since 1.21: +4 -1 lines
Diff to previous 1.21 (colored)
obvious tame "stdio rpath" ok semarie
Revision 1.21 / (download) - annotate - [select for diffs], Fri Jan 16 06:39:28 2015 UTC (9 years, 4 months ago) by deraadt
Branch: MAIN
CVS Tags: OPENBSD_5_8_BASE,
OPENBSD_5_8,
OPENBSD_5_7_BASE,
OPENBSD_5_7
Changes since 1.20: +5 -3 lines
Diff to previous 1.20 (colored)
Replace <sys/param.h> with <limits.h> and other less dirty headers where possible. Annotate <sys/param.h> lines with their current reasons. Switch to PATH_MAX, NGROUPS_MAX, HOST_NAME_MAX+1, LOGIN_NAME_MAX, etc. Change MIN() and MAX() to local definitions of MINIMUM() and MAXIMUM() where sensible to avoid pulling in the pollution. These are the files confirmed through binary verification. ok guenther, millert, doug (helped with the verification protocol)
Revision 1.20 / (download) - annotate - [select for diffs], Tue Oct 27 23:59:19 2009 UTC (14 years, 7 months ago) by deraadt
Branch: MAIN
CVS Tags: OPENBSD_5_6_BASE,
OPENBSD_5_6,
OPENBSD_5_5_BASE,
OPENBSD_5_5,
OPENBSD_5_4_BASE,
OPENBSD_5_4,
OPENBSD_5_3_BASE,
OPENBSD_5_3,
OPENBSD_5_2_BASE,
OPENBSD_5_2,
OPENBSD_5_1_BASE,
OPENBSD_5_1,
OPENBSD_5_0_BASE,
OPENBSD_5_0,
OPENBSD_4_9_BASE,
OPENBSD_4_9,
OPENBSD_4_8_BASE,
OPENBSD_4_8,
OPENBSD_4_7_BASE,
OPENBSD_4_7
Changes since 1.19: +1 -15 lines
Diff to previous 1.19 (colored)
rcsid[] and sccsid[] and copyright[] are essentially unmaintained (and unmaintainable). these days, people use source. these id's do not provide any benefit, and do hurt the small install media (the 33,000 line diff is essentially mechanical) ok with the idea millert, ok dms
Revision 1.19 / (download) - annotate - [select for diffs], Tue Jul 17 07:10:22 2007 UTC (16 years, 10 months ago) by jmc
Branch: MAIN
CVS Tags: OPENBSD_4_6_BASE,
OPENBSD_4_6,
OPENBSD_4_5_BASE,
OPENBSD_4_5,
OPENBSD_4_4_BASE,
OPENBSD_4_4,
OPENBSD_4_3_BASE,
OPENBSD_4_3,
OPENBSD_4_2_BASE,
OPENBSD_4_2
Changes since 1.18: +3 -3 lines
Diff to previous 1.18 (colored)
sync usage(); from Tobias Stoeckmann
Revision 1.18 / (download) - annotate - [select for diffs], Thu Mar 22 18:35:07 2007 UTC (17 years, 2 months ago) by millert
Branch: MAIN
Changes since 1.17: +5 -3 lines
Diff to previous 1.17 (colored)
Fix handling of multiple stdin arguments in cooked mode, closes PR 5418. From Johan Veenhuizen
Revision 1.17 / (download) - annotate - [select for diffs], Tue Apr 5 01:18:53 2005 UTC (19 years, 2 months ago) by jaredy
Branch: MAIN
CVS Tags: OPENBSD_4_1_BASE,
OPENBSD_4_1,
OPENBSD_4_0_BASE,
OPENBSD_4_0,
OPENBSD_3_9_BASE,
OPENBSD_3_9,
OPENBSD_3_8_BASE,
OPENBSD_3_8
Changes since 1.16: +3 -3 lines
Diff to previous 1.16 (colored)
change incorrect filename in output on fstat() failure from Cedric Berger <cedric@berger.to> ok otto
Revision 1.16 / (download) - annotate - [select for diffs], Fri May 21 02:11:33 2004 UTC (20 years ago) by jolan
Branch: MAIN
CVS Tags: OPENBSD_3_7_BASE,
OPENBSD_3_7,
OPENBSD_3_6_BASE,
OPENBSD_3_6
Changes since 1.15: +13 -10 lines
Diff to previous 1.15 (colored)
minor cleanups / shut up lint, ok pedro tedu
Revision 1.15 / (download) - annotate - [select for diffs], Mon Jun 2 23:32:06 2003 UTC (21 years ago) by millert
Branch: MAIN
CVS Tags: OPENBSD_3_5_BASE,
OPENBSD_3_5,
OPENBSD_3_4_BASE,
OPENBSD_3_4
Changes since 1.14: +3 -7 lines
Diff to previous 1.14 (colored)
Remove the advertising clause in the UCB license which Berkeley rescinded 22 July 1999. Proofed by myself and Theo.
Revision 1.14 / (download) - annotate - [select for diffs], Thu Jul 4 04:26:39 2002 UTC (21 years, 11 months ago) by deraadt
Branch: MAIN
CVS Tags: OPENBSD_3_3_BASE,
OPENBSD_3_3,
OPENBSD_3_2_BASE,
OPENBSD_3_2
Changes since 1.13: +7 -13 lines
Diff to previous 1.13 (colored)
ansi
Revision 1.13 / (download) - annotate - [select for diffs], Thu Mar 14 21:17:50 2002 UTC (22 years, 3 months ago) by millert
Branch: MAIN
CVS Tags: OPENBSD_3_1_BASE,
OPENBSD_3_1
Changes since 1.12: +14 -19 lines
Diff to previous 1.12 (colored)
Fix 'cat -se'; the '$' was not being printed for blank lines. Based on a patch from Denis Afonin.
Revision 1.12 / (download) - annotate - [select for diffs], Sat Feb 16 21:27:05 2002 UTC (22 years, 3 months ago) by millert
Branch: MAIN
Changes since 1.11: +6 -6 lines
Diff to previous 1.11 (colored)
Part one of userland __P removal. Done with a simple regexp with some minor hand editing to make comments line up correctly. Another pass is forthcoming that handles the cases that could not be done automatically.
Revision 1.11 / (download) - annotate - [select for diffs], Mon Nov 5 07:39:16 2001 UTC (22 years, 7 months ago) by mpech
Branch: MAIN
Changes since 1.10: +8 -8 lines
Diff to previous 1.10 (colored)
kill more registers; millert@ ok
Revision 1.10 / (download) - annotate - [select for diffs], Thu Sep 6 13:29:08 2001 UTC (22 years, 9 months ago) by mpech
Branch: MAIN
CVS Tags: OPENBSD_3_0_BASE,
OPENBSD_3_0
Changes since 1.9: +5 -3 lines
Diff to previous 1.9 (colored)
o) __progname aria; millert@ ok.
Revision 1.9 / (download) - annotate - [select for diffs], Sat Jan 22 20:24:45 2000 UTC (24 years, 4 months ago) by deraadt
Branch: MAIN
CVS Tags: OPENBSD_2_9_BASE,
OPENBSD_2_9,
OPENBSD_2_8_BASE,
OPENBSD_2_8,
OPENBSD_2_7_BASE,
OPENBSD_2_7
Changes since 1.8: +2 -3 lines
Diff to previous 1.8 (colored)
remove extra externs not needed because of unistd.h (rest of tree will be done later.. contact me if you want to help)
Revision 1.8 / (download) - annotate - [select for diffs], Wed Jun 18 18:37:56 1997 UTC (26 years, 11 months ago) by kstailey
Branch: MAIN
CVS Tags: OPENBSD_2_6_BASE,
OPENBSD_2_6,
OPENBSD_2_5_BASE,
OPENBSD_2_5,
OPENBSD_2_4_BASE,
OPENBSD_2_4,
OPENBSD_2_3_BASE,
OPENBSD_2_3,
OPENBSD_2_2_BASE,
OPENBSD_2_2
Changes since 1.7: +3 -3 lines
Diff to previous 1.7 (colored)
(foo *)NULL -> NULL
Revision 1.7 / (download) - annotate - [select for diffs], Sat Dec 14 12:17:33 1996 UTC (27 years, 6 months ago) by mickey
Branch: MAIN
CVS Tags: OPENBSD_2_1_BASE,
OPENBSD_2_1
Changes since 1.6: +3 -3 lines
Diff to previous 1.6 (colored)
-Wall'ing.
Revision 1.6 / (download) - annotate - [select for diffs], Sat Sep 28 20:52:50 1996 UTC (27 years, 8 months ago) by imp
Branch: MAIN
CVS Tags: OPENBSD_2_0_BASE,
OPENBSD_2_0
Changes since 1.5: +3 -3 lines
Diff to previous 1.5 (colored)
Back out last change, getopt on OpenBSD returns -1, not EOF
Revision 1.5 / (download) - annotate - [select for diffs], Sat Sep 28 19:36:38 1996 UTC (27 years, 8 months ago) by imp
Branch: MAIN
Changes since 1.4: +3 -3 lines
Diff to previous 1.4 (colored)
Fix the return value of test of getopt. It is documented to return EOF when there are no more args to process. This happens also to be a trivial difference between FreeBSD and OpenBSD which FreeBSD has right. Shouldn't break anything because EOF is #defined to be -1 on BSD systems.
Revision 1.4 / (download) - annotate - [select for diffs], Fri Aug 2 17:39:50 1996 UTC (27 years, 10 months ago) by tholo
Branch: MAIN
Changes since 1.3: +8 -3 lines
Diff to previous 1.3 (colored)
Exit with status >0 if any error occured; from FreeBSD
Revision 1.3 / (download) - annotate - [select for diffs], Fri Aug 2 12:40:48 1996 UTC (27 years, 10 months ago) by deraadt
Branch: MAIN
Changes since 1.2: +2 -3 lines
Diff to previous 1.2 (colored)
zap getopt() case of -?, come on, it is the default!
Revision 1.2 / (download) - annotate - [select for diffs], Sun Jun 23 14:19:02 1996 UTC (27 years, 11 months ago) by deraadt
Branch: MAIN
Changes since 1.1: +2 -1 lines
Diff to previous 1.1 (colored)
update rcsid
Revision 1.1.1.1 / (download) - annotate - [select for diffs] (vendor branch), Wed Oct 18 08:37:01 1995 UTC (28 years, 7 months ago) by deraadt
CVS Tags: netbsd_1_1
Changes since 1.1: +0 -0 lines
Diff to previous 1.1 (colored)
initial import of NetBSD tree
Revision 1.1 / (download) - annotate - [select for diffs], Wed Oct 18 08:37:01 1995 UTC (28 years, 7 months ago) by deraadt
Branch: MAIN
Initial revision