]> git.proxmox.com Git - mirror_edk2.git/blobdiff - Tools/CCode/Source/SplitFile/SplitFile.c
Modified version and usage display.
[mirror_edk2.git] / Tools / CCode / Source / SplitFile / SplitFile.c
index a1bda7dc312ea0bf21794797f17394ff3a6a4dc0..68a0739a5f628329cb44521b143fa583e923f442 100644 (file)
@@ -16,8 +16,43 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 #include "string.h"\r
 #include "stdlib.h"\r
 \r
+//\r
+// Utility Name\r
+//\r
+#define UTILITY_NAME  "SplitFile"\r
+\r
+//\r
+// Utility version information\r
+//\r
+#define UTILITY_MAJOR_VERSION 0\r
+#define UTILITY_MINOR_VERSION 1\r
+\r
+void\r
+Version (\r
+  void\r
+  )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+  Displays the standard utility information to SDTOUT\r
+\r
+Arguments:\r
+\r
+  None\r
+\r
+Returns:\r
+\r
+  None\r
+\r
+--*/\r
+{\r
+  printf ("%s v%d.%d -Utility to break a file into two pieces at the request offset.\n", UTILITY_NAME, UTILITY_MAJOR_VERSION, UTILITY_MINOR_VERSION);\r
+  printf ("Copyright (c) 1999-2007 Intel Corporation. All rights reserved.\n");\r
+}\r
+\r
 void\r
-helpmsg (\r
+Usage (\r
   void\r
   )\r
 /*++\r
@@ -35,11 +70,14 @@ Returns:
 \r
 --*/\r
 {\r
-  printf (\r
-    "SplitFile Filename Offset\n""   Filename = Input file to split\n""   Offset = offset at which to split file\n"\r
-    "\n\n""SplitFile will break a file in two pieces at the requested offset\n"\r
-    "  outputting Filename1 and Filename2\n"\r
-    );\r
+  Version();\r
+  printf ("\nUsage: \n\\r
+   SplitFile Filename Offset\n\\r
+     where:\n\\r
+       Filename: Input file to split\n\\r
+       Offset: offset at which to split file\n\\r
+   The output files will be named <Filename>1 and <Filename>2 with \n\\r
+   <Filename> being given as the input file name.\n");\r
 }\r
 \r
 int\r
@@ -75,8 +113,24 @@ Returns:
   unsigned long splitpoint;\r
   char          CharC;\r
 \r
+  if (argc == 1) {\r
+    Usage();\r
+    return -1;\r
+  }\r
+    \r
+  if ((strcmp(argv[1], "-h") == 0) || (strcmp(argv[1], "--help") == 0) ||\r
+      (strcmp(argv[1], "-?") == 0) || (strcmp(argv[1], "/?") == 0)) {\r
+    Usage();\r
+    return -1;\r
+  }\r
+  \r
+  if ((strcmp(argv[1], "-V") == 0) || (strcmp(argv[1], "--version") == 0)) {\r
+    Version();\r
+    return -1;\r
+  }\r
+  \r
   if (argc != 3) {\r
-    helpmsg ();\r
+    Usage ();\r
     return -1;\r
   }\r
 \r