ctermid.c 564 B

12345678910111213141516171819202122232425262728
  1. /* Copyright (C) 2004 Manuel Novoa III <mjn3@codepoet.org>
  2. *
  3. * GNU Library General Public License (LGPL) version 2 or later.
  4. *
  5. * Dedicated to Toni. See uClibc/DEDICATION.mjn3 for details.
  6. */
  7. #include "_stdio.h"
  8. /* Experimentally off - libc_hidden_proto(strcpy) */
  9. char *ctermid(register char *s)
  10. {
  11. static char sbuf[L_ctermid];
  12. #ifdef __BCC__
  13. /* Currently elks doesn't support /dev/tty. */
  14. if (!s) {
  15. s = sbuf;
  16. }
  17. *s = 0;
  18. return s;
  19. #else
  20. /* glibc always returns /dev/tty for linux. */
  21. return strcpy((s ? s : sbuf), "/dev/tty");
  22. #endif
  23. }