Changeset View
Changeset View
Standalone View
Standalone View
usr.bin/bintrans/uudecode.c
Show First 20 Lines • Show All 63 Lines • ▼ Show 20 Lines | |||||
#include <resolv.h> | #include <resolv.h> | ||||
#include <stdbool.h> | #include <stdbool.h> | ||||
#include <stdio.h> | #include <stdio.h> | ||||
#include <stdlib.h> | #include <stdlib.h> | ||||
#include <string.h> | #include <string.h> | ||||
#include <unistd.h> | #include <unistd.h> | ||||
extern int main_decode(int, char *[]); | extern int main_decode(int, char *[]); | ||||
extern int main_base64_decode(const char *); | |||||
static const char *infile, *outfile; | static const char *infile, *outfile; | ||||
static FILE *infp, *outfp; | static FILE *infp, *outfp; | ||||
static bool base64, cflag, iflag, oflag, pflag, rflag, sflag; | static bool base64, cflag, iflag, oflag, pflag, rflag, sflag; | ||||
static void usage(void); | static void usage(void); | ||||
static int decode(void); | static int decode(void); | ||||
static int decode2(void); | static int decode2(void); | ||||
static int uu_decode(void); | static int uu_decode(void); | ||||
static int base64_decode(void); | static int base64_decode(void); | ||||
int | |||||
main_base64_decode(const char *in) | |||||
{ | |||||
base64 = 1; | |||||
rflag = 1; | |||||
if (in != NULL) { | |||||
infile = in; | |||||
infp = fopen(infile, "r"); | |||||
if (infp == NULL) | |||||
err(1, "%s", in); | |||||
} else { | |||||
infile = "stdin"; | |||||
infp = stdin; | |||||
} | |||||
exit(decode()); | |||||
} | |||||
int | int | ||||
main_decode(int argc, char *argv[]) | main_decode(int argc, char *argv[]) | ||||
{ | { | ||||
int rval, ch; | int rval, ch; | ||||
if (strcmp(basename(argv[0]), "b64decode") == 0) | if (strcmp(basename(argv[0]), "b64decode") == 0) | ||||
base64 = true; | base64 = true; | ||||
▲ Show 20 Lines • Show All 382 Lines • Show Last 20 Lines |