#include <stdio.h>
#include <errno.h>
#include <getopt.h>
-#include <pwd.h>
+#include <stdlib.h>
#define RW (S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH)
}
if (ferror (stdin))
- errorMsg("Read error\n");
+ error_msg("Read error");
if (trans_ptr == uu_std) {
putchar (ENC ('\0'));
trans_ptr = uu_std; /* Standard encoding is old uu format */
/* Parse any options */
- while ((opt = getopt (argc, argv, "m")) != EOF) {
+ while ((opt = getopt (argc, argv, "m")) > 0) {
switch (opt) {
case 'm':
trans_ptr = uu_base64;
break;
- case 0:
- break;
-
default:
- usage(uuencode_usage);
+ show_usage();
}
}
case 2:
/* Optional first argument is input file. */
if (!freopen (argv[optind], "r", stdin) || fstat (fileno (stdin), &sb)) {
- errorMsg("%s: %s\n", argv[optind], strerror(errno));
- exit FALSE;
+ perror_msg("%s", argv[optind]);
+ return EXIT_FAILURE;
}
mode = sb.st_mode & (S_IRWXU | S_IRWXG | S_IRWXO);
optind++;
case 0:
default:
- usage(uuencode_usage);
+ show_usage();
}
printf("begin%s %o %s\n", trans_ptr == uu_std ? "" : "-base64",
encode();
printf(trans_ptr == uu_std ? "end\n" : "====\n");
if (ferror (stdout)) {
- errorMsg("Write error\n");
- exit FALSE;
+ error_msg("Write error");
+ return EXIT_FAILURE;
}
- return( TRUE);
+ return EXIT_SUCCESS;
}
/* Copyright (c) 1983 Regents of the University of California.