diff options
-rw-r--r-- | kerberosV/include/roken.h | 4 | ||||
-rw-r--r-- | kerberosV/src/lib/asn1/main.c | 3 | ||||
-rw-r--r-- | kerberosV/src/lib/roken/getarg.c | 42 | ||||
-rw-r--r-- | kerberosV/src/lib/roken/getprogname.c | 4 | ||||
-rw-r--r-- | kerberosV/src/lib/roken/print_version.c | 4 | ||||
-rw-r--r-- | kerberosV/src/lib/roken/warnerr.c | 32 | ||||
-rw-r--r-- | kerberosV/src/lib/roken/write_pid.c | 2 | ||||
-rw-r--r-- | kerberosV/usr.bin/asn1_compile/Makefile | 4 |
8 files changed, 44 insertions, 51 deletions
diff --git a/kerberosV/include/roken.h b/kerberosV/include/roken.h index 1161697f2f0..0ba1524c2ed 100644 --- a/kerberosV/include/roken.h +++ b/kerberosV/include/roken.h @@ -39,7 +39,7 @@ */ /* $KTH: roken.h.in,v 1.159 2001/08/21 15:32:05 assar Exp $ */ -/* $Id: roken.h,v 1.7 2002/02/06 09:12:30 hin Exp $ */ +/* $Id: roken.h,v 1.8 2002/05/30 20:06:23 hin Exp $ */ #include <stdio.h> #include <stdlib.h> @@ -169,8 +169,6 @@ int get_window_size(int fd, struct winsize *); -extern const char *__progname; - extern char **environ; struct hostent * diff --git a/kerberosV/src/lib/asn1/main.c b/kerberosV/src/lib/asn1/main.c index 172e5403a95..f5adc429ade 100644 --- a/kerberosV/src/lib/asn1/main.c +++ b/kerberosV/src/lib/asn1/main.c @@ -34,7 +34,7 @@ #include "gen_locl.h" #include <getarg.h> -RCSID("$KTH: main.c,v 1.10 1999/12/02 17:05:02 joda Exp $"); +RCSID("$KTH: main.c,v 1.11 2001/02/20 01:44:52 assar Exp $"); extern FILE *yyin; @@ -61,7 +61,6 @@ main(int argc, char **argv) char *name = NULL; int optind = 0; - set_progname(argv[0]); if(getarg(args, num_args, argc, argv, &optind)) usage(1); if(help_flag) diff --git a/kerberosV/src/lib/roken/getarg.c b/kerberosV/src/lib/roken/getarg.c index d07c9a9dfe6..57adfa13d1b 100644 --- a/kerberosV/src/lib/roken/getarg.c +++ b/kerberosV/src/lib/roken/getarg.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997 - 2000 Kungliga Tekniska Högskolan + * Copyright (c) 1997 - 2001 Kungliga Tekniska Högskolan * (Royal Institute of Technology, Stockholm, Sweden). * All rights reserved. * @@ -33,7 +33,7 @@ #ifdef HAVE_CONFIG_H #include <config.h> -RCSID("$KTH: getarg.c,v 1.37 2000/12/25 17:03:15 assar Exp $"); +RCSID("$KTH: getarg.c,v 1.42 2001/07/23 04:30:11 assar Exp $"); #endif #include <stdio.h> @@ -44,6 +44,8 @@ RCSID("$KTH: getarg.c,v 1.37 2000/12/25 17:03:15 assar Exp $"); #define ISFLAG(X) ((X).type == arg_flag || (X).type == arg_negative_flag) +extern char *__progname; + static size_t print_arg (char *string, size_t len, int mdoc, int longp, struct getargs *arg) { @@ -139,7 +141,7 @@ mandoc_template(struct getargs *args, print_arg(buf, sizeof(buf), 1, 0, args + i); printf(".Oo Fl %c%s \\*(Ba Xo\n", args[i].short_name, buf); print_arg(buf, sizeof(buf), 1, 1, args + i); - printf(".Fl -%s%s Oc\n.Xc\n", args[i].long_name, buf); + printf(".Fl -%s%s\n.Xc\n.Oc\n", args[i].long_name, buf); } /* if(args[i].type == arg_strings) @@ -223,6 +225,23 @@ arg_printusage (struct getargs *args, columns = 80; col = 0; col += fprintf (stderr, "Usage: %s", progname); + buf[0] = '\0'; + for (i = 0; i < num_args; ++i) { + if(args[i].short_name && ISFLAG(args[i])) { + char s[2]; + if(buf[0] == '\0') + strlcpy(buf, "[-", sizeof(buf)); + s[0] = args[i].short_name; + s[1] = '\0'; + strlcat(buf, s, sizeof(buf)); + } + } + if(buf[0] != '\0') { + strlcat(buf, "]", sizeof(buf)); + col = check_column(stderr, col, strlen(buf) + 1, columns); + col += fprintf(stderr, " %s", buf); + } + for (i = 0; i < num_args; ++i) { size_t len = 0; @@ -244,7 +263,7 @@ arg_printusage (struct getargs *args, col = check_column(stderr, col, strlen(buf) + 1, columns); col += fprintf(stderr, " %s", buf); } - if (args[i].short_name) { + if (args[i].short_name && !ISFLAG(args[i])) { snprintf(buf, sizeof(buf), "[-%c", args[i].short_name); len += 2; len += print_arg(buf + strlen(buf), sizeof(buf) - strlen(buf), @@ -398,13 +417,8 @@ arg_match_long(struct getargs *args, size_t num_args, if (*optarg == '\0') val = 1; - else { - char *endstr; - - val = strtol (optarg, &endstr, 0); - if (endstr == optarg) - return ARG_ERR_BAD_ARG; - } + else if(sscanf(optarg + 1, "%d", &val) != 1) + return ARG_ERR_BAD_ARG; *(int *)current->value += val; return 0; } @@ -528,6 +542,12 @@ getarg(struct getargs *args, size_t num_args, return ret; } +void +free_getarg_strings (getarg_strings *s) +{ + free (s->strings); +} + #if TEST int foo_flag = 2; int flag1 = 0; diff --git a/kerberosV/src/lib/roken/getprogname.c b/kerberosV/src/lib/roken/getprogname.c index b48dda13e26..5cf6b0e21d9 100644 --- a/kerberosV/src/lib/roken/getprogname.c +++ b/kerberosV/src/lib/roken/getprogname.c @@ -38,9 +38,7 @@ RCSID("$KTH: getprogname.c,v 1.1 2001/07/09 14:56:51 assar Exp $"); #include "roken.h" -#ifndef HAVE___PROGNAME -const char *__progname; -#endif +extern char *__progname; #ifndef HAVE_GETPROGNAME const char * diff --git a/kerberosV/src/lib/roken/print_version.c b/kerberosV/src/lib/roken/print_version.c index 9ddd87ac872..cfe69a295ce 100644 --- a/kerberosV/src/lib/roken/print_version.c +++ b/kerberosV/src/lib/roken/print_version.c @@ -33,12 +33,14 @@ #ifdef HAVE_CONFIG_H #include <config.h> -RCSID("$KTH: print_version.c,v 1.7 2001/01/30 03:05:29 assar Exp $"); +RCSID("$KTH: print_version.c,v 1.8 2001/02/20 01:44:55 assar Exp $"); #endif #include "roken.h" #include "print_version.h" +extern char *__progname; + void print_version(const char *progname) { diff --git a/kerberosV/src/lib/roken/warnerr.c b/kerberosV/src/lib/roken/warnerr.c index 02880168c35..e37493b2530 100644 --- a/kerberosV/src/lib/roken/warnerr.c +++ b/kerberosV/src/lib/roken/warnerr.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 1995, 1996, 1997 Kungliga Tekniska Högskolan + * Copyright (c) 1995 - 2001 Kungliga Tekniska Högskolan * (Royal Institute of Technology, Stockholm, Sweden). * All rights reserved. * @@ -33,42 +33,18 @@ #ifdef HAVE_CONFIG_H #include <config.h> -RCSID("$KTH: warnerr.c,v 1.9 2000/07/25 09:54:05 joda Exp $"); +RCSID("$KTH: warnerr.c,v 1.15 2001/07/09 14:56:51 assar Exp $"); #endif #include "roken.h" #include "err.h" -#ifndef HAVE___PROGNAME -const char *__progname; -#endif - -const char * -get_progname(void) -{ - return __progname; -} - -void -set_progname(char *argv0) -{ -#ifndef HAVE___PROGNAME - char *p; - if(argv0 == NULL) - return; - p = strrchr(argv0, '/'); - if(p == NULL) - p = argv0; - else - p++; - __progname = p; -#endif -} - void warnerr(int doerrno, const char *fmt, va_list ap) { int sverrno = errno; + extern char *__progname; + if(__progname != NULL){ fprintf(stderr, "%s", __progname); if(fmt != NULL || doerrno) diff --git a/kerberosV/src/lib/roken/write_pid.c b/kerberosV/src/lib/roken/write_pid.c index f03336f0451..4667188add9 100644 --- a/kerberosV/src/lib/roken/write_pid.c +++ b/kerberosV/src/lib/roken/write_pid.c @@ -33,7 +33,7 @@ #ifdef HAVE_CONFIG_H #include <config.h> -RCSID("$KTH: write_pid.c,v 1.4 2000/08/04 11:19:41 joda Exp $"); +RCSID("$KTH: write_pid.c,v 1.5 2001/02/20 01:44:55 assar Exp $"); #endif #include <stdio.h> diff --git a/kerberosV/usr.bin/asn1_compile/Makefile b/kerberosV/usr.bin/asn1_compile/Makefile index 62b9e2488e1..4e5e2259538 100644 --- a/kerberosV/usr.bin/asn1_compile/Makefile +++ b/kerberosV/usr.bin/asn1_compile/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.3 2002/02/06 09:13:34 hin Exp $ +# $OpenBSD: Makefile,v 1.4 2002/05/30 20:06:23 hin Exp $ KRBDEPTH= ../.. .include <${.CURDIR}/${KRBDEPTH}/Makefile.inc> @@ -7,7 +7,7 @@ PROG= asn1_compile NOMAN= SRCS= parse.c lex.l main.c hash.c symbol.c gen.c \ gen_encode.c gen_decode.c gen_free.c gen_length.c gen_copy.c \ - gen_glue.c getprogname.c setprogname.c + gen_glue.c CLEANFILES= parse.[ch] lex.[ch] |