version 1.54, 2012/12/04 19:31:17 |
version 1.55, 2015/02/07 10:07:15 |
|
|
/* |
/* |
* tip - UNIX link to other systems |
* tip - UNIX link to other systems |
* tip [-v] [-speed] system-name |
* tip [-v] [-speed] system-name |
* or |
|
* cu phone-number [-s speed] [-l line] |
|
*/ |
*/ |
|
|
#include <sys/types.h> |
#include <sys/types.h> |
|
|
/* XXX preserve previous braindamaged behavior */ |
/* XXX preserve previous braindamaged behavior */ |
vsetnum(DC, 1); |
vsetnum(DC, 1); |
|
|
if (strcmp(__progname, "cu") == 0) { |
|
cumode = 1; |
|
cumain(argc, argv); |
|
goto cucommon; |
|
} |
|
|
|
if (argc > 4) { |
if (argc > 4) { |
fprintf(stderr, "usage: tip [-nv] [-speed] [system-name]\n"); |
fprintf(stderr, "usage: tip [-nv] [-speed] [system-name]\n"); |
exit(1); |
exit(1); |
|
|
} |
} |
con(); |
con(); |
|
|
cucommon: |
|
/* |
|
* From here down the code is shared with |
|
* the "cu" version of tip. |
|
*/ |
|
|
|
i = fcntl(FD, F_GETFL); |
i = fcntl(FD, F_GETFL); |
if (i == -1) { |
if (i == -1) { |
perror("fcntl"); |
perror("fcntl"); |
|
|
* internal data structures (variables) |
* internal data structures (variables) |
* 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("\07connected\r\n"); |
tipin_pid = getpid(); |
tipin_pid = getpid(); |
switch (tipout_pid = fork()) { |
switch (tipout_pid = fork()) { |
case -1: |
case -1: |
|
|
if (!(gch = escape())) |
if (!(gch = escape())) |
continue; |
continue; |
} |
} |
} else if (!cumode && gch == vgetnum(RAISECHAR)) { |
} else if (gch == vgetnum(RAISECHAR)) { |
vsetnum(RAISE, !vgetnum(RAISE)); |
vsetnum(RAISE, !vgetnum(RAISE)); |
continue; |
continue; |
} else if (gch == '\r') { |
} else if (gch == '\r') { |
|
|
if (vgetnum(HALFDUPLEX)) |
if (vgetnum(HALFDUPLEX)) |
printf("\r\n"); |
printf("\r\n"); |
continue; |
continue; |
} else if (!cumode && gch == vgetnum(FORCE)) { |
} else if (gch == vgetnum(FORCE)) { |
gch = getchar(); |
gch = getchar(); |
if (gch == EOF) |
if (gch == EOF) |
cleanup(0); |
cleanup(0); |