version 1.7, 1997/08/25 16:30:13 |
version 1.8, 1997/09/01 23:24:26 |
|
|
char *sname(); |
char *sname(); |
char PNbuf[256]; /* This limits the size of a number */ |
char PNbuf[256]; /* This limits the size of a number */ |
|
|
|
int |
main(argc, argv) |
main(argc, argv) |
|
int argc; |
char *argv[]; |
char *argv[]; |
{ |
{ |
char *system = NOSTR; |
char *system = NOSTR; |
|
|
for (p = system; *p; p++) |
for (p = system; *p; p++) |
*p = '\0'; |
*p = '\0'; |
PN = PNbuf; |
PN = PNbuf; |
(void)snprintf(sbuf, sizeof(sbuf), "tip%d", BR); |
(void)snprintf(sbuf, sizeof(sbuf), "tip%ld", BR); |
system = sbuf; |
system = sbuf; |
|
|
notnumber: |
notnumber: |
|
|
vinit(); /* init variables */ |
vinit(); /* init variables */ |
setparity("even"); /* set the parity table */ |
setparity("even"); /* set the parity table */ |
if ((i = speed(number(value(BAUDRATE)))) == 0) { |
if ((i = speed(number(value(BAUDRATE)))) == 0) { |
printf("tip: bad baud rate %d\n", number(value(BAUDRATE))); |
printf("tip: bad baud rate %ld\n", number(value(BAUDRATE))); |
daemon_uid(); |
daemon_uid(); |
(void)uu_unlock(uucplock); |
(void)uu_unlock(uucplock); |
exit(3); |
exit(3); |
|
|
*/ |
*/ |
if (HW) |
if (HW) |
ttysetup(i); |
ttysetup(i); |
if (p = connect()) { |
if ((p = connect())) { |
printf("\07%s\n[EOT]\n", p); |
printf("\07%s\n[EOT]\n", p); |
daemon_uid(); |
daemon_uid(); |
(void)uu_unlock(uucplock); |
(void)uu_unlock(uucplock); |
|
|
* so, fork one process for local side and one for remote. |
* so, fork one process for local side and one for remote. |
*/ |
*/ |
printf(cumode ? "Connected\r\n" : "\07connected\r\n"); |
printf(cumode ? "Connected\r\n" : "\07connected\r\n"); |
if (pid = fork()) |
if ((pid = fork())) |
tipin(); |
tipin(); |
else |
else |
tipout(); |
tipout(); |
/*NOTREACHED*/ |
/*NOTREACHED*/ |
|
exit(0); |
} |
} |
|
|
void |
void |
|
|
*/ |
*/ |
static int uidswapped; |
static int uidswapped; |
|
|
|
void |
user_uid() |
user_uid() |
{ |
{ |
if (uidswapped == 0) { |
if (uidswapped == 0) { |
|
|
} |
} |
} |
} |
|
|
|
void |
daemon_uid() |
daemon_uid() |
{ |
{ |
|
|
|
|
} |
} |
} |
} |
|
|
|
void |
shell_uid() |
shell_uid() |
{ |
{ |
setegid(gid); |
setegid(gid); |
|
|
/* |
/* |
* put the controlling keyboard into raw mode |
* put the controlling keyboard into raw mode |
*/ |
*/ |
|
void |
raw() |
raw() |
{ |
{ |
tcsetattr(0, TCSADRAIN, &term); |
tcsetattr(0, TCSADRAIN, &term); |
|
|
/* |
/* |
* return keyboard to normal mode |
* return keyboard to normal mode |
*/ |
*/ |
|
void |
unraw() |
unraw() |
{ |
{ |
tcsetattr(0, TCSADRAIN, &defterm); |
tcsetattr(0, TCSADRAIN, &defterm); |
|
|
* in from the terminal. Handles signals & allows use of |
* in from the terminal. Handles signals & allows use of |
* normal erase and kill characters. |
* normal erase and kill characters. |
*/ |
*/ |
|
int |
prompt(s, p, sz) |
prompt(s, p, sz) |
char *s; |
char *s; |
register char *p; |
char *p; |
size_t sz; |
size_t sz; |
{ |
{ |
register int c; |
register int c; |
|
|
/* |
/* |
* ****TIPIN TIPIN**** |
* ****TIPIN TIPIN**** |
*/ |
*/ |
|
void |
tipin() |
tipin() |
{ |
{ |
char gch, bol = 1; |
char gch, bol = 1; |
|
|
* Escape handler -- |
* Escape handler -- |
* called on recognition of ``escapec'' at the beginning of a line |
* called on recognition of ``escapec'' at the beginning of a line |
*/ |
*/ |
|
int |
escape() |
escape() |
{ |
{ |
register char gch; |
register char gch; |
|
|
return (gch); |
return (gch); |
} |
} |
|
|
|
int |
speed(n) |
speed(n) |
int n; |
int n; |
{ |
{ |
|
|
return 0; |
return 0; |
} |
} |
|
|
any(c, p) |
int |
register char c, *p; |
any(cc, p) |
|
register int cc; |
|
char *p; |
{ |
{ |
|
char c = cc; |
while (p && *p) |
while (p && *p) |
if (*p++ == c) |
if (*p++ == c) |
return (1); |
return (1); |
return (0); |
return (0); |
} |
} |
|
|
|
int |
size(s) |
size(s) |
register char *s; |
register char *s; |
{ |
{ |
|
|
static char buf[256]; |
static char buf[256]; |
register char *p = buf, c, *q; |
register char *p = buf, c, *q; |
|
|
while (c = *s++) { |
while ((c = *s++)) { |
for (q = "\nn\rr\tt\ff\033E\bb"; *q; q++) |
for (q = "\nn\rr\tt\ff\033E\bb"; *q; q++) |
if (*q++ == c) { |
if (*q++ == c) { |
*p++ = '\\'; *p++ = *q; |
*p++ = '\\'; *p++ = *q; |
|
|
/* |
/* |
* Help command |
* Help command |
*/ |
*/ |
|
void |
help(c) |
help(c) |
char c; |
char c; |
{ |
{ |
|
|
/* |
/* |
* Set up the "remote" tty's state |
* Set up the "remote" tty's state |
*/ |
*/ |
|
void |
ttysetup(speed) |
ttysetup(speed) |
int speed; |
int speed; |
{ |
{ |
|
|
* We are doing 8 bit wide output, so we just generate a character |
* We are doing 8 bit wide output, so we just generate a character |
* with the right parity and output it. |
* with the right parity and output it. |
*/ |
*/ |
|
void |
pwrite(fd, buf, n) |
pwrite(fd, buf, n) |
int fd; |
int fd; |
char *buf; |
char *buf; |
|
|
/* |
/* |
* Build a parity table with appropriate high-order bit. |
* Build a parity table with appropriate high-order bit. |
*/ |
*/ |
|
void |
setparity(defparity) |
setparity(defparity) |
char *defparity; |
char *defparity; |
{ |
{ |