lynx-dev
[Top][All Lists]
Advanced

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

lynx-dev lynx 2.8.2. dev 22


From: Andy Harper
Subject: lynx-dev lynx 2.8.2. dev 22
Date: Tue, 13 Apr 1999 18:04:08 BST

Trying to build 2.8.2 dev 22 under VMS 6.2 and DEC C results in a number of
problems still.

First, 'sleep' is undeclared in
    Gridtext.c
    HTalert.c
    LYbookmark.c
    LYedit.c
    LYjump.c
    LYstrings.c

Second, 'alarm' is undeclared in
    LYCurses.c

All of these are warnings only but still should be fixed. Both are declared
in 'unistd.h' for DEC C

The files HTutils.h and HTstring.H both include each other. This lead to a
rather repetitious listing in the compilation

HTFILE.C will not compile at all. The error is obscure. The error and an
extract from the listing is enclosed (with all macro expansions etc turned
on).  I think it's a mismatched '}' somewhere but I gave up trying to find it!
Lines marked with an X down the left are EXCLUDED by ifdef's.

Finally, I think DISP_PARTIAL should be defined for the compilation within
BUILD.COM and the DESCRIP.MMS files.

Regards,

Andy Harper
Kings College London

Here's the two routines around the error in their entirety (to assist
debugging). Sorry they are a bit long...

          32263 /*      Output parent directory entry.
          32264 **      ------------------------------
          32265 **
          32266 **    This gives the TITLE and H1 header, and also a link
          32267 **    to the parent directory if appropriate.
          32268 **
          32269 **  On exit:
          32270 **      Returns TRUE if an "Up to <parent>" link was not created
          32271 **      for a readable local directory because LONG_LIST is 
defined
          32272 **      and NO_PARENT_DIR_REFERENCE is not defined, such that 
the
          32273 **      calling function use LYListFmtParse() to create a link 
to
          32274 **      the parent directory.  Otherwise, it returns FALSE. - FM
          32275 */
          32276 PUBLIC BOOL HTDirTitles ARGS3(
      1E        
      1E               BOOLEAN
      1E                                (HTStructured * target, HTAnchor * 
anchor, BOOLEAN tildeIsTop)
          32277         HTStructured *, target,
          32278         HTAnchor *,     anchor,
          32279         BOOL,           tildeIsTop)
          32280 {
          32281     char * logical = HTAnchor_address(anchor);
          32282     char * path = HTParse(logical, "", PARSE_PATH + 
PARSE_PUNCTUATION);
      1E                                               4
      1E                                                            1
          32283     char * current;
          32284     char * cp = NULL;
      1E                        ((void *) 0)
          32285     BOOL need_parent_link = FALSE;
      1E            BOOLEAN
      1E                                    (0)
          32286     int i;
          32287 
          32288 #ifdef DOSPATH
       X  32289     BOOL local_link = FALSE;
       X  32290     if (logical[18] == ':') local_link = TRUE;
       X  32291 #endif
          32292     /*
          32293     **  Check tildeIsTop for treating home directory as Welcome
          32294     **  (assume the tilde is not followed by a username). - FM
          32295     */
          32296     if (tildeIsTop && !strncmp(path, "/~", 2)) {
          32297         if (path[2] == '\0') {
          32298             path[1] = '\0';

                                Source Listing                  13-APR-1999 
17:06:13  DEC C V5.5-002                    Page 585    
                                                                13-APR-1999 
09:39:16  HTFILE.C;1  

          32299         } else {
          32300             for (i = 0; path[(i + 2)]; i++) {
          32301                 path[i] = path[(i + 2)];
          32302             }
          32303             path[i] = '\0';
          32304         }
          32305     }
          32306 
          32307     /*
          32308     **  Trim out the ;type= parameter, if present. - FM
          32309     */
          32310     if ((cp = strrchr(path, ';')) != NULL) {
      1E                                             ((void *) 0)
          32311         if (!strncasecomp((cp+1), "type=", 5)) {
          32312             if (TOUPPER(*(cp+6)) == 'D' ||
      1E                 
(((decc$$gl___ctypea)?(*decc$$ga___ctypet)[(int)((unsigned 
char)*(cp+6))]&0x2:islower((unsigned char)*(cp+6
      1E        ))) ? toupper((unsigned char)*(cp+6)) : ((unsigned 
char)*(cp+6)))
          32313                 TOUPPER(*(cp+6)) == 'A' ||
      1E          (((decc$$gl___ctypea)?(*decc$$ga___ctypet)[(int)((unsigned 
char)*(cp+6))]&0x2:islower((unsigned char)*(cp+6))) ? t
      1E        oupper((unsigned char)*(cp+6)) : ((unsigned char)*(cp+6)))
          32314                 TOUPPER(*(cp+6)) == 'I')
      1E          (((decc$$gl___ctypea)?(*decc$$ga___ctypet)[(int)((unsigned 
char)*(cp+6))]&0x2:islower((unsigned char)*(cp+6))) ? t
      1E        oupper((unsigned char)*(cp+6)) : ((unsigned char)*(cp+6)))
          32315                 *cp = '\0';
          32316         }
          32317         cp = NULL;
      1E              ((void *) 0)
          32318     }
          32319     current = strrchr(path, '/');       /* last part or "" */
          32320 
          32321     {
          32322       char * printable = NULL;
      1E                                 ((void *) 0)
          32323 
          32324 #ifdef DIRED_SUPPORT
       X  32325       printable = HTfullURL_toFile(
       X  32326             (0 == strncasecomp(path, "/%2F", 4))        /* "//" 
? */
       X  32327             ? (path+1)
       X  32328             : path);
       X  32329       if (0 == strncasecomp(printable, "/vmsysu:", 8) ||
       X  32330           0 == strncasecomp(printable, "/anonymou.", 10)) {
       X  32331           StrAllocCopy(cp, (printable+1));
       X  32332           StrAllocCopy(printable, cp);
       X  32333           FREE(cp);
       X  32334       }
       X  32335 #else
          32336       StrAllocCopy(printable, (current ? current + 1 : ""));
      1E              HTSACopy (&(printable), (current ? current + 1 : ""))
          32337       HTUnEscape(printable);
          32338 #endif /* DIRED_SUPPORT */
          32339 
          32340       START(HTML_HEAD);
      1E              (*target->isa->start_element)(target, HTML_HEAD, 0, 0, 
-1, 0)
          32341       PUTC('\n');
      1E              (*target->isa->put_character)(target, '\n')
          32342       START(HTML_TITLE);
      1E              (*target->isa->start_element)(target, HTML_TITLE, 0, 0, 
-1, 0)

                                Source Listing                  13-APR-1999 
17:06:13  DEC C V5.5-002                    Page 586    
                                                                13-APR-1999 
09:39:16  HTFILE.C;1  

          32343       PUTS(*printable ? printable : WELCOME_MSG);
      1E              (*target->isa->put_string)(target, *printable ? printable 
: "Welcome")
          32344       PUTS(SEGMENT_DIRECTORY);
      1E              (*target->isa->put_string)(target, " directory")
          32345       END(HTML_TITLE);
      1E              (*target->isa->end_element)(target, HTML_TITLE, 0)
          32346       PUTC('\n');
      1E              (*target->isa->put_character)(target, '\n')
          32347       END(HTML_HEAD);
      1E              (*target->isa->end_element)(target, HTML_HEAD, 0)
          32348       PUTC('\n');
      1E              (*target->isa->put_character)(target, '\n')
          32349 
          32350 #ifdef DIRED_SUPPORT
       X  32351       START(HTML_H2);
       X  32352       PUTS(*printable ? SEGMENT_CURRENT_DIR : "");
       X  32353       PUTS(*printable ? printable : WELCOME_MSG);
       X  32354       END(HTML_H2);
       X  32355       PUTC('\n');
       X  32356 #else
          32357       START(HTML_H1);
      1E              (*target->isa->start_element)(target, HTML_H1, 0, 0, -1, 
0)
          32358       PUTS(*printable ? printable : WELCOME_MSG);
      1E              (*target->isa->put_string)(target, *printable ? printable 
: "Welcome")
          32359       END(HTML_H1);
      1E              (*target->isa->end_element)(target, HTML_H1, 0)
          32360       PUTC('\n');
      1E              (*target->isa->put_character)(target, '\n')
          32361 #endif /* DIRED_SUPPORT */
          32362       if (((0 == strncasecomp(printable, "vmsysu:", 7)) &&
          32363            (cp = strchr(printable, '.')) != NULL &&
      1E                                             ((void *) 0)
          32364            strchr(cp, '/') == NULL) ||
      1E                               ((void *) 0)
          32365           (0 == strncasecomp(printable, "anonymou.", 9) &&
          32366            strchr(printable, '/') == NULL)) {
      1E                                      ((void *) 0)
          32367           FREE(printable);
      1E           if (printable) {free(printable); printable = ((void *) 0);}
          32368           FREE(logical);
      1E           if (logical) {free(logical); logical = ((void *) 0);}
          32369           FREE(path);
      1E           if (path) {free(path); path = ((void *) 0);}
          32370           return(need_parent_link);
          32371       }
          32372       FREE(printable);
      1E              if (printable) {free(printable); printable = ((void *) 
0);}
          32373     }
          32374 
          32375 #ifndef NO_PARENT_DIR_REFERENCE
          32376     /*
          32377     **  Make link back to parent directory.
          32378     */
          32379     if (current && current[1]) {   /* was a slash AND something 
else too */
          32380         char * parent = NULL;
      1E                         ((void *) 0)
          32381         char * relative = NULL;

                                Source Listing                  13-APR-1999 
17:06:13  DEC C V5.5-002                    Page 587    
                                                                13-APR-1999 
09:39:16  HTFILE.C;1  

      1E                           ((void *) 0)
          32382 
          32383         *current++ = '\0';
          32384         parent = strrchr(path, '/');  /* penultimate slash */
          32385 
          32386         if ((parent &&
          32387              (!strcmp(parent, "/..") ||
          32388               !strncasecomp(parent, "/%2F", 4))) ||
          32389             !strncasecomp(current, "%2F", 3)) {
          32390             FREE(logical);
      1E             if (logical) {free(logical); logical = ((void *) 0);}
          32391             FREE(path);
      1E             if (path) {free(path); path = ((void *) 0);}
          32392             return(need_parent_link);
          32393         }
          32394 
          32395         relative = 0;
          32396         HTSprintf0(&relative, "%s/..", current);
          32397 
          32398 #ifdef DOSPATH
       X  32399         if (local_link)
       X  32400             if (strlen(parent) == 3 )
       X  32401                 StrAllocCat(relative, "/.");
       X  32402 #endif
          32403 
          32404 #if !defined (VMS)
       X  32405 #ifdef DOSPATH
       X  32406         if(!local_link)
       X  32407 #endif
       X  32408         {
       X  32409             /*
       X  32410             **  On Unix, if it's not ftp and the directory 
cannot
       X  32411             **  be read, don't put out a link.
       X  32412             **
       X  32413             **  On VMS, this problem is dealt with internally by
       X  32414             **  HTVMSBrowseDir().
       X  32415             */
       X  32416             DIR  * dp = NULL;
       X  32417 
       X  32418             if (LYisLocalFile(logical)) {
       X  32419                 /*
       X  32420                 **  We need an absolute file path for the 
opendir.
       X  32421                 **  We also need to unescape for this test.
       X  32422                 **  Don't worry about %2F now, they presumably 
have been
       X  32423                 **  dealt with above, and shouldn't appear for 
local
       X  32424                 **  files anyway...  Assume OS / filesystem 
will just
       X  32425                 **  ignore superfluous slashes. - KW
       X  32426                 */
       X  32427                 char * fullparentpath = NULL;
       X  32428 
       X  32429                 /*
       X  32430                 **  Path has been shortened above.
       X  32431                 */
       X  32432                 StrAllocCopy(fullparentpath, *path ? path : 
"/");
       X  32433 
       X  32434                 /*
       X  32435                 **  Guard against weirdness.

                                Source Listing                  13-APR-1999 
17:06:13  DEC C V5.5-002                    Page 588    
                                                                13-APR-1999 
09:39:16  HTFILE.C;1  

       X  32436                 */
       X  32437                 if (0 == strcmp(current,"..")) {
       X  32438                     StrAllocCat(fullparentpath,"/../..");
       X  32439                 } else if (0 == strcmp(current,".")) {
       X  32440                     StrAllocCat(fullparentpath,"/..");
       X  32441                 }
       X  32442 
       X  32443                 HTUnEscape(fullparentpath);
       X  32444                 if ((dp = opendir(fullparentpath)) == NULL) {
       X  32445                     FREE(fullparentpath);
       X  32446                     FREE(logical);
       X  32447                     FREE(relative);
       X  32448                     FREE(path);
       X  32449                     return(need_parent_link);
       X  32450                 }
       X  32451                 closedir(dp);
       X  32452                 FREE(fullparentpath);
       X  32453 #ifdef LONG_LIST
       X  32454                 need_parent_link = TRUE;
       X  32455                 FREE(logical);
       X  32456                 FREE(path);
       X  32457                 FREE(relative);
       X  32458                 return(need_parent_link);
       X  32459 #endif /* LONG_LIST */
       X  32460             }
       X  32461         }
       X  32462 #endif /* !VMS */
          32463         HTStartAnchor(target, "", relative);
          32464         FREE(relative);
      1E         if (relative) {free(relative); relative = ((void *) 0);}
          32465 
          32466         PUTS(SEGMENT_UP_TO);
      1E         (*target->isa->put_string)(target, "Up to ")
          32467         if (parent) {
          32468             if ((0 == strcmp(current,".")) ||
          32469                 (0 == strcmp(current,".."))) {
          32470                 /*
          32471                 **  Should not happen, but if it does,
          32472                 **  at least avoid giving misleading info. - KW
          32473                 */
          32474                 PUTS("..");
      1E          (*target->isa->put_string)(target, "..")
          32475             } else {
          32476                 char * printable = NULL;
      1E                             ((void *) 0)
          32477                 StrAllocCopy(printable, parent + 1);
      1E          HTSACopy (&(printable), parent + 1)
          32478                 HTUnEscape(printable);
          32479                 PUTS(printable);
      1E          (*target->isa->put_string)(target, printable)
          32480                 FREE(printable);
      1E          if (printable) {free(printable); printable = ((void *) 0);}
          32481             }
          32482         } else {
          32483             PUTS("/");
      1E             (*target->isa->put_string)(target, "/")
          32484         }

                                Source Listing                  13-APR-1999 
17:06:13  DEC C V5.5-002                    Page 589    
                                                                13-APR-1999 
09:39:16  HTFILE.C;1  

          32485         END(HTML_A);
      1E         (*target->isa->end_element)(target, HTML_A, 0)
          32486         PUTC('\n');
      1E         (*target->isa->put_character)(target, '\n')
          32487     }
          32488 #endif /* !NO_PARENT_DIR_REFERENCE */
          32489 
          32490     FREE(logical);
      1E            if (logical) {free(logical); logical = ((void *) 0);}
          32491     FREE(path);
      1E            if (path) {free(path); path = ((void *) 0);}
          32492     return(need_parent_link);
          32493 }
          32494 
          32495 PRIVATE int print_local_dir ARGS5(
                ............................1      
%CC-E-CLOSEPAREN, (1) Missing ")".

      1E        static
      1E                                    (DIR * dp, char * localname, 
HTParentAnchor * anchor, HTFormat format_out, HTStream * si
      1E        nk)
          32496         DIR  *,                 dp,
          32497         char *,                 localname,
          32498         HTParentAnchor *,       anchor,
          32499         HTFormat,               format_out,
          32500         HTStream *,             sink)
          32501 {
          32502     HTStructured *target;       /* HTML object */
          32503     HTStructuredClass targetClass;
          32504     STRUCT_DIRENT * dirbuf;
          32505     char *logical = NULL;
                ....1                     
%CC-E-BADSTMT, (1) Invalid statement.

      1E                            ((void *) 0)
          32506     char *pathname = NULL;
                ....1                      
%CC-E-BADSTMT, (1) Invalid statement.

      1E                             ((void *) 0)
          32507     char *tail = NULL;
                ....1                  
%CC-E-BADSTMT, (1) Invalid statement.

      1E                         ((void *) 0)
          32508     BOOL present[HTML_A_ATTRIBUTES];
                .........1                           
%CC-E-NOSEMI, (1) Missing ";".

      1E            BOOLEAN
      1E                         25
          32509     char * tmpfilename = NULL;
                ....1                          
%CC-E-BADSTMT, (1) Invalid statement.

      1E                                 ((void *) 0)

                                Source Listing                  13-APR-1999 
17:06:13  DEC C V5.5-002                    Page 590    
                                                                13-APR-1999 
09:39:16  HTFILE.C;1  

          32510     BOOL need_parent_link = FALSE;
                .........1                         
%CC-E-NOSEMI, (1) Missing ";".

      1E            BOOLEAN
      1E                                    (0)
          32511     struct stat file_info;
                ....1                      
%CC-E-BADSTMT, (1) Invalid statement.

          32512     int status;
                ....1           
%CC-E-BADSTMT, (1) Invalid statement.

          32513 
          32514     CTRACE(tfp, "print_local_dir() started\n");
      1E            if((WWW_TraceFlag))si_fprintf
      1E                   TraceFP()
          32515 
          32516     logical = HTAnchor_address((HTAnchor*)anchor);
          32517     pathname = HTParse(logical, "",
          32518                        PARSE_PATH + PARSE_PUNCTUATION);
      1E                 4
      1E                              1
          32519 
          32520     if (!strcmp(pathname,"/")) {
          32521         /*
          32522         **  Root path.
          32523         */
          32524         StrAllocCopy (tail, "/foo/..");
      1E         HTSACopy (&(tail), "/foo/..")
          32525     } else {
          32526         char *p = strrchr(pathname, '/');  /* find last slash */
          32527 
          32528         if (!p) {
          32529             /*
          32530             **  This probably should not happen,
          32531             **  but be prepared if it does. - KW
          32532             */
          32533             StrAllocCopy (tail, "/foo/..");
      1E             HTSACopy (&(tail), "/foo/..")
          32534         } else {
          32535             /*
          32536             **  Take slash off the beginning.
          32537             */
          32538             StrAllocCopy(tail, (p + 1));
      1E             HTSACopy (&(tail), (p + 1))
          32539         }
          32540     }
          32541     FREE(pathname);
      1E            if (pathname) {free(pathname); pathname = ((void *) 0);}
          32542 
          32543     if (UCLYhndl_HTFile_for_unspec >= 0) {
          32544         HTAnchor_setUCInfoStage(anchor,
          32545                                 UCLYhndl_HTFile_for_unspec,
          32546                                 UCT_STAGE_PARSER,
      1E            1

                                Source Listing                  13-APR-1999 
17:06:13  DEC C V5.5-002                    Page 591    
                                                                13-APR-1999 
09:39:16  HTFILE.C;1  

          32547                                 UCT_SETBY_DEFAULT);
      1E            1
          32548     }
          32549 
          32550     target = HTML_new(anchor, format_out, sink);
          32551     targetClass = *target->isa;     /* Copy routine entry 
points */
          32552 
          32553     { int i;
          32554            for (i = 0; i < HTML_A_ATTRIBUTES; i++)
      1E                            25
          32555                    present[i] = (i == HTML_A_HREF);
      1E                                6
          32556     }
          32557 
          32558     /*
          32559     **  The need_parent_link flag will be set if an
          32560     **  "Up to <parent>" link was not created for a
          32561     **  readable parent in HTDirTitles() because
          32562     **  LONG_LIST is defined and NO_PARENT_DIR_REFERENCE
          32563     **  is not defined so that need we to create the
          32564     **  link via an LYListFmtParse() call. - FM
          32565     */
          32566     need_parent_link = HTDirTitles(target,
          32567                                    (HTAnchor *)anchor, FALSE);
      1E                                   (0)
          32568 
          32569 #ifdef DIRED_SUPPORT
       X  32570     if (strncmp(anchor->address, "lynxcgi:", 8)) {
       X  32571         HTAnchor_setFormat((HTParentAnchor *) anchor, 
WWW_DIRED);
       X  32572         lynx_edit_mode = TRUE;
       X  32573     }
       X  32574 #endif /* DIRED_SUPPORT */
          32575     if (HTDirReadme == HT_DIR_README_TOP)
      1E                               1
          32576         do_readme(target, localname);
          32577 
          32578 
          32579     {
          32580         HTBTree * bt = HTBTree_new((HTComparer)strcmp);
          32581         int num_of_entries = 0;     /* lines counter */
          32582 
          32583         _HTProgress (gettext("Reading directory..."));
      1E         mustshow = (1), HTProgress("Reading directory...")
          32584         status = HT_LOADED; /* assume we don't get interrupted 
*/
      1E                  200
          32585         while ((dirbuf = readdir(dp)) != NULL) {
      1E                                          ((void *) 0)
          32586             /*
          32587             **  While there are directory entries to be read...
          32588             */
          32589             char * dirname = NULL;
      1E                              ((void *) 0)
          32590 
          32591 #ifndef DOSPATH
          32592             if (dirbuf->d_ino == 0)
          32593                 /*
          32594                 **  If the entry is not being used, skip it.

                                Source Listing                  13-APR-1999 
17:06:13  DEC C V5.5-002                    Page 592    
                                                                13-APR-1999 
09:39:16  HTFILE.C;1  

          32595                 */
          32596                 continue;
          32597 #endif
          32598             /*
          32599             **  Skip self, parent if handled in HTDirTitles()
          32600             **  or if NO_PARENT_DIR_REFERENCE is not defined,
          32601             **  and any dot files if no_dotfiles is set or
          32602             **  show_dotfiles is not set. - FM
          32603             */
          32604             if (!strcmp(dirbuf->d_name, ".")   /* self   */ ||
          32605                 (!strcmp(dirbuf->d_name, "..") /* parent */ &&
          32606                  need_parent_link == FALSE) ||
      1E                               (0)
          32607                 ((strcmp(dirbuf->d_name, "..")) &&
          32608                  (dirbuf->d_name[0] == '.' &&
          32609                   (no_dotfiles || !show_dotfiles))))
          32610                 continue;
          32611 
          32612             StrAllocCopy(tmpfilename, localname);
      1E             HTSACopy (&(tmpfilename), localname)
          32613             if (strcmp(localname, "/"))
          32614                 /*
          32615                 **  If filename is not root directory.
          32616                 */
          32617                 StrAllocCat(tmpfilename, "/");
      1E          HTSACat (&(tmpfilename), "/")
          32618 
          32619             StrAllocCat(tmpfilename, dirbuf->d_name);
      1E             HTSACat (&(tmpfilename), dirbuf->d_name)
          32620             stat(tmpfilename, &file_info);
          32621             if (S_ISDIR(file_info.st_mode))
      1E                 (((file_info.st_mode)& 0170000) == 0040000)
          32622 #ifndef DIRED_SUPPORT
          32623                 HTSprintf0(&dirname, "D%s",dirbuf->d_name);
          32624             else
          32625                 HTSprintf0(&dirname, "F%s",dirbuf->d_name);
          32626                 /* D & F to have first directories, then files 
*/
          32627 #else
       X  32628             {
       X  32629                 if (dir_list_style == MIXED_STYLE)
       X  32630                     HTSprintf0(&dirname, " %s/", 
dirbuf->d_name);
       X  32631                 else if (!strcmp(dirbuf->d_name, ".."))
       X  32632                     HTSprintf0(&dirname, "A%s", dirbuf->d_name);
       X  32633                 else
       X  32634                     HTSprintf0(&dirname, "D%s", dirbuf->d_name);
       X  32635             }
       X  32636             else if (dir_list_style == MIXED_STYLE)
       X  32637                 HTSprintf0(&dirname, " %s", dirbuf->d_name);
       X  32638             else if (dir_list_style == FILES_FIRST)
       X  32639                 HTSprintf0(&dirname, "C%s", dirbuf->d_name);
       X  32640                 /* C & D to have first files, then directories 
*/
       X  32641             else
       X  32642                 HTSprintf0(&dirname, "F%s", dirbuf->d_name);
       X  32643 #endif /* !DIRED_SUPPORT */
          32644             /*
          32645             **  Sort dirname in the tree bt.
          32646             */

                                Source Listing                  13-APR-1999 
17:06:13  DEC C V5.5-002                    Page 593    
                                                                13-APR-1999 
09:39:16  HTFILE.C;1  

          32647             HTBTree_add(bt, dirname);
          32648 
          32649 #ifdef DISP_PARTIAL
       X  32650             /* optimize for expensive operation: */
       X  32651             if (num_of_entries % (partial_threshold > 0  ?
       X  32652                                   partial_threshold : 
display_lines)
       X  32653                                == 0) {
       X  32654                 if (HTCheckForInterrupt()) {
       X  32655                     status = HT_PARTIAL_CONTENT;
       X  32656                     break;
       X  32657                 }
       X  32658             }
       X  32659             num_of_entries++;
       X  32660 #endif /* DISP_PARTIAL */
          32661 
          32662         }   /* end while directory entries left to read */
          32663 
          32664         if (status != HT_PARTIAL_CONTENT)
      1E                       206
          32665             _HTProgress (gettext("OK"));
      1E             mustshow = (1), HTProgress("OK")
          32666         else
          32667             CTRACE(tfp, "Reading the directory interrupred by 
user\n");
      1E             if((WWW_TraceFlag))si_fprintf
      1E                    TraceFP()
          32668 
          32669 
          32670         /*
          32671         **  Run through tree printing out in order.
          32672         */
          32673         {
          32674             HTBTElement * next_element = HTBTree_next(bt,NULL);
      1E                                                          ((void *) 0)
          32675                 /* pick up the first element of the list */
          32676             int num_of_entries_partial = 0; /* lines counter */
          32677 
          32678             char state;
          32679                 /* I for initial (.. file),
          32680                    D for directory file,
          32681                    F for file */
          32682 
          32683 #ifdef DIRED_SUPPORT
       X  32684             char test;
       X  32685 #endif /* DIRED_SUPPORT */
          32686             state = 'I';
          32687 
          32688             while (next_element != NULL) {
      1E                                    ((void *) 0)
          32689                 char *entry, *file_extra;
          32690 
          32691                 StrAllocCopy(tmpfilename,localname);
      1E          HTSACopy (&(tmpfilename), localname)
          32692                 if (strcmp(localname, "/"))
          32693                     /*
          32694                     **  If filename is not root directory.
          32695                     */
          32696                     StrAllocCat(tmpfilename, "/");

                                Source Listing                  13-APR-1999 
17:06:13  DEC C V5.5-002                    Page 594    
                                                                13-APR-1999 
09:39:16  HTFILE.C;1  

      1E              HTSACat (&(tmpfilename), "/")
          32697 
          32698                 StrAllocCat(tmpfilename,
      1E          HTSACat (&(tmpfilename), (char *)((next_element)->object)+1)
          32699                             (char 
*)HTBTree_object(next_element)+1);
          32700                 /*
          32701                 **  Append the current entry's filename
          32702                 **  to the path.
          32703                 */
          32704                 HTSimplify(tmpfilename);
          32705                 /*
          32706                 **  Output the directory entry.
          32707                 */
          32708                 if (strcmp((char *)
          32709                            (HTBTree_object(next_element)), 
"D..") &&
      1E               ((next_element)->object)
          32710                     strcmp((char *)
          32711                            (HTBTree_object(next_element)), 
"A.."))
      1E               ((next_element)->object)
          32712                 {
          32713 #ifdef DIRED_SUPPORT
       X  32714                     test = (*(char 
*)(HTBTree_object(next_element))
       X  32715                             == 'D' ? 'D' : 'F');
       X  32716                     if (state != test) {
       X  32717 #ifndef LONG_LIST
       X  32718                         if (dir_list_style == FILES_FIRST) {
       X  32719                             if (state == 'F') {
       X  32720                                 END(HTML_DIR);
       X  32721                                 PUTC('\n');
       X  32722                             }
       X  32723                         } else if (dir_list_style != 
MIXED_STYLE)
       X  32724                             if (state == 'D') {
       X  32725                                 END(HTML_DIR);
       X  32726                                 PUTC('\n');
       X  32727                             }
       X  32728 #endif /* !LONG_LIST */
       X  32729                         state =
       X  32730                            (*(char 
*)(HTBTree_object(next_element))
       X  32731                             == 'D' ? 'D' : 'F');
       X  32732                         START(HTML_H2);
       X  32733                         if (dir_list_style != MIXED_STYLE) {
       X  32734                            START(HTML_EM);
       X  32735                            PUTS(state == 'D'
       X  32736                               ? LABEL_SUBDIRECTORIES
       X  32737                               : LABEL_FILES);
       X  32738                            END(HTML_EM);
       X  32739                         }
       X  32740                         END(HTML_H2);
       X  32741                         PUTC('\n');
       X  32742 #ifndef LONG_LIST
       X  32743                         START(HTML_DIR);
       X  32744                         PUTC('\n');
       X  32745 #endif /* !LONG_LIST */
       X  32746                     }
       X  32747 #else
          32748                     if (state != *(char *)(HTBTree_object(
      1E                                     ((next_element)->object)

                                Source Listing                  13-APR-1999 
17:06:13  DEC C V5.5-002                    Page 595    
                                                                13-APR-1999 
09:39:16  HTFILE.C;1  

          32749                                              next_element))) {
          32750 #ifndef LONG_LIST
          32751                         if (state == 'D') {
          32752                             END(HTML_DIR);
      1E               (*target->isa->end_element)(target, HTML_DIR, 0)
          32753                             PUTC('\n');
      1E               (*target->isa->put_character)(target, '\n')
          32754                         }
          32755 #endif /* !LONG_LIST */
          32756                         state =
          32757                           (*(char 
*)(HTBTree_object(next_element))
      1E                        ((next_element)->object)
          32758                            == 'D' ? 'D' : 'F');
          32759                         START(HTML_H2);
      1E           (*target->isa->start_element)(target, HTML_H2, 0, 0, -1, 0)
          32760                         START(HTML_EM);
      1E           (*target->isa->start_element)(target, HTML_EM, 0, 0, -1, 0)
          32761                         PUTS(state == 'D'
      1E           (*target->isa->put_string)(target, state == 'D' ? 
"Subdirectories:" : "Files:")
          32762                             ? LABEL_SUBDIRECTORIES
          32763                             : LABEL_FILES);
          32764                         END(HTML_EM);
      1E           (*target->isa->end_element)(target, HTML_EM, 0)
          32765                         END(HTML_H2);
      1E           (*target->isa->end_element)(target, HTML_H2, 0)
          32766                         PUTC('\n');
      1E           (*target->isa->put_character)(target, '\n')
          32767 #ifndef LONG_LIST
          32768                         START(HTML_DIR);
      1E           (*target->isa->start_element)(target, HTML_DIR, 0, 0, -1, 0)
          32769                         PUTC('\n');
      1E           (*target->isa->put_character)(target, '\n')
          32770 #endif /* !LONG_LIST */
          32771                     }
          32772 #endif /* DIRED_SUPPORT */
          32773 #ifndef LONG_LIST
          32774                     START(HTML_LI);
      1E              (*target->isa->start_element)(target, HTML_LI, 0, 0, -1, 
0)
          32775 #endif /* !LONG_LIST */
          32776                 }
          32777                 entry = (char*)HTBTree_object(next_element)+1;
      1E                         ((next_element)->object)
          32778                 file_extra = NULL;
      1E                       ((void *) 0)
          32779 
          32780 #ifdef LONG_LIST
       X  32781                 LYListFmtParse(list_format, tmpfilename, target,
       X  32782                     entry, tail);
       X  32783 #else
          32784                 HTDirEntry(target, tail, entry);
          32785                 PUTS(entry);
      1E          (*target->isa->put_string)(target, entry)
          32786                 END(HTML_A);
      1E          (*target->isa->end_element)(target, HTML_A, 0)
          32787                 if (file_extra) {
          32788                     PUTS(file_extra);
      1E              (*target->isa->put_string)(target, file_extra)

                                Source Listing                  13-APR-1999 
17:06:13  DEC C V5.5-002                    Page 596    
                                                                13-APR-1999 
09:39:16  HTFILE.C;1  

          32789                     FREE(file_extra);
      1E              if (file_extra) {free(file_extra); file_extra = ((void *) 
0);}
          32790                 }
          32791                 MAYBE_END(HTML_LI);
      1E          if (HTML_dtd.tags[HTML_LI].contents != SGML_EMPTY) 
(*target->isa->end_element)(target, HTML_LI, 0)
          32792                 PUTC('\n');
      1E          (*target->isa->put_character)(target, '\n')
          32793 #endif /* LONG_LIST */
          32794 
          32795                 next_element = HTBTree_next(bt, next_element);
          32796                     /* pick up the next element of the list;
          32797                      if none, return NULL*/
          32798 
          32799                 /* optimize for expensive operation: */
          32800 #ifdef DISP_PARTIAL
       X  32801                 if (num_of_entries_partial %
       X  32802                     (partial_threshold > 0 ? partial_threshold 
: display_lines)
       X  32803                     == 0) {
       X  32804                     /* num_of_entries, 
num_of_entries_partial... */
       X  32805                     /* HTReadProgress...(bytes, 0); */
       X  32806                     HTDisplayPartial();
       X  32807 
       X  32808                     if (HTCheckForInterrupt()) {
       X  32809                         _HTProgress (TRANSFER_INTERRUPTED);
       X  32810                         status = HT_PARTIAL_CONTENT;
       X  32811                         break;
       X  32812                     }
       X  32813                 }
       X  32814                 num_of_entries_partial++;
       X  32815 #endif /* DISP_PARTIAL */
          32816 
          32817             } /* end while next_element */
          32818 
          32819             if (status == HT_LOADED) {
      1E                           200
          32820                 if (state == 'I') {
          32821                     START(HTML_P);
      1E              (*target->isa->start_element)(target, HTML_P, 0, 0, -1, 0)
          32822                     PUTS("Empty Directory");
      1E              (*target->isa->put_string)(target, "Empty Directory")
          32823                 }
          32824 #ifndef LONG_LIST
          32825                 else
          32826                     END(HTML_DIR);
      1E              (*target->isa->end_element)(target, HTML_DIR, 0)
          32827 #endif /* !LONG_LIST */
          32828             }
          32829         } /* end printing out the tree in order */
          32830 
          32831         closedir(dp);
          32832         FREE(logical);
      1E         if (logical) {free(logical); logical = ((void *) 0);}
          32833         FREE(tmpfilename);
      1E         if (tmpfilename) {free(tmpfilename); tmpfilename = ((void *) 
0);}
          32834         FREE(tail);
      1E         if (tail) {free(tail); tail = ((void *) 0);}
          32835         HTBTreeAndObject_free(bt);

                                Source Listing                  13-APR-1999 
17:06:13  DEC C V5.5-002                    Page 597    
                                                                13-APR-1999 
09:39:16  HTFILE.C;1  

          32836 
          32837         if (status == HT_LOADED) {
      1E                       200
          32838             if (HTDirReadme == HT_DIR_README_BOTTOM)
      1E                                2
          32839                 do_readme(target, localname);
          32840             FREE_TARGET;
      1E             (*target->isa->_free)(target)
          32841         } else {
          32842             ABORT_TARGET;
      1E             (*targetClass._abort)(target, ((void *) 0));
          32843         }
          32844     }
          32845     return status;  /* document loaded, maybe partial */
          32846 }

reply via email to

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