Add 1998/schweikh3/try.sh + other fixes & updates

The try.sh script runs the commands in the try section of the README.md.

The README.md had SOME format fixes.

The Makefile symlinks the program to samefile.

The author stated on their website that:

    the Internet Systems Consortium (ISC) has added my samefile utility
    to its treasure of software gems.

and this has been added to the README.md in the judges' remarks, along
with the web page for the program!
This commit is contained in:
Cody Boone Ferguson committed 2023-11-03 05:29:47 -07:00
1 parent 53f9cbce69
commit 122e54a5ae
5 files changed
+54 -24

No files matched your search

+1
View File
@@ -4,4 +4,5 @@ file2
file3
file4
schweikh3.orig
samefile
prog.orig
+1
View File
@@ -131,6 +131,7 @@ all: data ${TARGET}
${PROG}: ${PROG}.c
${CC} ${CFLAGS} $< -o $@ ${LDFLAGS}
${LN} -sf $@ samefile
# alternative executable
#
+25 -24
View File
@@ -1,11 +1,8 @@
# Most Space Efficient
Jens Schweikhardt\
DFN Network Operation Center\
Schlartaeckerweg 3 (Home address)\
D-71384 Weinstadt\
Germany\
<http://www.schweikhardt.net>
Jens Schweikhardt <schweikh@schweikhardt.net>\
<http://www.schweikhardt.net>\
Germany
## To build:
@@ -22,7 +19,7 @@ all your favorite pictures off the Internet or from
`alt.binaries.pictures.*`, do
```sh
find dir -type f -print | ./schweikh3
find dir -type f -print | ./samefile
```
Maybe you will not need to buy another 10 Gb disk to store them. :-)
@@ -33,7 +30,7 @@ Maybe you will not need to buy another 10 Gb disk to store them. :-)
If you're in this winning entry's directory:
```sh
find . -type f -print | ./schweikh3
find . -type f -print | ./samefile
```
Notice that the tool finds a duplicate file, that of the man page.
@@ -44,21 +41,17 @@ Notice that the tool finds a duplicate file, that of the man page.
Try this:
```sh
cp schweikh3 file1
cp schweikh3 file2
cp schweikh3.c file3
ln file3 file4
find . -type f -name 'file?' | ./schweikh3
./try.sh
```
This program is not as smart as to detect identity of JPEG files with the same
picture but with different compression levels. On the other hand compression can
make it thing look/sound/feel different so these probably aren't duplicates
make a thing look/sound/feel different so these probably aren't duplicates
anyway. :-)
NOTE: Some non-gcc compilers that are not fully ANSI standard do not compile
this entry correctly.
Some time after this entry won, the Internet Systems Consortium (ISC) added the
samefile utility to its treasure of software gems! See the author's page about
the tool as well at <http://www.schweikhardt.net/samefile>.
## Author's remarks:
@@ -66,11 +59,17 @@ this entry correctly.
The source is expected to conform to IEEE Std 1003.1-1990 ("POSIX").
Thank God the IEEE does not standardize a coding style...
### What this program does
This is best explained in the man page. The troff source for this
man page can be found in the file samefile.1. To render try: `man
./samefile.1`. Otherwise:
man page can be found in the file samefile.1. To render try:
```sh
`man ./samefile.1
```
Otherwise:
**SAMEFILE(1) User Manuals SAMEFILE(1)**
@@ -80,21 +79,23 @@ man page can be found in the file samefile.1. To render try: `man
**samefile** - find identical files
**SYNOPSIS**
**./samefile**
./samefile
**DESCRIPTION**
**samefile** reads a list of file names (one file name per
line) from stdin. For each file name pair with identical
`samefile` reads a list of file names (one file name per
line) from `stdin`. For each file name pair with identical
contents, a line consisting of six tab separated fields is
output: The size in bytes, two file names, the character
`=` if the two files are on the same device, `X` otherwise,
and the link counts of the two files. The output
is sorted in reverse order by size.
samefile uses two stages to give optimum performance.
`samefile` uses two stages to give optimum performance.
In the first stage, all non-plain files are silently
ignored (directories, devices, FIFOs, sockets, symbolic
@@ -186,7 +187,7 @@ otherwise.
`find(1)`, `ln(1)`, `rm(1)`
\
### Why I think it is obfuscated
- The code is commented but this gives only an *extremely* faint clue.
+14
View File
@@ -0,0 +1,14 @@
#!/usr/bin/env bash
make all || exit 1
echo "$ cp -f schweikh3 file1"
cp -f schweikh3 file1
echo "$ cp -f schweikh3 file2"
cp -f schweikh3 file2
echo "$ cp -f schweikh3.c file3"
cp -f schweikh3.c file3
echo "$ ln -f file3 file4"
ln -f file3 file4
echo "$ find . -type f -name 'file?' | ./samefile"
find . -type f -name 'file?' | ./samefile
+13
View File
@@ -1669,6 +1669,19 @@ interesting historical explanation and further details and fun, see the
README.md.
## [1998/schweikh3](1998/schweikh3/schweikh3.c) ([README.md](1998/schweikh3/README.md]))
Cody added the [try.sh](1998/schweikh3/try.sh) script to make it easier to try
the commands that we suggested. One command was not added, that of the to use
command.
Cody also made the Makefile rule `all` symlink the entry to `samefile` as that
is the name of the program.
There actually is a web page for the tool and this was added to the author
information for the entry. It has not been added to any JSON file.
## [2000/anderson](2000/anderson/anderson.c) ([README.md](2000/anderson/README.md]))
Cody changed this entry to use `fgets()` instead of `gets()` to make it safer