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@
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.
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().
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