ctermid.c 512 B

1234567891011121314151617181920212223242526
  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. char *ctermid(register char *s)
  9. {
  10. static char sbuf[L_ctermid];
  11. #ifdef __BCC__
  12. /* Currently elks doesn't support /dev/tty. */
  13. if (!s) {
  14. s = sbuf;
  15. }
  16. *s = 0;
  17. return s;
  18. #else
  19. /* glibc always returns /dev/tty for linux. */
  20. return __strcpy((s ? s : sbuf), "/dev/tty");
  21. #endif
  22. }