lynx-dev
[Top][All Lists]
Advanced

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

lynx-dev DOS patch


From: Leonid Pauzner
Subject: lynx-dev DOS patch
Date: Wed, 30 Dec 1998 14:48:10 +0300 (MSK)

* Fix HTDOS_name() for local files whose name are a single letter only.
* Remove "FIXME" hack (for DOSPATH || __EMX__) in edit_current_document()
  since it is explicitely covered by HTDOS_name/HTSYS_name.

This is against clean dev12.



diff -u old/htdos.c ./htdos.c
--- old/htdos.c Mon Dec 28 12:03:18 1998
+++ ./htdos.c   Wed Dec 30 13:42:16 1998
@@ -40,7 +40,7 @@

     if(*cp_url == ':') {
        cp_url++;
-       *cp_url = '/';
+       *cp_url = '/';   /* terminate drive letter to survive */
     }

     return(wwwname);
@@ -65,19 +65,30 @@

     for (joe = 0; cp_url[joe] != '\0'; joe++)  {
        if (cp_url[joe] == '/') {
-           cp_url[joe] = '\\';
+           cp_url[joe] = '\\';    /* convert slashes to dos-style */
        }
     }

     /* Needed to surf the root of a local drive. */

-    if(strlen(cp_url) < 4) cp_url[2] = ':';
-    if(strlen(cp_url) == 3) strcpy(cp_url+3, "\\");
-    if(strlen(cp_url) == 4) strcpy(cp_url+4, ".");
+/*  if((strlen(cp_url) == 2)
+           && isalpha(cp_url[1]))
+       strcpy(cp_url+2, ":"); */   /* guess??? it was a drive letter */
+    if((strlen(cp_url) == 3)
+           && isalpha(cp_url[1])
+           && (cp_url[2] == ':'))
+       strcpy(cp_url+3, "\\");  /* c: -> c:\  */
+/*  if((strlen(cp_url) == 4)
+           && isalpha(cp_url[1])
+           && (cp_url[2] == ':')
+           && (cp_url[2] == '\\'))
+       strcpy(cp_url+4, "."); */  /* c:\ -> c:\. (may live without it) */

-    if((strlen(cp_url) > 2) && (cp_url[1] == '|'))
+    if((strlen(cp_url) > 2) && (cp_url[1] == '|'))  /* ? */
        cp_url[1] = ':';

+    /* pesky leading slash, rudiment from file://localhost/  */
+    /* the rest path may be with or without drive letter     */
     if((cp_url[1] == '\\') || (cp_url[0]  != '\\')) {
        result = cp_url;
     } else {


diff -u old/lyedit.c ./lyedit.c
--- old/lyedit.c        Mon Dec 28 12:05:32 1998
+++ ./lyedit.c  Wed Dec 30 10:56:20 1998
@@ -77,14 +77,9 @@
 #endif /* !VMS */
        filename = HTParse(newfile, "", PARSE_PATH+PARSE_PUNCTUATION);
        HTUnEscape(filename);
-#if defined (DOSPATH) || defined (__EMX__)
-       if (strlen(filename) > 1) {     /* FIXME: why do we need to do this? */
-           int n;
-           for (n = 0; (filename[n] = filename[n+1]) != 0; n++)
-               ;
-       }
-#endif
-       if ((fp = fopen(HTSYS_name(filename), "r")) == NULL)
+       StrAllocCopy(filename, HTSYS_name(filename));
+
+       if ((fp = fopen(filename, "r")) == NULL)
        {
            HTAlert(COULD_NOT_ACCESS_FILE);
            goto done;
@@ -98,7 +93,7 @@
     /*
      *  Don't allow editing if user lacks append access.
      */
-    if ((fp = fopen(HTSYS_name(filename), "a")) == NULL)
+    if ((fp = fopen(filename, "a")) == NULL)
     {
        HTUserMsg(NOAUTH_TO_EDIT_FILE);
        goto done;
@@ -128,19 +123,19 @@
 #ifdef VMS
        format = "%s %s -%s";
        HTAddParam(&command, format, params++, editor);
-       HTAddParam(&command, format, params++, HTVMS_name("", filename));
+       HTAddParam(&command, format, params++, filename);
        HTAddParam(&command, format, params++, position);
        HTEndParam(&command, format, params);
 #else
        format = "%s +%s %s";
        HTAddParam(&command, format, params++, editor);
        HTAddParam(&command, format, params++, position);
-       HTAddParam(&command, format, params++, HTSYS_name(filename));
+       HTAddParam(&command, format, params++, filename);
        HTEndParam(&command, format, params);
 #endif
     } else {
        HTAddParam(&command, format, params++, editor);
-       HTAddParam(&command, format, params++, HTSYS_name(filename));
+       HTAddParam(&command, format, params++, filename);
        HTEndParam(&command, format, params);
     }




reply via email to

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