OpenBSD CVS

CVS log for src/usr.bin/tr/tr.c


[BACK] Up to [local] / src / usr.bin / tr

Request diff between arbitrary revisions


Default branch: MAIN
Current tag: OPENBSD_7_1_BASE


Revision 1.21 / (download) - annotate - [select for diffs], Fri Feb 11 16:09:21 2022 UTC (2 years, 3 months ago) by cheloha
Branch: MAIN
CVS Tags: OPENBSD_7_2_BASE, OPENBSD_7_2, OPENBSD_7_1_BASE, OPENBSD_7_1
Changes since 1.20: +23 -22 lines
Diff to previous 1.20 (colored)

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.

This form allows you to request diff's between any two revisions of a file. You may select a symbolic revision name using the selection box or you may type in a numeric name using the type-in text box.