2010年4月26日 星期一

md5sum a directory

Generate:
find
(your-dir) -type f -print0 | xargs -0 md5sum >> (output-md5sume-file)

Verify:
md5sum -c (output-md5sum-file)


my example:

robert@robert-desktop ~/work/nbd-work/ttt $ ls
first second test

robert@robert-desktop ~/work/nbd-work/ttt $ find -type f -print0 | xargs -0 md5sum >> ~/Test/mydir.md5


robert@robert-desktop ~/work/nbd-work/ttt $ cat ~/Test/mydir.md5
d41d8cd98f00b204e9800998ecf8427e ./second
d41d8cd98f00b204e9800998ecf8427e ./first
7423d8fc12da81d779d0485b3d3fb67d ./test

robert@robert-desktop ~/work/nbd-work/ttt $ md5sum -c ~/Test/mydir.md5
./second: OK
./first: OK
./test: OK

robert@robert-desktop ~/work/nbd-work/ttt $ echo $?
0



2010年4月13日 星期二

Use djgpp to build a DOS program in dosemu (under Linux)

Topic: How to use djgpp to build a DOS program in DOSEmu (running in Linux) ?

1. Install dosemu

DOSEmu (dosemu HOWTO)

2. Download djgpp files for dosemu

DJGPP (this name comes from ... DJ's GNU Programming Platform)

Use DJGPP Zip File Picker to download what you need (select dosemu for Operating System)

3. Install djgpp into dosemu

Refer to "installation instructions for dosemu" shown in DJGPP Zip File Picker Results. Key points:

* unzip those *.zip files to ~/djgpp/ (~ is your home in Linux)
* edit ~/.dosemu/drvie_c/autoexec.bat :
set PATH=d:\djgpp\BIN;%PATH%
set DJGPP=d:\djgpp\DJGPP.ENV
(dosemu defaults D:\ to ~/)
* reboot dosemu

4. Compile a helloworld in dosemu
* Edit main.c and its Makefile in ~/helloworld/ under Linux
* Then in dosbox, cd D:\helloworld\ and try to make it !
(gcc -o helloworld.exe main.c)

2010年4月7日 星期三

stop on first error (gcc, make)

Just want to see the first compilation error ? Try this:

-> gcc main.c -Wfatal-errors


-Wfatal-errors
This option causes the compiler to abort compilation on the first
error occurred rather than trying to keep going and printing
further error messages.

Ref:
man gcc