Well behaved POSIX.2 utilities always call setlocale() and getopt().
This commit is contained in:
parent
ce4f97eb24
commit
0605e44a71
@ -33,7 +33,7 @@
|
|||||||
|
|
||||||
#ifndef lint
|
#ifndef lint
|
||||||
/*static char sccsid[] = "from: @(#)uudecode.c 5.10 (Berkeley) 6/1/90";*/
|
/*static char sccsid[] = "from: @(#)uudecode.c 5.10 (Berkeley) 6/1/90";*/
|
||||||
static char rcsid[] = "$Id: uudecode.c,v 1.3 1993/08/27 22:30:54 jtc Exp $";
|
static char rcsid[] = "$Id: uudecode.c,v 1.4 1993/11/09 01:46:38 jtc Exp $";
|
||||||
#endif /* not lint */
|
#endif /* not lint */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -42,12 +42,14 @@ static char rcsid[] = "$Id: uudecode.c,v 1.3 1993/08/27 22:30:54 jtc Exp $";
|
|||||||
* create the specified file, decoding as you go.
|
* create the specified file, decoding as you go.
|
||||||
* used with uuencode.
|
* used with uuencode.
|
||||||
*/
|
*/
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <locale.h>
|
||||||
|
#include <errno.h>
|
||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <pwd.h>
|
#include <pwd.h>
|
||||||
#include <stdio.h>
|
#include <unistd.h>
|
||||||
#include <string.h>
|
|
||||||
#include <errno.h>
|
|
||||||
|
|
||||||
static int decode();
|
static int decode();
|
||||||
static void usage();
|
static void usage();
|
||||||
@ -61,7 +63,14 @@ main(argc, argv)
|
|||||||
{
|
{
|
||||||
int rval;
|
int rval;
|
||||||
|
|
||||||
if (*++argv) {
|
setlocale(LC_ALL, "");
|
||||||
|
|
||||||
|
while (getopt(argc, argv, "") != -1)
|
||||||
|
usage();
|
||||||
|
argc -= optind;
|
||||||
|
argv += optind;
|
||||||
|
|
||||||
|
if (*argv) {
|
||||||
rval = 0;
|
rval = 0;
|
||||||
do {
|
do {
|
||||||
if (!freopen(filename = *argv, "r", stdin)) {
|
if (!freopen(filename = *argv, "r", stdin)) {
|
||||||
|
@ -33,7 +33,7 @@
|
|||||||
|
|
||||||
#ifndef lint
|
#ifndef lint
|
||||||
/*static char sccsid[] = "from: @(#)uuencode.c 5.9 (Berkeley) 6/1/90";*/
|
/*static char sccsid[] = "from: @(#)uuencode.c 5.9 (Berkeley) 6/1/90";*/
|
||||||
static char rcsid[] = "$Id: uuencode.c,v 1.4 1993/10/13 18:34:49 jtc Exp $";
|
static char rcsid[] = "$Id: uuencode.c,v 1.5 1993/11/09 01:47:00 jtc Exp $";
|
||||||
#endif /* not lint */
|
#endif /* not lint */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -44,13 +44,14 @@ static char rcsid[] = "$Id: uuencode.c,v 1.4 1993/10/13 18:34:49 jtc Exp $";
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <locale.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
static void encode();
|
static void encode();
|
||||||
static void usage();
|
static __dead void usage();
|
||||||
|
|
||||||
int
|
int
|
||||||
main(argc, argv)
|
main(argc, argv)
|
||||||
@ -60,7 +61,9 @@ main(argc, argv)
|
|||||||
struct stat sb;
|
struct stat sb;
|
||||||
int mode;
|
int mode;
|
||||||
|
|
||||||
while (getopt(argc, argv, "") != EOF)
|
setlocale(LC_ALL, "");
|
||||||
|
|
||||||
|
while (getopt(argc, argv, "") != -1)
|
||||||
usage();
|
usage();
|
||||||
argv += optind;
|
argv += optind;
|
||||||
argc -= optind;
|
argc -= optind;
|
||||||
|
Loading…
Reference in New Issue
Block a user