aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorozan yigit <ozan.yigit@gmail.com>2023-12-28 14:49:20 -0500
committerozan yigit <ozan.yigit@gmail.com>2023-12-28 14:49:20 -0500
commit08fa2b8c53138ee1162a2b9be78e192adcce26ec (patch)
tree8fb05fac376ba673dfb77fc2b142816b0c47c53d
parentb7461b63f231d2d45a5309e6ee207276e7c44a98 (diff)
downloadone-true-awk-08fa2b8c53138ee1162a2b9be78e192adcce26ec.tar.gz
adjust version date: 20231228
Fix inconsistent handling of --csv and FS set via -v.
-rw-r--r--main.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/main.c b/main.c
index 8c8fb40..58f1541 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 20231127";
+const char *version = "version 20231228";
#define DEBUG
#include <stdio.h>
@@ -157,8 +157,6 @@ int main(int argc, char *argv[])
}
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 @@ int main(int argc, char *argv[])
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 @@ int main(int argc, char *argv[])
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) {