lynx-dev
[Top][All Lists]
Advanced

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

Re: LYNX-DEV A bunch of patches


From: Ryan Hung
Subject: Re: LYNX-DEV A bunch of patches
Date: Mon, 9 Dec 1996 02:30:54 -0800 (PST)

[To the list:] My apologies for resending the very large 'bunch of
patches' message.  I thought that it didn't go through the first time
because I didn't get the message back through the list.  It turned out
that it came a few days later due to local mail delivery problems.

On Thu, 5 Dec 1996, Klaus Weide wrote:
> I did some fixes of the DIRED code.  Most of them are now included in
> Hiram Lester's composite updates, available from
> 
>         <URL: http://www.mtsu.edu/~ripa0003/lynx.html>.
>
> The zip problem should be already fixed.

I'll take a look ASAP.

[snip]

> > LYGetFile.c:
> > 
> > - One small change so that documents are reloaded after finishing a
> > lynxprog or lynxexec.  Because Lynx does not reload no-cache pages after
> > exiting from a lynxprog or lynxexec, as it should.
> 
> Could you explain why you think it should?

Well, in general, anytime running a lynxprog or lynxexec changes something
on the screen prior to loading the program, the changes should be
reflected on that screen.  E.g., on our system, we have a CGI for the
E-mail page which both provides a link to Pine through a lynxprog link, as
well as providing an index of messages in the user's inbox.  If the E-mail
page is not updated after exiting from Pine, the page no longer provides a
current display of the status of the user's inbox.

[snip]

> > Also, I changed the ZIP%f's to ZIP%p's, so as to specify
> > the full path.  As per above, I can't seem to get zip to be called in the
> > current working directory when specifying just a filename.  It seems to
> > want to do everything from the home directory.  Funny thing is that gzip
> > works fine, and the code is nearly identical!
> 
> You should have a look at Hiram's composite patches (see URL above).
> Most likely the changes in there will be in the next Lynx version.
> Maybe you could redo your additions to LYLocal.c against the composite
> patches' version.  Note that that file has changed a lot, but you should
> still be able to recognize it :).
> 
> I have also some more changes relevant to DIRED at
> 
>         URL: http://www.tezcat.com/~kweide/lynx-patches/
> 
> which haven't made it into Hiram's code set (yet?).  You may want to
> look at that, too.

Ok, I'll try.  Just gotta find the time...

> Your patch for LYLocal.c showed a lot of diff sections where the only
> difference is caused by reformatting (or expansion of TABs).  That
> makes it more difficult to find the real differences... Could you
> resend the patch (only for that file) without those?  (Maybe just use
> diff -bwc instead of diff -c.)  Or better yet, resend them after 
> upgrading them to the current development code...

Hmm, sorry 'bout that.  I'll keep that in mind in the future.  Below is
the patch for LYLocal.c using diff -bwc.

                                                        Ryan.

_/  \__/  \__/  \__/  \__/  \__/  \__/  \__/address@hidden/  \__/  \__/
 \_Apoptosis=programmed cell death/  \__/  address@hidden/  \__/  \__
_/ --you can't live without it!/  \__/  \__/  \__/  \__/  \__/  \__/  \__/
 \__/  \__/  \__/  \__/  \__/  \__/  \__/  \My words Copyright (C) 1996  \__


