Changeset View
Changeset View
Standalone View
Standalone View
sbin/ipfw/main.c
Show All 24 Lines | |||||
#include <err.h> | #include <err.h> | ||||
#include <errno.h> | #include <errno.h> | ||||
#include <signal.h> | #include <signal.h> | ||||
#include <stdio.h> | #include <stdio.h> | ||||
#include <stdlib.h> | #include <stdlib.h> | ||||
#include <string.h> | #include <string.h> | ||||
#include <sysexits.h> | #include <sysexits.h> | ||||
#include <unistd.h> | #include <unistd.h> | ||||
#include <libgen.h> | |||||
#include "ipfw2.h" | #include "ipfw2.h" | ||||
static void | static void | ||||
help(void) | help(void) | ||||
{ | { | ||||
if (is_ipfw()) { | if (is_ipfw()) { | ||||
fprintf(stderr, | fprintf(stderr, | ||||
▲ Show 20 Lines • Show All 635 Lines • ▼ Show 20 Lines | #if defined(_WIN32) && defined(TCC) | ||||
if (ret != 0) { | if (ret != 0) { | ||||
/* Tell the user that we could not find a usable */ | /* Tell the user that we could not find a usable */ | ||||
/* Winsock DLL. */ | /* Winsock DLL. */ | ||||
printf("WSAStartup failed with error: %d\n", ret); | printf("WSAStartup failed with error: %d\n", ret); | ||||
return 1; | return 1; | ||||
} | } | ||||
} | } | ||||
#endif | #endif | ||||
kp: That catches a problem, but I believe the usual way of fixing this is with basename(3).
That'll… | |||||
if (strcmp(av[0], "dnctl") == 0) | if (strcmp("dnctl", basename(av[0])) == 0) | ||||
g_co.prog = cmdline_prog_dnctl; | g_co.prog = cmdline_prog_dnctl; | ||||
else | else | ||||
g_co.prog = cmdline_prog_ipfw; | g_co.prog = cmdline_prog_ipfw; | ||||
/* | /* | ||||
* If the last argument is an absolute pathname, interpret it | * If the last argument is an absolute pathname, interpret it | ||||
* as a file to be preprocessed. | * as a file to be preprocessed. | ||||
*/ | */ | ||||
Show All 16 Lines |
That catches a problem, but I believe the usual way of fixing this is with basename(3).
That'll be a lot simpler than this string manipulation.