Files
Sepp J Morris 31738079c4 Upload
Digital Research
2020-11-06 18:50:37 +01:00

59 lines
1.7 KiB
C
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/*************************************************************************
*
* Channel Info Functions
* ----------------------
* Copyright 1982,83 by Digital Reserach Inc. All rights reserved.
*
* "isatty(fd)" == TRUE iff the file on channel fd is a 'CON:' device.
* "isdev(fd)" == TRUE iff fd is 'CON:', 'LST:', 'AUX:'
*
* Where:
* fd = file descriptor returned by 'open'
*
**************************************************************************/
#include "portab.h"
#include "osif.h"
BOOLEAN isatty(fd) /* CLEAR FUNCTION ***********/
WORD fd; /* file des returned by open*/
{ /****************************/
REG FD *fp; /* ptr to ccb */
FD *_chkc(); /* validates fd, cvt to fp */
/* */
if((fp=_chkc(fd)) == NULLFD) /* make sure its open MGL */
return(FALSE); /* isno TTY ifnot open */
return( (fp->flags & ISTTY) != 0 ); /* test this flag */
} /****************************/
BOOLEAN isdev(fd) /* CLEAR FUNCTION ***********/
WORD fd; /* file des returned by open*/
{ /****************************/
REG FD *fp; /* ptr to ccb */
FD *_chkc(); /* validates fd, cvt to fp */
/* */
if((fp=_chkc(fd)) == NULLFD) /* make sure its open MGL */
return(FALSE); /* isno TTY ifnot open */
return(fp->flags&(ISTTY|ISLPT|ISAUX)); /* test these flags */
} /****************************/
/* ttyname - find name of a terminal */
/* returns "CON:" if isatty, NULLPTR o.w., under CP/M */
EXTERN BYTE __tname[]; /* CON: String */
BYTE * ttyname(fd) /* CLEAR FUNCTION ***********/
WORD fd;
{
if( isatty(fd) )
return(__tname);
return(NULLPTR);
}
satty(fd) )
return(__tname);
return(NULLPTR);
}
satty(fd) )
return(__tname);
return(NULLPTR);
}