Monday, October 29, 2012

df-3.5 standalone and volumes.exe

for the time being, df for windows is not available, the only available version floating around on the net is version 3.5 from brothersoft (yeah I really hate its Downloader-Installer and I have to run it in sandboxie).
The original version links dynamically to libgcc_s and libstdc++ library, which bloats the package so much. I relinking it to static libgcc and libstdc++ to give a small, standalone binary.

But I still not prefering using C++ in such small program, so I modified the MSDN example about Displaying Volume Paths.
The whole development environment is just TinyCC(my git mob build with somewhat more complete imports is available here), GreenPad, a Command Prompt Window (you may try ConEmu, but I'd prefer multi-window environment), and a web browser (for finding references).
Developing with TinyCC is fun. You don't need to compile for testing. Just run tcc -run volumes.c and it will run in memory. Passing arguments will work also, just like writing Perl scripts.
D:\>volumes.exe -?
volumes [-v] [-g] [-a] [-r[f]] [-u#] [-?] [drive|path...]

-v be verbose (-g switch will be turned off)
-g draw gauge of free space
-a append drive|path to detected list
-r[f] detect removable device free space (-rf for real floppy drive)
-u[num] use unit # (0=byte, 1=KB, 2=MB, 3=GB, 4=TB)
-? show this help and exit
drive|path... show individual drives
example: C: D: F:\mountpoint\


31 Oct 2012 Update: volumes ver5
- Support Windows 2000
- add "-rf" switch for real floppy
- fix showing garbage when using -u0 switch
- able to append undetected drives(network drives, etc.) to detected list when -a switch
- added "volumes-classic" for Windows NT which checks drive letters only

28 Oct 2012 Update: volumes ver4
- add "-r" switch
- able to show individual drives
- not showing ".00" anymore in -u0 mode