support procedures used in setting up the network
char logfile
[] = LOGFILE
;
int datasize
= SIZE
; /* best if mult of 512 */
int readfd
, writefd
, pipesim
;
called in netdaemon and debugging software
handles parameter lists to setup
remote
= argc
> 1 ? lookup(argv
[1]) : getremote(local
);
if(argc
== 4){ /* simulate using pipes */
set the correct mode on the link device
static char readbuf
[BUFSIZ
],writebuf
[BUFSIZ
];
if(str
== 0 || str
[0] == 0){
err("invalid net device\n");
readtty
= pipesim
? fdopen(readfd
,"r") : fopen(str
,"r");
writetty
= pipesim
? fdopen(writefd
,"w") : fopen(str
,"w");
/* set exclusive use for line */
if(ioctl(fileno(readtty
),TIOCEXCL
,&stt
) != 0 ||
gtty(fileno(readtty
),&stt
) < 0){
stt
.sg_ispeed
= stt
.sg_ospeed
= linkspeed
; /* user-set baud */
stt
.sg_erase
= stt
.sg_kill
= 0; /* erase and kill off */
stt
.sg_flags
= ANYP
; /* even and odd parity, off everything else */
if(stty(fileno(readtty
),&stt
) < 0){
setbuf(writetty
,writebuf
);
initialize various data structures and print banner
cfile
= fopen(INITFILE
,"r");
err("remote %c local %c link %s speed %d vtov %d length %d\n",
remote
,local
,device
,linkspeed
,vaxtovax
,datasize
);
err("debug %d time %d count %d onlyuid %d\n",debugflg
,atime
,
if(machtype
[local
- 'a'] != M_OTHER
)
if(machtype
[local
- 'a'] != M_OTHER
)
if(machtype
[local
- 'a'] != M_OTHER
)
if(machtype
[local
- 'a'] != M_VAX
)
if(machtype
[local
- 'a'] != M_CORY
)
if(machtype
[local
- 'a'] != M_INGRES
)
if(machtype
[local
- 'a'] != M_INGRES
)
if(machtype
[local
-'a'] != M_CC
&& machtype
[local
- 'a'] != M_SRC
)
err("Machine type disagrees with local machine\n");
if(remote
!= 0) sprintf(buf
,"%s",longname(remote
));
fprintf(stderr
,s
,a
,b
,c
,d
,e
,f
,g
,h
);
addtolog(remote
,"Err %s: ",buf
);
addtolog(remote
,s
,a
,b
,c
,d
,e
,f
,g
,h
);
/* this is really not right - we should use the rcslog format */
/* also, the user must be able to write on the
public logfile to get error messages such as
directory not found after he has
addtolog(mach
,s
,a
,b
,c
,d
,e
,f
,g
,h
,i
,j
,k
,l
,m
,n
)
logfile
[strlen(logfile
)-1] = mach
;
if(stat(logfile
,&statbuf
) < 0)return;
log
= fopen(logfile
,"a");
fprintf(log
,s
,a
,b
,c
,d
,e
,f
,g
,h
,i
,j
,k
,l
,m
,n
);
debug(s
,a
,b
,c
,d
,e
,f
,g
,h
,i
,h
,k
,l
,m
,n
);