home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 22 gnu / 22-gnu.zip / rcs57pc3.zip / rcs / src / rlog.c < prev    next >
C/C++ Source or Header  |  1996-02-12  |  37KB  |  1,373 lines

  1. /* Print log messages and other information about RCS files.  */
  2.  
  3. /* Copyright 1982, 1988, 1989 Walter Tichy
  4.    Copyright 1990, 1991, 1992, 1993, 1994, 1995 Paul Eggert
  5.    Distributed under license by the Free Software Foundation, Inc.
  6.  
  7. This file is part of RCS.
  8.  
  9. RCS is free software; you can redistribute it and/or modify
  10. it under the terms of the GNU General Public License as published by
  11. the Free Software Foundation; either version 2, or (at your option)
  12. any later version.
  13.  
  14. RCS is distributed in the hope that it will be useful,
  15. but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  17. GNU General Public License for more details.
  18.  
  19. You should have received a copy of the GNU General Public License
  20. along with RCS; see the file COPYING.
  21. If not, write to the Free Software Foundation,
  22. 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  23.  
  24. Report problems and direct all questions to:
  25.  
  26.     rcs-bugs@cs.purdue.edu
  27.  
  28. */
  29.  
  30. /*
  31.  * $Log: rlog.c,v $
  32.  * Revision 5.18  1995/06/16 06:19:24  eggert
  33.  * Update FSF address.
  34.  *
  35.  * Revision 5.17  1995/06/01 16:23:43  eggert
  36.  * (struct rcslockers): Renamed from `struct lockers'.
  37.  * (getnumericrev): Return error indication instead of ignoring errors.
  38.  * (main): Check it.  Don't use dateform.
  39.  * (recentdate, extdate): cmpnum -> cmpdate
  40.  *
  41.  * Revision 5.16  1994/04/13 16:30:34  eggert
  42.  * Fix bug; `rlog -lxxx' inverted the sense of -l.
  43.  *
  44.  * Revision 5.15  1994/03/17 14:05:48  eggert
  45.  * -d'<DATE' now excludes DATE; the new syntax -d'<=DATE' includes it.
  46.  * Emulate -V4's white space generation more precisely.
  47.  * Work around SVR4 stdio performance bug.  Remove lint.
  48.  *
  49.  * Revision 5.14  1993/11/09 17:40:15  eggert
  50.  * -V now prints version on stdout and exits.
  51.  *
  52.  * Revision 5.13  1993/11/03 17:42:27  eggert
  53.  * Add -N, -z.  Ignore -T.
  54.  *
  55.  * Revision 5.12  1992/07/28  16:12:44  eggert
  56.  * Don't miss B.0 when handling branch B.  Diagnose missing `,' in -r.
  57.  * Add -V.  Avoid `unsigned'.  Statement macro names now end in _.
  58.  *
  59.  * Revision 5.11  1992/01/24  18:44:19  eggert
  60.  * Don't duplicate unexpected_EOF's function.  lint -> RCS_lint
  61.  *
  62.  * Revision 5.10  1992/01/06  02:42:34  eggert
  63.  * Update usage string.
  64.  * while (E) ; -> while (E) continue;
  65.  *
  66.  * Revision 5.9  1991/09/17  19:07:40  eggert
  67.  * Getscript() didn't uncache partial lines.
  68.  *
  69.  * Revision 5.8  1991/08/19  03:13:55  eggert
  70.  * Revision separator is `:', not `-'.
  71.  * Check for missing and duplicate logs.  Tune.
  72.  * Permit log messages that do not end in newline (including empty logs).
  73.  *
  74.  * Revision 5.7  1991/04/21  11:58:31  eggert
  75.  * Add -x, RCSINIT, MS-DOS support.
  76.  *
  77.  * Revision 5.6  1991/02/26  17:07:17  eggert
  78.  * Survive RCS files with missing logs.
  79.  * strsave -> str_save (DG/UX name clash)
  80.  *
  81.  * Revision 5.5  1990/11/01  05:03:55  eggert
  82.  * Permit arbitrary data in logs and comment leaders.
  83.  *
  84.  * Revision 5.4  1990/10/04  06:30:22  eggert
  85.  * Accumulate exit status across files.
  86.  *
  87.  * Revision 5.3  1990/09/11  02:41:16  eggert
  88.  * Plug memory leak.
  89.  *
  90.  * Revision 5.2  1990/09/04  08:02:33  eggert
  91.  * Count RCS lines better.
  92.  *
  93.  * Revision 5.0  1990/08/22  08:13:48  eggert
  94.  * Remove compile-time limits; use malloc instead.  Add setuid support.
  95.  * Switch to GMT.
  96.  * Report dates in long form, to warn about dates past 1999/12/31.
  97.  * Change "added/del" message to make room for the longer dates.
  98.  * Don't generate trailing white space.  Add -V.  Ansify and Posixate.
  99.  *
  100.  * Revision 4.7  89/05/01  15:13:48  narten
  101.  * changed copyright header to reflect current distribution rules
  102.  * 
  103.  * Revision 4.6  88/08/09  19:13:28  eggert
  104.  * Check for memory exhaustion; don't access freed storage.
  105.  * Shrink stdio code size; remove lint.
  106.  * 
  107.  * Revision 4.5  87/12/18  11:46:38  narten
  108.  * more lint cleanups (Guy Harris)
  109.  * 
  110.  * Revision 4.4  87/10/18  10:41:12  narten
  111.  * Updating version numbers
  112.  * Changes relative to 1.1 actually relative to 4.2
  113.  * 
  114.  * Revision 1.3  87/09/24  14:01:10  narten
  115.  * Sources now pass through lint (if you ignore printf/sprintf/fprintf 
  116.  * warnings)
  117.  * 
  118.  * Revision 1.2  87/03/27  14:22:45  jenkins
  119.  * Port to suns
  120.  * 
  121.  * Revision 4.2  83/12/05  09:18:09  wft
  122.  * changed rewriteflag to external.
  123.  * 
  124.  * Revision 4.1  83/05/11  16:16:55  wft
  125.  * Added -b, updated getnumericrev() accordingly.
  126.  * Replaced getpwuid() with getcaller().
  127.  * 
  128.  * Revision 3.7  83/05/11  14:24:13  wft
  129.  * Added options -L and -R;
  130.  * Fixed selection bug with -l on multiple files.
  131.  * Fixed error on dates of the form -d'>date' (rewrote getdatepair()).
  132.  * 
  133.  * Revision 3.6  82/12/24  15:57:53  wft
  134.  * shortened output format.
  135.  *
  136.  * Revision 3.5  82/12/08  21:45:26  wft
  137.  * removed call to checkaccesslist(); used DATEFORM to format all dates;
  138.  * removed unused variables.
  139.  *
  140.  * Revision 3.4  82/12/04  13:26:25  wft
  141.  * Replaced getdelta() with gettree(); removed updating of field lockedby.
  142.  *
  143.  * Revision 3.3  82/12/03  14:08:20  wft
  144.  * Replaced getlogin with getpwuid(), %02d with %.2d, fancydate with PRINTDATE.
  145.  * Fixed printing of nil, removed printing of Suffix,
  146.  * added shortcut if no revisions are printed, disambiguated struct members.
  147.  *
  148.  * Revision 3.2  82/10/18  21:09:06  wft
  149.  * call to curdir replaced with getfullRCSname(),
  150.  * fixed call to getlogin(), cosmetic changes on output,
  151.  * changed conflicting long identifiers.
  152.  *
  153.  * Revision 3.1  82/10/13  16:07:56  wft
  154.  * fixed type of variables receiving from getc() (char -> int).
  155.  */
  156.  
  157.  
  158.  
  159. #include "rcsbase.h"
  160.  
  161. struct rcslockers {                   /* lockers in locker option; stored   */
  162.      char const        * login;      /* lockerlist                */
  163.      struct rcslockers  * lockerlink;
  164.      }  ;
  165.  
  166. struct  stateattri {                  /* states in state option; stored in  */
  167.      char const        * status;     /* statelist                */
  168.      struct  stateattri * nextstate;
  169.      }  ;
  170.  
  171. struct  authors {                     /* login names in author option;      */
  172.      char const        * login;      /* stored in authorlist            */
  173.      struct     authors * nextauthor;
  174.      }  ;
  175.  
  176. struct Revpairs{                      /* revision or branch range in -r     */
  177.      int          numfld;     /* option; stored in revlist        */
  178.      char const        * strtrev;
  179.      char const        * endrev;
  180.      struct  Revpairs   * rnext;
  181.      } ;
  182.  
  183. struct Datepairs{                     /* date range in -d option; stored in */
  184.      struct Datepairs *dnext;
  185.      char               strtdate[datesize];   /* duelst and datelist      */
  186.      char               enddate[datesize];
  187.      char ne_date; /* datelist only; distinguishes < from <= */
  188.      };
  189.  
  190. static char extractdelta P((struct hshentry const*));
  191. static int checkrevpair P((char const*,char const*));
  192. static int extdate P((struct hshentry*));
  193. static int getnumericrev P((void));
  194. static struct hshentry const *readdeltalog P((void));
  195. static void cleanup P((void));
  196. static void exttree P((struct hshentry*));
  197. static void getauthor P((char*));
  198. static void getdatepair P((char*));
  199. static void getlocker P((char*));
  200. static void getrevpairs P((char*));
  201. static void getscript P((struct hshentry*));
  202. static void getstate P((char*));
  203. static void putabranch P((struct hshentry const*));
  204. static void putadelta P((struct hshentry const*,struct hshentry const*,int));
  205. static void putforest P((struct branchhead const*));
  206. static void putree P((struct hshentry const*));
  207. static void putrunk P((void));
  208. static void recentdate P((struct hshentry const*,struct Datepairs*));
  209. static void trunclocks P((void));
  210.  
  211. static char const *insDelFormat;
  212. static int branchflag;    /*set on -b */
  213. static int exitstatus;
  214. static int lockflag;
  215. static struct Datepairs *datelist, *duelst;
  216. static struct Revpairs *revlist, *Revlst;
  217. static struct authors *authorlist;
  218. static struct rcslockers *lockerlist;
  219. static struct stateattri *statelist;
  220.  
  221. static int onlyid;
  222. static char const *numrev2symbrev P((char const *numrev));
  223.  
  224.  
  225. mainProg(rlogId, "rlog", "$Id: rlog.c,v 5.18 1995/06/16 06:19:24 eggert Exp $")
  226. {
  227.     static char const cmdusage[] =
  228.         "\nrlog usage: rlog -{bhLNRtIZ} -ddates -l[lockers] -r[revs] -sstates -Vn -w[logins] -xsuff -zzone file ...";
  229.  
  230.     register FILE *out;
  231.     char *a, **newargv;
  232.     struct Datepairs *currdate;
  233.     char const *accessListString, *accessFormat;
  234.     char const *headFormat, *symbolFormat;
  235.     struct access const *curaccess;
  236.     struct assoc const *curassoc;
  237.     struct hshentry const *delta;
  238.     struct rcslock const *currlock;
  239.     int descflag, selectflag;
  240.     int onlylockflag;  /* print only files with locks */
  241.     int onlyRCSflag;  /* print only RCS pathname */
  242.     int onlylockers = 0;
  243.     int pre5;
  244.     int shownames;
  245.     int revno;
  246.  
  247.         descflag = selectflag = shownames = true;
  248.     onlylockflag = onlyRCSflag = false;
  249.     out = stdout;
  250.     suffixes = X_DEFAULT;
  251.  
  252.     argc = getRCSINIT(argc, argv, &newargv);
  253.     argv = newargv;
  254.     while (a = *++argv,  0<--argc && *a++=='-') {
  255.         switch (*a++) {
  256.  
  257.         case 'L':
  258.             onlylockflag = true;
  259.             break;
  260.  
  261.         case 'N':
  262.             shownames = false;
  263.             break;
  264.  
  265.         case 'R':
  266.             onlyRCSflag =true;
  267.             break;
  268.  
  269.         case 'I':
  270.             onlyid = (*a == 'I') ? 2 : 1;
  271.             break;
  272.  
  273.         case 'Z':
  274.             onlylockers = (*a == 'Z') ? 2 : 1;
  275.             break;
  276.  
  277.                 case 'l':
  278.                         lockflag = true;
  279.             getlocker(a);
  280.                         break;
  281.  
  282.                 case 'b':
  283.                         branchflag = true;
  284.                         break;
  285.  
  286.                 case 'r':
  287.             getrevpairs(a);
  288.                         break;
  289.  
  290.                 case 'd':
  291.             getdatepair(a);
  292.                         break;
  293.  
  294.                 case 's':
  295.             getstate(a);
  296.                         break;
  297.  
  298.                 case 'w':
  299.             getauthor(a);
  300.                         break;
  301.  
  302.                 case 'h':
  303.             descflag = false;
  304.                         break;
  305.  
  306.                 case 't':
  307.                         selectflag = false;
  308.                         break;
  309.  
  310.         case 'q':
  311.             /* This has no effect; it's here for consistency.  */
  312.             quietflag = true;
  313.             break;
  314.  
  315.         case 'x':
  316.             suffixes = a;
  317.             break;
  318.  
  319.         case 'z':
  320.             zone_set(a);
  321.             break;
  322.  
  323.         case 'T':
  324.             /* Ignore -T, so that RCSINIT can contain -T.  */
  325.             if (*a)
  326.                 goto unknown;
  327.             break;
  328.  
  329.         case 'V':
  330.             setRCSversion(*argv);
  331.             break;
  332.  
  333.                 default:
  334.         unknown:
  335.             error("unknown option: %s%s", *argv, cmdusage);
  336.  
  337.                 };
  338.         } /* end of option processing */
  339.  
  340.     if (! (descflag|selectflag)) {
  341.         warn("-t overrides -h.");
  342.         descflag = true;
  343.     }
  344.  
  345.     pre5 = RCSversion < VERSION(5);
  346.     if (pre5) {
  347.         accessListString = "\naccess list:   ";
  348.         accessFormat = "  %s";
  349.         headFormat = "RCS file:        %s;   Working file:    %s\nhead:           %s%s\nbranch:         %s%s\nlocks:         ";
  350.         insDelFormat = "  lines added/del: %ld/%ld";
  351.         symbolFormat = "  %s: %s;";
  352.     } else {
  353.         accessListString = "\naccess list:";
  354.         accessFormat = "\n\t%s";
  355.         headFormat = "RCS file: %s\nWorking file: %s\nhead:%s%s\nbranch:%s%s\nlocks:%s";
  356.         insDelFormat = "  lines: +%ld -%ld";
  357.         symbolFormat = "\n\t%s: %s";
  358.     }
  359.  
  360.     /* Now handle all pathnames.  */
  361.     if (nerror)
  362.       cleanup();
  363.     else if (argc < 1)
  364.       faterror("no input file%s", cmdusage);
  365.     else
  366.       for (;  0 < argc;  cleanup(), ++argv, --argc) {
  367.         ffree();
  368.  
  369.         if (pairnames(argc, argv, rcsreadopen, true, false)  <=  0)
  370.         continue;
  371.  
  372.         /*
  373.          * RCSname contains the name of the RCS file,
  374.          * and finptr the file descriptor;
  375.          * workname contains the name of the working file.
  376.              */
  377.  
  378.         /* Options 'Z' and 'ZZ' added to quickly get the relevant Data
  379.          * for locked File(s)/Revisions.
  380.          * Options 'I' and 'II' added to easily get Information about
  381.          * unlocked File(s) of the specified Revision(s). These Records
  382.          * could be used as an Entry of an Revision-List.
  383.          * The single-option Version prints Basenames, the double-option
  384.          * Version prints Filenames with the full path.
  385.          */
  386.         if (onlyid) {
  387.           if (Locks) {         /* Issue Warnings for locked Versions */
  388.         currlock = Locks;
  389.         aprintf (stderr, "Warning: there are Locks for File %s:\n",
  390.              onlyid == 1 ? RCSname : getfullRCSname());
  391.         while (currlock) {
  392.           aprintf (stderr, 
  393.                "\tFile: %s   Revision: %s [%s]  locked by: %s\n",
  394.                onlyid == 1 ? RCSname : getfullRCSname(), 
  395.                currlock->delta->num, 
  396.                numrev2symbrev (currlock->delta->num),
  397.                currlock->login);
  398.           currlock = currlock->nextlock;
  399.         }
  400.           }
  401.  
  402.           if (! Head) continue;
  403.           gettree ();
  404.           revno = 0;
  405.           getnumericrev ();
  406.           exttree (Head);
  407.           currdate = duelst;
  408.           while (currdate) {
  409.         /* VOID sprintf (currdate->strtdate,dateform,0,0,0,0,0,0); */
  410.         time2date(0,currdate->strtdate);
  411.         recentdate (Head, currdate);
  412.         currdate = currdate->dnext;
  413.           }
  414.           revno = extdate (Head);
  415.           getdesc (false);
  416.           if (revno) {
  417.         while (! (delta = readdeltalog())->selector  ||  --revno) ;
  418.         if (delta->next && countnumflds(delta->num)==2) {
  419.           while (readdeltalog() != delta->next) ;
  420.         }
  421.         putrunk ();
  422.         putree (Head);
  423.           }
  424.           continue;
  425.         }
  426.  
  427.         if (onlylockers) {
  428.           currlock = Locks;
  429.           while (currlock) {
  430.         aprintf (out, "File: %s   Revision: %s [%s]  locked by: %s\n",
  431.              onlylockers == 1 ? RCSname : getfullRCSname(), 
  432.              currlock->delta->num, 
  433.              numrev2symbrev (currlock->delta->num),
  434.              currlock->login);
  435.         currlock = currlock->nextlock;
  436.           }
  437.           continue;
  438.         }
  439.  
  440.         /* Keep only those locks given by -l.  */
  441.         if (lockflag)
  442.         trunclocks();
  443.  
  444.             /* do nothing if -L is given and there are no locks*/
  445.         if (onlylockflag && !Locks)
  446.         continue;
  447.  
  448.         if ( onlyRCSflag ) {
  449.         aprintf(out, "%s\n", RCSname);
  450.         continue;
  451.         }
  452.  
  453.         gettree();
  454.  
  455.         if (!getnumericrev())
  456.         continue;
  457.  
  458.         /*
  459.         * Output the first character with putc, not printf.
  460.         * Otherwise, an SVR4 stdio bug buffers output inefficiently.
  461.         */
  462.         aputc_('\n', out)
  463.  
  464.         /*   print RCS pathname, working pathname and optional
  465.                  administrative information                         */
  466.             /* could use getfullRCSname() here, but that is very slow */
  467.         aprintf(out, headFormat, RCSname, workname,
  468.             Head ? " " : "",  Head ? Head->num : "",
  469.             Dbranch ? " " : "",  Dbranch ? Dbranch : "",
  470.             StrictLocks ? " strict" : ""
  471.         );
  472.             currlock = Locks;
  473.             while( currlock ) {
  474.         aprintf(out, symbolFormat, currlock->login,
  475.                                 currlock->delta->num);
  476.                 currlock = currlock->nextlock;
  477.             }
  478.             if (StrictLocks && pre5)
  479.                 aputs("  ;  strict" + (Locks?3:0), out);
  480.  
  481.         aputs(accessListString, out);      /*  print access list  */
  482.             curaccess = AccessList;
  483.             while(curaccess) {
  484.         aprintf(out, accessFormat, curaccess->login);
  485.                 curaccess = curaccess->nextaccess;
  486.             }
  487.  
  488.         if (shownames) {
  489.         aputs("\nsymbolic names:", out);   /*  print symbolic names   */
  490.         for (curassoc=Symbols; curassoc; curassoc=curassoc->nextassoc)
  491.             aprintf(out, symbolFormat, curassoc->symbol, curassoc->num);
  492.         }
  493.         if (pre5) {
  494.         aputs("\ncomment leader:  \"", out);
  495.         awrite(Comment.string, Comment.size, out);
  496.         afputc('\"', out);
  497.         }
  498.         if (!pre5  ||  Expand != KEYVAL_EXPAND)
  499.         aprintf(out, "\nkeyword substitution: %s",
  500.             expand_names[Expand]
  501.         );
  502.  
  503.         aprintf(out, "\ntotal revisions: %d", TotalDeltas);
  504.  
  505.         revno = 0;
  506.  
  507.         if (Head  &&  selectflag & descflag) {
  508.  
  509.         exttree(Head);
  510.  
  511.         /*  get most recently date of the dates pointed by duelst  */
  512.         currdate = duelst;
  513.         while( currdate) {
  514.             VOID strcpy(currdate->strtdate, "0.0.0.0.0.0");
  515.             recentdate(Head, currdate);
  516.             currdate = currdate->dnext;
  517.         }
  518.  
  519.         revno = extdate(Head);
  520.  
  521.         aprintf(out, ";\tselected revisions: %d", revno);
  522.         }
  523.  
  524.         afputc('\n',out);
  525.         if (descflag) {
  526.         aputs("description:\n", out);
  527.         getdesc(true);
  528.         }
  529.         if (revno) {
  530.         while (! (delta = readdeltalog())->selector  ||  --revno)
  531.             continue;
  532.         if (delta->next && countnumflds(delta->num)==2)
  533.             /* Read through delta->next to get its insertlns.  */
  534.             while (readdeltalog() != delta->next)
  535.             continue;
  536.         putrunk();
  537.         putree(Head);
  538.         }
  539.         aputs("=============================================================================\n",out);
  540.       }
  541.     Ofclose(out);
  542.     exitmain(exitstatus);
  543. }
  544.  
  545.     static void
  546. cleanup()
  547. {
  548.     if (nerror) exitstatus = EXIT_FAILURE;
  549.     Izclose(&finptr);
  550. }
  551.  
  552. #if RCS_lint
  553. #    define exiterr rlogExit
  554. #endif
  555.     void
  556. exiterr()
  557. {
  558.     _exit(EXIT_FAILURE);
  559. }
  560.  
  561.  
  562.  
  563.     static void
  564. putrunk()
  565. /*  function:  print revisions chosen, which are in trunk      */
  566.  
  567. {
  568.     register struct hshentry const *ptr;
  569.  
  570.     for (ptr = Head;  ptr;  ptr = ptr->next)
  571.         putadelta(ptr, ptr->next, true);
  572. }
  573.  
  574.  
  575.  
  576.     static void
  577. putree(root)
  578.     struct hshentry const *root;
  579. /*   function: print delta tree (not including trunk) in reverse
  580.                order on each branch                                        */
  581.  
  582. {
  583.     if (!root) return;
  584.  
  585.         putree(root->next);
  586.  
  587.         putforest(root->branches);
  588. }
  589.  
  590.  
  591.  
  592.  
  593.     static void
  594. putforest(branchroot)
  595.     struct branchhead const *branchroot;
  596. /*   function:  print branches that has the same direct ancestor    */
  597. {
  598.     if (!branchroot) return;
  599.  
  600.         putforest(branchroot->nextbranch);
  601.  
  602.         putabranch(branchroot->hsh);
  603.         putree(branchroot->hsh);
  604. }
  605.  
  606.  
  607.  
  608.  
  609.     static void
  610. putabranch(root)
  611.     struct hshentry const *root;
  612. /*   function  :  print one branch     */
  613.  
  614. {
  615.     if (!root) return;
  616.  
  617.         putabranch(root->next);
  618.  
  619.         putadelta(root, root, false);
  620. }
  621.  
  622.  
  623.  
  624.  
  625.  
  626.     static void
  627. putadelta(node,editscript,trunk)
  628.     register struct hshentry const *node, *editscript;
  629.     int trunk;
  630. /*  function: Print delta node if node->selector is set.        */
  631. /*      editscript indicates where the editscript is stored     */
  632. /*      trunk indicated whether this node is in trunk           */
  633. {
  634.     static char emptych[] = EMPTYLOG;
  635.  
  636.     register FILE *out;
  637.     char const *s;
  638.     size_t n;
  639.     struct branchhead const *newbranch;
  640.     struct buf branchnum;
  641.     char datebuf[datesize + zonelenmax];
  642.     int pre5 = RCSversion < VERSION(5);
  643.  
  644.     if (!node->selector)
  645.             return;
  646.  
  647.     out = stdout;
  648.  
  649.     if (onlyid) {
  650.       aprintf (out, 
  651.            "File: %s   Revision: %s [%s]  Date: %s   Author: %s  State: %s\n",
  652.            onlyid == 1 ? workname : getfullRCSname(),
  653.            node->num, numrev2symbrev (node->num),
  654.            date2str (node->date, datebuf), node->author, node->state);
  655.       return;
  656.     }
  657.  
  658.     aprintf(out,
  659.         "----------------------------\nrevision %s%s",
  660.         node->num,  pre5 ? "        " : ""
  661.     );
  662.         if ( node->lockedby )
  663.         aprintf(out, pre5+"\tlocked by: %s;", node->lockedby);
  664.  
  665.     aprintf(out, "\ndate: %s;  author: %s;  state: %s;",
  666.         date2str(node->date, datebuf),
  667.         node->author, node->state
  668.     );
  669.  
  670.         if ( editscript )
  671.            if(trunk)
  672.           aprintf(out, insDelFormat,
  673.                              editscript->deletelns, editscript->insertlns);
  674.            else
  675.           aprintf(out, insDelFormat,
  676.                              editscript->insertlns, editscript->deletelns);
  677.  
  678.         newbranch = node->branches;
  679.         if ( newbranch ) {
  680.        bufautobegin(&branchnum);
  681.        aputs("\nbranches:", out);
  682.            while( newbranch ) {
  683.         getbranchno(newbranch->hsh->num, &branchnum);
  684.         aprintf(out, "  %s;", branchnum.string);
  685.                 newbranch = newbranch->nextbranch;
  686.            }
  687.        bufautoend(&branchnum);
  688.         }
  689.  
  690.     afputc('\n', out);
  691.     s = node->log.string;
  692.     if (!(n = node->log.size)) {
  693.         s = emptych;
  694.         n = sizeof(emptych)-1;
  695.     }
  696.     awrite(s, n, out);
  697.     if (s[n-1] != '\n')
  698.         afputc('\n', out);
  699. }
  700.  
  701.  
  702.     static struct hshentry const *
  703. readdeltalog()
  704. /*  Function : get the log message and skip the text of a deltatext node.
  705.  *           Return the delta found.
  706.  *             Assumes the current lexeme is not yet in nexttok; does not
  707.  *             advance nexttok.
  708.  */
  709. {
  710.         register struct  hshentry  * Delta;
  711.     struct buf logbuf;
  712.     struct cbuf cb;
  713.  
  714.     if (eoflex())
  715.         fatserror("missing delta log");
  716.         nextlex();
  717.     if (!(Delta = getnum()))
  718.         fatserror("delta number corrupted");
  719.     getkeystring(Klog);
  720.     if (Delta->log.string)
  721.         fatserror("duplicate delta log");
  722.     bufautobegin(&logbuf);
  723.     cb = savestring(&logbuf);
  724.     Delta->log = bufremember(&logbuf, cb.size);
  725.  
  726.     ignorephrases(Ktext);
  727.     getkeystring(Ktext);
  728.         Delta->insertlns = Delta->deletelns = 0;
  729.         if ( Delta != Head)
  730.                 getscript(Delta);
  731.         else
  732.                 readstring();
  733.     return Delta;
  734. }
  735.  
  736.  
  737.     static void
  738. getscript(Delta)
  739. struct    hshentry   * Delta;
  740. /*   function:  read edit script of Delta and count how many lines added  */
  741. /*              and deleted in the script                                 */
  742.  
  743. {
  744.         int ed;   /*  editor command  */
  745.     declarecache;
  746.     register RILE *fin;
  747.         register  int   c;
  748.     register long i;
  749.     struct diffcmd dc;
  750.  
  751.     fin = finptr;
  752.     setupcache(fin);
  753.     initdiffcmd(&dc);
  754.     while (0  <=  (ed = getdiffcmd(fin,true,(FILE *)0,&dc)))
  755.         if (!ed)
  756.                  Delta->deletelns += dc.nlines;
  757.         else {
  758.                  /*  skip scripted lines  */
  759.          i = dc.nlines;
  760.          Delta->insertlns += i;
  761.          cache(fin);
  762.          do {
  763.              for (;;) {
  764.             cacheget_(c)
  765.             switch (c) {
  766.                 default:
  767.                 continue;
  768.                 case SDELIM:
  769.                 cacheget_(c)
  770.                 if (c == SDELIM)
  771.                     continue;
  772.                 if (--i)
  773.                     unexpected_EOF();
  774.                 nextc = c;
  775.                 uncache(fin);
  776.                 return;
  777.                 case '\n':
  778.                 break;
  779.             }
  780.             break;
  781.              }
  782.              ++rcsline;
  783.          } while (--i);
  784.          uncache(fin);
  785.             }
  786. }
  787.  
  788.  
  789.  
  790.  
  791.  
  792.  
  793.  
  794.     static void
  795. exttree(root)
  796. struct hshentry  *root;
  797. /*  function: select revisions , starting with root             */
  798.  
  799. {
  800.     struct branchhead const *newbranch;
  801.  
  802.     if (!root) return;
  803.  
  804.     root->selector = extractdelta(root);
  805.     root->log.string = 0;
  806.         exttree(root->next);
  807.  
  808.         newbranch = root->branches;
  809.         while( newbranch ) {
  810.             exttree(newbranch->hsh);
  811.             newbranch = newbranch->nextbranch;
  812.         }
  813. }
  814.  
  815.  
  816.  
  817.  
  818.     static void
  819. getlocker(argv)
  820. char    * argv;
  821. /*   function : get the login names of lockers from command line   */
  822. /*              and store in lockerlist.                           */
  823.  
  824. {
  825.         register char c;
  826.     struct rcslockers *newlocker;
  827.         argv--;
  828.     while ((c = *++argv)==',' || c==' ' || c=='\t' || c=='\n' || c==';')
  829.         continue;
  830.         if (  c == '\0') {
  831.         lockerlist = 0;
  832.             return;
  833.         }
  834.  
  835.         while( c != '\0' ) {
  836.         newlocker = talloc(struct rcslockers);
  837.             newlocker->lockerlink = lockerlist;
  838.             newlocker->login = argv;
  839.             lockerlist = newlocker;
  840.         while ((c = *++argv) && c!=',' && c!=' ' && c!='\t' && c!='\n' && c!=';')
  841.         continue;
  842.             *argv = '\0';
  843.             if ( c == '\0' ) return;
  844.         while ((c = *++argv)==',' || c==' ' || c=='\t' || c=='\n' || c==';')
  845.         continue;
  846.         }
  847. }
  848.  
  849.  
  850.  
  851.     static void
  852. getauthor(argv)
  853. char   *argv;
  854. /*   function:  get the author's name from command line   */
  855. /*              and store in authorlist                   */
  856.  
  857. {
  858.         register    c;
  859.         struct     authors  * newauthor;
  860.  
  861.         argv--;
  862.     while ((c = *++argv)==',' || c==' ' || c=='\t' || c=='\n' || c==';')
  863.         continue;
  864.         if ( c == '\0' ) {
  865.         authorlist = talloc(struct authors);
  866.         authorlist->login = getusername(false);
  867.         authorlist->nextauthor = 0;
  868.             return;
  869.         }
  870.  
  871.         while( c != '\0' ) {
  872.         newauthor = talloc(struct authors);
  873.             newauthor->nextauthor = authorlist;
  874.             newauthor->login = argv;
  875.             authorlist = newauthor;
  876.         while ((c = *++argv) && c!=',' && c!=' ' && c!='\t' && c!='\n' && c!=';')
  877.         continue;
  878.             * argv = '\0';
  879.             if ( c == '\0') return;
  880.         while ((c = *++argv)==',' || c==' ' || c=='\t' || c=='\n' || c==';')
  881.         continue;
  882.         }
  883. }
  884.  
  885.  
  886.  
  887.  
  888.     static void
  889. getstate(argv)
  890. char   * argv;
  891. /*   function :  get the states of revisions from command line  */
  892. /*               and store in statelist                         */
  893.  
  894. {
  895.         register  char  c;
  896.         struct    stateattri    *newstate;
  897.  
  898.         argv--;
  899.     while ((c = *++argv)==',' || c==' ' || c=='\t' || c=='\n' || c==';')
  900.         continue;
  901.         if ( c == '\0'){
  902.         error("missing state attributes after -s options");
  903.             return;
  904.         }
  905.  
  906.         while( c != '\0' ) {
  907.         newstate = talloc(struct stateattri);
  908.             newstate->nextstate = statelist;
  909.             newstate->status = argv;
  910.             statelist = newstate;
  911.         while ((c = *++argv) && c!=',' && c!=' ' && c!='\t' && c!='\n' && c!=';')
  912.         continue;
  913.             *argv = '\0';
  914.             if ( c == '\0' ) return;
  915.         while ((c = *++argv)==',' || c==' ' || c=='\t' || c=='\n' || c==';')
  916.         continue;
  917.         }
  918. }
  919.  
  920.  
  921.  
  922.     static void
  923. trunclocks()
  924. /*  Function:  Truncate the list of locks to those that are held by the  */
  925. /*             id's on lockerlist. Do not truncate if lockerlist empty.  */
  926.  
  927. {
  928.     struct rcslockers const *plocker;
  929.     struct rcslock *p, **pp;
  930.  
  931.     if (!lockerlist) return;
  932.  
  933.         /* shorten Locks to those contained in lockerlist */
  934.     for (pp = &Locks;  (p = *pp);  )
  935.         for (plocker = lockerlist;  ;  )
  936.         if (strcmp(plocker->login, p->login) == 0) {
  937.             pp = &p->nextlock;
  938.             break;
  939.         } else if (!(plocker = plocker->lockerlink)) {
  940.             *pp = p->nextlock;
  941.             break;
  942.         }
  943. }
  944.  
  945.  
  946.  
  947.     static void
  948. recentdate(root, pd)
  949.     struct hshentry const *root;
  950.     struct Datepairs *pd;
  951. /*  function:  Finds the delta that is closest to the cutoff date given by   */
  952. /*             pd among the revisions selected by exttree.                   */
  953. /*             Successively narrows down the interval given by pd,           */
  954. /*             and sets the strtdate of pd to the date of the selected delta */
  955. {
  956.     struct branchhead const *newbranch;
  957.  
  958.     if (!root) return;
  959.     if (root->selector) {
  960.          if ( cmpdate(root->date, pd->strtdate) >= 0 &&
  961.           cmpdate(root->date, pd->enddate) <= 0)
  962.         VOID strcpy(pd->strtdate, root->date);
  963.         }
  964.  
  965.         recentdate(root->next, pd);
  966.         newbranch = root->branches;
  967.         while( newbranch) {
  968.            recentdate(newbranch->hsh, pd);
  969.            newbranch = newbranch->nextbranch;
  970.     }
  971. }
  972.  
  973.  
  974.  
  975.  
  976.  
  977.  
  978.     static int
  979. extdate(root)
  980. struct  hshentry        * root;
  981. /*  function:  select revisions which are in the date range specified     */
  982. /*             in duelst  and datelist, start at root                     */
  983. /* Yield number of revisions selected, including those already selected.  */
  984. {
  985.     struct branchhead const *newbranch;
  986.     struct Datepairs const *pdate;
  987.     int revno, ne;
  988.  
  989.     if (!root)
  990.         return 0;
  991.  
  992.         if ( datelist || duelst) {
  993.             pdate = datelist;
  994.             while( pdate ) {
  995.         ne = pdate->ne_date;
  996.         if (
  997.             (!pdate->strtdate[0]
  998.             || ne <= cmpdate(root->date, pdate->strtdate))
  999.             &&
  1000.             (!pdate->enddate[0]
  1001.             || ne <= cmpdate(pdate->enddate, root->date))
  1002.         )
  1003.                         break;
  1004.                 pdate = pdate->dnext;
  1005.             }
  1006.         if (!pdate) {
  1007.                 pdate = duelst;
  1008.         for (;;) {
  1009.            if (!pdate) {
  1010.             root->selector = false;
  1011.             break;
  1012.            }
  1013.            if (cmpdate(root->date, pdate->strtdate) == 0)
  1014.                       break;
  1015.                    pdate = pdate->dnext;
  1016.                 }
  1017.             }
  1018.         }
  1019.     revno = root->selector + extdate(root->next);
  1020.  
  1021.         newbranch = root->branches;
  1022.         while( newbranch ) {
  1023.        revno += extdate(newbranch->hsh);
  1024.            newbranch = newbranch->nextbranch;
  1025.         }
  1026.     return revno;
  1027. }
  1028.  
  1029.  
  1030.  
  1031.     static char
  1032. extractdelta(pdelta)
  1033.     struct hshentry const *pdelta;
  1034. /*  function:  compare information of pdelta to the authorlist, lockerlist,*/
  1035. /*             statelist, revlist and yield true if pdelta is selected.    */
  1036.  
  1037. {
  1038.     struct rcslock const *plock;
  1039.     struct stateattri const *pstate;
  1040.     struct authors const *pauthor;
  1041.     struct Revpairs const *prevision;
  1042.     int length;
  1043.  
  1044.     if ((pauthor = authorlist)) /* only certain authors wanted */
  1045.         while (strcmp(pauthor->login, pdelta->author) != 0)
  1046.         if (!(pauthor = pauthor->nextauthor))
  1047.             return false;
  1048.     if ((pstate = statelist)) /* only certain states wanted */
  1049.         while (strcmp(pstate->status, pdelta->state) != 0)
  1050.         if (!(pstate = pstate->nextstate))
  1051.             return false;
  1052.     if (lockflag) /* only locked revisions wanted */
  1053.         for (plock = Locks;  ;  plock = plock->nextlock)
  1054.         if (!plock)
  1055.             return false;
  1056.         else if (plock->delta == pdelta)
  1057.             break;
  1058.     if ((prevision = Revlst)) /* only certain revs or branches wanted */
  1059.         for (;;) {
  1060.                 length = prevision->numfld;
  1061.         if (
  1062.             countnumflds(pdelta->num) == length+(length&1) &&
  1063.             0 <= compartial(pdelta->num, prevision->strtrev, length) &&
  1064.             0 <= compartial(prevision->endrev, pdelta->num, length)
  1065.         )
  1066.              break;
  1067.         if (!(prevision = prevision->rnext))
  1068.             return false;
  1069.             }
  1070.     return true;
  1071. }
  1072.  
  1073.  
  1074.  
  1075.     static void
  1076. getdatepair(argv)
  1077.    char   * argv;
  1078. /*  function:  get time range from command line and store in datelist if    */
  1079. /*             a time range specified or in duelst if a time spot specified */
  1080.  
  1081. {
  1082.         register   char         c;
  1083.         struct     Datepairs    * nextdate;
  1084.     char const        * rawdate;
  1085.     int                     switchflag;
  1086.  
  1087.         argv--;
  1088.     while ((c = *++argv)==',' || c==' ' || c=='\t' || c=='\n' || c==';')
  1089.         continue;
  1090.         if ( c == '\0' ) {
  1091.         error("missing date/time after -d");
  1092.             return;
  1093.         }
  1094.  
  1095.         while( c != '\0' )  {
  1096.         switchflag = false;
  1097.         nextdate = talloc(struct Datepairs);
  1098.             if ( c == '<' ) {   /*   case: -d <date   */
  1099.                 c = *++argv;
  1100.         if (!(nextdate->ne_date = c!='='))
  1101.             c = *++argv;
  1102.                 (nextdate->strtdate)[0] = '\0';
  1103.         } else if (c == '>') { /* case: -d'>date' */
  1104.         c = *++argv;
  1105.         if (!(nextdate->ne_date = c!='='))
  1106.             c = *++argv;
  1107.         (nextdate->enddate)[0] = '\0';
  1108.         switchflag = true;
  1109.         } else {
  1110.                 rawdate = argv;
  1111.         while( c != '<' && c != '>' && c != ';' && c != '\0')
  1112.              c = *++argv;
  1113.                 *argv = '\0';
  1114.         if ( c == '>' ) switchflag=true;
  1115.         str2date(rawdate,
  1116.              switchflag ? nextdate->enddate : nextdate->strtdate);
  1117.         if ( c == ';' || c == '\0') {  /*  case: -d date  */
  1118.             VOID strcpy(nextdate->enddate,nextdate->strtdate);
  1119.                     nextdate->dnext = duelst;
  1120.                     duelst = nextdate;
  1121.             goto end;
  1122.         } else {
  1123.             /*   case:   -d date<  or -d  date>; see switchflag */
  1124.             int eq = argv[1]=='=';
  1125.             nextdate->ne_date = !eq;
  1126.             argv += eq;
  1127.             while ((c = *++argv) == ' ' || c=='\t' || c=='\n')
  1128.             continue;
  1129.             if ( c == ';' || c == '\0') {
  1130.             /* second date missing */
  1131.             if (switchflag)
  1132.                 *nextdate->strtdate= '\0';
  1133.             else
  1134.                 *nextdate->enddate= '\0';
  1135.             nextdate->dnext = datelist;
  1136.             datelist = nextdate;
  1137.             goto end;
  1138.             }
  1139.                 }
  1140.             }
  1141.             rawdate = argv;
  1142.         while( c != '>' && c != '<' && c != ';' && c != '\0')
  1143.          c = *++argv;
  1144.             *argv = '\0';
  1145.         str2date(rawdate,
  1146.              switchflag ? nextdate->strtdate : nextdate->enddate);
  1147.             nextdate->dnext = datelist;
  1148.         datelist = nextdate;
  1149.      end:
  1150.         if (RCSversion < VERSION(5))
  1151.         nextdate->ne_date = 0;
  1152.         if ( c == '\0')  return;
  1153.         while ((c = *++argv) == ';' || c == ' ' || c == '\t' || c =='\n')
  1154.         continue;
  1155.         }
  1156. }
  1157.  
  1158.  
  1159.  
  1160.     static int
  1161. getnumericrev()
  1162. /*  function:  get the numeric name of revisions which stored in revlist  */
  1163. /*             and then stored the numeric names in Revlst                */
  1164. /*             if branchflag, also add default branch                     */
  1165.  
  1166. {
  1167.         struct  Revpairs        * ptr, *pt;
  1168.     int n;
  1169.     struct buf s, e;
  1170.     char const *lrev;
  1171.     struct buf const *rstart, *rend;
  1172.  
  1173.     Revlst = 0;
  1174.         ptr = revlist;
  1175.     bufautobegin(&s);
  1176.     bufautobegin(&e);
  1177.         while( ptr ) {
  1178.         n = 0;
  1179.         rstart = &s;
  1180.         rend = &e;
  1181.  
  1182.         switch (ptr->numfld) {
  1183.  
  1184.           case 1: /* -rREV */
  1185.         if (!expandsym(ptr->strtrev, &s))
  1186.             goto freebufs;
  1187.         rend = &s;
  1188.         n = countnumflds(s.string);
  1189.         if (!n  &&  (lrev = tiprev())) {
  1190.             bufscpy(&s, lrev);
  1191.             n = countnumflds(lrev);
  1192.         }
  1193.         break;
  1194.  
  1195.           case 2: /* -rREV: */
  1196.         if (!expandsym(ptr->strtrev, &s))
  1197.             goto freebufs;
  1198.         bufscpy(&e, s.string);
  1199.         n = countnumflds(s.string);
  1200.         (n<2 ? e.string : strrchr(e.string,'.'))[0]  =  0;
  1201.         break;
  1202.  
  1203.           case 3: /* -r:REV */
  1204.         if (!expandsym(ptr->endrev, &e))
  1205.             goto freebufs;
  1206.         if ((n = countnumflds(e.string)) < 2)
  1207.             bufscpy(&s, ".0");
  1208.         else {
  1209.             bufscpy(&s, e.string);
  1210.             VOID strcpy(strrchr(s.string,'.'), ".0");
  1211.         }
  1212.         break;
  1213.  
  1214.           default: /* -rREV1:REV2 */
  1215.         if (!(
  1216.             expandsym(ptr->strtrev, &s)
  1217.             &&    expandsym(ptr->endrev, &e)
  1218.             &&    checkrevpair(s.string, e.string)
  1219.         ))
  1220.             goto freebufs;
  1221.         n = countnumflds(s.string);
  1222.         /* Swap if out of order.  */
  1223.         if (compartial(s.string,e.string,n) > 0) {
  1224.             rstart = &e;
  1225.             rend = &s;
  1226.         }
  1227.         break;
  1228.         }
  1229.  
  1230.         if (n) {
  1231.         pt = ftalloc(struct Revpairs);
  1232.         pt->numfld = n;
  1233.         pt->strtrev = fstr_save(rstart->string);
  1234.         pt->endrev = fstr_save(rend->string);
  1235.                 pt->rnext = Revlst;
  1236.                 Revlst = pt;
  1237.         }
  1238.         ptr = ptr->rnext;
  1239.         }
  1240.         /* Now take care of branchflag */
  1241.     if (branchflag && (Dbranch||Head)) {
  1242.         pt = ftalloc(struct Revpairs);
  1243.         pt->strtrev = pt->endrev =
  1244.         Dbranch ? Dbranch : fstr_save(partialno(&s,Head->num,1));
  1245.         pt->rnext=Revlst; Revlst=pt;
  1246.         pt->numfld = countnumflds(pt->strtrev);
  1247.         }
  1248.  
  1249.       freebufs:
  1250.     bufautoend(&s);
  1251.     bufautoend(&e);
  1252.     return !ptr;
  1253. }
  1254.  
  1255.  
  1256.  
  1257.     static int
  1258. checkrevpair(num1,num2)
  1259.     char const *num1, *num2;
  1260. /*  function:  check whether num1, num2 are legal pair,i.e.
  1261.     only the last field are different and have same number of
  1262.     fields( if length <= 2, may be different if first field)   */
  1263.  
  1264. {
  1265.     int length = countnumflds(num1);
  1266.  
  1267.     if (
  1268.             countnumflds(num2) != length
  1269.         ||    (2 < length  &&  compartial(num1, num2, length-1) != 0)
  1270.     ) {
  1271.         rcserror("invalid branch or revision pair %s : %s", num1, num2);
  1272.             return false;
  1273.         }
  1274.  
  1275.         return true;
  1276. }
  1277.  
  1278.  
  1279.  
  1280.     static void
  1281. getrevpairs(argv)
  1282. register     char    * argv;
  1283. /*  function:  get revision or branch range from command line, and   */
  1284. /*             store in revlist                                      */
  1285.  
  1286. {
  1287.         register    char    c;
  1288.         struct      Revpairs  * nextrevpair;
  1289.     int separator;
  1290.  
  1291.     c = *argv;
  1292.  
  1293.     /* Support old ambiguous '-' syntax; this will go away.  */
  1294.     if (strchr(argv,':'))
  1295.         separator = ':';
  1296.     else {
  1297.         if (strchr(argv,'-')  &&  VERSION(5) <= RCSversion)
  1298.         warn("`-' is obsolete in `-r%s'; use `:' instead", argv);
  1299.         separator = '-';
  1300.     }
  1301.  
  1302.     for (;;) {
  1303.         while (c==' ' || c=='\t' || c=='\n')
  1304.         c = *++argv;
  1305.         nextrevpair = talloc(struct Revpairs);
  1306.             nextrevpair->rnext = revlist;
  1307.             revlist = nextrevpair;
  1308.         nextrevpair->numfld = 1;
  1309.         nextrevpair->strtrev = argv;
  1310.         for (;;  c = *++argv) {
  1311.         switch (c) {
  1312.             default:
  1313.             continue;
  1314.             case '\0': case ' ': case '\t': case '\n':
  1315.             case ',': case ';':
  1316.             break;
  1317.             case ':': case '-':
  1318.             if (c == separator)
  1319.                 break;
  1320.             continue;
  1321.         }
  1322.         break;
  1323.         }
  1324.         *argv = '\0';
  1325.         while (c==' ' || c=='\t' || c=='\n')
  1326.         c = *++argv;
  1327.         if (c == separator) {
  1328.         while ((c = *++argv) == ' ' || c == '\t' || c =='\n')
  1329.             continue;
  1330.         nextrevpair->endrev = argv;
  1331.         for (;;  c = *++argv) {
  1332.             switch (c) {
  1333.             default:
  1334.                 continue;
  1335.             case '\0': case ' ': case '\t': case '\n':
  1336.             case ',': case ';':
  1337.                 break;
  1338.             case ':': case '-':
  1339.                 if (c == separator)
  1340.                 break;
  1341.                 continue;
  1342.             }
  1343.             break;
  1344.         }
  1345.         *argv = '\0';
  1346.         while (c==' ' || c=='\t' || c =='\n')
  1347.             c = *++argv;
  1348.         nextrevpair->numfld =
  1349.             !nextrevpair->endrev[0] ? 2 /* -rREV: */ :
  1350.             !nextrevpair->strtrev[0] ? 3 /* -r:REV */ :
  1351.             4 /* -rREV1:REV2 */;
  1352.             }
  1353.         if (!c)
  1354.         break;
  1355.         else if (c==',' || c==';')
  1356.         c = *++argv;
  1357.         else
  1358.         error("missing `,' near `%c%s'", c, argv+1);
  1359.     }
  1360. }
  1361.  
  1362. static char const *numrev2symbrev (numrev)
  1363. char const *numrev;
  1364. {
  1365.     struct assoc const *p;
  1366.  
  1367.     for (p = Symbols; p; p = p->nextassoc) {
  1368.         if (! strcmp (numrev, p->num)) return (p->symbol);
  1369.     }
  1370.  
  1371.     return ("");
  1372. }
  1373.