]> ncurses.scripts.mit.edu Git - ncurses.git/blobdiff - test/ditto.c
ncurses 6.2 - patch 20210821
[ncurses.git] / test / ditto.c
index 6d8ba46e1606369630b23322e3a0431acac80d2c..fdc8611aaf6d3862dd47cc9d56352889ccb2d6eb 100644 (file)
@@ -30,7 +30,7 @@
 /*
  * Author: Thomas E. Dickey (1998-on)
  *
 /*
  * Author: Thomas E. Dickey (1998-on)
  *
- * $Id: ditto.c,v 1.50 2021/03/20 16:05:49 tom Exp $
+ * $Id: ditto.c,v 1.52 2021/08/15 20:07:11 tom Exp $
  *
  * The program illustrates how to set up multiple screens from a single
  * program.
  *
  * The program illustrates how to set up multiple screens from a single
  * program.
@@ -182,7 +182,7 @@ open_tty(char *path)
 #else
     struct stat sb;
 
 #else
     struct stat sb;
 
-    if (stat(path, &sb) < 0)
+    if (stat(path, &sb) == -1)
        failed(path);
     if ((sb.st_mode & S_IFMT) != S_IFCHR) {
        errno = ENOTTY;
        failed(path);
     if ((sb.st_mode & S_IFMT) != S_IFCHR) {
        errno = ENOTTY;
@@ -353,7 +353,6 @@ static void *
 handle_screen(void *arg)
 {
     DDATA ddata;
 handle_screen(void *arg)
 {
     DDATA ddata;
-    int ch;
 
     memset(&ddata, 0, sizeof(ddata));
     ddata.ditto = (DITTO *) arg;
 
     memset(&ddata, 0, sizeof(ddata));
     ddata.ditto = (DITTO *) arg;
@@ -361,7 +360,7 @@ handle_screen(void *arg)
     ddata.ditto -= ddata.source;       /* -> base of array */
 
     for (;;) {
     ddata.ditto -= ddata.source;       /* -> base of array */
 
     for (;;) {
-       ch = read_screen(ddata.ditto->screen, &ddata);
+       int ch = read_screen(ddata.ditto->screen, &ddata);
        if (ch == CTRL('D')) {
            int later = (ddata.source ? ddata.source : -1);
            int j;
        if (ch == CTRL('D')) {
            int later = (ddata.source ? ddata.source : -1);
            int j;