home *** CD-ROM | disk | FTP | other *** search
/ Atari FTP / ATARI_FTP_0693.zip / ATARI_FTP_0693 / Mint / mntlib32.zoo / ctermid.c < prev    next >
C/C++ Source or Header  |  1993-06-11  |  281b  |  22 lines

  1. #include <stdio.h>
  2. #include <string.h>
  3. #include <unistd.h>
  4.  
  5. char *
  6. ctermid(s)
  7.   char *s;
  8. {
  9.   static char name[L_ctermid];
  10.   char *t;
  11.  
  12.   if (!s)
  13.     s = name;
  14.   t = ttyname(-1);
  15.   if (t)
  16.     strncpy(s, t, L_ctermid);
  17.   else
  18.     s[0] = '\0';
  19.   s[L_ctermid - 1] = '\0';
  20.   return s;
  21. }
  22.