2006/06/26 tmccolm
authortmccolm <tmccolm@cinecert.com>
Tue, 27 Jun 2006 05:19:28 +0000 (05:19 +0000)
committertmccolm <>
Tue, 27 Jun 2006 05:19:28 +0000 (05:19 +0000)
src/kmfilegen.cpp
src/kmrandgen.cpp
src/kmuuidgen.cpp

index bc1243d9da8e7106801b6508d7bdea0687004a1a..38387a8c739864152b184707068e4af57d51601d 100755 (executable)
@@ -83,23 +83,26 @@ void
 usage(FILE* stream = stdout)
 {
   fprintf(stream, "\
-USAGE: %s [-c <file-size>][-o <fwd|rev|rand>][-w <filename>][-v]\n\
-       <filename>\n\
+USAGE: %s [-c <file-size>] [-v] <output-file>\n\
+\n\
+       %s [-o <fwd|rev|rand>] [-v] <input-file>\n\
+\n\
+       %s [-w <output-file>] [-v] <input-file>\n\
 \n\
        %s [-h|-help] [-V]\n\
 \n\
-  -c <file-size>  - Create a test file containing <file-size> megabytes of data\n\
-  -h | -help      - Show help\n\
-  -o <order>      - Specify order used when validating a file.\n\
-                    One of fwd|rev|rand, default is rand\n\
-  -v              - Verbose. Prints informative messages to stderr\n\
-  -V              - Show version information\n\
-  -w              - Read-Validate-Write - file is written to <filename>\n\
-                    (sequential read only)\n\
+  -c <file-size>     - Create test file containing <file-size> megabytes of data\n\
+  -h | -help         - Show help\n\
+  -o <fwd|rev|rand>  - Specify order used when validating a file.\n\
+                       One of fwd|rev|rand, default is rand\n\
+  -v                 - Verbose. Prints informative messages to stderr\n\
+  -V                 - Show version information\n\
+  -w <output-file>   - Read-Validate-Write - file is written to <output-file>\n\
+                       (sequential read only)\n\
 \n\
   NOTES: o There is no option grouping, all options must be distinct arguments.\n\
          o All option arguments must be separated from the option by whitespace.\n\
-\n", PACKAGE, PACKAGE);
+\n", PACKAGE, PACKAGE, PACKAGE, PACKAGE);
 }
 
 enum MajorMode_t {
@@ -127,19 +130,19 @@ public:
 
   //
   CommandOptions(int argc, const char** argv) :
-    error_flag(true), order(0), verbose_flag(false), version_flag(false), help_flag(false),
+    error_flag(true), order(""), verbose_flag(false), version_flag(false), help_flag(false),
     filename(""), write_filename(""), chunk_count(0), mode(MMT_VALIDATE)
   {
-    order = "rand";
+    //    order = "rand";
 
     for ( int i = 1; i < argc; i++ )
       {
 
-        if ( (strcmp( argv[i], "-help") == 0) )
-          {
-            help_flag = true;
-            continue;
-          }
+       if ( (strcmp( argv[i], "-help") == 0) )
+         {
+           help_flag = true;
+           continue;
+         }
      
        if ( argv[i][0] == '-' && isalpha(argv[i][1]) && argv[i][2] == 0 )
          {
@@ -200,22 +203,31 @@ public:
          }
       }
     
-     if ( help_flag || version_flag )
-       return;
-  
-     if ( strlen ( filename ) == 0 )
+    if ( help_flag || version_flag )
+      return;
+    
+    if ( strlen ( filename ) == 0 )
       {
        fprintf(stderr, "Filename required.\n");
        return;
       }
+    
+    if ( mode != MMT_VALIDATE && strcmp(order, "") != 0 )
+      {
+       fprintf(stderr, "-o option not valid with -c or -w options.\n");
+       return;
+      }
+    else
+      if ( strcmp(order, "") == 0 )
+       order = "rand";
 
-   if ( strcmp ( filename, write_filename ) == 0 )
-     {
-       fprintf(stderr, "Output and input files must be different.\n");
-       return;
-     }
-
-   error_flag = false;
+    if ( strcmp ( filename, write_filename ) == 0 )
+      {
+       fprintf(stderr, "Output and input files must be different.\n");
+       return;
+      }
+    
+    error_flag = false;
   }
 };
 
index c953244c502323bbed048500cf5e9e7b2f699448..615f2d1e661c0cc856c5067146eb516f1570fe72 100644 (file)
@@ -67,7 +67,7 @@ void
 usage(FILE* stream = stdout)
 {
   fprintf(stream, "\
-USAGE: %s [-b|-c] [-n] [-s <size>]\n\
+USAGE: %s [-b|-c] [-n] [-s <size>] [-v]\n\
 \n\
        %s [-h|-help] [-V]\n\
 \n\
index bb9afafa3bf5f1f29401339d191dc38a4f88f727..84d26ce27cc81fa7bec9cc4e9c7ba496cedfb17d 100644 (file)
@@ -64,7 +64,7 @@ void
 usage(FILE* stream = stdout)
 {
   fprintf(stream, "\
-USAGE: %s [-c][-n]\n\
+USAGE: %s [-c] [-n] [-v]\n\
 \n\
        %s [-h|-help] [-V]\n\
 \n\