ctermid.c 511 B

123456789101112131415161718192021222324252627
  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. }