/****************************************************************************
- * Copyright (c) 1998-2016,2017 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2018,2019 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
#include <transform.h>
#include <tty_settings.h>
-MODULE_ID("$Id: tput.c,v 1.77 2017/10/07 23:51:01 tom Exp $")
+MODULE_ID("$Id: tput.c,v 1.80 2019/07/28 18:18:41 tom Exp $")
#define PUTS(s) fputs(s, stdout)
* representations
*/
- for (k = 1; k < argc; k++) {
+ for (k = 1; (k < argc) && (k < NUM_PARM); k++) {
char *tmp = 0;
strings[k] = argv[k];
numbers[k] = strtol(argv[k], &tmp, 0);
term = getenv("TERM");
- while ((c = getopt(argc, argv, "ST:V")) != -1) {
+ while ((c = getopt(argc, argv, "ST:Vx")) != -1) {
switch (c) {
case 'S':
cmdline = FALSE;
}
is_alias = (is_clear || is_reset || is_init);
- need_tty = (is_reset || is_init);
+ need_tty = ((is_reset || is_init) ||
+ (optind < argc &&
+ (!strcmp(argv[optind], "reset") ||
+ !strcmp(argv[optind], "init"))));
/*
* Modify the argument list to omit the options we processed.