Changeset 31cd205d in rtems
- Timestamp:
- 04/12/18 04:12:06 (5 years ago)
- Branches:
- 5, master
- Children:
- 86e79d7
- Parents:
- 2a61542
- git-author:
- Chris Johns <chrisj@…> (04/12/18 04:12:06)
- git-committer:
- Chris Johns <chrisj@…> (04/12/18 07:54:59)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
tools/build/rtems-bin2c.c
r2a61542 r31cd205d 53 53 } 54 54 55 void process(const char *ifname, const char *ofname )55 void process(const char *ifname, const char *ofname, const char *forced_name) 56 56 { 57 57 FILE *ifile, *ocfile, *ohfile; … … 120 120 121 121 /* find basename */ 122 char *ifbasename_to_free = strdup(ifname); 122 char *ifbasename_to_free = 123 forced_name != NULL ? strdup(forced_name) : strdup(ifname); 123 124 if ( ifbasename_to_free == NULL ) { 124 125 fprintf(stderr, "cannot allocate memory\n" ); … … 261 262 fprintf( 262 263 stderr, 263 "usage: bin2c [-csvzCH] <input_file> <output_file>\n"264 "usage: bin2c [-csvzCH] [-N name] <input_file> <output_file>\n" 264 265 " <input_file> is the binary file to convert\n" 265 266 " <output_file> should not have a .c or .h extension\n" … … 271 272 " -H - create c-header only\n" 272 273 " -C - create c-source file only\n" 274 " -N - force name of data array\n" 273 275 ); 274 276 exit(1); … … 277 279 int main(int argc, char **argv) 278 280 { 281 const char *name = NULL; 279 282 while (argc > 3) { 280 283 if (!strcmp(argv[1], "-c")) { … … 304 307 --argc; 305 308 ++argv; 309 } else if (!strcmp(argv[1], "-N")) { 310 --argc; 311 ++argv; 312 if (argc <= 1) { 313 fprintf(stderr, "error: -N needs a name\n"); 314 usage(); 315 } 316 name = argv[1]; 317 --argc; 318 ++argv; 306 319 } else { 307 320 usage(); … … 313 326 314 327 /* process( input_file, output_basename ) */ 315 process(argv[1], argv[2] );328 process(argv[1], argv[2], name); 316 329 return 0; 317 330 } 318
Note: See TracChangeset
for help on using the changeset viewer.