Description
I like the idea of your program, but I do have a few suggestions and ideas. IMO it should be a little bit more Unix like. Simple invocation, scriptable, ...
Currently you get output that has to be redirected to /dev/null if you want to use it in a script. Nobody really cares about text output in such a case. But for this program there's no text required at all. (Maybe you wanted to play with multiple languages, but it's just not necessary and superfluous output only annoys people - or at least it annoys me.)
Arguments are great, but there should be short and long options. e.g. -f
for --filename
, ...
The only important argument is the size, thus it should not need an argument at all. You shoud be able to create a file by just doing this:
$ trash-dump 1048576
and you get a 1 megabyte file called tdump.tdp
(or whatever you want to choose as the default filename).
Which brings me to my next suggesttion. Allow modifiers like k
, m
, g
, which multiply the size by a factor.
10m
would be 10 * 1048576
bytes = 10 megabytes.
Also, the program should not output any text, unless invoked with -v
or --verbose
. Text output can be nice for statistics or other stuff, but there's nothing needed in the program. You can use time
(Unix/Linux command) to measure the runtime. The size of the file was specified at input time. So why do we need a text output?
The return code usually tells me everything I want to know. 0
for success. 1
for error. You can use different error codes for different errors. (disk full = 2, file exists = 1, unspecified = 3, ....).
P.S.: A Makefile
would be great to build and install the program.