]> ncurses.scripts.mit.edu Git - ncurses.git/blobdiff - progs/tput.c
ncurses 6.1 - patch 20190601
[ncurses.git] / progs / tput.c
index 76370cbcb74cc8cb3355da93d041d67a17935a03..88e757994fa123a0e4d241b05509e1bca0f13947 100644 (file)
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 1998-2016,2017 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2017,2018 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            *
@@ -50,7 +50,7 @@
 #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.79 2018/06/30 15:56:01 Nicholas.Marriott Exp $")
 
 #define PUTS(s)                fputs(s, stdout)
 
@@ -293,7 +293,7 @@ main(int argc, char **argv)
 
     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;
@@ -316,7 +316,10 @@ main(int argc, char **argv)
     }
 
     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.