// saved from url
// http://www-cs.canisius.edu/PL_TUTORIALS/C++/EXAMPLES/MRD/SRC/speclist.c -->

//-------------------------------- speclist.c -----------------------------

#include <stdio.h>
#include <string.h>
#include "speclist.h"

void Speclist::print ()
{
     for (int i=0; i<numspecs; i++)
          printf ("%s %2s %s\n", specs[i].fieldname, specs[i].comparison, 
                                 specs[i].fieldvalueC);
}

void Speclist::addspec (char relationship, char *whichfield,
                        char *newcomparison, char *newfieldvalue)
{
     if (numspecs >= MAXSPECS) return;
     numspecs++;
     int i = numspecs - 1;   // index is 1 less than number of specs
     specs[i].relation_to_previous = relationship;
     strcpy (specs[i].fieldname, whichfield);
     strcpy (specs[i].comparison, newcomparison);
     strcpy (specs[i].fieldvalueC, newfieldvalue);
}
