-// These are two utility functions for printing CVS IDs. Massagecvs()
-// returns distance that it has moved ahead in the input string
-int massagecvs(char *out, const char *cvsid){
- char *copy,*filename,*date,*version;
- int retVal=0;
- const char delimiters[] = " ,$";
-
- // make a copy on the heap, go to first token,
- if (!(copy=strdup(cvsid)))
- return 0;
-
- if (!(filename=strtok(copy, delimiters)))
- goto endmassage;
-
- // move to first instance of "Id:"
- while (strcmp(filename,"Id:"))
- if (!(filename=strtok(NULL, delimiters)))
- goto endmassage;
-
- // get filename, skip "v", get version and date
- if (!( filename=strtok(NULL, delimiters) ) ||
- !( strtok(NULL, delimiters) ) ||
- !( version=strtok(NULL, delimiters) ) ||
- !( date=strtok(NULL, delimiters) ) )
- goto endmassage;
-
- sprintf(out,"%-16s revision: %-5s date: %-15s", filename, version, date);
- retVal = (date-copy)+strlen(date);
-
- endmassage:
- free(copy);
- return retVal;
-}
-
-// prints a single set of CVS ids
-void printone(char *block, const char *cvsid){
- char strings[CVSMAXLEN];
- const char *here=cvsid;
- int bi=0, len=strlen(cvsid)+1;
-
- // check that the size of the output block is sufficient
- if (len>=CVSMAXLEN) {
- pout("CVSMAXLEN=%d must be at least %d\n",CVSMAXLEN,len+1);
- EXIT(1);
- }
-
- // loop through the different strings
- while (bi<CVSMAXLEN && (len=massagecvs(strings,here))){
- bi+=snprintf(block+bi,CVSMAXLEN-bi,"%s %s\n",(bi==0?"Module:":" uses:"),strings);
- here+=len;
- }
- return;
-}
-
-