| 35 |
|
printf("Could not open SHAPE file %s\n", fname); |
| 36 |
|
exit(-1); |
| 37 |
|
} |
| 38 |
< |
rewind(shapeFile); |
| 39 |
< |
lineNum = 0; |
| 38 |
> |
|
| 39 |
> |
findBegin( "ShapeInfo" ); |
| 40 |
> |
|
| 41 |
|
eof_test = fgets( readLine, sizeof(readLine), shapeFile ); |
| 42 |
< |
lineNum++; |
| 42 |
< |
if( eof_test == NULL ){ |
| 43 |
< |
printf("Error in reading SHAPE from SHAPE file at line %d.\n", |
| 44 |
< |
lineNum ); |
| 45 |
< |
exit(-1); |
| 46 |
< |
} |
| 47 |
< |
// first find the shape name: |
| 42 |
> |
|
| 43 |
|
while( eof_test != NULL ){ |
| 44 |
|
// toss comment lines |
| 45 |
|
if( readLine[0] != '!' && readLine[0] != '#' ){ |
| 46 |
+ |
|
| 47 |
+ |
foo = strtok(readLine, " ,;\t"); |
| 48 |
+ |
if (!strcasecmp(foo, "end")) break; |
| 49 |
|
|
| 50 |
|
nTokens = count_tokens(readLine, " ,;\t"); |
| 51 |
|
if (nTokens < 5) { |
| 52 |
< |
printf("Not enough data on information line in SHAPE file.\n"); |
| 52 |
> |
printf("Not enough data on shapeInfo line in SHAPE file.\n"); |
| 53 |
|
exit(-1); |
| 54 |
|
} |
| 55 |
|
|
| 66 |
|
break; |
| 67 |
|
} |
| 68 |
|
eof_test = fgets( readLine, sizeof(readLine), shapeFile ); |
| 71 |
– |
lineNum++; |
| 69 |
|
} |
| 70 |
|
|
| 71 |
|
findBegin( "ContactFunctions" ); |