Update 1993 winning entries' README.md files
Format and typo fixes. Starting with this year I actually did more thorough typo fixes. It might be that I did some of this in earlier years too but I am sure I did it for this year and beyond (at least up through 1995 .. not sure about years beyond that that I have also edited). Even so I'll probably want to do another pass through all files before I can say that the typo issue is resolved. That includes possibly other files and the worst of all files in my entries.
This commit is contained in:
1 parent
cf4437c508
commit
ee4ee3497d
9 files changed
+360
-298
No files matched your search
+21
-17
@@ -1,22 +1,26 @@
|
||||
# Best One Liner
|
||||
|
||||
Mark Plummer
|
||||
2901 Reckord Road
|
||||
Fallston, MD, 21047
|
||||
USA
|
||||
Mark Plummer
|
||||
2901 Reckord Road
|
||||
Fallston, MD, 21047
|
||||
USA
|
||||
|
||||
## To build:
|
||||
|
||||
make all
|
||||
```sh
|
||||
make all
|
||||
```
|
||||
|
||||
## To run:
|
||||
|
||||
./plummer number arg
|
||||
```sh
|
||||
./plummer number arg
|
||||
```
|
||||
|
||||
where:
|
||||
|
||||
number is a number (try 21701)
|
||||
arg is any argument
|
||||
- number is a number (try 21701)
|
||||
- arg is any argument
|
||||
|
||||
### INABIAF - it's not a bug it's a feature :-)
|
||||
|
||||
@@ -33,31 +37,31 @@ characters, and why?
|
||||
This program prints out all numbers up to a given number of digits
|
||||
on a single line. When the largest number is reached, the program
|
||||
starts again with 0. It takes two arguments: the first argument
|
||||
specifies the number to start counting from and uses leading 0's to
|
||||
specifies the number to start counting from and uses leading `0`s to
|
||||
indicate the number of digits, the second argument can be anything
|
||||
but must be present.
|
||||
|
||||
Variable names are single characters chosen for their similarity to
|
||||
other characters (O for 0, l for 1, S for 5 (in some fonts), and _
|
||||
other characters (O for 0, l for 1, S for 5 in some fonts, and _
|
||||
for ... well nothing really, but it is easy to miss). To prevent
|
||||
the need for `strlen()`, the fact that argv is laid out sequentially
|
||||
is exploited (ie. `argv[i + 1] == argv[i] + strlen(argv[i]) + 1`).
|
||||
This is not portable (by the books), but it seems to work
|
||||
everywhere I try (actually, for vms, that only holds for `i > 1`).
|
||||
everywhere I try (actually, for VMS, that only holds for `i > 1`).
|
||||
Also, I depend on the fact that a carriage return causes the line
|
||||
just written to be overwritten. lint (and most compilers) complain
|
||||
that there is no control path leading to a return from main(). At
|
||||
just written to be overwritten. `lint` (and most compilers) complain
|
||||
that there is no control path leading to a return from `main()`. At
|
||||
125 characters, it still fits on a single line (for those of us who
|
||||
don't mind ruining our eyes with 132 column screens).
|
||||
|
||||
The first statement points the base of `l` (the argument vector) to
|
||||
be the first argument by incrementing it. It then assigns `O` to
|
||||
point to the character before the first character of the second
|
||||
argument which also happens to be the null termination of the first
|
||||
argument which also happens to be the NULL termination of the first
|
||||
argument. `*O` gets a `\r` assigned to it. Finally `0` is assigned to
|
||||
the first character of the second argument which has the effect of
|
||||
null terminating the first argument after the carriage return had
|
||||
removed its null termination. I really tried to make the last part
|
||||
NULL terminating the first argument after the carriage return had
|
||||
removed its NULL termination. I really tried to make the last part
|
||||
of that statement part of the original expression, but the best I
|
||||
could do was attach it with a comma (against the advice of K&R).
|
||||
The for loop runs the next for loop continuously (actually until
|
||||
@@ -66,7 +70,7 @@ counting). The next for loop is the meat of the program. In the
|
||||
initialization statement, the string pointed to by `l` (the first
|
||||
argument containing the digits used for counting followed by a `\r`)
|
||||
is printed, and `_` is started at the least significant digit in the
|
||||
string. In the test portion, `_` is insured not to be past the
|
||||
string. In the test portion, `_` is ensured not to be past the
|
||||
beginning of the string (the most significant digit), and the digit
|
||||
pointed to by `_` is incremented and checked to be sure that it _is_
|
||||
greater than `9` (written here as `(S+*O+S)*S`). If the test fails,
|
||||
|
||||
Reference in new issue
Block a user