]>
iEval git - authen-passphrase-scrypt.git/blob - scrypt-1.2.1/libcperciva/util/warnp.c
9 static int initialized
= 0;
10 static char * name
= NULL
;
12 /* Free the name string. */
22 * warnp_setprogname(progname):
23 * Set the program name to be used by warn() and warnx() to ${progname}.
26 warnp_setprogname(const char * progname
)
30 /* Free the name if we already have one. */
33 /* Find the last segment of the program name. */
34 for (p
= progname
; progname
[0] != '\0'; progname
++)
35 if (progname
[0] == '/')
38 /* Copy the name string. */
41 /* If we haven't already done so, register our exit handler. */
42 if (initialized
== 0) {
49 warn(const char * fmt
, ...)
54 fprintf(stderr
, "%s", (name
!= NULL
) ? name
: "(unknown)");
56 fprintf(stderr
, ": ");
57 vfprintf(stderr
, fmt
, ap
);
59 fprintf(stderr
, ": %s\n", strerror(errno
));
64 warnx(const char * fmt
, ...)
69 fprintf(stderr
, "%s", (name
!= NULL
) ? name
: "(unknown)");
71 fprintf(stderr
, ": ");
72 vfprintf(stderr
, fmt
, ap
);
74 fprintf(stderr
, "\n");
This page took 0.043258 seconds and 4 git commands to generate.