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:
Dag-Erling Smørgrav 2012-04-02 09:54:09 +00:00
parent 31950458f5
commit 3a2fec89e2
3 changed files with 13 additions and 3 deletions

2
t/t.h
View File

@ -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);

View File

@ -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':

View File

@ -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);