Improve the way base64 mode is enabled based on the program name,

so that it works when the path to b64encode is used to run it.
This commit is contained in:
fanf 2002-10-20 14:18:25 +00:00
parent e5e93f10fa
commit 9a04c30aaa

View File

@ -58,6 +58,7 @@ __FBSDID("$FreeBSD$");
#include <netinet/in.h>
#include <err.h>
#include <libgen.h>
#include <resolv.h>
#include <stdio.h>
#include <stdlib.h>
@ -83,7 +84,7 @@ main(int argc, char *argv[])
base64 = 0;
outfile = NULL;
if (strcmp(argv[0], "b64encode") == 0)
if (strcmp(basename(argv[0]), "b64encode") == 0)
base64 = 1;
while ((ch = getopt(argc, argv, "mo:")) != -1) {