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

##### Functions

    draino            X
    flush             X
    p2dig             X
    psecs             X
    putchar           X

##### Variables

    linbuf            X
    linp              X

       1: /*
       2:  * Copyright (c) 1980 Regents of the University of California.
       3:  * All rights reserved.  The Berkeley Software License Agreement
       4:  * specifies the terms and conditions for redistribution.
       5:  */
       6:
       7: #if !defined(lint) && defined(DOSCCS)
       8: static char *sccsid = "@(#)sh.print.c	5.2 (Berkeley) 6/6/85";
       9: #endif
      10:
      11: #include "sh.h"
      12: #include <sys/ioctl.h>
      13:
      14: /*
      15:  * C Shell
      16:  */
      17:
      18: psecs(l)
      19:     long l;
      20: {
      21:     register int i;
      22:
      23:     i = l / 3600;
      24:     if (i) {
      25:         printf("%d:", i);
      26:         i = l % 3600;
      27:         p2dig(i / 60);
      28:         goto minsec;
      29:     }
      30:     i = l;
      31:     printf("%d", i / 60);
      32: minsec:
      33:     i %= 60;
      34:     printf(":");
      35:     p2dig(i);
      36: }
      37:
      38: p2dig(i)
      39:     register int i;
      40: {
      41:
      42:     printf("%d%d", i / 10, i % 10);
      43: }
      44:
      45: char    linbuf[128];
      46: char    *linp = linbuf;
      47:
      48: putchar(c)
      49:     register int c;
      50: {
      51:
      52:     if ((c & QUOTE) == 0 && (c == 0177 || c < ' ' && c != '\t' && c != '\n')) {
      53:         putchar('^');
      54:         if (c == 0177)
      55:             c = '?';
      56:         else
      57:             c |= 'A' - 1;
      58:     }
      59:     c &= TRIM;
      60:     *linp++ = c;
      61:     if (c == '\n' || linp >= &linbuf[sizeof linbuf - 2])
      62:         flush();
      63: }
      64:
      65: draino()
      66: {
      67:
      68:     linp = linbuf;
      69: }
      70:
      71: flush()
      72: {
      73:     register int unit;
      74:     int lmode;
      75:
      76:     if (linp == linbuf)
      77:         return;
      78:     if (haderr)
      79:         unit = didfds ? 2 : SHDIAG;
      80:     else
      81:         unit = didfds ? 1 : SHOUT;
      82: #ifdef TIOCLGET
      83:     if (didfds == 0 && ioctl(unit, TIOCLGET, (char *)&lmode) == 0 &&
      84:         lmode&LFLUSHO) {
      85:         lmode = LFLUSHO;
      86:         (void) ioctl(unit, TIOCLBIC, (char *)&lmode);
      87:         (void) write(unit, "\n", 1);
      88:     }
      89: #endif
      90:     (void) write(unit, linbuf, linp - linbuf);
      91:     linp = linbuf;
      92: }

#### Defined functions

draino defined in line 65; used 1 times

- in /usr/src/bin/csh/sh.c line 643

flush defined in line 71; used 9 times

- in line 62
- in /usr/src/bin/csh/sh.c line 938
- in /usr/src/bin/csh/sh.err.c line 45, 112
- in /usr/src/bin/csh/sh.exec.c line 248
- in /usr/src/bin/csh/sh.file.c line 291
- in /usr/src/bin/csh/sh.func.c line 536, 724, 759

p2dig defined in line 38; used 2 times

- in line 27, 35

psecs defined in line 18; used 2 times

- in /usr/src/bin/csh/sh.func.c line 1027
- in /usr/src/bin/csh/sh.time.c line 113

putchar defined in line 48; used 24 times

- in line 53
- in /usr/src/bin/csh/printf.c line 32-41(4)
- in /usr/src/bin/csh/sh.c line 930
- in /usr/src/bin/csh/sh.exec.c line 250
- in /usr/src/bin/csh/sh.exec2.c line 144
- in /usr/src/bin/csh/sh.file.c line 204-212(3), 537
- in /usr/src/bin/csh/sh.func.c line 752-757(3)
- in /usr/src/bin/csh/sh.lex.c line 114
- in /usr/src/bin/csh/sh.proc.c line 789-791(2)
- in /usr/src/bin/csh/sh.set.c line 684-690(4)
- in /usr/src/bin/csh/sh.time.c line 101, 166

#### Defined variables

linbuf defined in line 45; used 8 times

- in line 46, 61(2), 68, 76, 90-91(3)

linp defined in line 46; used 6 times

- in line 60-61(2), 68, 76, 90-91(2)

sccsid defined in line 8; never used

Last modified: 1991-08-31 Generated: 2016-12-26 | Generated by src2html V0.67 page hit count: 1200 |