kermit from SunOS to ethernet
Don Faulkner
faulkner%jmullins at husc6.harvard.edu
Tue Apr 25 03:19:26 AEST 1989
contact!umb!gplan at husc6.harvard.edu (George A. Planansky) writes:
George> Kermit asks for a "line", being a /dev/tty#, to get out of a Unix machine.
George> Our Unix machines have no available serial ports, as we connect to them
George> via their ethernet controllers.
George> Thus I can use the Unix telnet command to connect to a modem interactively,
George> QUESTION: how can I get to an ethernet address, with kermit, from Unix?
try PTY's, like:
==================================================
#include <stdio.h>
#include <fcntl.h>
main ()
{ char ttyp_name [200], pty_name [200], pty_let;
int pty_index, pty_fildes, telnet_pid;
pty_fildes = -1;
for (pty_index = 0; pty_fildes < 0; pty_index++) {
pty_let = (pty_index < 10) ? (pty_index + '0') :
(pty_index + 'a' - 10);
sprintf (pty_name, "/dev/ptyp%c", pty_let);
pty_fildes = open (pty_name, O_RDWR);
}
if (pty_fildes < 0) {
perror ("No ptyp? opened because");
exit (1);
}
fprintf (stderr,
"PseudoTeletype pair is /dev/ttyp%c and /dev/ptyp%c\n",
pty_let, pty_let);
if (!(telnet_pid = fork ())) {
close (0);
close (1);
close (2);
dup2 (pty_fildes, 0);
dup2 (pty_fildes, 1);
dup2 (pty_fildes, 2);
execlp ("telnet", "telnet", "localhost", NULL);
perror ("EXECLP to telnet failed because");
exit (1);
}
close (pty_fildes);
sprintf (ttyp_name, "/dev/ttyp%c", pty_let);
fprintf (stderr, "Running: \"%s\" \"%s\" \"%s\"\n",
"kermit" ,"-l", ttyp_name);
execlp ("kermit" ,"kermit", "-l", ttyp_name, "-b", "9600",
NULL);
perror ("EXECLP to kermit failed because");
exit (1);
}
==================================================
--
Don Faulkner
Building 1, Room 803
Harvard University, School of Public Health
665 Huntington Avenue
Boston, MA 02115
ARPA: faulkner%jmullins at harvard.harvard.edu
BITNET: faulkner at harvard
Telephone: (617) 732-2297
More information about the Comp.sys.sun
mailing list