home *** CD-ROM | disk | FTP | other *** search
/ rtsi.com / 2014.01.www.rtsi.com.tar / www.rtsi.com / OS9 / OSK / LIB / unix.zoo / ttyname.c < prev   
Text File  |  2009-11-06  |  2KB  |  50 lines

  1.  
  2. /***************************************************************************/
  3. /*                                                                         */
  4. /* ttyname() : Unix library (OS9/68000)                                    */
  5. /* =========                                                               */
  6. /*                                                                         */
  7. /* Author:     K. Schmitt                                                  */
  8. /* Compiler:   Microware C Vers. 3.0                                       */
  9. /* OS:         OS9/68000 Vers. 2.2                                         */
  10. /*                                                                         */
  11. /* Edition History                                                         */
  12. /* ===============                                                         */
  13. /*                                                                         */
  14. /* Ed. 0.00  Date 11/14/88                                                 */
  15. /*           First version                                                 */
  16. /*                                                                         */
  17. /***************************************************************************/
  18. /*                                                                         */
  19. /* Description                                                             */
  20. /*                                                                         */
  21. /*
  22.  
  23.      NAME
  24.           ttyname - return the device name of a tty
  25.  
  26.      SYNOPSIS
  27.           char *ttyname(fildes)
  28.           int fildes;
  29.  
  30.      DESCRIPTION
  31.           ttyname returns the device name for fildes or NULL
  32.  
  33. */
  34.  
  35. #define ERROR      -1
  36.  
  37. char *ttyname(fildes)
  38.           int fildes;
  39.           {
  40.           extern int _gs_devn();
  41.           extern char *malloc();
  42.           register char *name;
  43.  
  44.           if ((name=malloc(32)) == (char *) 0) return ((char *) 0);
  45.           if (_gs_devn(fildes,name) == ERROR) return ((char *) 0);
  46.           return (name);
  47.  
  48.           } /* end of ttyname */
  49.  
  50.