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

##### Functions

    blank             X
    itos              X
    newline           X
    prc               X
    prn               X
    prp               X
    prs               X
    prt               X
    stoi              X

       1: #ifndef lint
       2: static char sccsid[] = "@(#)print.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: CHAR        numbuf[6];
      17:
      18:
      19: /* printing and io conversion */
      20:
      21: newline()
      22: {   prc(NL);
      23: }
      24:
      25: blank()
      26: {   prc(SP);
      27: }
      28:
      29: prp()
      30: {
      31:     IF (flags&prompt)==0 ANDF cmdadr
      32:     THEN    prs(cmdadr); prs(colon);
      33:     FI
      34: }
      35:
      36: VOID    prs(as)
      37:     STRING      as;
      38: {
      39:     REG STRING  s;
      40:
      41:     IF s=as
      42:     THEN    write(output,s,length(s)-1);
      43:     FI
      44: }
      45:
      46: VOID    prc(c)
      47:     CHAR        c;
      48: {
      49:     IF c
      50:     THEN    write(output,&c,1);
      51:     FI
      52: }
      53:
      54: prt(t)
      55:     L_INT       t;
      56: {
      57:     REG INT hr, min, sec;
      58:
      59:     t += 30; t /= 60;
      60:     sec=t%60; t /= 60;
      61:     min=t%60;
      62:     IF hr=t/60
      63:     THEN    prn(hr); prc('h');
      64:     FI
      65:     prn(min); prc('m');
      66:     prn(sec); prc('s');
      67: }
      68:
      69: prn(n)
      70:     INT     n;
      71: {
      72:     itos(n); prs(numbuf);
      73: }
      74:
      75: itos(n)
      76: {
      77:     REG char *abuf; REG POS a, i; INT pr, d;
      78:     abuf=numbuf; pr=FALSE; a=n;
      79:     FOR i=10000; i!=1; i/=10
      80:     DO  IF (pr |= (d=a/i)) THEN *abuf++=d+'0' FI
      81:         a %= i;
      82:     OD
      83:     *abuf++=a+'0';
      84:     *abuf++=0;
      85: }
      86:
      87: stoi(icp)
      88: STRING  icp;
      89: {
      90:     REG CHAR    *cp = icp;
      91:     REG INT     r = 0;
      92:     REG CHAR    c;
      93:
      94:     WHILE (c = *cp, digit(c)) ANDF c ANDF r>=0
      95:     DO r = r*10 + c - '0'; cp++ OD
      96:     IF r<0 ORF cp==icp
      97:     THEN    failed(icp,badnum);
      98:     ELSE    return(r);
      99:     FI
     100: }

#### Defined functions

blank defined in line 25; used 6 times

- in /usr/src/bin/sh/name.c line 62, 290-293(2)
- in /usr/src/bin/sh/service.c line 267
- in /usr/src/bin/sh/xec.c line 66, 86

itos defined in line 75; used 4 times

- in line 72
- in /usr/src/bin/sh/io.c line 104
- in /usr/src/bin/sh/main.c line 179
- in /usr/src/bin/sh/name.c line 173

newline defined in line 21; used 12 times

- in /usr/src/bin/sh/cmd.c line 408
- in /usr/src/bin/sh/error.c line 42
- in /usr/src/bin/sh/name.c line 62, 260, 296
- in /usr/src/bin/sh/service.c line 272
- in /usr/src/bin/sh/word.c line 133
- in /usr/src/bin/sh/xec.c line 67, 86, 130, 221, 251

prc defined in line 46; used 16 times

- in line 22-26(2), 63-66(3)
- in /usr/src/bin/sh/blok.c line 113(2)
- in /usr/src/bin/sh/cmd.c line 387-390(2), 402-407(2)
- in /usr/src/bin/sh/defs.h line 108
- in /usr/src/bin/sh/name.c line 259
- in /usr/src/bin/sh/word.c line 115
- in /usr/src/bin/sh/xec.c line 218-220(2)

prn defined in line 69; used 9 times

- in line 63-66(3)
- in /usr/src/bin/sh/blok.c line 113(2)
- in /usr/src/bin/sh/cmd.c line 399
- in /usr/src/bin/sh/service.c line 267
- in /usr/src/bin/sh/xec.c line 130, 251

prp defined in line 29; used 3 times

- in /usr/src/bin/sh/cmd.c line 397
- in /usr/src/bin/sh/error.c line 38
- in /usr/src/bin/sh/service.c line 267

prs defined in line 36; used 31 times

- in line 32(2), 72
- in /usr/src/bin/sh/cmd.c line 384-389(3), 397-407(5)
- in /usr/src/bin/sh/defs.h line 107
- in /usr/src/bin/sh/error.c line 38-40(3)
- in /usr/src/bin/sh/main.c line 154-157(2), 173
- in /usr/src/bin/sh/name.c line 61, 258-259(2), 290-296(3)
- in /usr/src/bin/sh/service.c line 262, 269-270(2)
- in /usr/src/bin/sh/xec.c line 64-66(2), 130(2)

prt defined in line 54; used 2 times

- in /usr/src/bin/sh/xec.c line 86(2)

stoi defined in line 87; used 4 times

- in /usr/src/bin/sh/service.c line 53
- in /usr/src/bin/sh/xec.c line 91, 102, 114

#### 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: 890 |