ctermid.c 253 B

1234567891011121314151617181920
  1. #include <unistd.h>
  2. #include <stdio.h>
  3. #include <string.h>
  4. char *
  5. ctermid(char *s)
  6. {
  7. static char buf[L_ctermid];
  8. if(s == 0)
  9. s = buf;
  10. strncpy(s, "/dev/cons", sizeof buf);
  11. return(s);
  12. }
  13. char *
  14. ctermid_r(char *s)
  15. {
  16. return s ? ctermid(s) : NULL;
  17. }