1: #ifndef lint
   2: static char sccsid[] = "@(#)wwgets.c	3.9 4/24/85";
   3: #endif
   4: 
   5: /*
   6:  * Copyright (c) 1983 Regents of the University of California,
   7:  * All rights reserved.  Redistribution permitted subject to
   8:  * the terms of the Berkeley Software License Agreement.
   9:  */
  10: 
  11: #include "ww.h"
  12: #include "char.h"
  13: 
  14: wwgets(buf, n, w)
  15: char *buf;
  16: int n;
  17: register struct ww *w;
  18: {
  19:     register char *p = buf;
  20:     register char c;
  21:     char uc = w->ww_unctrl;
  22: 
  23:     w->ww_unctrl = 0;
  24:     for (;;) {
  25:         wwcurtowin(w);
  26:         while ((c = wwgetc()) < 0)
  27:             wwiomux();
  28:         if (c == wwoldtty.ww_sgttyb.sg_erase) {
  29:             if (p > buf)
  30:                 rub(*--p, w);
  31:         } else if (c == wwoldtty.ww_sgttyb.sg_kill) {
  32:             while (p > buf)
  33:                 rub(*--p, w);
  34:         } else if (c == wwoldtty.ww_ltchars.t_werasc) {
  35:             while (--p >= buf && (*p == ' ' || *p == '\t'))
  36:                 rub(*p, w);
  37:             while (p >= buf && *p != ' ' && *p != '\t')
  38:                 rub(*p--, w);
  39:             p++;
  40:         } else if (c == '\r' || c == '\n') {
  41:             break;
  42:         } else {
  43:             if (p >= buf + n - 1)
  44:                 wwputc(ctrl(g), w);
  45:             else
  46:                 wwputs(unctrl(*p++ = c), w);
  47:         }
  48:     }
  49:     *p = 0;
  50:     w->ww_unctrl = uc;
  51: }
  52: 
  53: static
  54: rub(c, w)
  55: struct ww *w;
  56: {
  57:     register i;
  58: 
  59:     for (i = strlen(unctrl(c)); --i >= 0;)
  60:         (void) wwwrite(w, "\b \b", 3);
  61: }

Defined functions

rub defined in line 53; used 4 times
wwgets defined in line 14; used 1 times

Defined variables

sccsid defined in line 2; never used
Last modified: 1985-04-25
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 964
Valid CSS Valid XHTML 1.0 Strict