Do not fail with less then two arguments.
authorDmitry Gorbachev <gorbachev@reactos.org>
Fri, 11 May 2007 23:12:49 +0000 (23:12 +0000)
committerDmitry Gorbachev <gorbachev@reactos.org>
Fri, 11 May 2007 23:12:49 +0000 (23:12 +0000)
svn path=/trunk/; revision=26707

reactos/base/applications/cmdutils/more/more.c

index a851da6..6024c8d 100644 (file)
@@ -79,8 +79,8 @@ int main(int argc, char* argv[]) {
 
        rdtscll(timeStart);
 
-       randfile = fopen(argv[1],"r");
-       sortfile = fopen(argv[2],"w");
+       randfile = (argc < 2) ? stdin : fopen(argv[1],"r");
+       sortfile = (argc < 3) ? stdout : fopen(argv[2],"w");
        if (randfile == NULL || sortfile == NULL) {
                fprintf(stderr,"Could not open all files.\n");
                return 1;