diff options
author | Todd C. Miller <millert@cvs.openbsd.org> | 2023-09-20 16:57:13 +0000 |
---|---|---|
committer | Todd C. Miller <millert@cvs.openbsd.org> | 2023-09-20 16:57:13 +0000 |
commit | 9266531ba436016a7c1017deb833060102dc8ecf (patch) | |
tree | 9347239cae4873f2cff0f34c43f3ebcc586a81cf /usr.bin/awk/main.c | |
parent | 3d2624a3aada4edd73e26e8b362d3ea62f5974ce (diff) |
Support --version option like upstream awk but don't document it.
Upstream awk has supported --version for a long time but does not
support -V like our awk does. Both options are supported by gawk.
Diffstat (limited to 'usr.bin/awk/main.c')
-rw-r--r-- | usr.bin/awk/main.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/usr.bin/awk/main.c b/usr.bin/awk/main.c index 5a976d82814..2ec0bc7d9e9 100644 --- a/usr.bin/awk/main.c +++ b/usr.bin/awk/main.c @@ -1,4 +1,4 @@ -/* $OpenBSD: main.c,v 1.61 2023/09/18 19:32:19 millert Exp $ */ +/* $OpenBSD: main.c,v 1.62 2023/09/20 16:57:12 millert Exp $ */ /**************************************************************** Copyright (C) Lucent Technologies 1997 All Rights Reserved @@ -170,6 +170,10 @@ int main(int argc, char *argv[]) yyin = NULL; symtab = makesymtab(NSYMTAB); while (argc > 1 && argv[1][0] == '-' && argv[1][1] != '\0') { + if (strcmp(argv[1], "--version") == 0) { + printf("awk %s\n", version); + return 0; + } if (strcmp(argv[1], "--") == 0) { /* explicit end of args */ argc--; argv++; @@ -214,8 +218,7 @@ int main(int argc, char *argv[]) break; case 'V': /* added for exptools "standard" */ printf("awk %s\n", version); - exit(0); - break; + return 0; default: WARNING("unknown option %s ignored", argv[1]); break; |