X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=blobdiff_plain;f=Tools%2FCCode%2FSource%2FStrip%2FStrip.c;h=a89bcf9a8ab1a9bae67fa6b7678f9cbc6b0c5968;hp=bccdffb55aeaf95547bf85a4c062a55ad44a1148;hb=a85cb24e2bb75a9ad063db978d1f91ae036850ca;hpb=6dbea97890c3ad7cb82d8c8ae837f161560b4eee diff --git a/Tools/CCode/Source/Strip/Strip.c b/Tools/CCode/Source/Strip/Strip.c index bccdffb55a..a89bcf9a8a 100644 --- a/Tools/CCode/Source/Strip/Strip.c +++ b/Tools/CCode/Source/Strip/Strip.c @@ -25,6 +25,59 @@ Abstract: #include #include +#define UTILITY_NAME "Strip" +#define UTILITY_MAJOR_VERSION 1 +#define UTILITY_MINOR_VERSION 1 + + +void +StripVersion( + void + ) +/*++ + +Routine Description: + + Print out version information for Strip. + +Arguments: + + None + +Returns: + + None + +--*/ +{ + printf ("%s v%d.%d -EDK Convert EXE to BIN\n", UTILITY_NAME, UTILITY_MAJOR_VERSION, UTILITY_MINOR_VERSION); + printf ("Copyright (c) 2005-2006 Intel Corporation. All rights reserved.\n"); +} + +void +StripUsage( + void + ) +/*++ + +Routine Description: + + Print out usage information for Strip. + +Arguments: + + None + +Returns: + + None + +--*/ +{ + StripVersion(); + printf ("\n Usage: %s InputFile OutputFile\n", UTILITY_NAME); +} + int main ( int argc, @@ -54,9 +107,25 @@ Returns: int FileSize; char *Buffer; char *Ptrx; - + + if (argc < 1) { + StripUsage(); + return -1; + } + + if ((strcmp(argv[1], "-h") == 0) || (strcmp(argv[1], "--help") == 0) || + (strcmp(argv[1], "-?") == 0) || (strcmp(argv[1], "/?") == 0)) { + StripUsage(); + return 0; + } + + if ((strcmp(argv[1], "-V") == 0) || (strcmp(argv[1], "--version") == 0)) { + StripVersion(); + return 0; + } + if (argc < 3) { - printf ("Need more args, such as file name to convert and output name\n"); + StripUsage(); return -1; } @@ -64,12 +133,12 @@ Returns: OutFile = fopen (argv[2], "wb"); if (!InFile) { - printf ("no file, exit\n"); + printf ("Unable to open input file, exit\n"); return -1; } if (OutFile == NULL) { - printf ("Unable to open output file.\n"); + printf ("Unable to open output file, exit.\n"); return -1; } @@ -77,7 +146,7 @@ Returns: FileSize = ftell (InFile); if (FileSize < 0x200) { - printf ("%d is not a legal size, exit\n", FileSize); + printf ("%d is not a legal file size, exit\n", FileSize); return -1; }