lynx-dev
[Top][All Lists]
Advanced

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

lynx-dev Revised DOS patch for LYDownload.c


From: Doug Kaufman
Subject: lynx-dev Revised DOS patch for LYDownload.c
Date: Wed, 2 Sep 1998 17:53:01 -0700 (PDT)

The patch that I submitted yesterday leaves a potential null pointer
with possibility for SIGSEGV. I fixed that and added changes that
will allow the use of ~ for the HOME directory under DOS (i.e.
allow download to ~/file.ext) in addition to allowing downloading
to any directory when full pathname is specified. This is tied to
the presence of ":" in the buffer, which shouldn't be there unless a
pathname such as f:/path/file.ext is present. I suspect that there
is a better way to do this. Perhaps someone who knows C can suggest
a different patch. I am not sure if any of these changes should also
apply to the Win32 port.
                                Doug

*** lynx2-8-1/src/LYDownload.c  Sat Aug 29 16:22:40 1998
--- lynx2-8-1/src/LYDownload.c.new      Wed Sep  2 17:19:10 1998
***************
*** 264,274 ****
        }
  #else
  #ifndef __EMX__
!       if (*buffer != '/')
            cp = getenv("PWD");
        else
  #endif /* __EMX__*/
            cp = NULL;
        if (cp) {
            sprintf(command, "%s/%s", cp, buffer);
  #ifdef DOSPATH
--- 264,284 ----
        }
  #else
  #ifndef __EMX__
!       if (*buffer != '/'){
! #ifdef __DJGPP__
!               if (strchr(buffer, ':') != NULL)
!                       cp = NULL;
!               else
! #endif /*  __DJGPP__ */
            cp = getenv("PWD");
+       }
        else
  #endif /* __EMX__*/
            cp = NULL;
+ #ifdef __DJGPP__
+           if (cp != NULL &&(len = strlen(cp)) > 0 && cp[len-1] == '/')
+               cp[len-1] = '\0';
+ #endif /* __DJGPP__ */
        if (cp) {
            sprintf(command, "%s/%s", cp, buffer);
  #ifdef DOSPATH

__
Doug Kaufman
Internet: address@hidden (preferred)
          address@hidden

reply via email to

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