I wanted to know the switches of imdisk, so I just typed (from CMD prompt)
C:\>imdisk
and the output was
Control program for the ImDisk Virtual Disk Driver. For copyrights and credits, type imdisk --version Syntax: imdisk -a -t type -m mountpoint [-n] [-o opt1[,opt2 ...]] [-f|-F file] [-s size] [-b offset] [-v partition] [-S sectorsize] [-u unit] [-x sectors/track] [-y tracks/cylinder] [-p "format-parameters"] [-P] ...
so far so good. But when I redirected the output to a file:
C:\>imdisk 2>output.txt
The output has many extra blank lines
Control program for the ImDisk Virtual Disk Driver. For copyrights and credits, type imdisk --version Syntax: imdisk -a -t type -m mountpoint [-n] [-o opt1[,opt2 ...]] [-f|-F file] [-s size] [-b offset] [-v partition] [-S sectorsize] [-u unit] [-x sectors/track] [-y tracks/cylinder] [-p "format-parameters"] [-P] ...
when viewed from Command Prompt, Powershell shell or any text editors.
The output happened to be printed from function ImDiskSyntaxHelp(), in file cli/imdisk.c. It has a fputs() statement with '\r\n' all over the place instead of '\n'. Is it necessary? Even on Windows (AFAIK) on almost never needs to bother with a '\r' in front or '\n'. fprintf() and fputs() will smartly write 0x0d 0x0a for a single '\n' so '\r' is almost never needed.
Probably the same thing happens in other source files as well. Please review.
Thanks.