7 |
|
|
8 |
|
#include "standard.h" |
9 |
|
#include <ctype.h> |
10 |
+ |
#include <signal.h> |
11 |
|
#include "platform.h" |
12 |
|
#include "rtprocess.h" |
13 |
|
#include "selcall.h" |
67 |
|
}; /* rtrace process buffer */ |
68 |
|
|
69 |
|
/* rtrace command and defaults */ |
70 |
< |
char *rtargv[256] = { "rtrace", "-dt", "0", "-dj", ".5", "-dr", "3", |
71 |
< |
"-ab", "1", "-ad", "128", }; |
70 |
> |
char *rtargv[256] = { "rtrace", "-dj", ".5", "-dr", "3", |
71 |
> |
"-ab", "1", "-ad", "128", "-lr", "-10", }; |
72 |
|
int rtargc = 11; |
73 |
|
/* overriding rtrace options */ |
74 |
< |
char *myrtopts[] = { "-o~~TmWdp", "-h-", |
75 |
< |
"-x", "1", "-y", "0", |
75 |
< |
"-as", "0", "-aa", "0", NULL }; |
74 |
> |
char *myrtopts[] = { "-o~~TmWdp", "-h-", "-x", "1", "-y", "0", |
75 |
> |
"-dt", "0", "-as", "0", "-aa", "0", NULL }; |
76 |
|
|
77 |
|
struct rtproc rt0; /* head of rtrace process list */ |
78 |
|
|
123 |
|
setformat(const char *fmt) |
124 |
|
{ |
125 |
|
switch (fmt[0]) { |
126 |
– |
case 'a': |
126 |
|
case 'f': |
127 |
|
case 'd': |
128 |
+ |
SET_FILE_BINARY(stdin); |
129 |
+ |
/* fall through */ |
130 |
+ |
case 'a': |
131 |
|
inpfmt = fmt[0]; |
132 |
|
break; |
133 |
|
default: |
204 |
|
break; |
205 |
|
case 'f': /* file or i/o format */ |
206 |
|
if (!argv[i][2]) { |
207 |
+ |
char *fpath; |
208 |
|
if (i >= argc-1) break; |
209 |
< |
fcompile(argv[++i]); |
209 |
> |
fpath = getpath(argv[++i], |
210 |
> |
getrlibpath(), R_OK); |
211 |
> |
if (fpath == NULL) { |
212 |
> |
sprintf(errmsg, |
213 |
> |
"cannot find file '%s'", |
214 |
> |
argv[i]); |
215 |
> |
error(USER, errmsg); |
216 |
> |
} |
217 |
> |
fcompile(fpath); |
218 |
|
continue; |
219 |
|
} |
220 |
|
setformat(argv[i]+2); |
500 |
|
LUENT *lep; |
501 |
|
|
502 |
|
if (ospec == NULL) { /* use stdout? */ |
503 |
< |
if (!using_stdout && header) |
504 |
< |
printheader(stdout); |
503 |
> |
if (!using_stdout) { |
504 |
> |
if (outfmt != 'a') |
505 |
> |
SET_FILE_BINARY(stdout); |
506 |
> |
if (header) |
507 |
> |
printheader(stdout); |
508 |
> |
} |
509 |
|
using_stdout = 1; |
510 |
|
return stdout; |
511 |
|
} |
547 |
|
if (lep->key == NULL) /* new entry */ |
548 |
|
lep->key = strcpy((char *)malloc(strlen(ofname)+1), ofname); |
549 |
|
if (lep->data == NULL) { /* open output file */ |
550 |
< |
FILE *fp = fopen(ofname, "w"); |
550 |
> |
FILE *fp; |
551 |
|
int i; |
552 |
+ |
if (ofname[0] == '!') /* output to command */ |
553 |
+ |
fp = popen(ofname+1, "w"); |
554 |
+ |
else |
555 |
+ |
fp = fopen(ofname, "w"); |
556 |
|
if (fp == NULL) { |
557 |
|
sprintf(errmsg, "cannot open '%s' for writing", ofname); |
558 |
|
error(SYSTEM, errmsg); |
559 |
|
} |
560 |
+ |
if (outfmt != 'a') |
561 |
+ |
SET_FILE_BINARY(fp); |
562 |
|
if (header) |
563 |
|
printheader(fp); |
564 |
|
/* play catch-up */ |