concordance.cc:
  ...
        107  void saveAlphabetFile(char *origFn, char *alphaFn,CharCtVector &cc
        108  void outOfMem(void);  //new() error handler
        109
X       110  int main(int argc, char **argv)
        111  {
        112      char *outfile;
        113      int n, ndx;
  ...
        115
        116      copyright();
        117
TF      118      if (argc<2){   //if only appname is called, provide instructio
        119         instructions();
        120         return 0;
        121      }
        122
        123      //if help is asked for, provide instructions
-->F    124a     else if(
  -->f  124b             strcmp(argv[1],"-?")==0||
  -->f  124c                                      strcmp(argv[1],"-h")==0||
  -->f  124d                                                               strc
        125         instructions();
        126         return 0;
        127      }
        128
TF      129      if (argc<4){   //no outfile name given on command line: set as
        130         outfile=0;
        131      }
        132      else{ //otherwise use the name of the outfile given by operato
  ...
        143  #ifdef OS_UNIX //this block is set to handle command line switches
        144     enum CtType{UNINDICATED,PAGE,LINE,STANZA}; //command line switc
        145        CtType countType=UNINDICATED;
TF      146     if (argc > 2){    //operator has included switches (segfaulted
TF      147        if (strstr(argv[1],"n:")){ //determine starting p/line/v num
TF      148           for (n=0;argv[1][n]!=':';n++);//move past the colon
        149           n++;
TF      150a          for (ndx=0;
  tf    150b                     ndx<12&&
  tf    150c                             argv[1][n];ndx++,n++){
        151              numBfr[ndx]=argv[1][n];
        152           }
        153
        154        numBfr[ndx]='\0';
TF      155a       for (n=0;
  tf    155b                n<12&&
  tf    155c                      numBfr[n];n++) //check to be surethere is a n
TF      156           if (!isdigit(numBfr[n])){
        157              cerr << "\n\nSYNTAX ERROR on command line: switch -[pv
        158              exit(1);
        159           }
  ...
        162
        163     //find out what kind of numbering is to be used in determining
        164
TF      165     for(n=1; n < argc; n++){
TF      166        if(strstr(argv[n],"-")){    //if the arg is a switch...
TF      167           if(strstr(argv[n],"p"))
        168              countType=PAGE;
TF      169           else if(strstr(argv[n],"l"))
        170              countType=LINE;
-->T    171           else if(strstr(argv[n],"s"))
        172              countType=STANZA;
        173           else
        174              countType=PAGE;
TF      175           if(strstr(argv[n],"q"))
        176              QuietFlag=ON;
        177        }
        178     }
        179     switch(countType){
X       180        case STANZA:
        181           parse(argv[2],'s',outfile,QuietFlag);
        182           break;
X       183        case LINE:
        184           parse(argv[2],'l',outfile,QuietFlag);
        185           break;
X       186        case PAGE:
        187           parse(argv[2],'p',outfile,QuietFlag);
        188           break;
-->     189        case UNINDICATED:
        190           parse(argv[2],'p',outfile,QuietFlag);
        191           break;
-->     192        }
        193     }
        194
        195     else parse(argv[1],'p',outfile,QuietFlag);  //default choice if
  ...
        243
        244  //**copyright(void)***********************************************
        245  // put copyright on screen
X       246  void copyright(void)
        247  {
        248      cout << "\nThis is Concordance, a program to make concordances
        249     << "$Id: concordance.cc,v 0.5 1996/11/26 23:49:48 ralph Exp ral
  ...
        260
        261  // print usage instructions on screen:
        262  #ifdef OS_UNIX
X       263  void instructions(void)
        264  {
        265      cout << "\nUSAGE:\n"
        266        << "concordance [-p[q][n:num] or -l[q][n:num]] or -s[q][num]
  ...
        368  #endif
        369
        370  //parser of words on line numbers, pages, stanzas.
X       371  void parse(char *fname,char countType,char *ofname,BOOLEAN quiet=O
        372  {
        373     FILE *fp; //read-in file, char file, concordance file
        374     char *filenameBfr;
  ...
        380     CharCtVector ccv; //character counter
        381     WordList wl;   //the concordance: the linked list of words and
        382
-->F    383     if((fp=fopen(fname,"rb"))==0){   //open file to be concordanced
        384        cerr << "Couldn't open file" << fname << endl;
        385        perror("File opening error");
        386        assert (fp);   //make sure it opened OK
        387     }
        388
        389      //Set up filenames for output .wds & .abc results files:
TF      390     if (ofname==0){   //if operator hasn't provided an output file
        391        filenameBfr=new char[(fnlen=strlen(fname)+EXTENSIONLEN)];
        392        assert(filenameBfr!=0);
        393        strcpy(filenameBfr,fname);  //use the filename of file to be
  ...
        426        << "\n                                     (1 line of dots =
        427  #endif
        428  #ifdef OS_UNIX
TF      429     if(!quiet)cout << "\n\nMaking Condordance. Depending on file le
        430  #endif
        431     unsigned char inbuffer[FILESEGMENT];  //holding buffer for read
        432
TF      433     while (!ateof(fp)) {
        434        charsRead=fread(inbuffer,sizeof(char),sizeof(inbuffer),fp);
        435        assert(charsRead>0);
TF      436a       for (unsigned int n=0;
  -->t  436b                             n<FILESEGMENT&&
  tf    436c                                            n<charsRead&&
  -->t  436d                                                         char(inbuf
        437           ccv.incChar(inbuffer[n]);
TF      438a          if (
  tf    438b              isAlphaDiacritic(inbuffer[n])||
  tf    438c                                             isdigit(inbuffer[n])){
TF      439              if (!wordFlag)wordFlag=1;   //as a word
        440              wordBfr[wordNdx++]=inbuffer[n];
TF      441a             if (
  tf    441b                 isdigit(inbuffer[n])&&
  -->t  441c                                       !isWord)isNum=YES; //if inbu
TF      442              else if (!isWord){
        443                 isWord=YES;  //if a digit has a letter included, in
        444                 isNum=NO;    //added along with &&(inbuffer[n]!='>'
        445              }
        446           }
TF      447a          else if (
  tf    447b                   wordFlag&&!(
  tf    447c                               inbuffer[n]=='>'&&
  -->t  447d                                                 isNum)){ //inbuffe
        448              wordBfr[wordNdx]='\0';  //NULL end the word in wordBfr
        449              wl.addWord(wordBfr,locNum);  //add the word to the con
        450              fileLoc=ftell(fp); //note location in file
  ...
        461           if (inbuffer[n] == CR && countType == 'l') //if whitespac
        462  #endif
        463  #ifdef OS_UNIX
TF      464a          if (
  tf    464b              inbuffer[n] == LF &&
  tf    464c                                   countType == 'l') //if whitespac
        465  #endif
        466              locNum++; //increment locnum as line number on carriag
TF      467a          else if (
  tf    467b                   inbuffer[n] == FF &&
  -->t  467c                                        countType == 'p') //if whit
        468              locNum++; //increment locnum as page number on formfee
TF      469a          else if (
  tf    469b                   inbuffer[n] == '>' &&
  -->t  469c                                         countType == 's' &&
  -->t  469d                                                             isNum)
        470              wordBfr[wordNdx]='\0';  //end the string
        471              locNum=atoi(wordBfr);   //put the number into location
        472              wordNdx=isWord=wordFlag=isNum=0; //start with new word
  ...
        478     saveConFile(fname,conFn,countType,wl,quiet); //save the list of
        479     saveAlphabetFile(fname,alphaFn,ccv,quiet);   //save the alphabe
        480
TF      481     if(!quiet)
        482        cout << "\n\nConcordancing completed.  For concordance file,
        483        << "usage file, see " << alphaFn << "\n\n";
        484
  ...
        488
        489
        490
X       491  void saveConFile(char *origFn, char *conFn, char ctType,WordList &
        492  quiet=OFF)
        493  {
        494     ofstream confile(conFn);
        495     assert(confile!=0);
TF      496     if(!quiet)cout << "\n\nSaving concordance file " << conFn << ",
        497     confile << "Concordance for file: " << origFn << "\n\n";
        498     confile << "Note: Concordancer considers a word a set of alphan
        499     confile << "      bounded by whitespace at each end of the set.
        500     confile << "Total number of words in file: " << wordCount << "\
        501
TF      502     if(ctType=='s')      confile << "Initial stanza of file was sta
TF      503     else if(ctType=='p') confile << "Initial page of file was page
-->T    504     else if(ctType=='l') confile << "Initial line of file was line
        505
TF      506     if(ctType=='s')        confile << "Last stanza of file was stan
TF      507     else if(ctType=='p')   confile << "Last page of file was page "
-->T    508     else if(ctType=='l')   confile << "Last line of file was line "
        509
        510     confile << "Word           Number of";
TF      511     if(ctType=='s') confile << "   Stanza number\n";
TF      512     else if(ctType=='p') confile << "   Page number\n";
-->T    513     else if(ctType=='l') confile << "   Line number\n";
        514     confile << "Len  Word:         uses:   Locations:\n";
        515     confile << wl;
        516  }
        517
        518
        519
X       520  void saveAlphabetFile(char *origFn, char *alphaFn,CharCtVector &cc
        521  {
        522     ofstream alphafile(alphaFn);
        523     assert(alphafile!=0);
        524
TF      525     if(!quiet)cout << "\n\nSaving alphabet count file " << alphaFn
        526     alphafile << ccv;
        527  }
        528
        529
        530
        531  //out of memory message to display on screen in parser:
-->     532  void outOfMem(void)
        533  {
        534     cerr << "\n\nERROR: You have insufficient memory to continue ma
        535          << "document.  It will be necessary for you to shorten the
  ...
