home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / unix / volume2 / window / part4 / longname.c.new < prev    next >
Encoding:
Text File  |  1986-11-30  |  855 b   |  35 lines

  1. # define    reg    register
  2.  
  3. /*
  4.  *    This routine fills in "def" with the long name of the terminal.
  5.  *
  6.  * 1/26/81 (Berkeley) @(#)longname.c    1.1
  7.  *
  8.  * 2/22/84 Corrections made at University of California, San Francisco.
  9.  * This correction makes a private copy of the longname. The original version
  10.  * simply patched a '\0' in the termcap buffer, preventing access to
  11.  * terminal capabilities at a later point.
  12.  * rti-sel!trt: note: this code is still broken wrt the documentation.
  13.  * It operates confusingly and usually gets the wrong answer.
  14.  */
  15.  
  16. char *
  17. longname(bp, def)
  18. reg char    *bp, *def; {
  19.  
  20.     reg char    *cp;
  21.     static char longcopy[30] ;
  22.  
  23.     while (*bp && *bp != ':' && *bp != '|')
  24.         bp++;
  25.     if (*bp == '|') {
  26.         bp++;
  27.         cp = longcopy ;
  28.         while ((cp-longcopy)<29 && *bp && *bp != ':' && *bp != '|')
  29.             *cp++ = *bp++ ;
  30.         *cp = 0;
  31.         return longcopy;
  32.     }
  33.     return def;
  34. }
  35.