remove some #ifdef's where it's possible (so it will still compile with WEGA)
This commit is contained in:
parent
7fbd337de4
commit
0f0f856719
|
|
@ -22,14 +22,16 @@
|
||||||
#define SECONDS 20 /* timeout interval */
|
#define SECONDS 20 /* timeout interval */
|
||||||
|
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
#ifdef __FreeBSD__
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
|
|
||||||
|
void look_for_etx();
|
||||||
|
void aread();
|
||||||
|
|
||||||
|
#ifdef __FreeBSD__
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <term.h>
|
#include <term.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
void look_for_etx();
|
|
||||||
void aread();
|
|
||||||
struct termios targ;
|
struct termios targ;
|
||||||
#define RAW ICANON
|
#define RAW ICANON
|
||||||
#define CRMOD OPOST
|
#define CRMOD OPOST
|
||||||
|
|
@ -50,20 +52,14 @@ int timeout = 0;
|
||||||
char *fname;
|
char *fname;
|
||||||
char flags = 0;
|
char flags = 0;
|
||||||
|
|
||||||
#ifdef __FreeBSD__
|
|
||||||
int
|
int
|
||||||
#endif
|
|
||||||
main (argc, argv)
|
main (argc, argv)
|
||||||
|
|
||||||
int argc;
|
int argc;
|
||||||
char **argv;
|
char **argv;
|
||||||
|
|
||||||
{
|
{
|
||||||
#ifdef __FreeBSD__
|
|
||||||
void time_out();
|
void time_out();
|
||||||
#else
|
|
||||||
int time_out();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
signal(SIGALRM,time_out); /* set up alarm handling */
|
signal(SIGALRM,time_out); /* set up alarm handling */
|
||||||
tty = ttyname(1); /* get name of the output file */
|
tty = ttyname(1); /* get name of the output file */
|
||||||
|
|
@ -106,7 +102,7 @@ char **argv;
|
||||||
c = 'y'; /* assume we are proceeding */
|
c = 'y'; /* assume we are proceeding */
|
||||||
|
|
||||||
if (flags & QUERY) /* test for existing file */
|
if (flags & QUERY) /* test for existing file */
|
||||||
if ((fd = open(*argv, 0)) != -1) /* file exists */
|
if ((fd = open(*argv, O_RDONLY)) != -1) /* file exists */
|
||||||
{
|
{
|
||||||
printf ("replace %s (y/n)?", *argv);
|
printf ("replace %s (y/n)?", *argv);
|
||||||
c = getchar() & 0177; /* could have parity so mask bit 7 */
|
c = getchar() & 0177; /* could have parity so mask bit 7 */
|
||||||
|
|
@ -162,11 +158,7 @@ char **argv;
|
||||||
look_for_etx(); /* flush chars coming from local sys */
|
look_for_etx(); /* flush chars coming from local sys */
|
||||||
printf("%c", CAN); /* send cancel */
|
printf("%c", CAN); /* send cancel */
|
||||||
printf ("\n\nunable to open file on remote system\r\n");
|
printf ("\n\nunable to open file on remote system\r\n");
|
||||||
#ifdef __FreeBSD__
|
|
||||||
scanf("%c",&c); /* wait for CAN from local sys */
|
scanf("%c",&c); /* wait for CAN from local sys */
|
||||||
#else
|
|
||||||
scanf("%c",c); /* wait for CAN from local sys */
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
else /* file was opened with no error */
|
else /* file was opened with no error */
|
||||||
|
|
@ -271,23 +263,18 @@ char **argv;
|
||||||
|
|
||||||
if (chmod(tty, 0622) == -1) /* un-write protect the terminal */
|
if (chmod(tty, 0622) == -1) /* un-write protect the terminal */
|
||||||
printf ("\ngetfile: unable to un-write protect the terminal\n");
|
printf ("\ngetfile: unable to un-write protect the terminal\n");
|
||||||
#ifdef __FreeBSD__
|
|
||||||
return 0;
|
return 0;
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef __FreeBSD__
|
|
||||||
void
|
void
|
||||||
#endif
|
|
||||||
time_out()
|
time_out()
|
||||||
{
|
{
|
||||||
signal(SIGALRM,time_out);
|
signal(SIGALRM,time_out);
|
||||||
timeout = 1;
|
timeout = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef __FreeBSD__
|
|
||||||
void
|
void
|
||||||
#endif
|
|
||||||
look_for_etx() /* look for etx and chksum */
|
look_for_etx() /* look for etx and chksum */
|
||||||
{
|
{
|
||||||
while (c != ETX)
|
while (c != ETX)
|
||||||
|
|
@ -299,9 +286,7 @@ look_for_etx() /* look for etx and chksum */
|
||||||
if(timeout) return;
|
if(timeout) return;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef __FreeBSD__
|
|
||||||
void
|
void
|
||||||
#endif
|
|
||||||
aread() /* alarm read */
|
aread() /* alarm read */
|
||||||
{
|
{
|
||||||
timeout = 0; /* assume no timeout */
|
timeout = 0; /* assume no timeout */
|
||||||
|
|
|
||||||
|
|
@ -9,8 +9,8 @@
|
||||||
#define SOH 0x01 /* ascii start-of-header character */
|
#define SOH 0x01 /* ascii start-of-header character */
|
||||||
#define ESC 0x1b /* ascii escape character */
|
#define ESC 0x1b /* ascii escape character */
|
||||||
|
|
||||||
#ifdef __FreeBSD__
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#ifdef __FreeBSD__
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
@ -28,9 +28,7 @@ int tflags;
|
||||||
|
|
||||||
char c;
|
char c;
|
||||||
|
|
||||||
#ifdef __FreeBSD__
|
|
||||||
int
|
int
|
||||||
#endif
|
|
||||||
main (argc, argv)
|
main (argc, argv)
|
||||||
int argc;
|
int argc;
|
||||||
char *argv[];
|
char *argv[];
|
||||||
|
|
@ -81,9 +79,9 @@ char *argv[];
|
||||||
#ifdef __FreeBSD__
|
#ifdef __FreeBSD__
|
||||||
targ.c_oflag = tflags;
|
targ.c_oflag = tflags;
|
||||||
tcsetattr(0, TCSADRAIN, &targ);
|
tcsetattr(0, TCSADRAIN, &targ);
|
||||||
return 0;
|
|
||||||
#else
|
#else
|
||||||
targ.sg_flags = tflags; /* restore initial terminal mode */
|
targ.sg_flags = tflags; /* restore initial terminal mode */
|
||||||
stty (0, &targ);
|
stty (0, &targ);
|
||||||
#endif
|
#endif
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -21,9 +21,10 @@
|
||||||
#define SECONDS 20 /* timeout interval */
|
#define SECONDS 20 /* timeout interval */
|
||||||
|
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
#ifdef __FreeBSD__
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
|
|
||||||
|
#ifdef __FreeBSD__
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <term.h>
|
#include <term.h>
|
||||||
struct termios targ;
|
struct termios targ;
|
||||||
|
|
@ -48,20 +49,14 @@ int timeout = 0;
|
||||||
char *fname;
|
char *fname;
|
||||||
char flags = 0;
|
char flags = 0;
|
||||||
|
|
||||||
#ifdef __FreeBSD__
|
|
||||||
int
|
int
|
||||||
#endif
|
|
||||||
main (argc, argv)
|
main (argc, argv)
|
||||||
|
|
||||||
int argc;
|
int argc;
|
||||||
char **argv;
|
char **argv;
|
||||||
|
|
||||||
{
|
{
|
||||||
#ifdef __FreeBSD__
|
|
||||||
void time_out();
|
void time_out();
|
||||||
#else
|
|
||||||
int time_out();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
signal(SIGALRM,time_out); /* set up alarm handling */
|
signal(SIGALRM,time_out); /* set up alarm handling */
|
||||||
tty = ttyname(1); /* get name of the output file */
|
tty = ttyname(1); /* get name of the output file */
|
||||||
|
|
@ -104,7 +99,7 @@ char **argv;
|
||||||
}
|
}
|
||||||
else /* argument is a file name */
|
else /* argument is a file name */
|
||||||
{
|
{
|
||||||
if ((fd = open(*argv, 0)) == -1) /* open file and test for error */
|
if ((fd = open(*argv, O_RDONLY)) == -1) /* open file and test for error */
|
||||||
{
|
{
|
||||||
printf ("\n%s\n\nunable to open file on remote system\r\n", *argv);
|
printf ("\n%s\n\nunable to open file on remote system\r\n", *argv);
|
||||||
unsuccess++;
|
unsuccess++;
|
||||||
|
|
@ -231,14 +226,11 @@ char **argv;
|
||||||
|
|
||||||
if (chmod(tty, 0622) == -1) /* un-write protect */
|
if (chmod(tty, 0622) == -1) /* un-write protect */
|
||||||
printf ("\nputfile: unable to un-write protect the terminal\n");
|
printf ("\nputfile: unable to un-write protect the terminal\n");
|
||||||
#ifdef __FreeBSD__
|
|
||||||
return 0;
|
return 0;
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef __FreeBSD__
|
|
||||||
void
|
void
|
||||||
#endif
|
|
||||||
time_out()
|
time_out()
|
||||||
{
|
{
|
||||||
signal(SIGALRM,time_out);
|
signal(SIGALRM,time_out);
|
||||||
|
|
|
||||||
|
|
@ -67,14 +67,14 @@ char can = CAN;
|
||||||
char esc = ESC;
|
char esc = ESC;
|
||||||
char exc = EXEC;
|
char exc = EXEC;
|
||||||
|
|
||||||
|
|
||||||
#ifdef __FreeBSD__
|
#ifdef __FreeBSD__
|
||||||
|
#include <stdlib.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/uio.h>
|
#include <sys/uio.h>
|
||||||
#include <sys/wait.h>
|
#include <sys/wait.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdlib.h>
|
|
||||||
#include <fcntl.h>
|
|
||||||
#include <termios.h>
|
#include <termios.h>
|
||||||
#include <sys/ttycom.h>
|
#include <sys/ttycom.h>
|
||||||
#define TCGETA TIOCGETA
|
#define TCGETA TIOCGETA
|
||||||
|
|
@ -84,11 +84,10 @@ char exc = EXEC;
|
||||||
#define CBAUD 0010017
|
#define CBAUD 0010017
|
||||||
#define TCFLSH TCIOFLUSH
|
#define TCFLSH TCIOFLUSH
|
||||||
#define termio termios
|
#define termio termios
|
||||||
void logout();
|
|
||||||
int try();
|
|
||||||
#else
|
#else
|
||||||
#include <termio.h>
|
#include <termio.h>
|
||||||
#endif
|
#endif
|
||||||
|
#include <fcntl.h>
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
|
|
@ -102,29 +101,17 @@ static char line[100],*p; /* buffer for reading in database */
|
||||||
static int lockfd,pterm;
|
static int lockfd,pterm;
|
||||||
static struct termio targ; /* defined in termio.h */
|
static struct termio targ; /* defined in termio.h */
|
||||||
static struct termio tflags, ptflags; /* original tty flags */
|
static struct termio tflags, ptflags; /* original tty flags */
|
||||||
#ifdef __FreeBSD__
|
|
||||||
static struct termio ptxlflags; /* xlucent flags */
|
static struct termio ptxlflags; /* xlucent flags */
|
||||||
#else
|
void logout();
|
||||||
static struct termio txlflags, ptxlflags; /* xlucent flags */
|
int try();
|
||||||
#endif
|
|
||||||
#ifdef __FreeBSD__
|
|
||||||
#define curint SIG_DFL
|
|
||||||
#else
|
|
||||||
int (*curint)(); /* initial SIGINT value */
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef __FreeBSD__
|
|
||||||
void
|
void
|
||||||
#endif
|
|
||||||
xlucent (term, targp, savterm) /* make terminal interface translucent and */
|
xlucent (term, targp, savterm) /* make terminal interface translucent and */
|
||||||
int term; /* return the previous configuration */
|
int term; /* return the previous configuration */
|
||||||
struct termio *targp, *savterm;
|
struct termio *targp, *savterm;
|
||||||
{
|
{
|
||||||
#ifdef __FreeBSD__
|
|
||||||
int iospeed = 0, i;
|
int iospeed = 0, i;
|
||||||
#else
|
|
||||||
int iospeed, i;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
ioctl (term, TCGETA, targp); /* get terminal parameters */
|
ioctl (term, TCGETA, targp); /* get terminal parameters */
|
||||||
savterm->c_iflag = targp->c_iflag;
|
savterm->c_iflag = targp->c_iflag;
|
||||||
|
|
@ -171,9 +158,7 @@ struct termio *targp, *savterm;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifdef __FreeBSD__
|
|
||||||
void
|
void
|
||||||
#endif
|
|
||||||
xparent (term, targp, savterm) /* make terminal interface transparent and */
|
xparent (term, targp, savterm) /* make terminal interface transparent and */
|
||||||
int term; /* return the previous configuration */
|
int term; /* return the previous configuration */
|
||||||
struct termio *targp, *savterm;
|
struct termio *targp, *savterm;
|
||||||
|
|
@ -200,9 +185,7 @@ struct termio *targp, *savterm;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* return terminal interface to its initial state */
|
/* return terminal interface to its initial state */
|
||||||
#ifdef __FreeBSD__
|
|
||||||
void
|
void
|
||||||
#endif
|
|
||||||
tinit (term, savterm, targp)
|
tinit (term, savterm, targp)
|
||||||
int term;
|
int term;
|
||||||
struct termio *savterm, *targp;
|
struct termio *savterm, *targp;
|
||||||
|
|
@ -224,16 +207,12 @@ struct termio *savterm, *targp;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef __FreeBSD__
|
|
||||||
void
|
void
|
||||||
#endif
|
|
||||||
term_to_wega (pterm) /* send all input from terminal to wega */
|
term_to_wega (pterm) /* send all input from terminal to wega */
|
||||||
int pterm;
|
int pterm;
|
||||||
{
|
{
|
||||||
char c;
|
char c;
|
||||||
#ifdef __FreeBSD__
|
|
||||||
void cleanup();
|
void cleanup();
|
||||||
#endif
|
|
||||||
|
|
||||||
while (1) /* do forever */
|
while (1) /* do forever */
|
||||||
{
|
{
|
||||||
|
|
@ -280,9 +259,7 @@ int pterm;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef __FreeBSD__
|
|
||||||
void
|
void
|
||||||
#endif
|
|
||||||
watch_for_abort (parent) /* child executes this routine during file */
|
watch_for_abort (parent) /* child executes this routine during file */
|
||||||
int parent; /* transfers to detect user abort requests */
|
int parent; /* transfers to detect user abort requests */
|
||||||
{
|
{
|
||||||
|
|
@ -301,9 +278,7 @@ int parent; /* transfers to detect user abort requests */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifdef __FreeBSD__
|
|
||||||
void
|
void
|
||||||
#endif
|
|
||||||
total_abort () /* set flag to indicate all xfers to stop */
|
total_abort () /* set flag to indicate all xfers to stop */
|
||||||
{
|
{
|
||||||
signal (SIGQUIT, total_abort); /* set up the signal call again */
|
signal (SIGQUIT, total_abort); /* set up the signal call again */
|
||||||
|
|
@ -311,27 +286,21 @@ total_abort () /* set flag to indicate all xfers to stop */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifdef __FreeBSD__
|
|
||||||
void
|
void
|
||||||
#endif
|
|
||||||
single_abort () /* set flag to stop xfer in progress */
|
single_abort () /* set flag to stop xfer in progress */
|
||||||
{
|
{
|
||||||
signal (SIGTERM, single_abort); /* set up the signal call again */
|
signal (SIGTERM, single_abort); /* set up the signal call again */
|
||||||
onestop = 1;
|
onestop = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef __FreeBSD__
|
|
||||||
void
|
void
|
||||||
#endif
|
|
||||||
time_out () /* set flag to indicate a read timed out */
|
time_out () /* set flag to indicate a read timed out */
|
||||||
{
|
{
|
||||||
signal (SIGALRM, time_out); /* set up the signal call again */
|
signal (SIGALRM, time_out); /* set up the signal call again */
|
||||||
timeout = 1;
|
timeout = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef __FreeBSD__
|
|
||||||
void
|
void
|
||||||
#endif
|
|
||||||
message (pterm) /* get a message from the remote system */
|
message (pterm) /* get a message from the remote system */
|
||||||
int pterm; /* an ETX ends the message */
|
int pterm; /* an ETX ends the message */
|
||||||
{
|
{
|
||||||
|
|
@ -346,9 +315,7 @@ int pterm; /* an ETX ends the message */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifdef __FreeBSD__
|
|
||||||
void
|
void
|
||||||
#endif
|
|
||||||
aread (pterm, cptr) /* time out a read using the alarm clock */
|
aread (pterm, cptr) /* time out a read using the alarm clock */
|
||||||
int pterm;
|
int pterm;
|
||||||
char *cptr;
|
char *cptr;
|
||||||
|
|
@ -360,9 +327,7 @@ char *cptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifdef __FreeBSD__
|
|
||||||
void
|
void
|
||||||
#endif
|
|
||||||
wait_etx (pterm) /* wait for etx, checksum from remote system */
|
wait_etx (pterm) /* wait for etx, checksum from remote system */
|
||||||
int pterm;
|
int pterm;
|
||||||
{
|
{
|
||||||
|
|
@ -375,9 +340,7 @@ int pterm;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef __FreeBSD__
|
|
||||||
int
|
int
|
||||||
#endif
|
|
||||||
getname (pterm, name) /* get a file name from the remote system */
|
getname (pterm, name) /* get a file name from the remote system */
|
||||||
int pterm;
|
int pterm;
|
||||||
char *name;
|
char *name;
|
||||||
|
|
@ -437,9 +400,7 @@ char *name;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef __FreeBSD__
|
|
||||||
int
|
int
|
||||||
#endif
|
|
||||||
getrec (pterm, fd) /* get a file record from remote system */
|
getrec (pterm, fd) /* get a file record from remote system */
|
||||||
int pterm;
|
int pterm;
|
||||||
int fd; /* file descriptor of local system file */
|
int fd; /* file descriptor of local system file */
|
||||||
|
|
@ -537,9 +498,7 @@ int fd; /* file descriptor of local system file */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef __FreeBSD__
|
|
||||||
int
|
int
|
||||||
#endif
|
|
||||||
load (pterm) /* download a file from the remote system */
|
load (pterm) /* download a file from the remote system */
|
||||||
int pterm;
|
int pterm;
|
||||||
{
|
{
|
||||||
|
|
@ -555,11 +514,7 @@ int pterm;
|
||||||
|
|
||||||
printmsg = (flags & FATAL) ? 0 : 1; /* print or suppress non-fatal msgs */
|
printmsg = (flags & FATAL) ? 0 : 1; /* print or suppress non-fatal msgs */
|
||||||
|
|
||||||
#ifdef __FreeBSD__
|
|
||||||
if (getname (pterm, fname) < 0) return -1; /* get the file name */
|
if (getname (pterm, fname) < 0) return -1; /* get the file name */
|
||||||
#else
|
|
||||||
if (getname (pterm, fname) < 0) return; /* get the file name */
|
|
||||||
#endif
|
|
||||||
|
|
||||||
c = 'y';
|
c = 'y';
|
||||||
if(flags & QUERY) /* test for existing file */
|
if(flags & QUERY) /* test for existing file */
|
||||||
|
|
@ -575,13 +530,8 @@ int pterm;
|
||||||
{
|
{
|
||||||
write(pterm, &can, 1); /* cancel the transfer */
|
write(pterm, &can, 1); /* cancel the transfer */
|
||||||
aread(pterm, &c); /* wait for CAN from remote sys */
|
aread(pterm, &c); /* wait for CAN from remote sys */
|
||||||
#ifdef __FreeBSD__
|
|
||||||
write(pterm, &ack, 1); /* tell remote sys to proceed */
|
write(pterm, &ack, 1); /* tell remote sys to proceed */
|
||||||
return 0;
|
return 0;
|
||||||
#else
|
|
||||||
write(pterm &ack, 1); /* tell remote sys to proceed */
|
|
||||||
return;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
printf ("\n\r%s", fname); /* print file name */
|
printf ("\n\r%s", fname); /* print file name */
|
||||||
|
|
@ -618,11 +568,7 @@ int pterm;
|
||||||
close (dnfd); /* end of file sent */
|
close (dnfd); /* end of file sent */
|
||||||
printf ("\n\r");
|
printf ("\n\r");
|
||||||
write (pterm, &ack, 1);
|
write (pterm, &ack, 1);
|
||||||
#ifdef __FreeBSD__
|
|
||||||
return 0;
|
return 0;
|
||||||
#else
|
|
||||||
return;
|
|
||||||
#endif
|
|
||||||
case 4:
|
case 4:
|
||||||
write (pterm, &can, 1); /* user requests cancellation */
|
write (pterm, &can, 1); /* user requests cancellation */
|
||||||
break; /* remote system should return a cancel */
|
break; /* remote system should return a cancel */
|
||||||
|
|
@ -633,9 +579,7 @@ int pterm;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef __FreeBSD__
|
|
||||||
int
|
int
|
||||||
#endif
|
|
||||||
sendrec (pterm, fd, fname) /* upload one file record */
|
sendrec (pterm, fd, fname) /* upload one file record */
|
||||||
int pterm; /* send the record here */
|
int pterm; /* send the record here */
|
||||||
int fd; /* get the record from this file */
|
int fd; /* get the record from this file */
|
||||||
|
|
@ -699,9 +643,7 @@ char *fname; /* file name used for message only */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef __FreeBSD__
|
|
||||||
int
|
int
|
||||||
#endif
|
|
||||||
send (pterm) /* upload a file to the remote system */
|
send (pterm) /* upload a file to the remote system */
|
||||||
int pterm;
|
int pterm;
|
||||||
{
|
{
|
||||||
|
|
@ -719,11 +661,7 @@ int pterm;
|
||||||
|
|
||||||
printmsg = (flags & FATAL) ? 0 : 1; /* print or suppress non-fatal msgs */
|
printmsg = (flags & FATAL) ? 0 : 1; /* print or suppress non-fatal msgs */
|
||||||
|
|
||||||
#ifdef __FreeBSD__
|
|
||||||
if (getname (pterm, fname) < 0) return -1; /* get the file name */
|
if (getname (pterm, fname) < 0) return -1; /* get the file name */
|
||||||
#else
|
|
||||||
if (getname (pterm, fname) < 0) return; /* get the file name */
|
|
||||||
#endif
|
|
||||||
|
|
||||||
printf ("\n\r%s", fname); /* print file name */
|
printf ("\n\r%s", fname); /* print file name */
|
||||||
if ((upfd = open (fname, 0)) < 0) /* open the file */
|
if ((upfd = open (fname, 0)) < 0) /* open the file */
|
||||||
|
|
@ -767,39 +705,25 @@ int pterm;
|
||||||
}
|
}
|
||||||
|
|
||||||
write (pterm, &ack, 1); /* tell remote system to proceed */
|
write (pterm, &ack, 1); /* tell remote system to proceed */
|
||||||
#ifdef __FreeBSD__
|
|
||||||
return 0;
|
return 0;
|
||||||
#else
|
|
||||||
return;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifdef __FreeBSD__
|
|
||||||
int
|
int
|
||||||
#endif
|
|
||||||
main (argc, argv)
|
main (argc, argv)
|
||||||
int argc;
|
int argc;
|
||||||
char **argv;
|
char **argv;
|
||||||
{
|
{
|
||||||
char c, wega_to_term();
|
char c, wega_to_term();
|
||||||
FILE *dbf; /* file descriptor for database */
|
FILE *dbf; /* file descriptor for database */
|
||||||
#ifdef __FreeBSD__
|
|
||||||
void total_abort(), single_abort(), time_out(), cleanup(), intrupt();
|
void total_abort(), single_abort(), time_out(), cleanup(), intrupt();
|
||||||
#else
|
|
||||||
int total_abort(), single_abort(), time_out(), cleanup(), intrupt();
|
|
||||||
#endif
|
|
||||||
int inithookup; /* initial hookup flag */
|
int inithookup; /* initial hookup flag */
|
||||||
char *eof,*nxtdev; /* end of file on database */
|
char *eof,*nxtdev; /* end of file on database */
|
||||||
|
|
||||||
inithookup = 1;
|
inithookup = 1;
|
||||||
signal(SIGHUP, cleanup); /* watch for hangups */
|
signal(SIGHUP, cleanup); /* watch for hangups */
|
||||||
/* get current SIGINT value, watch for interrupts before going to raw mode */
|
/* get current SIGINT value, watch for interrupts before going to raw mode */
|
||||||
#ifdef __FreeBSD__
|
|
||||||
signal(SIGINT, intrupt);
|
signal(SIGINT, intrupt);
|
||||||
#else
|
|
||||||
curint = signal(SIGINT, intrupt);
|
|
||||||
#endif
|
|
||||||
signal(SIGALRM, time_out); /* set up timeout for initial hookup */
|
signal(SIGALRM, time_out); /* set up timeout for initial hookup */
|
||||||
|
|
||||||
/* attempt to open database file */
|
/* attempt to open database file */
|
||||||
|
|
@ -947,9 +871,7 @@ char **argv;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef __FreeBSD__
|
|
||||||
int
|
int
|
||||||
#endif
|
|
||||||
try(device)
|
try(device)
|
||||||
char *device;
|
char *device;
|
||||||
{
|
{
|
||||||
|
|
@ -999,15 +921,11 @@ char *device;
|
||||||
ioctl(pterm, TCFLSH, 2);
|
ioctl(pterm, TCFLSH, 2);
|
||||||
xlucent (0, &targ, &tflags); /* set new terminal parameters */
|
xlucent (0, &targ, &tflags); /* set new terminal parameters */
|
||||||
xlucent (pterm, &targ, &ptflags); /* set new pseudo terminal parameters */
|
xlucent (pterm, &targ, &ptflags); /* set new pseudo terminal parameters */
|
||||||
signal(SIGINT, curint); /* reset to original SIGINT value */
|
signal(SIGINT, SIG_DFL); /* reset to original SIGINT value */
|
||||||
#ifdef __FreeBSD__
|
|
||||||
return 0;
|
return 0;
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef __FreeBSD__
|
|
||||||
void
|
void
|
||||||
#endif
|
|
||||||
cleanup() /* interrupt or hang up, so exit gracefully */
|
cleanup() /* interrupt or hang up, so exit gracefully */
|
||||||
{
|
{
|
||||||
write(pterm, "logout\n", 7);
|
write(pterm, "logout\n", 7);
|
||||||
|
|
@ -1015,9 +933,7 @@ cleanup() /* interrupt or hang up, so exit gracefully */
|
||||||
logout();
|
logout();
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef __FreeBSD__
|
|
||||||
void
|
void
|
||||||
#endif
|
|
||||||
logout() /* logout processing */
|
logout() /* logout processing */
|
||||||
{
|
{
|
||||||
ioctl(pterm, TCFLSH, 2); /* flush remote line */
|
ioctl(pterm, TCFLSH, 2); /* flush remote line */
|
||||||
|
|
@ -1031,9 +947,7 @@ logout() /* logout processing */
|
||||||
/*
|
/*
|
||||||
* this routine is used by both parent and child
|
* this routine is used by both parent and child
|
||||||
*/
|
*/
|
||||||
#ifdef __FreeBSD__
|
|
||||||
void
|
void
|
||||||
#endif
|
|
||||||
intrupt()
|
intrupt()
|
||||||
{
|
{
|
||||||
unlink(locknm);
|
unlink(locknm);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue