fix Makefile and README.md for 2019/yang
This commit is contained in:
1 parent
9920198ffa
commit
7679d99c64
3 files changed
+219
-388
No files matched your search
+80
-54
@@ -1,91 +1,106 @@
|
||||
# Most in need of transparency
|
||||
|
||||
Don Yang
|
||||
<http://uguu.org/>
|
||||
Don Yang
|
||||
<http://uguu.org/>
|
||||
|
||||
# To build:
|
||||
|
||||
## Judges' comments:
|
||||
```sh
|
||||
make
|
||||
```
|
||||
|
||||
## To build:
|
||||
### To run:
|
||||
|
||||
make all
|
||||
```sh
|
||||
./prog sample_input.txt a b c d
|
||||
|
||||
### To use:
|
||||
cat a
|
||||
|
||||
cat b
|
||||
|
||||
./prog sample_input.txt a b c d
|
||||
cat c
|
||||
|
||||
cat a
|
||||
cat d
|
||||
|
||||
cat b
|
||||
|
||||
cat c
|
||||
|
||||
cat d
|
||||
|
||||
cat a b c d | ./prog
|
||||
cat a b c d | ./prog
|
||||
```
|
||||
|
||||
### Try:
|
||||
|
||||
./prog prog.c a b c d e
|
||||
```sh
|
||||
./prog prog.c a b c d e
|
||||
|
||||
cat a
|
||||
cat a
|
||||
|
||||
cat b
|
||||
cat b
|
||||
|
||||
cat c
|
||||
cat c
|
||||
|
||||
cat d
|
||||
cat d
|
||||
|
||||
cat e
|
||||
cat e
|
||||
|
||||
cat a b c d e | ./prog
|
||||
cat a b c d e | ./prog
|
||||
|
||||
cat a b c d e | ./prog | diff - prog.c
|
||||
cat a b c d e | ./prog | diff - prog.c
|
||||
```
|
||||
|
||||
### Selected Judges Remarks:
|
||||
## Judges' comments:
|
||||
|
||||
Do you understand how this program works?
|
||||
You may have to go over and over the output again.
|
||||
|
||||
## Author's comments:
|
||||
# Summary
|
||||
|
||||
### Summary
|
||||
|
||||
Scramble/unscramble to single file:
|
||||
|
||||
./prog original.txt > scrambled.txt
|
||||
```sh
|
||||
./prog original.txt > scrambled.txt
|
||||
|
||||
./prog < scrambled.txt > unscrambled.txt
|
||||
./prog < scrambled.txt > unscrambled.txt
|
||||
```
|
||||
|
||||
Scramble/unscramble to multiple files:
|
||||
|
||||
./prog input.txt output1.txt output2.txt ...
|
||||
```sh
|
||||
./prog input.txt output1.txt output2.txt ...
|
||||
|
||||
cat output1.txt output2.txt ... | ./prog > unscrambled.txt
|
||||
cat output1.txt output2.txt ... | ./prog > unscrambled.txt
|
||||
```
|
||||
|
||||
Re-scramble:
|
||||
|
||||
./prog original.txt | ./prog - > scrambled1.txt
|
||||
./prog original.txt | ./prog - | ./prog - > scrambled2.txt
|
||||
./prog original.txt | ./prog - | ./prog - | ... > scrambled3.txt
|
||||
```sh
|
||||
./prog original.txt | ./prog - > scrambled1.txt
|
||||
./prog original.txt | ./prog - | ./prog - > scrambled2.txt
|
||||
./prog original.txt | ./prog - | ./prog - | ... > scrambled3.txt
|
||||
```
|
||||
|
||||
Scramble slowly:
|
||||
|
||||
./prog input.txt | ruby prog.c
|
||||
```sh
|
||||
./prog input.txt | ruby prog.c
|
||||
```
|
||||
|
||||
Input must be in UTF-8 encoding.
|
||||
|
||||
# Details
|
||||
### Details
|
||||
|
||||
This is a text scrambling utility. To scramble text, specify input
|
||||
file name as the first argument:
|
||||
|
||||
./prog input.txt > output.txt
|
||||
```sh
|
||||
./prog input.txt > output.txt
|
||||
```
|
||||
|
||||
If original input file was small enough to fit in your terminal, you
|
||||
can simply use `cat` to unscramble the output text.
|
||||
|
||||
cat output.txt
|
||||
```sh
|
||||
cat output.txt
|
||||
```
|
||||
|
||||
It might seem like nothing was scrambled, but you can try passing the
|
||||
output through `strings(1)` and see that most of the original strings
|
||||
@@ -95,19 +110,25 @@ printed in random order. This effect is more visible if there is a
|
||||
delay after each character is printed. For convenience, an utility is
|
||||
included in the source to output characters slowly:
|
||||
|
||||
./prog input.txt | ruby prog.c
|
||||
```sh
|
||||
./prog input.txt | ruby prog.c
|
||||
```
|
||||
|
||||
Scrambling order is deterministic, but you can reshuffle the output by
|
||||
piping it through the same utility again, by specifying `-` as the
|
||||
first argument:
|
||||
|
||||
./prog input.txt | ./prog - | ./prog - | ...
|
||||
```sh
|
||||
./prog input.txt | ./prog - | ./prog - | ...
|
||||
```
|
||||
|
||||
You can also split the input to multiple files, each getting a subset
|
||||
of the original input characters:
|
||||
|
||||
./prog input.txt output1.txt output2.txt ...
|
||||
cat output1.txt output2.txt ... > unscrambled.txt
|
||||
```sh
|
||||
./prog input.txt output1.txt output2.txt ...
|
||||
cat output1.txt output2.txt ... > unscrambled.txt
|
||||
```
|
||||
|
||||
You can only unscramble files with `cat` if the input fits in a single
|
||||
terminal screen. If you don't know what will be the terminal size of
|
||||
@@ -121,16 +142,20 @@ positions to be misaligned. But fear not, this utility also includes
|
||||
unscrambling functionality. If no argument is specified, input will
|
||||
be read through stdin and unscrambled to stdout:
|
||||
|
||||
./prog < scrambled.txt > unscrambled.txt
|
||||
```sh
|
||||
./prog < scrambled.txt > unscrambled.txt
|
||||
```
|
||||
|
||||
Where this is useful is that if you scramble the input to multiple
|
||||
files and unscramble each output files individually, those output
|
||||
files can be printed on transparencies and distributed separately.
|
||||
|
||||
./prog input.txt output1.txt output2.txt output3.txt
|
||||
./prog < output1.txt > layer1.txt
|
||||
./prog < output2.txt > layer2.txt
|
||||
./prog < output3.txt > layer3.txt
|
||||
```sh
|
||||
./prog input.txt output1.txt output2.txt output3.txt
|
||||
./prog < output1.txt > layer1.txt
|
||||
./prog < output2.txt > layer2.txt
|
||||
./prog < output3.txt > layer3.txt
|
||||
```
|
||||
|
||||
In other words, this is a utility for facilitating
|
||||
[visual cryptography](https://en.wikipedia.org/wiki/Visual_cryptography).
|
||||
@@ -138,11 +163,13 @@ In other words, this is a utility for facilitating
|
||||
This utility can also be used just for removing trailing whitespaces
|
||||
and expanding tabs to 8 spaces.
|
||||
|
||||
./prog input.txt | ./prog
|
||||
```sh
|
||||
./prog input.txt | ./prog
|
||||
```
|
||||
|
||||
# Features
|
||||
### Features
|
||||
|
||||
## UTF-8 support
|
||||
### UTF-8 support
|
||||
|
||||
A simple text scrambling utility might not have required a screenful
|
||||
of code, but this particular one natively supports UTF-8.
|
||||
@@ -158,7 +185,7 @@ be possible to unscramble those text back to the original using this
|
||||
same utility, since the utility is self-consistent in how cursor
|
||||
positions are handled.
|
||||
|
||||
## Error handling
|
||||
$## Error handling
|
||||
|
||||
If any file can not be opened for reading or writing, an error is
|
||||
printed to stderr, and the utility will exit with nonzero status.
|
||||
@@ -169,7 +196,7 @@ If input contains CR-LF end of line sequences, those CRs are silently
|
||||
dropped. In fact, most control codes are silently ignored except line
|
||||
feeds (preserved) and tabs (expanded to 8 spaces).
|
||||
|
||||
## Compatibility
|
||||
$## Compatibility
|
||||
|
||||
Verified to work and compiles without warnings on these environments:
|
||||
|
||||
@@ -179,7 +206,7 @@ Verified to work and compiles without warnings on these environments:
|
||||
* clang 5.0.1 on Cygwin
|
||||
* gcc 4.8.4 on Linux
|
||||
|
||||
## Full version
|
||||
$## Full version
|
||||
|
||||
I tried really hard to make `prog.c` fit in a 80x25 terminal without
|
||||
wrapping. If I were not constrained by space, I would have made an
|
||||
@@ -190,11 +217,10 @@ depending on `sizeof(int)`.
|
||||
Violet is named after "Violet Evergarden", the character who is highly
|
||||
skilled in writing letters.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
<!--
|
||||
## Copyright:
|
||||
|
||||
(c) Copyright 1984-2019, [Leo Broukhis, Simon Cooper, Landon Curt Noll][judges] - All rights reserved
|
||||
This work is licensed under a [Creative Commons Attribution-ShareAlike 3.0 Unported License][cc].
|
||||
|
||||
[judges]: http://www.ioccc.org/judges.html
|
||||
[cc]: http://creativecommons.org/licenses/by-sa/3.0/
|
||||
-->
|
||||
Reference in new issue
Block a user