Get rid of BSDisms
git-svn-id: svn+ssh://svn.openpam.org/svn/openpam/trunk@555 185d5e19-27fe-0310-9dcf-9bff6b9f3609
This commit is contained in:
parent
31950458f5
commit
3a2fec89e2
3 changed files with 13 additions and 3 deletions
2
t/t.h
2
t/t.h
|
@ -44,6 +44,8 @@ struct t_test {
|
|||
#define T(n) \
|
||||
&t_ ## n
|
||||
|
||||
extern const char *t_progname;
|
||||
|
||||
const struct t_test **t_prepare(int, char **);
|
||||
void t_cleanup(void);
|
||||
|
||||
|
|
10
t/t_main.c
10
t/t_main.c
|
@ -31,10 +31,13 @@
|
|||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "t.h"
|
||||
|
||||
const char *t_progname;
|
||||
|
||||
static int verbose;
|
||||
|
||||
void
|
||||
|
@ -53,7 +56,7 @@ static void
|
|||
usage(void)
|
||||
{
|
||||
|
||||
fprintf(stderr, "usage: %s\n", getprogname());
|
||||
fprintf(stderr, "usage: [-v] %s\n", t_progname);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
|
@ -65,6 +68,11 @@ main(int argc, char *argv[])
|
|||
int n, pass, fail;
|
||||
int opt;
|
||||
|
||||
if ((t_progname = strrchr(argv[0], '/')) != NULL)
|
||||
t_progname++; /* one past the slash */
|
||||
else
|
||||
t_progname = argv[0];
|
||||
|
||||
while ((opt = getopt(argc, argv, "v")) != -1)
|
||||
switch (opt) {
|
||||
case 'v':
|
||||
|
|
|
@ -40,7 +40,7 @@
|
|||
|
||||
#include "t.h"
|
||||
|
||||
static char *filename;
|
||||
static char filename[1024];
|
||||
static FILE *f;
|
||||
|
||||
/*
|
||||
|
@ -398,7 +398,7 @@ t_prepare(int argc, char *argv[])
|
|||
|
||||
(void)argc;
|
||||
(void)argv;
|
||||
asprintf(&filename, "%s.%d.tmp", getprogname(), getpid());
|
||||
snprintf(filename, sizeof filename, "%s.%d.tmp", t_progname, getpid());
|
||||
if (filename == NULL)
|
||||
err(1, "asprintf()");
|
||||
return (t_plan);
|
||||
|
|
Loading…
Reference in a new issue