Fix 'e' feature of 2015/burton + formatting

The program is supposed to echo stdin to stdout if the program name
starts with 'e'. This was only possible if one do something like:

    PATH=$PATH:.
    echo '5*5+17' | eprog

because otherwise the first char would be '.' not 'e'.

This was done by using basename(3) and -include libgen.h (in the
Makefile so as to not modify the code more than is necessary).

The Makefile now copies 'prog' to 'eprog' and 'prog' to 'calc'. It also
copies 'prog.alt' to 'eprog.alt' and 'ecalc.alt' as this is what the
program is documented as.

Format fix the calc.1 man page and remove calc.man. This is so that the
formatting is correct and also so as to not have to maintain more than
one copy of the same text (which was almost certainly already out of
sync as I did not update calc.man when I added calc.1 exactly for the
reason that I deleted calc.man).

The try.sh script has been updated and so has the try.this.txt file that
try.sh uses.

This should complete the review of 2015/burton if I'm not very much
mistaken.
This commit is contained in:
Cody Boone Ferguson committed 2023-12-10 05:09:26 -08:00
1 parent 0ce39fe068
commit 0335c04e15
10 files changed
+107 -110

No files matched your search

+18 -10
View File
@@ -15,11 +15,11 @@ make CC="$CC" all >/dev/null || exit 1
# clear screen after compilation so that only the entry is shown
clear
echo "$ ./prog '?0x3343<<2'" 1>&2
./prog '?0x3343<<2'
echo "$ ./calc '?0x3343<<2'" 1>&2
./calc '?0x3343<<2'
echo "$ echo '?0x3343<<2' | ./prog" 1>&2
echo '?0x3343<<2' | ./prog
echo "$ echo '?0x3343<<2' | ./ecalc" 1>&2
echo '?0x3343<<2' | ./ecalc
echo "$ grep '[0-9]' prog.c" 1>&2
@@ -27,9 +27,9 @@ read -r -n 1 -p "Press any key to continue (notice how there are no digits!): "
echo 1>&2
grep -c '[0-9]' prog.c
read -r -n 1 -p "Press any key to run: ./prog < test.in: "
read -r -n 1 -p "Press any key to run: ./calc < test.in: "
echo 1>&2
./prog < test.in
./calc < test.in
echo 1>&2
read -r -n 1 -p "Press any key to show try.this.txt: "
@@ -37,11 +37,19 @@ echo 1>&2
cat try.this.txt
echo 1>&2
read -r -n 1 -p "Press any key to run: ./prog < try.this.txt: "
read -r -n 1 -p "Press any key to run: ./calc < try.this.txt: "
echo 1>&2
./prog < try.this.txt
./calc < try.this.txt
read -r -n 1 -p "Press any key to show the hex value of 42: "
echo 1>&2
echo "$ ./prog 42" 1>&2
./prog 42
echo "$ ./calc 42" 1>&2
./calc 42
read -r -n 1 -p "Press any key to run: ./calc '1<<22-1' (show mask value for 22 bits): "
echo 1>&2
./calc '1<<22-1'
read -r -n 1 -p "Press any key to run: ./calc ?0x11223344 (byte-swapped value of 0x11223344): "
echo 1>&2
./calc ?0x11223344