* tip - Unix link to other systems
* tip [-v] [-speed] system-name
* Uses remote file for system descriptions.
* Current commands (escapes):
* ~! fork a shell on the local machine
* ~c change working directory on local machine
* ~< fetch file from remote system
* ~> send file to remote system
* ~t take a file from a remote UNIX (uses cat & echo)
* ~p send a file to a remote UNIX (uses cat)
* ~| fetch file from remote system and pipe it to
* ~% fork and wait for a program which inherits file
* descriptors 3 & 4 attached to the remote machine
* (optional by CONNECT define)
* ~s set or show variable
* Samuel J. Leffler 1-18-81
* add auto-dial stuff for the BIZCOMP
* cleaned up auto-dialer stuff and added variables
* handle quit and interrupt during calls
* mods to handle both FIOCAPACITY and FIONREAD in biz.c
* added take and put, made piping stuff work
* rewrite remote file stuff for DN-11 like acu's and just to clean
* Baud rate mapping table
0, 50, 75, 110, 134, 150, 200, 300, 600,
1200, 1800, 2400, 4800, 9600, 19200, -1
fprintf(stderr
, "usage: tip [-v] [-speed] [system-name]\n");
fprintf(stderr
, "tip: must be interactive\n");
if (argc
> 1 && argv
[argc
-1][0] != '-')
system
= argv
[argc
-1]; /* always last item */
signal(SIGQUIT
, cleanup
);
signal(SIGTERM
, cleanup
);
if ((i
= hunt(system
)) == 0) {
printf("all ports busy\n");
* Now that we have the logfile and the ACU open
* return to the real uid and gid. These things will
* be closed on exit. Note that we can't run as root,
* because locking mechanism on the tty and the accounting
for (i
= 1; i
< argc
-1; i
++)
if (equal(argv
[i
], "-v"))
* Kludge, their's no easy way to get the initialization
* in the right order, so force it here
if ((PH
= getenv("PHONES")) == NOSTR
)
vinit(); /* init variables */
for (i
= 1; i
< argc
-1; i
++)
if (argv
[i
][0] == '-' && argv
[i
][1] != 'v') {
number(value(BAUDRATE
)) = atoi(&argv
[i
][1]);
printf("%s: unknown option\n", argv
[i
]);
if ((arg
.sg_ispeed
= speed(number(value(BAUDRATE
)))) == NULL
) {
printf("tip: bad baud rate %d\n", number(value(BAUDRATE
)));
arg
.sg_ospeed
= arg
.sg_ispeed
;
* NOTE that remote side runs in TANDEM mode,
* if the host doesn't honor X-ON/X-OFF with default
* start/stop chars, the remote description must be
* extended and tchars will have to be set up here.
* If the host doesn't honor TANDEM mode, then watch
* out, as you'll get garbage.
arg
.sg_flags
= RAW
| TANDEM
;
ioctl(FD
, TIOCSETP
, &arg
);
ioctl(0, TIOCGETP
, &defarg
); /* store initial status */
ioctl(0, TIOCGETC
, &defchars
);
arg
.sg_flags
= ANYP
| CBREAK
;
tchars
.t_intrc
= tchars
.t_quitc
= -1;
printf("\07%s\n[EOT]\n", p
);
write(1, "\07connected\n", 11);
ioctl(0, TIOCGETD
, (char *)&odisc
);
ioctl(0, TIOCSETD
, (char *)&disc
);
pipe(fildes
); pipe(repdes
);
signal(SIGALRM
, timeout
);
* put the controlling keyboard into raw mode
ioctl(0, TIOCSETP
, &arg
);
ioctl(0, TIOCSETC
, &tchars
);
* return keyboard to normal mode
ioctl(0, TIOCSETP
, &defarg
);
ioctl(0, TIOCSETC
, &defchars
);
* Print string ``s'', then read a string
* in from the terminal. Handles signals & allows use of
* normal erase and kill characters.
signal(SIGINT
, intprompt
);
signal(SIGQUIT
, SIG_IGN
);
while ((*p
= getchar()) != EOF
&& *p
!= '\n') {
return(stoprompt
|| p
== b
);
* Interrupt service routine during prompting
if ((gch
== character(value(ESCAPE
))) && bol
) {
} else if (gch
== character(value(RAISECHAR
))) {
boolean(value(RAISE
)) = !boolean(value(RAISE
));
printf("%s", ctrl(character(value(RAISECHAR
))));
} else if (gch
== '\r') {
} else if (gch
== character(value(FORCE
))) {
printf("%s", ctrl(character(value(FORCE
))));
bol
= any(gch
, value(EOL
));
if (boolean(value(RAISE
)) && islower(gch
))
* called on recognition of ``escapec'' at the beginning of a line
char c
= character(value(ESCAPE
));
extern esctable_t etable
[];
for (p
= etable
; p
->e_char
; p
++)
if ((p
->e_flags
&PRIV
) && getuid())
for (p
= bauds
; *p
!= -1; p
++)
register char *p
= buf
, c
, *q
;
for (q
= "\nn\rr\tt\ff\033E\bb"; *q
; q
++)
*p
++ = '^'; *p
++ = c
+ 'A'-1;
if (c
< 040 || c
== 0177) {
s
[1] = c
== 0177 ? '?' : c
+'A'-1;
extern esctable_t etable
[];
for (p
= etable
; p
->e_char
; p
++) {
if ((p
->e_flags
&PRIV
) && getuid())
printf("%2s", ctrl(character(value(ESCAPE
))));
printf("%-2s %c %s\r\n", ctrl(p
->e_char
),
p
->e_flags
&EXP
? '*': ' ', p
->e_help
);