extern unsigned int ptrace_setoptions;
extern int dtime, xflag, qflag;
extern cflag_t cflag;
-extern int acolumn;
extern int max_strlen;
extern struct tcb *tcp_last;
extern void printsignal(int);
extern void printleader(struct tcb *);
extern void printtrailer(void);
-extern void tabto(int);
+extern void tabto(void);
extern void call_summary(FILE *);
extern void tprint_iov(struct tcb *, unsigned long, unsigned long, int decode_iov);
extern void tprint_open_modes(mode_t);
}
/* special case: we stop tracing this process, finish line now */
tprintf("%ld) ", tcp->u_arg[0]);
- tabto(acolumn);
+ tabto();
tprintf("= ?");
printtrailer();
return 0;
static uid_t run_uid;
static gid_t run_gid;
-int acolumn = DEFAULT_ACOLUMN;
int max_strlen = DEFAULT_STRLEN;
+static int acolumn = DEFAULT_ACOLUMN;
+static char *acolumn_spaces;
static char *outfname = NULL;
static FILE *outf;
static int curcol;
break;
case 'a':
acolumn = atoi(optarg);
+ if (acolumn < 0)
+ error_msg_and_die("Bad column width '%s'", optarg);
break;
case 'e':
qualify(optarg);
}
}
+ acolumn_spaces = malloc(acolumn + 1);
+ if (!acolumn_spaces)
+ error_msg_and_die("Out of memory");
+ memset(acolumn_spaces, ' ', acolumn);
+ acolumn_spaces[acolumn] = '\0';
+
if ((optind == argc) == !pflag_seen)
usage(stderr, 1);
if (tcp_last->ptrace_errno) {
if (tcp_last->flags & TCB_INSYSCALL) {
tprintf(" <unavailable>) ");
- tabto(acolumn);
+ tabto();
}
tprintf("= ? <unavailable>\n");
tcp_last->ptrace_errno = 0;
}
void
-tabto(int col)
+tabto(void)
{
- if (curcol < col)
- tprintf("%*s", col - curcol, "");
+ if (curcol < acolumn)
+ tprintf(acolumn_spaces + curcol);
}
void
if (res != 1) {
tprintf(") ");
- tabto(acolumn);
+ tabto();
tprintf("= ? <unavailable>");
printtrailer();
tcp->flags &= ~TCB_INSYSCALL;
}
tprintf(") ");
- tabto(acolumn);
+ tabto();
u_error = tcp->u_error;
if (!SCNO_IN_RANGE(tcp->scno) ||
qual_flags[tcp->scno] & QUAL_RAW) {