Rename check*() to parse*() to be consistent with the rest of sbase
This commit is contained in:
parent
d7383490dc
commit
6da5fb7153
22
uudecode.c
22
uudecode.c
|
@ -11,9 +11,9 @@
|
||||||
#include "text.h"
|
#include "text.h"
|
||||||
|
|
||||||
static void uudecode(FILE *, FILE *);
|
static void uudecode(FILE *, FILE *);
|
||||||
static void checkheader(FILE *, const char *, const char *, mode_t *, char **);
|
static void parseheader(FILE *, const char *, const char *, mode_t *, char **);
|
||||||
static void checkmode(const char *, mode_t *);
|
static void parsemode(const char *, mode_t *);
|
||||||
static FILE *checkfile(const char *);
|
static FILE *parsefile(const char *);
|
||||||
|
|
||||||
static void
|
static void
|
||||||
usage(void)
|
usage(void)
|
||||||
|
@ -39,16 +39,16 @@ main(int argc, char *argv[])
|
||||||
usage();
|
usage();
|
||||||
|
|
||||||
if (argc == 0) {
|
if (argc == 0) {
|
||||||
checkheader(stdin, "<stdin>", "begin ", &mode, &fname);
|
parseheader(stdin, "<stdin>", "begin ", &mode, &fname);
|
||||||
if ((nfp = checkfile(fname)) == NULL)
|
if ((nfp = parsefile(fname)) == NULL)
|
||||||
eprintf("fopen %s:", fname);
|
eprintf("fopen %s:", fname);
|
||||||
uudecode(stdin, nfp);
|
uudecode(stdin, nfp);
|
||||||
fclose(nfp);
|
fclose(nfp);
|
||||||
} else {
|
} else {
|
||||||
if ((fp = fopen(argv[0], "r")) == NULL)
|
if ((fp = fopen(argv[0], "r")) == NULL)
|
||||||
eprintf("fopen %s:", argv[0]);
|
eprintf("fopen %s:", argv[0]);
|
||||||
checkheader(fp, argv[0], "begin ", &mode, &fname);
|
parseheader(fp, argv[0], "begin ", &mode, &fname);
|
||||||
if ((nfp = checkfile(fname)) == NULL)
|
if ((nfp = parsefile(fname)) == NULL)
|
||||||
eprintf("fopen %s:", fname);
|
eprintf("fopen %s:", fname);
|
||||||
uudecode(fp, nfp);
|
uudecode(fp, nfp);
|
||||||
fclose(nfp);
|
fclose(nfp);
|
||||||
|
@ -61,7 +61,7 @@ main(int argc, char *argv[])
|
||||||
}
|
}
|
||||||
|
|
||||||
static FILE *
|
static FILE *
|
||||||
checkfile(const char *fname)
|
parsefile(const char *fname)
|
||||||
{
|
{
|
||||||
struct stat st;
|
struct stat st;
|
||||||
int ret;
|
int ret;
|
||||||
|
@ -85,7 +85,7 @@ tropen:
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
checkheader(FILE *fp, const char *s, const char *header, mode_t *mode, char **fname)
|
parseheader(FILE *fp, const char *s, const char *header, mode_t *mode, char **fname)
|
||||||
{
|
{
|
||||||
char bufs[PATH_MAX + 11]; /* len header + mode + maxname */
|
char bufs[PATH_MAX + 11]; /* len header + mode + maxname */
|
||||||
char *p, *q;
|
char *p, *q;
|
||||||
|
@ -106,7 +106,7 @@ checkheader(FILE *fp, const char *s, const char *header, mode_t *mode, char **fn
|
||||||
eprintf("malformed mode string in header\n");
|
eprintf("malformed mode string in header\n");
|
||||||
*q++ = '\0';
|
*q++ = '\0';
|
||||||
/* now mode should be null terminated, q points to fname */
|
/* now mode should be null terminated, q points to fname */
|
||||||
checkmode(p,mode);
|
parsemode(p, mode);
|
||||||
n = strlen(q);
|
n = strlen(q);
|
||||||
while (n > 0 && (q[n - 1] == '\n' || q[n - 1] == '\r'))
|
while (n > 0 && (q[n - 1] == '\n' || q[n - 1] == '\r'))
|
||||||
q[--n] = '\0';
|
q[--n] = '\0';
|
||||||
|
@ -115,7 +115,7 @@ checkheader(FILE *fp, const char *s, const char *header, mode_t *mode, char **fn
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
checkmode(const char *str,mode_t *validmode)
|
parsemode(const char *str, mode_t *validmode)
|
||||||
{
|
{
|
||||||
char *end;
|
char *end;
|
||||||
int octal;
|
int octal;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user