Changeset 1200
- Timestamp:
- Oct 13, 2006, 3:19:45 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
toilet/trunk/src/figlet.c
r1196 r1200 120 120 char *data = NULL; 121 121 char path[2048]; 122 char buf[2048]; 122 123 char hardblank[10]; 123 124 cucul_buffer_t *b; … … 145 146 cx->full_layout = 0; 146 147 cx->codetag_count = 0; 147 if(fscanf(f, "%*[ft]lf2a%6s %u %u %u %i %u %u %u %u\n", hardblank, 148 fgets(buf, 2048, f); 149 if(sscanf(buf, "%*[ft]lf2a%6s %u %u %u %i %u %u %u %u\n", hardblank, 148 150 &cx->height, &cx->baseline, &cx->max_length, 149 151 &cx->old_layout, &comment_lines, &cx->print_direction, … … 159 161 /* Skip comment lines */ 160 162 for(i = 0; i < comment_lines; i++) 161 { 162 fscanf(f, "%*[^\n]"); 163 fscanf(f, "%*c"); 164 } 163 fgets(buf, 2048, f); 165 164 166 165 /* Read mandatory characters (32-127, 196, 214, 220, 228, 246, 252, 223) … … 186 185 else 187 186 { 188 char number[10]; 189 int ret = fscanf(f, "%s %*[^\n]", number); 190 191 if(ret == EOF) 187 if(fgets(buf, 2048, f) == NULL) 192 188 break; 193 189 194 if(! ret)190 if(!buf[0]) 195 191 { 196 192 free(data); … … 201 197 } 202 198 203 if( number[1] == 'x')204 sscanf( number, "%x", &cx->lookup[cx->glyphs * 2]);199 if(buf[1] == 'x') 200 sscanf(buf, "%x", &cx->lookup[cx->glyphs * 2]); 205 201 else 206 sscanf(number, "%u", &cx->lookup[cx->glyphs * 2]); 207 208 fscanf(f, "%*c"); 202 sscanf(buf, "%u", &cx->lookup[cx->glyphs * 2]); 209 203 } 210 204
Note: See TracChangeset
for help on using the changeset viewer.