# 2.11BSD#431 - /usr/src/bin/sh/string.c

##### Functions

    any               X
    cf                X
    length            X
    movstr            X

       1: #ifndef lint
       2: static char sccsid[] = "@(#)string.c	4.2 8/11/83";
       3: #endif
       4:
       5: #
       6: /*
       7:  * UNIX shell
       8:  *
       9:  * S. R. Bourne
      10:  * Bell Telephone Laboratories
      11:  *
      12:  */
      13:
      14: #include    "defs.h"
      15:
      16:
      17: /* ========	general purpose string handling ======== */
      18:
      19:
      20: STRING  movstr(a,b)
      21:     REG STRING  a, b;
      22: {
      23:     WHILE *b++ = *a++ DONE
      24:     return(--b);
      25: }
      26:
      27: INT any(c,s)
      28:     REG CHAR    c;
      29:     STRING      s;
      30: {
      31:     REG CHAR d;
      32:
      33:     WHILE d = *s++
      34:     DO  IF d==c
      35:         THEN    return(TRUE);
      36:         FI
      37:     OD
      38:     return(FALSE);
      39: }
      40:
      41: INT cf(s1, s2)
      42:     REG STRING s1, s2;
      43: {
      44:     WHILE *s1++ == *s2
      45:     DO  IF *s2++==0
      46:         THEN    return(0);
      47:         FI
      48:     OD
      49:     return(*--s1 - *s2);
      50: }
      51:
      52: INT length(as)
      53:     STRING as;
      54: {
      55:     REG STRING s;
      56:
      57:     IF s=as THEN WHILE *s++ DONE FI
      58:     return(s-as);
      59: }

#### Defined functions

any defined in line 27; used 3 times

- in /usr/src/bin/sh/name.c line 145
- in /usr/src/bin/sh/service.c line 77, 385

cf defined in line 41; used 3 times

- in /usr/src/bin/sh/defs.h line 115
- in /usr/src/bin/sh/name.c line 200
- in /usr/src/bin/sh/service.c line 349

length defined in line 52; used 3 times

- in /usr/src/bin/sh/io.c line 35
- in /usr/src/bin/sh/name.c line 182
- in /usr/src/bin/sh/print.c line 42

movstr defined in line 20; used 10 times

- in /usr/src/bin/sh/blok.c line 76
- in /usr/src/bin/sh/defs.h line 86
- in /usr/src/bin/sh/io.c line 104
- in /usr/src/bin/sh/macro.c line 200
- in /usr/src/bin/sh/main.c line 180
- in /usr/src/bin/sh/name.c line 182, 269-271(3)
- in /usr/src/bin/sh/stak.c line 84

#### Defined variables

sccsid defined in line 2; never used

Last modified: 1983-08-12 Generated: 2016-12-26 | Generated by src2html V0.67 page hit count: 554 |