]> git.sur5r.net Git - openldap/commitdiff
Do not use struct winsize or declare chwinsz unless defined(TIOCGWINSZ)
authorHallvard Furuseth <hallvard@openldap.org>
Sun, 22 Nov 1998 05:14:41 +0000 (05:14 +0000)
committerHallvard Furuseth <hallvard@openldap.org>
Sun, 22 Nov 1998 05:14:41 +0000 (05:14 +0000)
clients/ud/main.c
clients/ud/ud.h

index 3d9a004180285793f59a3775bcd01d98bf1acf46..5a527c2979f1b98bd1c0d4df982f319f305795ec 100644 (file)
@@ -681,18 +681,13 @@ initialize_client( void )
 #ifndef NO_TERMCAP
        {
        char *term;
-       struct winsize win;                     /* for tty set-up */
 
        if (((term = getenv("TERM")) == NULL) || (tgetent(bp, term) <= 0))
                return;
        else {
 #ifdef TIOCGWINSZ
-               if (ioctl(fileno(stdout), TIOCGWINSZ, &win) < 0) {
-                       lpp = tgetnum("li");
-                       col_size = tgetnum("co");
-               } else
-#endif
-               {
+               struct winsize win;             /* for tty set-up */
+               if (ioctl(fileno(stdout), TIOCGWINSZ, &win) >= 0) {
                        if ((lpp = win.ws_row) == 0)
                                lpp = tgetnum("li");
                        if ((col_size = win.ws_col) == 0)
@@ -701,10 +696,14 @@ initialize_client( void )
                                lpp = DEFAULT_TTY_HEIGHT;
                        if ((col_size <= 0) || tgetflag("hc"))
                                col_size = DEFAULT_TTY_WIDTH;
+                       (void) SIGNAL (SIGWINCH, chwinsz);
+               } else
+#endif
+               {
+                       lpp = tgetnum("li");
+                       col_size = tgetnum("co");
                }
        }
-       (void) SIGNAL (SIGWINCH, chwinsz);
-
        }
 #endif
 }
index aeea56ae640c5b24d9e21c18c7e494258c75fd93..a5245479e3dce2eb64593a85c683ec221b1b4c0a 100644 (file)
@@ -230,7 +230,7 @@ void status LDAP_P(( void ));
 void change_base       LDAP_P(( int type, char **base, char *s ));
 void initialize_client LDAP_P(( void ));
 RETSIGTYPE  attn       LDAP_P(( int sig ));
-#ifndef NO_TERMCAP
+#if !defined(NO_TERMCAP) && defined(TIOCGWINSZ)
 RETSIGTYPE  chwinsz    LDAP_P(( int sig ));
 #endif