projects
/
debian
/
pax
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
freshen to upstream CVS head
[debian/pax]
/
getoldopt.c
diff --git
a/getoldopt.c
b/getoldopt.c
index 7da7f85e1aabe12ef9ddc15e98093b9aebdca56c..45fdbf29fbc92546da64c0b37543fa581e5e80ef 100644
(file)
--- a/
getoldopt.c
+++ b/
getoldopt.c
@@
-1,4
+1,4
@@
-/* $OpenBSD: getoldopt.c,v 1.
3 1997/09/01 18:29:52
deraadt Exp $ */
+/* $OpenBSD: getoldopt.c,v 1.
8 2003/07/02 21:19:33
deraadt Exp $ */
/* $NetBSD: getoldopt.c,v 1.3 1995/03/21 09:07:28 cgd Exp $ */
/*
/* $NetBSD: getoldopt.c,v 1.3 1995/03/21 09:07:28 cgd Exp $ */
/*
@@
-7,25
+7,24
@@
* otherwise, it uses the old rules used by tar, dump, and ps.
*
* Written 25 August 1985 by John Gilmore (ihnp4!hoptoad!gnu) and placed
* otherwise, it uses the old rules used by tar, dump, and ps.
*
* Written 25 August 1985 by John Gilmore (ihnp4!hoptoad!gnu) and placed
- * in the Pubic Domain for your edification and enjoyment.
+ * in the Pub
l
ic Domain for your edification and enjoyment.
*/
#ifndef lint
*/
#ifndef lint
-static c
har rcsid[] = "$OpenBSD: getoldopt.c,v 1.3 1997/09/01 18:29:52
deraadt Exp $";
+static c
onst char rcsid[] = "$OpenBSD: getoldopt.c,v 1.8 2003/07/02 21:19:33
deraadt Exp $";
#endif /* not lint */
#endif /* not lint */
+#include <sys/types.h>
+#include <sys/stat.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>
+#include "pax.h"
+#include "extern.h"
int
int
-getoldopt(argc, argv, optstring)
- int argc;
- char **argv;
- char *optstring;
+getoldopt(int argc, char **argv, const char *optstring)
{
{
- extern char *optarg; /* Points to next arg */
- extern int optind; /* Global argv index */
static char *key; /* Points to next keyletter */
static char use_getopt; /* !=0 if argv[1][0] was '-' */
char c;
static char *key; /* Points to next keyletter */
static char use_getopt; /* !=0 if argv[1][0] was '-' */
char c;
@@
-34,7
+33,8
@@
getoldopt(argc, argv, optstring)
optarg = NULL;
if (key == NULL) { /* First time */
optarg = NULL;
if (key == NULL) { /* First time */
- if (argc < 2) return EOF;
+ if (argc < 2)
+ return (-1);
key = argv[1];
if (*key == '-')
use_getopt++;
key = argv[1];
if (*key == '-')
use_getopt++;
@@
-43,18
+43,18
@@
getoldopt(argc, argv, optstring)
}
if (use_getopt)
}
if (use_getopt)
- return
getopt(argc, argv, optstring
);
+ return
(getopt(argc, argv, optstring)
);
c = *key++;
if (c == '\0') {
key--;
c = *key++;
if (c == '\0') {
key--;
- return
EOF
;
+ return
(-1)
;
}
place = strchr(optstring, c);
if (place == NULL || c == ':') {
fprintf(stderr, "%s: unknown option %c\n", argv[0], c);
}
place = strchr(optstring, c);
if (place == NULL || c == ':') {
fprintf(stderr, "%s: unknown option %c\n", argv[0], c);
- return('?');
+ return
('?');
}
place++;
}
place++;
@@
-65,9
+65,9
@@
getoldopt(argc, argv, optstring)
} else {
fprintf(stderr, "%s: %c argument missing\n",
argv[0], c);
} else {
fprintf(stderr, "%s: %c argument missing\n",
argv[0], c);
- return('?');
+ return
('?');
}
}
}
}
- return(c);
+ return
(c);
}
}