lynx-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

lynx-dev Lynx can't select /dev/null


From: Bela Lubkin
Subject: lynx-dev Lynx can't select /dev/null
Date: Tue, 10 Nov 1998 00:39:31 -0800

> Just figured out why one of my cron jobs hasn't worked for a couple of 
> months. 
> This works (on deepthought):
> /local/bin/lynx-2.8.1dev.9 -dump http://www.armory.com  < /dev/null
> This does not, and gives a highly misleading error message, which, combined
> with the fact that the site I actually want to access often *is* down, had
> me running the job manually every day:
> /local/bin/lynx -dump http://www.armory.com  < /dev/null

My fault... I did a bunch of work to make Lynx's DNS lookup truly
interruptable, and little glitches are still coming in.  I patched it as
follows.

>Bela<

*** HTTCP.c.orig        Sat Oct 24 09:49:07 1998
--- HTTCP.c     Tue Nov 10 00:30:39 1998
***************
*** 454,459 ****
--- 454,460 ----
            struct timeval timeout;
            int dns_patience = 30; /* how many seconds will we wait for DNS? */
            int child_exited = 0;
+           int ok_to_select_stdin = -1;
  
            /*
            **  Reap any children that have terminated since last time
***************
*** 526,544 ****
                */
                cycle++;
  
-               timeout.tv_sec = 1;
-               timeout.tv_usec = 0;
                FD_ZERO(&readfds);
-               FD_SET(pfd[0], &readfds);
  #ifndef USE_SLANG
                /*
                **  This allows us to abort immediately, not after 1-second
                **  timeout, when user hits abort key.  Can't do this when
                **  using SLANG (or at least I don't know how), so SLANG
                **  users must live with up-to-1s timeout.  -BL
                */
!               FD_SET(0, &readfds);    /* stdin -BL */
  #endif /* USE_SLANG */
  
                /*
                **  Return when data received, interrupted, or failed.
--- 527,558 ----
                */
                cycle++;
  
                FD_ZERO(&readfds);
  #ifndef USE_SLANG
                /*
                **  This allows us to abort immediately, not after 1-second
                **  timeout, when user hits abort key.  Can't do this when
                **  using SLANG (or at least I don't know how), so SLANG
                **  users must live with up-to-1s timeout.  -BL
+               **
+               **  Whoops -- we need to make sure stdin is actually
+               **  selectable!  /dev/null isn't, on some systems, which
+               **  makes some useful Lynx invocations fail.  -BL
                */
!               if (ok_to_select_stdin == -1) {
!                   timeout.tv_sec = 0;
!                   timeout.tv_usec = 0;
!                   FD_SET(0, &readfds);    /* stdin -BL */
!                   selret = select(1, &readfds, NULL, NULL, &timeout);
!                   if (selret >= 0) ok_to_select_stdin = 1;
!                   else ok_to_select_stdin = 0;
!                   FD_ZERO(&readfds);
!               }
!               if (ok_to_select_stdin) FD_SET(0, &readfds);
  #endif /* USE_SLANG */
+               timeout.tv_sec = 1;
+               timeout.tv_usec = 0;
+               FD_SET(pfd[0], &readfds);
  
                /*
                **  Return when data received, interrupted, or failed.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]