1/* { dg-do compile } */ 2 3typedef struct _IO_FILE FILE; 4unsigned long int strtoul(const char *, char **, int); 5char *fgets(char *, int, FILE *); 6struct ihexrec { 7 unsigned char reclen; 8 unsigned char data[256]; 9}; 10static void srec_readrec(struct ihexrec * srec, char * rec) 11{ 12 int i, j; 13 char buf[8]; 14 int offset = 0, len; 15 char * e; 16 for (i=0; j<srec->reclen; j++) 17 { 18 if (offset+2 > len) 19 return; 20 for (i=0; i<2; i++) 21 buf[i] = rec[offset++]; 22 srec->data[j] = strtoul(buf, &e, 16); 23 } 24 for (i=0; i<2; i++) 25 buf[i] = rec[offset++]; 26} 27void srec2b(FILE *inf) 28{ 29 char buffer[256]; 30 struct ihexrec srec; 31 while (fgets(buffer,256,inf)!=(void *)0) 32 srec_readrec(&srec, buffer); 33} 34