12 _Noreturn
void GCC_FMT_ATTR (3, 4) err (int exitcode
, int errno_val
,
18 vfprintf (stdout
, fmt
, ap
);
20 fprintf (stdout
, ": %s\n", strerror (errno_val
));
25 _Noreturn
void GCC_FMT_ATTR (2, 3) errx (int exitcode
, const char *fmt
, ...)
30 vfprintf (stdout
, fmt
, ap
);
37 void *parse_pointer (const char *cap
, const char *s
)
40 int ret
= sscanf (s
, "%" SCNxPTR
, (uintptr_t *) &ptr
);
42 errx (1, "%s: cannot parse pointer in `%s' (ret=%d)", cap
, s
, ret
);
50 gettimeofday (&tv
, NULL
); /* gettimeofday shall always return zero */
51 return tv
.tv_sec
+ tv
.tv_usec
*1e-6;
54 void fmt_linkn (char *s
, const char *c
, unsigned int l
, int n
)
59 do { d
= div (n
, l
); sl
++; n
= d
.quot
; } while (d
.quot
);
60 for (int i
= 0, n
= nn
; i
< sl
; ++i
) {