aboutsummaryrefslogtreecommitdiffstats
path: root/main.c
diff options
context:
space:
mode:
authorRuslan Ermilov <ru@FreeBSD.org>2011-08-09 12:23:27 +0000
committerRuslan Ermilov <ru@FreeBSD.org>2011-08-09 12:23:27 +0000
commit9cb3faa6600faf227157090f70a6ec850ac1ef75 (patch)
treea1dbab506adcf1ed332e9b7f6440e5df5b5ab3ee /main.c
parente2f76e526c9828f75cb69d51857e9efd1ed0684f (diff)
downloadsrc-vendor/one-true-awk/20110807.tar.gz
src-vendor/one-true-awk/20110807.zip
Vendor import of bwk's 7-Aug-2011 release.vendor/one-true-awk/20110807
Diffstat (limited to 'main.c')
-rw-r--r--main.c20
1 files changed, 15 insertions, 5 deletions
diff --git a/main.c b/main.c
index 9eff3d751c6b..bd9eeeeaf90a 100644
--- a/main.c
+++ b/main.c
@@ -22,7 +22,7 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
THIS SOFTWARE.
****************************************************************/
-const char *version = "version 20110506";
+const char *version = "version 20110807";
#define DEBUG
#include <stdio.h>
@@ -121,10 +121,20 @@ int main(int argc, char *argv[])
WARNING("field separator FS is empty");
break;
case 'v': /* -v a=1 to be done NOW. one -v for each */
- if (argv[1][2] == '\0' && --argc > 1 && isclvar((++argv)[1]))
- setclvar(argv[1]);
- else if (argv[1][2] != '\0')
- setclvar(&argv[1][2]);
+ if (argv[1][2] != 0) { /* arg is -vsomething */
+ if (isclvar(&argv[1][2]))
+ setclvar(&argv[1][2]);
+ else
+ FATAL("invalid -v option argument: %s", &argv[1][2]);
+ } else { /* arg is -v something */
+ argc--; argv++;
+ if (argc <= 1)
+ FATAL("no variable name");
+ if (isclvar(argv[1]))
+ setclvar(argv[1]);
+ else
+ FATAL("invalid -v option argument: %s", argv[1]);
+ }
break;
case 'd':
dbg = atoi(&argv[1][2]);