+++ /dev/null
-/*\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
-\r
-// GC_TODO: fix comment to start with /*++\r
-#include "stdio.h"\r
-#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
-Usage (\r
- void\r
- )\r
-/*++\r
-\r
-Routine Description:\r
-\r
- GC_TODO: Add function description\r
-\r
-Arguments:\r
-\r
-\r
-Returns:\r
-\r
- GC_TODO: add return values\r
-\r
---*/\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
-main (\r
- int argc,\r
- char*argv[]\r
- )\r
-/*++\r
-\r
-Routine Description:\r
-\r
- GC_TODO: Add function description\r
-\r
-Arguments:\r
-\r
- argc - GC_TODO: add argument description\r
- ] - GC_TODO: add argument description\r
-\r
-Returns:\r
-\r
- GC_TODO: add return values\r
-\r
---*/\r
-{\r
- FILE *In;\r
-\r
- FILE *Out1;\r
-\r
- FILE *Out2;\r
- char OutName1[512];\r
- char OutName2[512];\r
- unsigned long Index;\r
- 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
- Usage ();\r
- return -1;\r
- }\r
-\r
- In = fopen (argv[1], "rb");\r
- if (In == NULL) {\r
- printf ("Unable to open file \"%s\"\n", argv[1]);\r
- return -1;\r
- }\r
-\r
- strncpy (OutName1, argv[1], 510);\r
- strncpy (OutName2, argv[1], 510);\r
- strcat (OutName1, "1");\r
- strcat (OutName2, "2");\r
-\r
- Out1 = fopen (OutName1, "wb");\r
- if (Out1 == NULL) {\r
- printf ("Unable to open file \"%s\"\n", OutName1);\r
- return -1;\r
- }\r
-\r
- Out2 = fopen (OutName2, "wb");\r
- if (Out2 == NULL) {\r
- printf ("Unable to open file \"%s\"\n", OutName2);\r
- return -1;\r
- }\r
-\r
- splitpoint = atoi (argv[2]);\r
-\r
- for (Index = 0; Index < splitpoint; Index++) {\r
- CharC = (char) fgetc (In);\r
- if (feof (In)) {\r
- break;\r
- }\r
-\r
- fputc (CharC, Out1);\r
- }\r
-\r
- for (;;) {\r
- CharC = (char) fgetc (In);\r
- if (feof (In)) {\r
- break;\r
- }\r
-\r
- fputc (CharC, Out2);\r
- }\r
-\r
- fclose (In);\r
- fclose (Out1);\r
- fclose (Out2);\r
-\r
- return 0;\r
-}\r