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) \
|
#define T(n) \
|
||||||
&t_ ## n
|
&t_ ## n
|
||||||
|
|
||||||
|
extern const char *t_progname;
|
||||||
|
|
||||||
const struct t_test **t_prepare(int, char **);
|
const struct t_test **t_prepare(int, char **);
|
||||||
void t_cleanup(void);
|
void t_cleanup(void);
|
||||||
|
|
||||||
|
|
10
t/t_main.c
10
t/t_main.c
|
@ -31,10 +31,13 @@
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
#include "t.h"
|
#include "t.h"
|
||||||
|
|
||||||
|
const char *t_progname;
|
||||||
|
|
||||||
static int verbose;
|
static int verbose;
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -53,7 +56,7 @@ static void
|
||||||
usage(void)
|
usage(void)
|
||||||
{
|
{
|
||||||
|
|
||||||
fprintf(stderr, "usage: %s\n", getprogname());
|
fprintf(stderr, "usage: [-v] %s\n", t_progname);
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -65,6 +68,11 @@ main(int argc, char *argv[])
|
||||||
int n, pass, fail;
|
int n, pass, fail;
|
||||||
int opt;
|
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)
|
while ((opt = getopt(argc, argv, "v")) != -1)
|
||||||
switch (opt) {
|
switch (opt) {
|
||||||
case 'v':
|
case 'v':
|
||||||
|
|
|
@ -40,7 +40,7 @@
|
||||||
|
|
||||||
#include "t.h"
|
#include "t.h"
|
||||||
|
|
||||||
static char *filename;
|
static char filename[1024];
|
||||||
static FILE *f;
|
static FILE *f;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -398,7 +398,7 @@ t_prepare(int argc, char *argv[])
|
||||||
|
|
||||||
(void)argc;
|
(void)argc;
|
||||||
(void)argv;
|
(void)argv;
|
||||||
asprintf(&filename, "%s.%d.tmp", getprogname(), getpid());
|
snprintf(filename, sizeof filename, "%s.%d.tmp", t_progname, getpid());
|
||||||
if (filename == NULL)
|
if (filename == NULL)
|
||||||
err(1, "asprintf()");
|
err(1, "asprintf()");
|
||||||
return (t_plan);
|
return (t_plan);
|
||||||
|
|
Loading…
Reference in a new issue