diff options
author | ywang <ywang@6f19259b-4bc3-4df7-8a09-765794883524> | 2007-01-17 21:31:03 +0000 |
---|---|---|
committer | ywang <ywang@6f19259b-4bc3-4df7-8a09-765794883524> | 2007-01-17 21:31:03 +0000 |
commit | 243009a7bf0cbd4a40815343d132481031f128c2 (patch) | |
tree | 5ac02172c1b319404d72ce95559b2f0bee61f3f0 /Tools/CCode | |
parent | 92bb9cf6370df8e6685111f85429afa2a576008d (diff) | |
download | edk2-243009a7bf0cbd4a40815343d132481031f128c2.tar.gz edk2-243009a7bf0cbd4a40815343d132481031f128c2.tar.bz2 edk2-243009a7bf0cbd4a40815343d132481031f128c2.zip |
Modified version and usage display.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@2262 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'Tools/CCode')
-rw-r--r-- | Tools/CCode/Source/SplitFile/SplitFile.c | 68 | ||||
-rw-r--r-- | Tools/CCode/Source/StrGather/StrGather.c | 121 | ||||
-rw-r--r-- | Tools/CCode/Source/StrGather/StrGather.h | 7 |
3 files changed, 148 insertions, 48 deletions
diff --git a/Tools/CCode/Source/SplitFile/SplitFile.c b/Tools/CCode/Source/SplitFile/SplitFile.c index a1bda7dc31..68a0739a5f 100644 --- a/Tools/CCode/Source/SplitFile/SplitFile.c +++ b/Tools/CCode/Source/SplitFile/SplitFile.c @@ -16,8 +16,43 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. #include "string.h"
#include "stdlib.h"
+//
+// Utility Name
+//
+#define UTILITY_NAME "SplitFile"
+
+//
+// Utility version information
+//
+#define UTILITY_MAJOR_VERSION 0
+#define UTILITY_MINOR_VERSION 1
+
+void
+Version (
+ void
+ )
+/*++
+
+Routine Description:
+
+ Displays the standard utility information to SDTOUT
+
+Arguments:
+
+ None
+
+Returns:
+
+ None
+
+--*/
+{
+ 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);
+ printf ("Copyright (c) 1999-2007 Intel Corporation. All rights reserved.\n");
+}
+
void
-helpmsg (
+Usage (
void
)
/*++
@@ -35,11 +70,14 @@ Returns: --*/
{
- printf (
- "SplitFile Filename Offset\n"" Filename = Input file to split\n"" Offset = offset at which to split file\n"
- "\n\n""SplitFile will break a file in two pieces at the requested offset\n"
- " outputting Filename1 and Filename2\n"
- );
+ Version();
+ printf ("\nUsage: \n\
+ SplitFile Filename Offset\n\
+ where:\n\
+ Filename: Input file to split\n\
+ Offset: offset at which to split file\n\
+ The output files will be named <Filename>1 and <Filename>2 with \n\
+ <Filename> being given as the input file name.\n");
}
int
@@ -75,8 +113,24 @@ Returns: unsigned long splitpoint;
char CharC;
+ if (argc == 1) {
+ Usage();
+ return -1;
+ }
+
+ if ((strcmp(argv[1], "-h") == 0) || (strcmp(argv[1], "--help") == 0) ||
+ (strcmp(argv[1], "-?") == 0) || (strcmp(argv[1], "/?") == 0)) {
+ Usage();
+ return -1;
+ }
+
+ if ((strcmp(argv[1], "-V") == 0) || (strcmp(argv[1], "--version") == 0)) {
+ Version();
+ return -1;
+ }
+
if (argc != 3) {
- helpmsg ();
+ Usage ();
return -1;
}
diff --git a/Tools/CCode/Source/StrGather/StrGather.c b/Tools/CCode/Source/StrGather/StrGather.c index 8908b430a1..b9d4a493af 100644 --- a/Tools/CCode/Source/StrGather/StrGather.c +++ b/Tools/CCode/Source/StrGather/StrGather.c @@ -1,6 +1,6 @@ /*++
-Copyright (c) 2004, Intel Corporation
+Copyright (c) 2004-2007, Intel Corporation
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
@@ -31,8 +31,6 @@ Abstract: #include "StrGather.h"
#include "StringDB.h"
-#define TOOL_VERSION "0.31"
-
#ifndef MAX_PATH
#define MAX_PATH 255
#endif
@@ -239,6 +237,12 @@ wstrcmp ( static
void
+Version (
+ VOID
+ );
+
+static
+void
Usage (
VOID
);
@@ -321,7 +325,7 @@ Returns: {
STATUS Status;
- SetUtilityName (PROGRAM_NAME);
+ SetUtilityName (UTILITY_NAME);
//
// Process the command-line arguments
//
@@ -1470,7 +1474,7 @@ FindFile ( // Put the path and filename together
//
if (strlen (List->Str) + strlen (FileName) + 1 > FoundFileNameLen) {
- Error (PROGRAM_NAME, 0, 0, NULL, "internal error - cannot concatenate path+filename");
+ Error (UTILITY_NAME, 0, 0, NULL, "internal error - cannot concatenate path+filename");
return NULL;
}
//
@@ -1519,6 +1523,17 @@ ProcessArgs ( Usage ();
return STATUS_ERROR;
}
+
+ if ((strcmp(Argv[0], "-h") == 0) || (strcmp(Argv[0], "--help") == 0) ||
+ (strcmp(Argv[0], "-?") == 0) || (strcmp(Argv[0], "/?") == 0)) {
+ Usage();
+ return STATUS_ERROR;
+ }
+
+ if ((strcmp(Argv[0], "-V") == 0) || (strcmp(Argv[0], "--version") == 0)) {
+ Version();
+ return STATUS_ERROR;
+ }
mGlobals.Mode = MODE_UNKNOWN;
//
@@ -1570,7 +1585,7 @@ ProcessArgs ( // check for one more arg
//
if ((Argc <= 1) || (Argv[1][0] == '-')) {
- Error (PROGRAM_NAME, 0, 0, Argv[0], "missing include path");
+ Error (UTILITY_NAME, 0, 0, Argv[0], "missing include path");
return STATUS_ERROR;
}
//
@@ -1580,7 +1595,7 @@ ProcessArgs ( //
NewList = malloc (sizeof (TEXT_STRING_LIST));
if (NewList == NULL) {
- Error (PROGRAM_NAME, 0, 0, NULL, "memory allocation failure");
+ Error (UTILITY_NAME, 0, 0, NULL, "memory allocation failure");
return STATUS_ERROR;
}
@@ -1588,7 +1603,7 @@ ProcessArgs ( NewList->Str = malloc (strlen (Argv[1]) + 2);
if (NewList->Str == NULL) {
free (NewList);
- Error (PROGRAM_NAME, 0, 0, NULL, "memory allocation failure");
+ Error (UTILITY_NAME, 0, 0, NULL, "memory allocation failure");
return STATUS_ERROR;
}
@@ -1613,7 +1628,7 @@ ProcessArgs ( // Indirection file -- check for one more arg
//
if ((Argc <= 1) || (Argv[1][0] == '-')) {
- Error (PROGRAM_NAME, 0, 0, Argv[0], "missing indirection file name");
+ Error (UTILITY_NAME, 0, 0, Argv[0], "missing indirection file name");
return STATUS_ERROR;
}
//
@@ -1623,7 +1638,7 @@ ProcessArgs ( //
NewList = malloc (sizeof (TEXT_STRING_LIST));
if (NewList == NULL) {
- Error (PROGRAM_NAME, 0, 0, NULL, "memory allocation failure");
+ Error (UTILITY_NAME, 0, 0, NULL, "memory allocation failure");
return STATUS_ERROR;
}
@@ -1631,7 +1646,7 @@ ProcessArgs ( NewList->Str = malloc (strlen (Argv[1]) + 1);
if (NewList->Str == NULL) {
free (NewList);
- Error (PROGRAM_NAME, 0, 0, NULL, "memory allocation failure");
+ Error (UTILITY_NAME, 0, 0, NULL, "memory allocation failure");
return STATUS_ERROR;
}
@@ -1654,13 +1669,13 @@ ProcessArgs ( // Check for one more arg (the database file name)
//
if ((Argc <= 1) || (Argv[1][0] == '-')) {
- Error (PROGRAM_NAME, 0, 0, Argv[0], "missing database file name");
+ Error (UTILITY_NAME, 0, 0, Argv[0], "missing database file name");
return STATUS_ERROR;
}
NewList = malloc (sizeof (TEXT_STRING_LIST));
if (NewList == NULL) {
- Error (PROGRAM_NAME, 0, 0, NULL, "memory allocation failure");
+ Error (UTILITY_NAME, 0, 0, NULL, "memory allocation failure");
return STATUS_ERROR;
}
@@ -1668,7 +1683,7 @@ ProcessArgs ( NewList->Str = malloc (strlen (Argv[1]) + 1);
if (NewList->Str == NULL) {
free (NewList);
- Error (PROGRAM_NAME, 0, 0, NULL, "memory allocation failure");
+ Error (UTILITY_NAME, 0, 0, NULL, "memory allocation failure");
return STATUS_ERROR;
}
@@ -1691,14 +1706,14 @@ ProcessArgs ( // which we can dump our database.
//
if ((Argc <= 1) || (Argv[1][0] == '-')) {
- Error (PROGRAM_NAME, 0, 0, Argv[0], "missing database dump output file name");
+ Error (UTILITY_NAME, 0, 0, Argv[0], "missing database dump output file name");
return STATUS_ERROR;
}
if (mGlobals.DumpUFileName[0] == 0) {
strcpy (mGlobals.DumpUFileName, Argv[1]);
} else {
- Error (PROGRAM_NAME, 0, 0, Argv[1], "-ou option already specified with '%s'", mGlobals.DumpUFileName);
+ Error (UTILITY_NAME, 0, 0, Argv[1], "-ou option already specified with '%s'", mGlobals.DumpUFileName);
return STATUS_ERROR;
}
@@ -1709,14 +1724,14 @@ ProcessArgs ( // -hpk option to create an HII export pack of the input database file
//
if ((Argc <= 1) || (Argv[1][0] == '-')) {
- Error (PROGRAM_NAME, 0, 0, Argv[0], "missing raw string data dump output file name");
+ Error (UTILITY_NAME, 0, 0, Argv[0], "missing raw string data dump output file name");
return STATUS_ERROR;
}
if (mGlobals.HiiExportPackFileName[0] == 0) {
strcpy (mGlobals.HiiExportPackFileName, Argv[1]);
} else {
- Error (PROGRAM_NAME, 0, 0, Argv[1], "-or option already specified with '%s'", mGlobals.HiiExportPackFileName);
+ Error (UTILITY_NAME, 0, 0, Argv[1], "-or option already specified with '%s'", mGlobals.HiiExportPackFileName);
return STATUS_ERROR;
}
@@ -1740,7 +1755,7 @@ ProcessArgs ( // check for one more arg
//
if ((Argc <= 1) || (Argv[1][0] == '-')) {
- Error (PROGRAM_NAME, 0, 0, Argv[0], "missing output C filename");
+ Error (UTILITY_NAME, 0, 0, Argv[0], "missing output C filename");
return STATUS_ERROR;
}
@@ -1752,7 +1767,7 @@ ProcessArgs ( // check for one more arg
//
if ((Argc <= 1) || (Argv[1][0] == '-')) {
- Error (PROGRAM_NAME, 0, 0, Argv[0], "missing base name");
+ Error (UTILITY_NAME, 0, 0, Argv[0], "missing base name");
Usage ();
return STATUS_ERROR;
}
@@ -1765,7 +1780,7 @@ ProcessArgs ( // -oh to specify output .h defines file name
//
if ((Argc <= 1) || (Argv[1][0] == '-')) {
- Error (PROGRAM_NAME, 0, 0, Argv[0], "missing output .h filename");
+ Error (UTILITY_NAME, 0, 0, Argv[0], "missing output .h filename");
return STATUS_ERROR;
}
@@ -1777,7 +1792,7 @@ ProcessArgs ( // -skipext to skip scanning of files with certain filename extensions
//
if ((Argc <= 1) || (Argv[1][0] == '-')) {
- Error (PROGRAM_NAME, 0, 0, Argv[0], "missing filename extension");
+ Error (UTILITY_NAME, 0, 0, Argv[0], "missing filename extension");
return STATUS_ERROR;
}
//
@@ -1787,7 +1802,7 @@ ProcessArgs ( //
NewList = malloc (sizeof (TEXT_STRING_LIST));
if (NewList == NULL) {
- Error (PROGRAM_NAME, 0, 0, NULL, "memory allocation failure");
+ Error (UTILITY_NAME, 0, 0, NULL, "memory allocation failure");
return STATUS_ERROR;
}
@@ -1795,7 +1810,7 @@ ProcessArgs ( NewList->Str = malloc (strlen (Argv[1]) + 2);
if (NewList->Str == NULL) {
free (NewList);
- Error (PROGRAM_NAME, 0, 0, NULL, "memory allocation failure");
+ Error (UTILITY_NAME, 0, 0, NULL, "memory allocation failure");
return STATUS_ERROR;
}
@@ -1822,7 +1837,7 @@ ProcessArgs ( // "-lang eng" or "-lang spa+cat" to only output certain languages
//
if ((Argc <= 1) || (Argv[1][0] == '-')) {
- Error (PROGRAM_NAME, 0, 0, Argv[0], "missing language name");
+ Error (UTILITY_NAME, 0, 0, Argv[0], "missing language name");
Usage ();
return STATUS_ERROR;
}
@@ -1838,7 +1853,7 @@ ProcessArgs ( // Output database file name -- check for another arg
//
if ((Argc <= 1) || (Argv[1][0] == '-')) {
- Error (PROGRAM_NAME, 0, 0, Argv[0], "missing output database file name");
+ Error (UTILITY_NAME, 0, 0, Argv[0], "missing output database file name");
return STATUS_ERROR;
}
@@ -1849,7 +1864,7 @@ ProcessArgs ( //
// Unrecognized arg
//
- Error (PROGRAM_NAME, 0, 0, Argv[0], "unrecognized option");
+ Error (UTILITY_NAME, 0, 0, Argv[0], "unrecognized option");
Usage ();
return STATUS_ERROR;
}
@@ -1896,7 +1911,7 @@ ProcessArgs ( //
if (mGlobals.Mode == MODE_SCAN) {
if (Argc < 1) {
- Error (PROGRAM_NAME, 0, 0, NULL, "must specify at least one source file to scan with -scan");
+ Error (UTILITY_NAME, 0, 0, NULL, "must specify at least one source file to scan with -scan");
Usage ();
return STATUS_ERROR;
}
@@ -1906,14 +1921,14 @@ ProcessArgs ( while (Argc > 0) {
NewList = malloc (sizeof (TEXT_STRING_LIST));
if (NewList == NULL) {
- Error (PROGRAM_NAME, 0, 0, "memory allocation failure", NULL);
+ Error (UTILITY_NAME, 0, 0, "memory allocation failure", NULL);
return STATUS_ERROR;
}
memset (NewList, 0, sizeof (TEXT_STRING_LIST));
NewList->Str = (CHAR8 *) malloc (strlen (Argv[0]) + 1);
if (NewList->Str == NULL) {
- Error (PROGRAM_NAME, 0, 0, "memory allocation failure", NULL);
+ Error (UTILITY_NAME, 0, 0, "memory allocation failure", NULL);
return STATUS_ERROR;
}
@@ -1933,7 +1948,7 @@ ProcessArgs ( // Parse mode -- must specify an input unicode file name
//
if (Argc < 1) {
- Error (PROGRAM_NAME, 0, 0, NULL, "must specify input unicode string file name with -parse");
+ Error (UTILITY_NAME, 0, 0, NULL, "must specify input unicode string file name with -parse");
Usage ();
return STATUS_ERROR;
}
@@ -1966,7 +1981,7 @@ AddCommandLineLanguage ( //
WNewList = MALLOC (sizeof (WCHAR_STRING_LIST));
if (WNewList == NULL) {
- Error (PROGRAM_NAME, 0, 0, NULL, "memory allocation failure");
+ Error (UTILITY_NAME, 0, 0, NULL, "memory allocation failure");
return STATUS_ERROR;
}
@@ -1974,7 +1989,7 @@ AddCommandLineLanguage ( WNewList->Str = malloc ((strlen (Language) + 1) * sizeof (WCHAR));
if (WNewList->Str == NULL) {
free (WNewList);
- Error (PROGRAM_NAME, 0, 0, NULL, "memory allocation failure");
+ Error (UTILITY_NAME, 0, 0, NULL, "memory allocation failure");
return STATUS_ERROR;
}
//
@@ -1997,7 +2012,7 @@ AddCommandLineLanguage ( (From[LANGUAGE_IDENTIFIER_NAME_LEN] != L',')
)
) {
- Error (PROGRAM_NAME, 0, 0, Language, "invalid format for language name on command line");
+ Error (UTILITY_NAME, 0, 0, Language, "invalid format for language name on command line");
FREE (WNewList->Str);
FREE (WNewList);
return STATUS_ERROR;
@@ -2472,6 +2487,31 @@ SkipTo ( static
void
+Version (
+ VOID
+ )
+/*++
+
+Routine Description:
+
+ Displays the standard utility information to SDTOUT
+
+Arguments:
+
+ None
+
+Returns:
+
+ None
+
+--*/
+{
+ printf ("%s v%d.%d -Utility to process unicode strings file..\n", UTILITY_NAME, UTILITY_MAJOR_VERSION, UTILITY_MINOR_VERSION);
+ printf ("Copyright (c) 1999-2007 Intel Corporation. All rights reserved.\n");
+}
+
+static
+void
Usage (
VOID
)
@@ -2494,12 +2534,12 @@ Returns: int Index;
static const char *Str[] = {
"",
- PROGRAM_NAME " version "TOOL_VERSION " -- process unicode strings file",
- " Usage: "PROGRAM_NAME " -parse {parse options} [FileNames]",
- " "PROGRAM_NAME " -scan {scan options} [FileName]",
- " "PROGRAM_NAME " -dump {dump options}",
+ " Usage: "UTILITY_NAME " -parse {parse options} [FileNames]",
+ " "UTILITY_NAME " -scan {scan options} [FileName]",
+ " "UTILITY_NAME " -dump {dump options}",
" Common options include:",
- " -h or -? for this help information",
+ " -h,--help,-?,/? display help messages",
+ " -V,--version display version information",
" -db Database required name of output/input database file",
" -bn BaseName for use in the .h and .c output files",
" Default = "DEFAULT_BASE_NAME,
@@ -2535,6 +2575,9 @@ Returns: "",
NULL
};
+
+ Version();
+
for (Index = 0; Str[Index] != NULL; Index++) {
fprintf (stdout, "%s\n", Str[Index]);
}
diff --git a/Tools/CCode/Source/StrGather/StrGather.h b/Tools/CCode/Source/StrGather/StrGather.h index 65dc15cbe8..40a0386ae7 100644 --- a/Tools/CCode/Source/StrGather/StrGather.h +++ b/Tools/CCode/Source/StrGather/StrGather.h @@ -1,6 +1,6 @@ /*++
-Copyright (c) 2004, Intel Corporation
+Copyright (c) 2004-2007, Intel Corporation
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
@@ -25,7 +25,10 @@ Abstract: #define MALLOC(size) malloc (size)
#define FREE(ptr) free (ptr)
-#define PROGRAM_NAME "StrGather"
+#define UTILITY_NAME "StrGather"
+#define UTILITY_MAJOR_VERSION 0
+#define UTILITY_MINOR_VERSION 31
+
typedef CHAR16 WCHAR;
|