On 03/30/2013 18:28, Calvin Morrison wrote:
Comrades,

I just spend about fifteen minutes writing this little tool that I call print:

http://mutantturkey.com/print/

All it does is print the specified line from a file.

example usage:

$ print constitution.txt 1
We the People of the United States, in Order to form a more perfect Union,

$ print print.c 1
#include<stdio.h>

todo:

pipe from standard input

What do you guys think of the tool? Of the code? It does one thing and
one thing well.


I'll assume this is coding exercise, and set aside the questionable need for this utility.

- Line 28. Error messages like this should go to stderr. Stdout should contain the correct result, or nothing. Adhering to this rule will make the program more suitable as a filter in a pipeline.

- What guarantee do you have that the input file won't contain any lines with length > LINE_MAX? As far as I know, that's an arbitrary number, and there is no intrinsic limit on the length of the lines in a Unix text file.



Reply via email to