From: Rui-Tao Dong <ruitao@home.com>
To: axp-list@redhat.com
Subject: Kermit?
Date: 25 May 1999 14:02:26 -0700 [thread overview]
Message-ID: <v590aclv6l.fsf@Phantom.newport.com> (raw)
I have a not quite dead (floppyless and diskless) UDB and I am trying
to make it a dedicated firewall for my cable modem. I need a terminal
program to talk to serial console.
Has anyone got Kermit working? I got the (very old) rpm from
Columbia, but it crashes on connect. I am having a hard time
compiling it. Does anyone have an RPM? Or has any suggestion on a
better terminal program? I tried to roll my own, but without much luck.
--
Regards,
Rui-Tao (x679)
/* Usage link /dev/cua0 */
#include <stdio.h>
#include <fcntl.h>
#include <unistd.h>
#include <sys/types.h>
#define BUFSIZE 1024
void copy_bytes(int in_fd, int out_fd)
{
char buf[BUFSIZE];
int rbytes;
if ( (rbytes=read(in_fd, buf, BUFSIZE)) > 0 )
{
int wbytes;
char* buf_p=buf;
fprintf(stderr, "Reading %d bytes from %d.\n", rbytes, in_fd);
while (buf_p < buf+rbytes)
{
int wsize=rbytes+buf-buf_p;
wbytes=write(out_fd, buf_p, wsize);
fprintf(stderr, "Writing %d bytes to %d.\n", wbytes, out_fd);
buf_p += wbytes;
}
if (wbytes < 0)
{
perror("write");
exit(-1);
}
}
else if (rbytes < 0)
{
perror("read");
exit(-1);
}
}
int main(int argc, char** argv)
{
int fd;
fd_set read_set;
/* Initialize the file descriptor set. */
if (argc !=2)
{
fprintf(stderr, "Using %s device-file.\n", argv[0]);
return -1;
}
if ((fd=open(argv[1], O_RDWR)) < 0)
{
perror("open");
return -1;
}
FD_ZERO (&read_set);
FD_SET (fd, &read_set);
FD_SET (0, &read_set);
while (1)
{
if ( select(FD_SETSIZE, &read_set, NULL, NULL, NULL) < 0 )
{
perror("select");
return -1;
}
if ( FD_ISSET(fd, &read_set))
{
copy_bytes(fd, 1);
}
else if (FD_ISSET(0, &read_set))
{
copy_bytes(0, fd);
}
else
{
return -1;
}
}
close(fd);
return 0;
}
next reply other threads:[~1999-05-25 21:48 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
1999-05-25 21:02 Rui-Tao Dong [this message]
1999-05-25 22:10 ` Kermit? Michal Jaegermann
1999-05-25 22:18 ` Kermit? Larry Snyder
1999-05-25 23:18 ` Kermit? Dan O'Reilly
1999-05-25 22:41 ` Kermit? Wes Bauske
1999-05-25 22:58 ` Kermit? Peter Petrakis
1999-05-26 9:34 ` Kermit? Peter Rye
1999-05-26 12:04 ` Kermit? mgraffam
read-only archive
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox