1: /*	@(#)sh.print.c	2.1	SCCS id keyword	*/
   2: /* Copyright (c) 1980 Regents of the University of California */
   3: #include "sh.h"
   4: 
   5: /*
   6:  * C Shell
   7:  */
   8: 
   9: p60ths(l)
  10:     long l;
  11: {
  12: 
  13:     l += 3;
  14:     printf("%d.%d", (int) (l / 60), (int) ((l % 60) / 6));
  15: }
  16: 
  17: psecs(l)
  18:     long l;
  19: {
  20:     register int i;
  21: 
  22:     i = l / 3600;
  23:     if (i) {
  24:         printf("%d:", i);
  25:         i = l % 3600;
  26:         p2dig(i / 60);
  27:         goto minsec;
  28:     }
  29:     i = l;
  30:     printf("%d", i / 60);
  31: minsec:
  32:     i %= 60;
  33:     printf(":");
  34:     p2dig(i);
  35: }
  36: 
  37: p2dig(i)
  38:     register int i;
  39: {
  40: 
  41:     printf("%d%d", i / 10, i % 10);
  42: }
  43: 
  44: char    linbuf[64];
  45: char    *linp = linbuf;
  46: 
  47: putchar(c)
  48:     register int c;
  49: {
  50: 
  51:     if ((c & QUOTE) == 0 && (c == 0177 || c < ' ' && c != '\t' && c != '\n')) {
  52:         putchar('^');
  53:         if (c == 0177)
  54:             c = '?';
  55:         else
  56:             c |= 'A' - 1;
  57:     }
  58:     c &= TRIM;
  59:     *linp++ = c;
  60:     if (c == '\n' || linp >= &linbuf[sizeof linbuf - 2])
  61:         flush();
  62: }
  63: 
  64: draino()
  65: {
  66: 
  67:     linp = linbuf;
  68: }
  69: 
  70: flush()
  71: {
  72:     register int unit;
  73: 
  74:     if (haderr)
  75:         unit = didfds ? 2 : SHDIAG;
  76:     else
  77:         unit = didfds ? 1 : SHOUT;
  78:     if (linp != linbuf) {
  79:         write(unit, linbuf, linp - linbuf);
  80:         linp = linbuf;
  81:     }
  82: }
  83: 
  84: plist(vp)
  85:     register struct varent *vp;
  86: {
  87:     register int (*wasintr)();
  88: 
  89:     if (setintr)
  90:         wasintr = signal(SIGINT, pintr);
  91:     for (vp = vp->link; vp != 0; vp = vp->link) {
  92:         int len = blklen(vp->vec);
  93: 
  94:         printf(vp->name);
  95:         printf("\t");
  96:         if (len != 1)
  97:             putchar('(');
  98:         blkpr(vp->vec);
  99:         if (len != 1)
 100:             putchar(')');
 101:         printf("\n");
 102:     }
 103:     if (setintr)
 104:         signal(SIGINT, wasintr);
 105: }

Defined functions

draino defined in line 64; used 1 times
p2dig defined in line 37; used 2 times
p60ths defined in line 9; used 6 times
plist defined in line 84; used 2 times
psecs defined in line 17; used 3 times

Defined variables

linbuf defined in line 44; used 8 times
linp defined in line 45; used 6 times
Last modified: 1980-09-12
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 888
Valid CSS Valid XHTML 1.0 Strict