home *** CD-ROM | disk | FTP | other *** search
- /*********
- * Atlast.c by Leonard Zerman
- * Placed in the public domain by Tom Rettig Associates, 10/22/1990.
- *
- * Syntax: ATLAST( <expC>, <expC> )
- * Return: The last position of a character found in a string.
- * Note : Returns 0 if not found, -1 if error.
- ********/
-
- #include "trlib.h"
-
- TRTYPE atlast() /* declare the atlast function */
- {
- char *instr; /* a pointer to the passed string */
- char *c; /* a pointer to the char to be found */
- int i;
-
- if (PCOUNT ==2 && ISCHAR(1) && ISCHAR(2))
- {
- c = _parc(1);
- instr = _parc(2); /* assign the address to instr */
- }
- else
- {
- _retni(ERRORNEG); /* return a syntax error */
- return; /* return from program */
- }
-
- for (i = _tr_strlen(instr); instr[i] != *c && i >= 0 ; i--)
- ; /* empty loop checking for condition */
- _retni( ++i );
- }
-
-