gno/usr.bin/man/common.c
gdr 73ce022151 Version 3.0 of the manpack archive. This moved on top of the
original makewhatis repository.  Earlier versions of man, apropos,
and whatis were by other authors (these are written from scratch).
Catman is new.
1996-01-28 00:41:22 +00:00

30 lines
650 B
C

/*
* Copyright 1995 by Devin Reade <gdr@myrias.com>. For distribution
* information see the README file that is part of the manpack archive,
* or contact the author, above.
*/
segment "common____";
#include <types.h>
#include <string.h>
#include "man.h"
/*
* getSuffixIndex
*
* return the index into compressArray of the appropriate
* suffix/decompresser. If there is no match, return -1.
*/
int getSuffixIndex(char *name) {
char *p;
int i;
for (i=0; compressArray[i].suffix != NULL; i++) {
p = strstr(name,compressArray[i].suffix);
if (p && !*(p + strlen(compressArray[i].suffix))) return i;
}
return -1;
}