Annotation of coherent/a/usr/man/ALL/rindex, revision 1.1.1.1

1.1       root        1: 
                      2: 
                      3: rindex()                 String Function                 rindex()
                      4: 
                      5: 
                      6: 
                      7: 
                      8: Find a character in a string
                      9: 
                     10: cchhaarr *rriinnddeexx(_s_t_r_i_n_g, _c) cchhaarr *_s_t_r_i_n_g; cchhaarr _c;
                     11: 
                     12: rindex scans string for the last occurrence of character c.  If c
                     13: is found,  rindex returns a pointer  to it.  If it  is not found,
                     14: rindex returns NULL.
                     15: 
                     16: ***** Example *****
                     17: 
                     18: This example uses rriinnddeexx to help  strip a sample file name of the
                     19: path information.
                     20: 
                     21: 
                     22: #include <stdio.h>
                     23: #define PATHSEP '/' /* path name separator */
                     24: 
                     25: 
                     26: 
                     27: extern char *rindex();
                     28: extern char *basename();
                     29: 
                     30: 
                     31: 
                     32: main()
                     33: {
                     34: 
                     35: 
                     36: 
                     37:     printf("Before massaging: %s\n", testpath);
                     38:     printf("After massaging: %s\n", basename(testpath));
                     39: }
                     40: 
                     41: 
                     42: 
                     43: char *basename(path)
                     44: char *path;
                     45: {
                     46:     char *cp;
                     47:     return (((cp = rindex(path, PATHSEP)) == NULL)
                     48:                      ? path : ++cp);
                     49: }
                     50: 
                     51: 
                     52: ***** See Also *****
                     53: 
                     54: index(), string functions
                     55: 
                     56: ***** Notes *****
                     57: 
                     58: This  function is  identical to  the  function strrchr,  which is
                     59: described in the ANSI standard.
                     60: 
                     61: 
                     62: 
                     63: 
                     64: COHERENT Lexicon                                           Page 1
                     65: 
                     66: 
                     67: 
                     68: 
                     69: rindex()                 String Function                 rindex()
                     70: 
                     71: 
                     72: 
                     73: COHERENT includes  strrchr in  its libraries.  It  is recommended
                     74: that it  be used instead of rindex so  that programs more closely
                     75: approach strict conformity with the ANSI standard.
                     76: 
                     77: 
                     78: 
                     79: 
                     80: 
                     81: 
                     82: 
                     83: 
                     84: 
                     85: 
                     86: 
                     87: 
                     88: 
                     89: 
                     90: 
                     91: 
                     92: 
                     93: 
                     94: 
                     95: 
                     96: 
                     97: 
                     98: 
                     99: 
                    100: 
                    101: 
                    102: 
                    103: 
                    104: 
                    105: 
                    106: 
                    107: 
                    108: 
                    109: 
                    110: 
                    111: 
                    112: 
                    113: 
                    114: 
                    115: 
                    116: 
                    117: 
                    118: 
                    119: 
                    120: 
                    121: 
                    122: 
                    123: 
                    124: 
                    125: 
                    126: 
                    127: 
                    128: 
                    129: 
                    130: COHERENT Lexicon                                           Page 2
                    131: 
                    132: 

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.