Annotation of researchv10dc/cmd/worm/scsi/tcl/strchr.c, revision 1.1

1.1     ! root        1: /* 
        !             2:  * strchr.c --
        !             3:  *
        !             4:  *     Source code for the "strchr" library routine.
        !             5:  *
        !             6:  * Copyright 1988 Regents of the University of California
        !             7:  * Permission to use, copy, modify, and distribute this
        !             8:  * software and its documentation for any purpose and without
        !             9:  * fee is hereby granted, provided that the above copyright
        !            10:  * notice appear in all copies.  The University of California
        !            11:  * makes no representations about the suitability of this
        !            12:  * software for any purpose.  It is provided "as is" without
        !            13:  * express or implied warranty.
        !            14:  */
        !            15: 
        !            16: #ifndef lint
        !            17: static char rcsid[] = "$Header: /sprite/src/lib/c/string/RCS/strchr.c,v 1.2 89/03/22 16:06:40 rab Exp $ SPRITE (Berkeley)";
        !            18: #endif /* not lint */
        !            19: 
        !            20: #include <string.h>
        !            21: 
        !            22: /*
        !            23:  *----------------------------------------------------------------------
        !            24:  *
        !            25:  * strchr --
        !            26:  *
        !            27:  *     Locate the first appearance of a character in a string.
        !            28:  *
        !            29:  * Results:
        !            30:  *     The return value is the address of the first appearance
        !            31:  *     in string of c.  If c doesn't appear in string then 0
        !            32:  *     is returned.
        !            33:  *
        !            34:  * Side effects:
        !            35:  *     None.
        !            36:  *
        !            37:  *----------------------------------------------------------------------
        !            38:  */
        !            39: 
        !            40: char *
        !            41: strchr(string, c)
        !            42:     register char *string;             /* String to search. */
        !            43:     register char c;                   /* Desired character. */
        !            44: {
        !            45:     while (1) {
        !            46:        if (*string == c) {
        !            47:            return string;
        !            48:        }
        !            49:        if (*string++ == 0) {
        !            50:            return (char *) 0;
        !            51:        }
        !            52:     }
        !            53: }

unix.superglobalmegacorp.com

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