1
0
mirror of https://github.com/openbsd/src.git synced 2025-01-03 06:45:37 -08:00
Commit Graph

22 Commits

Author SHA1 Message Date
cheloha
d7259957e8 userspace: remove vestigial '?' cases from top-level getopt(3) loops
getopt(3) returns '?' when it encounters a flag not present in the in
the optstring or if a flag is missing its option argument.  We can
handle this case with the "default" failure case with no loss of
legibility.  Hence, remove all the redundant "case '?':" lines.

Prompted by dlg@.  With help from dlg@ and millert@.

Link: https://marc.info/?l=openbsd-tech&m=167011979726449&w=2

ok naddy@ millert@ dlg@
2022-12-04 23:50:45 +00:00
cheloha
d94933457f tr(1): rename lookup tables
The lookup tables in tr(1) are called "string1" and "string2".  This is
misleading:

- They aren't C strings, they are lookup tables.

- The names "string1" and "string2" don't hint at what their contents
  actually mean.  The meaning of a given table changes with tr(1)'s
  operating mode.  There are five different modes.

It would be considerably easier to see what is happening at a glance
if the tables were named for their corresponding byte transformation.

So instead of two tables named "string1" and "string2" we'll have
three tables named "delete", "squeeze", and "translate".  In addition,
the "string" passed to the setup() function will be called a "table".

With this patch the code in main() is way easier to understand.
Hopefully this makes subsequent patches easier to review.

Thread: https://marc.info/?l=openbsd-tech&m=164355980600901&w=2

No complaints on tech@ after over a week.
2022-02-11 16:09:21 +00:00
cheloha
dca3113990 tr(1): main(): eliminate isstring2 variable
If only there we a way to express how many positional arguments we
needed to run tr(1) in a given operating mode.

... oh.  Wait.  We have argc for that.

Remove the isstring2 variable to simplify some of the logic in main().
2021-11-02 15:45:52 +00:00
deraadt
0bd1216cbf Change all tame callers to namechange to pledge(2). 2015-10-09 01:37:06 +00:00
deraadt
48adfa3dbd only modifies data, stdin to stdout, so tame "stdout" 2015-10-06 13:49:33 +00:00
millert
dfde7b6dc5 Accept -C as an alias for -c. The -C option should be locale-aware,
but we don't have collation support yet.  Man bits OK jmc@
2014-06-03 20:57:23 +00:00
okan
5195d91e62 remove erroneous char cast to switch expression processing getopt(3);
not used in any cases.

ok deraadt@, guenther@, millert@
2013-11-27 13:32:02 +00:00
deraadt
043fbe51c1 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
2009-10-27 23:59:19 +00:00
sobrado
0b52b90c51 documentation tweaks. 2008-07-09 19:41:56 +00:00
deraadt
9400e9ef3e signed and unsigned char wiggles 2004-09-15 22:12:19 +00:00
deraadt
078ac152c4 spacing 2004-05-09 03:20:20 +00:00
mickey
257fef1a1a print usage in one printf (instead of four) 2003-06-26 16:03:43 +00:00
deraadt
1837a5ca50 mostly ansi cleanup; pval ok 2003-06-10 22:20:44 +00:00
millert
f75387cb26 Remove the advertising clause in the UCB license which Berkeley
rescinded 22 July 1999.  Proofed by myself and Theo.
2003-06-03 02:56:05 +00:00
millert
c72b5b24e1 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. 2002-02-16 21:27:05 +00:00
deraadt
0c7a89cb76 fix "no characters" input case; tim@robbins.dropbear.id.au 2002-02-09 02:03:28 +00:00
mpech
c0932ef1ff kill more registers
millert@ ok
2001-11-19 19:02:13 +00:00
mickey
c2d49de7d9 use err(3) 1997-07-25 21:14:03 +00:00
mickey
d8d7cb97b7 #if __STDC__ --> #ifdef __STDC__ 1997-07-25 21:05:26 +00:00
millert
72799b18e5 getopt(3) returns -1 when out of args, not EOF, whee! 1997-01-15 23:40:20 +00:00
deraadt
1258a77d10 rcsid 1996-06-26 05:31:08 +00:00
deraadt
df930be708 initial import of NetBSD tree 1995-10-18 08:37:01 +00:00