6100 ADCCP Programming Manual

ADCCP Programming Example Using C
C–4 069225 Tandem Computers Incorporated
return(status_code);
}
/*
*-------------------------------------------------------------------
*
* Open_line
*
* Opens a specified line.
*
* Results:
*
* Returns the file number OPEN assigns to the line.
*
* Side effects:
*
* None.
*
*----------------------------------------------------------------------
*/
short Open_line(open_name)
char *open_name; /* IN - pointer to the line name string.
*/
{
struct mask {
unsigned short demountable : 1;
unsigned short audited : 1;
unsigned short undefined : 2;
unsigned short type : 6;
unsigned short subtype : 6;
};
lowmem struct mask devtype;
lowmem short fname[127];
short c_code = 0;
short s_code = 0;
short reclnth;
short rfnum;
int error;
/*
* The line name is converted to Guardian format, and the line is checked
* to make sure it's an ADCCP line. If it is, the line is opened and
* the file number for the line is returned to main.
*/
s_code = extfname_to_intfname(open_name,fname);
if (s_code != 0) {
printf("Error with external-to-internal filename conversion.\n");
DEBUG();
}
DEVICEINFO(fname,&devtype,&reclnth);
if (devtype.type != 51 || devtype.subtype != 2) {
printf("%d is not a 6100 ADCCP line.\n",fname);
DEBUG();
ABEND();
}
c_code = OPEN(fname,(short *)&rfnum,14);
if (c_code != CCE) {
FILEINFO(rfnum,&error);
printf("OPEN ERROR %d on 1st open.\n",error);
DEBUG();
ABEND();
}
else SETMODE(rfnum,20,1);