ref: 08fa2b8c53138ee1162a2b9be78e192adcce26ec
parent: b7461b63f231d2d45a5309e6ee207276e7c44a98
author: ozan yigit <ozan.yigit@gmail.com>
date: Thu Dec 28 09:49:20 EST 2023
adjust version date: 20231228 Fix inconsistent handling of --csv and FS set via -v.
--- a/main.c
+++ b/main.c
@@ -22,7 +22,7 @@
THIS SOFTWARE.
****************************************************************/
-const char *version = "version 20231127";
+const char *version = "version 20231228";
#define DEBUG
#include <stdio.h>
@@ -157,8 +157,6 @@
}
if (strcmp(argv[1], "--csv") == 0) { /* turn on csv input processing */CSV = true;
- if (fs)
- WARNING("danger: don't set FS when --csv is in effect");argc--;
argv++;
continue;
@@ -180,8 +178,6 @@
break;
case 'F': /* set field separator */
fs = setfs(getarg(&argc, &argv, "no field separator"));
- if (CSV)
- WARNING("danger: don't set FS when --csv is in effect");break;
case 'v': /* -v a=1 to be done NOW. one -v for each */
vn = getarg(&argc, &argv, "no variable name");
@@ -203,6 +199,10 @@
argc--;
argv++;
}
+
+ if (CSV && (fs != NULL || lookup("FS", symtab) != NULL))+ WARNING("danger: don't set FS when --csv is in effect");+
/* argv[1] is now the first argument */
if (npfile == 0) { /* no -f; first argument is program */ if (argc <= 1) {--
⑨