Article View: comp.sys.sun
Article #12176Re: kermit from SunOS to ethernet
From: Don Faulkner
Date: Mon, 24 Apr 1989 17:19
Date: Mon, 24 Apr 1989 17:19
66 lines
2600 bytes
2600 bytes
contact!umb!gplan@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@harvard.harvard.edu
BITNET: faulkner@harvard
Telephone: (617) 732-2297
Technical Details
Message-ID:
<FAULKNER.89Mar31082332@jmullins.harvard.edu>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!cornell!uw-beaver!rice!sun-spots-requestReferences:
<756@umb.umb.edu>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!cornell!uw-beaver!rice!sun-spots-request From: faulkner%jmullins@husc6.harvard.edu (Don Faulkner) Newsgroups: comp.sys.sun Subject: Re: kermit from SunOS to ethernet Keywords: Networks Message-ID: <FAULKNER.89Mar31082332@jmullins.harvard.edu> Date: 24 Apr 89 17:19:26 GMT References: <756@umb.umb.edu> Sender: usenet@rice.edu Organization: Harvard University Lines: 66 Approved: Sun-Spots@rice.edu Original-Date: 31 Mar 89 13:23:32 GMT X-Sun-Spots-Digest: Volume 7, Issue 243, message 5 of 8