NAME

nst_suffix_and_version - test and parse file name

PROTOTYPE

int nst_suffix_and_version( char *pcName, char *pcSuffix, int *piBasenameLen, int *piMajor, int *piMinor)

ARGUMENTS

char *pcName
full file name
char *pcSuffix
suffix to test, inclusive dot
int *piBasenameLen
returns length of base part
int *piMajor
returns major version or -1, if not given
int *piMinor
returns minor version or -1, if not given

DESCRIPTION:

Expects that pcSuffix = NULL or is a suffix that starts with a dot followed by one or more non-dot characters. In this case, parses a file name of the form pcName = basename [ "." major [ "." minor ]] suffix [ ".gz" ] if pcSuffix != NULL, and pcName = basename [ "." major [ "." minor ]] [ ".gz" ] otherwise. In both cases, major and minor is a sequence of digits. If version numbers major and optionally minor are present, they are returned in *piMajor, *piMinor (returned values of -1 indicate absence). *piBasenameLen returns the length of the basename part, i.e., the part before the first dot of the version/suffix portion.

RETURN VALUE:

1, if the specified suffix is present 0 otherwise or if pcSuffix = NULL

Examples:

pcName = "foo34.2.4.5.NST.gz" and pcSuffix = ".NST" returns 1 and *piBasenameLen=7 *piMajor = 4 *piMinor = 5 pcName = "foo34.2.gz" and pcSuffix = NULL returns 0 and *piBasenameLen=5 *piMajor = 2 *piMinor = -1

FILE

/local/homes/rhaschke/nst7/man/../o.linx86//../nstsrc/nst0.c