*** src/LYLocal.c       Sun Sep  1 20:24:44 1996
--- ../lynx2-6.vcn/src/LYLocal.c        Wed Nov 27 13:04:03 1996
***************
*** 129,135 ****
  
  #ifdef OK_ZIP
  { DE_DIR,           "", "Package and compress",
!            "(using zip)", "LYNXDIRED://ZIP%f",                        NULL },
  #endif /* OK_ZIP */
  
  { DE_FILE,          "", "Compress",
--- 129,135 ----
  
  #ifdef OK_ZIP
  { DE_DIR,             "", "Package and compress",
!          "(using zip)", "LYNXDIRED://ZIP%p",                  NULL },
  #endif /* OK_ZIP */
  
  { DE_FILE,            "", "Compress",
***************
*** 142,148 ****
  
  #ifdef OK_ZIP
  { DE_FILE,          "", "Compress",
!            "(using zip)", "LYNXDIRED://ZIP%f",                        NULL },
  #endif /* OK_ZIP */
  
  { DE_TAG,           "", "Move all tagged items to another location.",
--- 142,148 ----
  
  #ifdef OK_ZIP
  { DE_FILE,            "", "Compress",
!          "(using zip)", "LYNXDIRED://ZIP%p",                  NULL },
  #endif /* OK_ZIP */
  
  { DE_TAG,             "", "Move all tagged items to another location.",
***************
*** 151,160 ****
--- 151,311 ----
  { DE_TAG,             "", "Remove all tagged files and directories.",
                      "", "LYNXDIRED://REMOVE_TAGGED",          NULL },
  
+ /* Download tagged files - rhung */
+ 
+ { DE_TAG,             "", "Download all tagged files.",
+                     "", "LYNXDIRED://DOWNLOAD_TAGGED",        NULL },
+ 
+ /* Zip tagged files - rhung */
+ 
+ { DE_TAG,             "", "Zip together all tagged files.",
+                     "", "LYNXDIRED://ZIP_TAGGED%d",             NULL },
+ 
  { 0,                NULL, NULL,
                    NULL, NULL,                                 NULL }
  };
  
+ PRIVATE BOOLEAN zip_tagged ARGS1(
+       char *,         current_location)
+ {
+    char *cp,*tp;
+    int count,i;
+    char command[2048];
+    char tmpbuf[512];
+    char testpath[512];
+    char testpatht[1024];
+    struct stat dir_info;
+    char *args[5];
+    char *bad_chars = ".~/";
+    taglink *tag;
+ 
+    if (tagged == NULL) return 0; /* should never happen */
+ 
+    sprintf(command, "%s -9jrq ", ZIP_PATH);
+ 
+    if (filename("Enter name of zipfile to create: ",
+               tmpbuf, sizeof(tmpbuf)) == NULL)
+       return 0;
+ 
+    if (!no_dotfiles && show_dotfiles) {
+        bad_chars = "~/";
+    }
+ 
+    if(strstr(tmpbuf,"//") != NULL) {
+       _statusline("Illegal redirection \"//\" found! Request ignored.");
+       sleep(AlertSecs);
+    } else if(strlen(tmpbuf) && strchr(bad_chars,tmpbuf[0]) == NULL) {
+       strcpy(testpath,current_location);
+       if(testpath[strlen(testpath)-1] != '/')
+       strcat(testpath,"/");
+ 
+ /* append the target filename to the current location */
+ 
+       strcat(testpath,tmpbuf);
+ 
+ /* make sure the target does not already exist */
+ 
+       if (stat(testpath,&dir_info) == -1) {
+        if (errno != ENOENT) {
+           sprintf(tmpbuf,"Unable to determine status of %s ",testpath);
+           _statusline(tmpbuf);
+           sleep(AlertSecs);
+           return 0;
+        } 
+        strcat(command,testpath);
+        strcat(command," ");
+        count = 0;
+        tag = tagged;
+        while(tag != NULL) {
+           cp = tag->name;
+           if(is_url(cp) == FILE_URL_TYPE) { /* unecessary check */
+           tp = cp;
+           if(!strncmp(tp,"file://localhost",16))
+             tp += 16;
+           else if(!strncmp(tp,"file:",5))
+             tp += 5;
+           strcpy(testpatht,tp);
+           HTUnEscape(testpatht);
+           if((i = strlen(testpatht)) && testpatht[i-1] == '/')
+             testpatht[i-1] = '\0';
+         }
+         strcat(command,testpatht);
+         strcat(command," ");
+         ++count;
+         tag = tag->next;
+      }
+        stop_curses();
+        system(command);
+        start_curses();
+        clear_tags();
+        return count;
+        } else if ((dir_info.st_mode & S_IFMT) == S_IFDIR) {
+        _statusline(
+          "There is already a directory with that name! Request ignored. ");
+        sleep(AlertSecs);
+       } else if ((dir_info.st_mode & S_IFMT) == S_IFREG) {
+        _statusline(
+               "There is already a file with that name! Request ignored. ");
+        sleep(AlertSecs);
+       } else {
+        _statusline(
+               "The specified name is already in use! Request ignored. ");
+        sleep(AlertSecs);
+       }
+    }
+    return 0;
+ }
+ 
+ 
+ 
+ PRIVATE BOOLEAN download_tagged ()
+ {
+   char *cp,*tp;
+   int count,i;
+   char command[2048];
+   char testpath[512];
+   char tmpbuf[1024];
+   taglink *tag;
+ 
+   if (tagged == NULL) return 0; /* should never happen */
+ 
+   sprintf(command, "%s -b -w1024 ", SZ_PATH);
+ 
+   count = 0;
+   tag = tagged;
+   while(tag != NULL) {
+      cp = tag->name;
+      if(is_url(cp) == FILE_URL_TYPE) { /* unecessary check */
+        tp = cp;
+        if(!strncmp(tp,"file://localhost",16))
+          tp += 16;
+        else if(!strncmp(tp,"file:",5))
+          tp += 5;
+        strcpy(testpath,tp);
+        HTUnEscape(testpath);
+        if((i = strlen(testpath)) && testpath[i-1] == '/')
+          testpath[i-1] = '\0';
+      }
+      strcat(command,testpath);
+      strcat(command," ");
+      ++count;
+      tag = tag->next;
+   }
+ 
+   sprintf(tmpbuf, "something");
+   stop_curses();
+   system(command);
+   while(tmpbuf[0] != '\0') {
+      printf("\n%s", RETURN_TO_LYNX);
+      fflush(stdout);
+      tmpbuf[0] = '\0';
+      LYgetstr(tmpbuf, VISIBLE, sizeof(tmpbuf), NORECALL);
+   }
+   start_curses();
+   clear_tags();
+   return count;
+ }
+ 
  /* Remove all tagged files and directories. */
  
  PRIVATE BOOLEAN remove_tagged NOARGS
***************
*** 1236,1241 ****
--- 1387,1403 ----
        if (modify_location(&line[27])) ++LYforce_no_cache;
     } else if (!strncmp(line,"LYNXDIRED://MOVE_TAGGED",23)) {
        if (modify_tagged(&line[23])) ++LYforce_no_cache;
+ 
+ /* Add LYNXDIRED://DOWNLOAD_TAGGED - rhung */
+ 
+    } else if (!strncmp(line,"LYNXDIRED://DOWNLOAD_TAGGED",27)) {
+       if (download_tagged()) ++LYforce_no_cache;
+ 
+ /* Add LYNXDIRED://ZIP_TAGGED - rhung */
+ 
+    } else if (!strncmp(line,"LYNXDIRED://ZIP_TAGGED",22)) {
+       if (zip_tagged(&line[22])) ++LYforce_no_cache;
+ 
  #ifdef OK_PERMIT
     } else if (!strncmp(line,"LYNXDIRED://PERMIT_SRC",22)) {
        permit_location(NULL, &line[22], &tp);
***************
*** 1333,1345 ****
  
  #ifdef OK_GZIP
        } else if (!strncmp(line,"LYNXDIRED://GZIP",16)) {
        tp = quote_pathname(line+16);
!       sprintf(buffer,"%s -q %s", GZIP_PATH, tp);
        FREE(tp);
  # ifndef ARCHIVE_ONLY
        } else if (!strncmp(line,"LYNXDIRED://UNGZIP",18)) {
        tp = quote_pathname(line+18);
!       sprintf(buffer,"%s -d %s", GZIP_PATH, tp);
        FREE(tp);
  # endif /* !ARCHIVE_ONLY */
  #endif /* OK_GZIP */
--- 1495,1513 ----
  
  #ifdef OK_GZIP
        } else if (!strncmp(line,"LYNXDIRED://GZIP",16)) {
+         *cp++ = '\0';
+         cp = quote_pathname(cp);
        tp = quote_pathname(line+16);
!       sprintf(buffer,"cd %s; %s -q %s", tp, GZIP_PATH, cp);
!       FREE(cp);
        FREE(tp);
  # ifndef ARCHIVE_ONLY
        } else if (!strncmp(line,"LYNXDIRED://UNGZIP",18)) {
+         *cp++ = '\0';
+         cp = quote_pathname(cp);
        tp = quote_pathname(line+18);
!       sprintf(buffer,"cd %s; %s -d %s", tp, GZIP_PATH, cp);
!       FREE(cp);
        FREE(tp);
  # endif /* !ARCHIVE_ONLY */
  #endif /* OK_GZIP */
***************
*** 1346,1358 ****
  
  #ifdef OK_ZIP
        } else if (!strncmp(line,"LYNXDIRED://ZIP",15)) {
        tp = quote_pathname(line+15);
!       sprintf(buffer,"%s -rq %s.zip %s", ZIP_PATH, tp, tp);
        FREE(tp);
  # ifndef ARCHIVE_ONLY
        } else if (!strncmp(line,"LYNXDIRED://UNZIP",17)) {
        tp = quote_pathname(line+17);
!       sprintf(buffer,"%s -q %s", UNZIP_PATH, tp);
        FREE(tp);
  # endif /* !ARCHIVE_ONLY */
  #endif /* OK_ZIP */
--- 1514,1532 ----
  
  #ifdef OK_ZIP
        } else if (!strncmp(line,"LYNXDIRED://ZIP",15)) {
+         *cp++ = '\0';
+         cp = quote_pathname(cp);
        tp = quote_pathname(line+15);
!       sprintf(buffer,"cd %s; %s -9jrq %s.zip %s", tp, ZIP_PATH, cp, cp);
!       FREE(cp);
        FREE(tp);
  # ifndef ARCHIVE_ONLY
        } else if (!strncmp(line,"LYNXDIRED://UNZIP",17)) {
+         *cp++ = '\0';
+         cp = quote_pathname(cp);
        tp = quote_pathname(line+17);
!       sprintf(buffer,"cd %s; %s -j -q %s", tp, UNZIP_PATH, cp);
!       FREE(cp);
        FREE(tp);
  # endif /* !ARCHIVE_ONLY */
  #endif /* OK_ZIP */

;
; To UNSUBSCRIBE:  Send a mail message to address@hidden
;                  with "unsubscribe lynx-dev" (without the
;                  quotation marks) on a line by itself.
;

reply via email to

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