]>
git.proxmox.com Git - mirror_edk2.git/blob - Tools/CCode/Source/SplitFile/SplitFile.c
3 Copyright (c) 1999-2006 Intel Corporation. All rights reserved
4 This program and the accompanying materials are licensed and made available
5 under the terms and conditions of the BSD License which accompanies this
6 distribution. The full text of the license may be found at
7 http://opensource.org/licenses/bsd-license.php
9 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
10 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
14 // GC_TODO: fix comment to start with /*++
22 #define UTILITY_NAME "SplitFile"
25 // Utility version information
27 #define UTILITY_MAJOR_VERSION 0
28 #define UTILITY_MINOR_VERSION 1
38 Displays the standard utility information to SDTOUT
50 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
);
51 printf ("Copyright (c) 1999-2007 Intel Corporation. All rights reserved.\n");
62 GC_TODO: Add function description
69 GC_TODO: add return values
75 SplitFile Filename Offset\n\
77 Filename: Input file to split\n\
78 Offset: offset at which to split file\n\
79 The output files will be named <Filename>1 and <Filename>2 with \n\
80 <Filename> being given as the input file name.\n");
92 GC_TODO: Add function description
96 argc - GC_TODO: add argument description
97 ] - GC_TODO: add argument description
101 GC_TODO: add return values
113 unsigned long splitpoint
;
121 if ((strcmp(argv
[1], "-h") == 0) || (strcmp(argv
[1], "--help") == 0) ||
122 (strcmp(argv
[1], "-?") == 0) || (strcmp(argv
[1], "/?") == 0)) {
127 if ((strcmp(argv
[1], "-V") == 0) || (strcmp(argv
[1], "--version") == 0)) {
137 In
= fopen (argv
[1], "rb");
139 printf ("Unable to open file \"%s\"\n", argv
[1]);
143 strncpy (OutName1
, argv
[1], 510);
144 strncpy (OutName2
, argv
[1], 510);
145 strcat (OutName1
, "1");
146 strcat (OutName2
, "2");
148 Out1
= fopen (OutName1
, "wb");
150 printf ("Unable to open file \"%s\"\n", OutName1
);
154 Out2
= fopen (OutName2
, "wb");
156 printf ("Unable to open file \"%s\"\n", OutName2
);
160 splitpoint
= atoi (argv
[2]);
162 for (Index
= 0; Index
< splitpoint
; Index
++) {
163 CharC
= (char) fgetc (In
);
172 CharC
= (char) fgetc (In
);