]> git.proxmox.com Git - mirror_edk2.git/blobdiff - Tools/Source/TianoTools/CreateMtFile/CreateMtFile.c
Restructuring for better separation of Tool packages.
[mirror_edk2.git] / Tools / Source / TianoTools / CreateMtFile / CreateMtFile.c
diff --git a/Tools/Source/TianoTools/CreateMtFile/CreateMtFile.c b/Tools/Source/TianoTools/CreateMtFile/CreateMtFile.c
deleted file mode 100644 (file)
index 1c17b3d..0000000
+++ /dev/null
@@ -1,247 +0,0 @@
-/*++\r
-\r
-Copyright (c)  1999-2006 Intel Corporation. All rights reserved\r
-This program and the accompanying materials are licensed and made available \r
-under the terms and conditions of the BSD License which accompanies this \r
-distribution.  The full text of the license may be found at\r
-http://opensource.org/licenses/bsd-license.php\r
-\r
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
-\r
-\r
-Module Name:\r
-\r
-  CreateMtFile.c\r
-\r
-Abstract:\r
-\r
-  Simple utility to create a pad file containing fixed data.\r
-  \r
---*/\r
-\r
-#include <stdio.h>\r
-#include <string.h>\r
-#include <stdlib.h>\r
-\r
-#include <Common/UefiBaseTypes.h>\r
-\r
-#define PROGRAM_NAME  "CreateMtFile"\r
-\r
-typedef struct {\r
-  INT8    *OutFileName;\r
-  INT8    ByteValue;\r
-  UINT32  FileSize;\r
-} OPTIONS;\r
-\r
-static\r
-EFI_STATUS\r
-ProcessArgs (\r
-  IN INT32          Argc,\r
-  IN INT8           *Argv[],\r
-  IN OUT OPTIONS    *Options\r
-  );\r
-\r
-static\r
-void\r
-Usage (\r
-  VOID\r
-  );\r
-\r
-int\r
-main (\r
-  IN INT32  Argc,\r
-  IN INT8   *Argv[]\r
-  )\r
-/*++\r
-\r
-Routine Description:\r
-  \r
-  Main entry point for this utility.\r
-\r
-Arguments:\r
-\r
-  Standard C entry point args Argc and Argv\r
-\r
-Returns:\r
-\r
-  EFI_SUCCESS if good to go\r
-\r
---*/\r
-// GC_TODO:    ] - add argument and description to function comment\r
-// GC_TODO:    EFI_INVALID_PARAMETER - add return value to function comment\r
-// GC_TODO:    EFI_DEVICE_ERROR - add return value to function comment\r
-// GC_TODO:    EFI_DEVICE_ERROR - add return value to function comment\r
-{\r
-  FILE    *OutFptr;\r
-  OPTIONS Options;\r
-\r
-  //\r
-  // Process the command-line arguments.\r
-  //\r
-  if (ProcessArgs (Argc, Argv, &Options) != EFI_SUCCESS) {\r
-    return EFI_INVALID_PARAMETER;\r
-  }\r
-  //\r
-  // Open the output file\r
-  //\r
-  if ((OutFptr = fopen (Options.OutFileName, "wb")) == NULL) {\r
-    fprintf (\r
-      stdout,\r
-      PROGRAM_NAME " ERROR: Could not open output file '%s' for writing\n",\r
-      Options.OutFileName\r
-      );\r
-    return EFI_DEVICE_ERROR;\r
-  }\r
-  //\r
-  // Write the pad bytes. Do it the slow way (one at a time) for now.\r
-  //\r
-  while (Options.FileSize > 0) {\r
-    if (fwrite (&Options.ByteValue, 1, 1, OutFptr) != 1) {\r
-      fclose (OutFptr);\r
-      fprintf (stdout, PROGRAM_NAME " ERROR: Failed to write to output file\n");\r
-      return EFI_DEVICE_ERROR;\r
-    }\r
-\r
-    Options.FileSize--;\r
-  }\r
-  //\r
-  // Close the file\r
-  //\r
-  fclose (OutFptr);\r
-  return EFI_SUCCESS;\r
-}\r
-\r
-static\r
-EFI_STATUS\r
-ProcessArgs (\r
-  IN INT32          Argc,\r
-  IN INT8           *Argv[],\r
-  IN OUT OPTIONS    *Options\r
-  )\r
-/*++\r
-\r
-Routine Description:\r
-  \r
-  Process the command line arguments.\r
-\r
-Arguments:\r
-\r
-  Argc    - argument count as passed in to the entry point function\r
-  Argv    - array of arguments as passed in to the entry point function\r
-  Options - stucture of where to put the values of the parsed arguments\r
-\r
-Returns:\r
-\r
-  EFI_SUCCESS if everything looks good\r
-  EFI_INVALID_PARAMETER otherwise\r
-\r
---*/\r
-// GC_TODO:    ] - add argument and description to function comment\r
-{\r
-  UINT32  Multiplier;\r
-\r
-  //\r
-  // Clear the options\r
-  //\r
-  memset ((char *) Options, 0, sizeof (OPTIONS));\r
-\r
-  //\r
-  // Skip program name\r
-  //\r
-  Argv++;\r
-  Argc--;\r
-  if (Argc < 2) {\r
-    Usage ();\r
-    return EFI_INVALID_PARAMETER;\r
-  }\r
-  //\r
-  // If first arg is dash-option, then print usage.\r
-  //\r
-  if (Argv[0][0] == '-') {\r
-    Usage ();\r
-    return EFI_INVALID_PARAMETER;\r
-  }\r
-  //\r
-  // First arg is file name\r
-  //\r
-  Options->OutFileName = Argv[0];\r
-  Argc--;\r
-  Argv++;\r
-\r
-  //\r
-  // Second arg is file size. Allow 0x1000, 0x100K, 1024, 1K\r
-  //\r
-  Multiplier = 1;\r
-  if ((Argv[0][strlen (Argv[0]) - 1] == 'k') || (Argv[0][strlen (Argv[0]) - 1] == 'K')) {\r
-    Multiplier = 1024;\r
-  }\r
-  //\r
-  // Look for 0x prefix on file size\r
-  //\r
-  if ((Argv[0][0] == '0') && ((Argv[0][1] == 'x') || (Argv[0][1] == 'X'))) {\r
-    if (sscanf (Argv[0], "%x", &Options->FileSize) != 1) {\r
-      fprintf (stdout, PROGRAM_NAME " ERROR: Invalid file size '%s'\n", Argv[0]);\r
-      Usage ();\r
-      return EFI_INVALID_PARAMETER;\r
-    }\r
-    //\r
-    // Otherwise must be a decimal number\r
-    //\r
-  } else {\r
-    if (sscanf (Argv[0], "%d", &Options->FileSize) != 1) {\r
-      fprintf (stdout, PROGRAM_NAME " ERROR: Invalid file size '%s'\n", Argv[0]);\r
-      Usage ();\r
-      return EFI_INVALID_PARAMETER;\r
-    }\r
-  }\r
-\r
-  Options->FileSize *= Multiplier;\r
-  //\r
-  // Assume byte value of 0xff\r
-  //\r
-  Options->ByteValue = (INT8) (UINT8) 0xFF;\r
-  return EFI_SUCCESS;\r
-}\r
-//\r
-// Print utility usage info\r
-//\r
-static\r
-void\r
-Usage (\r
-  VOID\r
-  )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-  GC_TODO: Add function description\r
-\r
-Arguments:\r
-\r
-  None\r
-\r
-Returns:\r
-\r
-  GC_TODO: add return values\r
-\r
---*/\r
-{\r
-  UINT32            Index;\r
-  static const INT8 *Text[] = {\r
-    " ",\r
-    "Usage:  "PROGRAM_NAME " OutFileName FileSize",\r
-    "  where:",\r
-    "    OutFileName is the name of the output file to generate",\r
-    "    FileSize is the size of the file to create",\r
-    "  Examples:",\r
-    "    "PROGRAM_NAME " OutFile.bin 32K",\r
-    "    "PROGRAM_NAME " OutFile.bin 0x1000",\r
-    " ",\r
-    NULL\r
-  };\r
-\r
-  for (Index = 0; Text[Index] != NULL; Index++) {\r
-    fprintf (stdout, "%s\n", Text[Index]);\r
-  }\r
-}\r