Changeset 2394b5a in rtems
- Timestamp:
- 08/20/98 15:56:57 (25 years ago)
- Branches:
- 4.10, 4.11, 4.8, 4.9, 5, master
- Children:
- 7c16a331
- Parents:
- dcc2404
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
c/build-tools/packhex.c
rdcc2404 r2394b5a 100 100 /*--------------------------- function prototypes ----------------------------*/ 101 101 102 Rec_vitals * identify_first_data_record( char * );102 Rec_vitals * identify_first_data_record( char *, int ); 103 103 Ulong get_ndigit_hex( char *, int ); 104 104 … … 421 421 char *in_dptr, *out_dptr; 422 422 int d_total, d_count, d_excess, n; 423 int length; 423 424 Ulong in_rec_addr, out_rec_addr = 0; 424 425 Rec_vitals *rptr; … … 426 427 427 428 /* Sift through file until first hex record is identified. */ 428 if ( ( rptr = identify_first_data_record( inbuff ) ) == NULL ) 429 430 rptr = identify_first_data_record( inbuff, MAX_LINE_SIZE ); 431 if ( rptr == NULL ) 429 432 { 430 433 fputs( "No hex records found.\n", stderr ); … … 435 438 /* Attempt data-record splicing until end-of-file is reached. */ 436 439 d_total = 0; 437 do 438 { 440 for (;;) { 439 441 if ( rptr->is_data_record( inbuff ) == YES ) 440 442 { /* Input record is a data record. */ … … 482 484 puts( inbuff ); 483 485 } 484 } while ( gets( inbuff ) != NULL ); 486 487 inbuff[ MAX_LINE_SIZE - 1 ] = '\0'; 488 if ( !fgets( inbuff, MAX_LINE_SIZE, stdin ) ) 489 break; 490 if ( inbuff[ MAX_LINE_SIZE - 1 ] ) { 491 fprintf( stderr, "Input line too long" ); 492 exit( 1 ); 493 } 494 length = strlen(inbuff); 495 inbuff[length - 1] = '\0'; 496 497 } 485 498 486 499 … … 504 517 *******************************************************************************/ 505 518 506 Rec_vitals * identify_first_data_record( char * buff_ptr )519 Rec_vitals * identify_first_data_record( char * buff_ptr, int max_length ) 507 520 { 508 521 Rec_vitals ** ptr; 509 510 while ( gets( buff_ptr ) != NULL ) 511 { 522 int length; 523 524 525 526 for ( ;; ) { 527 528 buff_ptr[ max_length - 1 ] = '\0'; 529 if ( !fgets( buff_ptr, max_length, stdin ) ) 530 break; 531 if ( buff_ptr[ max_length - 1 ] ) { 532 fprintf( stderr, "Input line too long" ); 533 exit( 1 ); 534 } 535 length = strlen(buff_ptr); 536 buff_ptr[length - 1] = '\0'; 537 512 538 for ( ptr = formats ; *ptr != ( Rec_vitals * ) NULL ; ptr++ ) 513 539 if ( ( *ptr )->is_data_record( buff_ptr ) == YES ) -
c/build-tools/src/packhex.c
rdcc2404 r2394b5a 100 100 /*--------------------------- function prototypes ----------------------------*/ 101 101 102 Rec_vitals * identify_first_data_record( char * );102 Rec_vitals * identify_first_data_record( char *, int ); 103 103 Ulong get_ndigit_hex( char *, int ); 104 104 … … 421 421 char *in_dptr, *out_dptr; 422 422 int d_total, d_count, d_excess, n; 423 int length; 423 424 Ulong in_rec_addr, out_rec_addr = 0; 424 425 Rec_vitals *rptr; … … 426 427 427 428 /* Sift through file until first hex record is identified. */ 428 if ( ( rptr = identify_first_data_record( inbuff ) ) == NULL ) 429 430 rptr = identify_first_data_record( inbuff, MAX_LINE_SIZE ); 431 if ( rptr == NULL ) 429 432 { 430 433 fputs( "No hex records found.\n", stderr ); … … 435 438 /* Attempt data-record splicing until end-of-file is reached. */ 436 439 d_total = 0; 437 do 438 { 440 for (;;) { 439 441 if ( rptr->is_data_record( inbuff ) == YES ) 440 442 { /* Input record is a data record. */ … … 482 484 puts( inbuff ); 483 485 } 484 } while ( gets( inbuff ) != NULL ); 486 487 inbuff[ MAX_LINE_SIZE - 1 ] = '\0'; 488 if ( !fgets( inbuff, MAX_LINE_SIZE, stdin ) ) 489 break; 490 if ( inbuff[ MAX_LINE_SIZE - 1 ] ) { 491 fprintf( stderr, "Input line too long" ); 492 exit( 1 ); 493 } 494 length = strlen(inbuff); 495 inbuff[length - 1] = '\0'; 496 497 } 485 498 486 499 … … 504 517 *******************************************************************************/ 505 518 506 Rec_vitals * identify_first_data_record( char * buff_ptr )519 Rec_vitals * identify_first_data_record( char * buff_ptr, int max_length ) 507 520 { 508 521 Rec_vitals ** ptr; 509 510 while ( gets( buff_ptr ) != NULL ) 511 { 522 int length; 523 524 525 526 for ( ;; ) { 527 528 buff_ptr[ max_length - 1 ] = '\0'; 529 if ( !fgets( buff_ptr, max_length, stdin ) ) 530 break; 531 if ( buff_ptr[ max_length - 1 ] ) { 532 fprintf( stderr, "Input line too long" ); 533 exit( 1 ); 534 } 535 length = strlen(buff_ptr); 536 buff_ptr[length - 1] = '\0'; 537 512 538 for ( ptr = formats ; *ptr != ( Rec_vitals * ) NULL ; ptr++ ) 513 539 if ( ( *ptr )->is_data_record( buff_ptr ) == YES ) -
tools/build/packhex.c
rdcc2404 r2394b5a 100 100 /*--------------------------- function prototypes ----------------------------*/ 101 101 102 Rec_vitals * identify_first_data_record( char * );102 Rec_vitals * identify_first_data_record( char *, int ); 103 103 Ulong get_ndigit_hex( char *, int ); 104 104 … … 421 421 char *in_dptr, *out_dptr; 422 422 int d_total, d_count, d_excess, n; 423 int length; 423 424 Ulong in_rec_addr, out_rec_addr = 0; 424 425 Rec_vitals *rptr; … … 426 427 427 428 /* Sift through file until first hex record is identified. */ 428 if ( ( rptr = identify_first_data_record( inbuff ) ) == NULL ) 429 430 rptr = identify_first_data_record( inbuff, MAX_LINE_SIZE ); 431 if ( rptr == NULL ) 429 432 { 430 433 fputs( "No hex records found.\n", stderr ); … … 435 438 /* Attempt data-record splicing until end-of-file is reached. */ 436 439 d_total = 0; 437 do 438 { 440 for (;;) { 439 441 if ( rptr->is_data_record( inbuff ) == YES ) 440 442 { /* Input record is a data record. */ … … 482 484 puts( inbuff ); 483 485 } 484 } while ( gets( inbuff ) != NULL ); 486 487 inbuff[ MAX_LINE_SIZE - 1 ] = '\0'; 488 if ( !fgets( inbuff, MAX_LINE_SIZE, stdin ) ) 489 break; 490 if ( inbuff[ MAX_LINE_SIZE - 1 ] ) { 491 fprintf( stderr, "Input line too long" ); 492 exit( 1 ); 493 } 494 length = strlen(inbuff); 495 inbuff[length - 1] = '\0'; 496 497 } 485 498 486 499 … … 504 517 *******************************************************************************/ 505 518 506 Rec_vitals * identify_first_data_record( char * buff_ptr )519 Rec_vitals * identify_first_data_record( char * buff_ptr, int max_length ) 507 520 { 508 521 Rec_vitals ** ptr; 509 510 while ( gets( buff_ptr ) != NULL ) 511 { 522 int length; 523 524 525 526 for ( ;; ) { 527 528 buff_ptr[ max_length - 1 ] = '\0'; 529 if ( !fgets( buff_ptr, max_length, stdin ) ) 530 break; 531 if ( buff_ptr[ max_length - 1 ] ) { 532 fprintf( stderr, "Input line too long" ); 533 exit( 1 ); 534 } 535 length = strlen(buff_ptr); 536 buff_ptr[length - 1] = '\0'; 537 512 538 for ( ptr = formats ; *ptr != ( Rec_vitals * ) NULL ; ptr++ ) 513 539 if ( ( *ptr )->is_data_record( buff_ptr ) == YES ) -
tools/build/src/packhex.c
rdcc2404 r2394b5a 100 100 /*--------------------------- function prototypes ----------------------------*/ 101 101 102 Rec_vitals * identify_first_data_record( char * );102 Rec_vitals * identify_first_data_record( char *, int ); 103 103 Ulong get_ndigit_hex( char *, int ); 104 104 … … 421 421 char *in_dptr, *out_dptr; 422 422 int d_total, d_count, d_excess, n; 423 int length; 423 424 Ulong in_rec_addr, out_rec_addr = 0; 424 425 Rec_vitals *rptr; … … 426 427 427 428 /* Sift through file until first hex record is identified. */ 428 if ( ( rptr = identify_first_data_record( inbuff ) ) == NULL ) 429 430 rptr = identify_first_data_record( inbuff, MAX_LINE_SIZE ); 431 if ( rptr == NULL ) 429 432 { 430 433 fputs( "No hex records found.\n", stderr ); … … 435 438 /* Attempt data-record splicing until end-of-file is reached. */ 436 439 d_total = 0; 437 do 438 { 440 for (;;) { 439 441 if ( rptr->is_data_record( inbuff ) == YES ) 440 442 { /* Input record is a data record. */ … … 482 484 puts( inbuff ); 483 485 } 484 } while ( gets( inbuff ) != NULL ); 486 487 inbuff[ MAX_LINE_SIZE - 1 ] = '\0'; 488 if ( !fgets( inbuff, MAX_LINE_SIZE, stdin ) ) 489 break; 490 if ( inbuff[ MAX_LINE_SIZE - 1 ] ) { 491 fprintf( stderr, "Input line too long" ); 492 exit( 1 ); 493 } 494 length = strlen(inbuff); 495 inbuff[length - 1] = '\0'; 496 497 } 485 498 486 499 … … 504 517 *******************************************************************************/ 505 518 506 Rec_vitals * identify_first_data_record( char * buff_ptr )519 Rec_vitals * identify_first_data_record( char * buff_ptr, int max_length ) 507 520 { 508 521 Rec_vitals ** ptr; 509 510 while ( gets( buff_ptr ) != NULL ) 511 { 522 int length; 523 524 525 526 for ( ;; ) { 527 528 buff_ptr[ max_length - 1 ] = '\0'; 529 if ( !fgets( buff_ptr, max_length, stdin ) ) 530 break; 531 if ( buff_ptr[ max_length - 1 ] ) { 532 fprintf( stderr, "Input line too long" ); 533 exit( 1 ); 534 } 535 length = strlen(buff_ptr); 536 buff_ptr[length - 1] = '\0'; 537 512 538 for ( ptr = formats ; *ptr != ( Rec_vitals * ) NULL ; ptr++ ) 513 539 if ( ( *ptr )->is_data_record( buff_ptr ) == YES )
Note: See TracChangeset
for help on using the changeset viewer.