| 5 |
|
* Gather rtrace output to compute contributions from particular sources |
| 6 |
|
*/ |
| 7 |
|
|
| 8 |
+ |
#include "standard.h" |
| 9 |
|
#include <ctype.h> |
| 9 |
– |
#include "rtio.h" |
| 10 |
– |
#include "rterror.h" |
| 10 |
|
#include "platform.h" |
| 11 |
|
#include "rtprocess.h" |
| 12 |
|
#include "selcall.h" |
| 561 |
|
int |
| 562 |
|
getinp(char *buf, FILE *fp) |
| 563 |
|
{ |
| 564 |
+ |
char *cp; |
| 565 |
+ |
int i; |
| 566 |
+ |
|
| 567 |
|
switch (inpfmt) { |
| 568 |
|
case 'a': |
| 569 |
< |
if (fgets(buf, 128, fp) == NULL) |
| 570 |
< |
return 0; |
| 569 |
> |
cp = buf; /* make sure we get 6 floats */ |
| 570 |
> |
for (i = 0; i < 6; i++) { |
| 571 |
> |
if (fgetword(cp, buf+127-cp, fp) == NULL) |
| 572 |
> |
return 0; |
| 573 |
> |
if ((cp = fskip(cp)) == NULL || *cp) |
| 574 |
> |
return 0; |
| 575 |
> |
*cp++ = ' '; |
| 576 |
> |
} |
| 577 |
> |
getc(fp); /* get/put eol */ |
| 578 |
> |
*cp-- = '\0'; *cp = '\n'; |
| 579 |
|
return strlen(buf); |
| 580 |
|
case 'f': |
| 581 |
|
if (fread(buf, sizeof(float), 6, fp) < 6) |