From b9499ee45b367620a3e5e150f242b9996fb26cb5 Mon Sep 17 00:00:00 2001 From: Oliver Lehmann Date: Wed, 31 May 2006 20:25:22 +0000 Subject: [PATCH] make it compile on FreeBSD --- WEGA/contrib/WEGA-Remote/Makefile | 11 ++++--- WEGA/contrib/WEGA-Remote/getfile.c | 7 ++++ WEGA/contrib/WEGA-Remote/putfile.c | 7 ++++ WEGA/contrib/WEGA-Remote/remote.c | 53 ++++++++++++++++++++++++++++++ 4 files changed, 73 insertions(+), 5 deletions(-) diff --git a/WEGA/contrib/WEGA-Remote/Makefile b/WEGA/contrib/WEGA-Remote/Makefile index 1f51abb..5feafb8 100755 --- a/WEGA/contrib/WEGA-Remote/Makefile +++ b/WEGA/contrib/WEGA-Remote/Makefile @@ -9,7 +9,8 @@ INCL = /usr/include BIN = is ready for installation in /bin # Cflags -CFLAGS = -O -s +#CFLAGS = -O -s +LDFLAGS = -lcompat # # Abhaengigkeiten und Aktionen @@ -19,21 +20,21 @@ default: putfile getfile local putfile: putfile.c $(INCL)/sgtty.h $(INCL)/sys/types.h \ $(INCL)/sys/stat.h $(INCL)/signal.h - $(CC) $(CFLAGS) putfile.c -o $@ + $(CC) $(CFLAGS) putfile.c -o $@ $(LDFLAGS) $(ECHO) $@ $(BIN) $(ECHO) with mode: 751 owner: bin group: 0 local: local.c $(INCL)/sgtty.h - $(CC) $(CFLAGS) local.c -o $@ + $(CC) $(CFLAGS) local.c -o $@ $(LDFLAGS) $(ECHO) $@ $(BIN) $(ECHO) with mode: 751 owner: bin group: 0 getfile: getfile.c $(INCL)/sgtty.h $(INCL)/signal.h - $(CC) $(CFLAGS) getfile.c -o $@ + $(CC) $(CFLAGS) getfile.c -o $@ $(LDFLAGS) $(ECHO) $@ $(BIN) $(ECHO) with mode: 751 owner: bin group: 0 -remote: remote.c $(INCL)/termio.h $(INCL)/signal.h $(INCL)/stdio.h \ +remote: remote.c $(INCL)/termios.h $(INCL)/signal.h $(INCL)/stdio.h \ $(INCL)/sys/types.h $(INCL)/sys/stat.h $(INCL)/pwd.h $(CC) $(CFLAGS) remote.c -o $@ $(ECHO) $@ $(BIN) diff --git a/WEGA/contrib/WEGA-Remote/getfile.c b/WEGA/contrib/WEGA-Remote/getfile.c index 79f2d48..9da9927 100644 --- a/WEGA/contrib/WEGA-Remote/getfile.c +++ b/WEGA/contrib/WEGA-Remote/getfile.c @@ -41,7 +41,11 @@ int argc; char **argv; { +#ifdef __FreeBSD__ + void time_out(); +#else int time_out(); +#endif signal(SIGALRM,time_out); /* set up alarm handling */ tty = ttyname(1); /* get name of the output file */ @@ -234,6 +238,9 @@ char **argv; printf ("\ngetfile: unable to un-write protect the terminal\n"); } +#ifdef __FreeBSD__ +void +#endif time_out() { signal(SIGALRM,time_out); diff --git a/WEGA/contrib/WEGA-Remote/putfile.c b/WEGA/contrib/WEGA-Remote/putfile.c index b303544..73f8893 100644 --- a/WEGA/contrib/WEGA-Remote/putfile.c +++ b/WEGA/contrib/WEGA-Remote/putfile.c @@ -42,7 +42,11 @@ int argc; char **argv; { +#ifdef __FreeBSD__ + void time_out(); +#else int time_out(); +#endif signal(SIGALRM,time_out); /* set up alarm handling */ tty = ttyname(1); /* get name of the output file */ @@ -200,6 +204,9 @@ char **argv; printf ("\nputfile: unable to un-write protect the terminal\n"); } +#ifdef __FreeBSD__ +void +#endif time_out() { signal(SIGALRM,time_out); diff --git a/WEGA/contrib/WEGA-Remote/remote.c b/WEGA/contrib/WEGA-Remote/remote.c index ee64fde..6252697 100644 --- a/WEGA/contrib/WEGA-Remote/remote.c +++ b/WEGA/contrib/WEGA-Remote/remote.c @@ -27,8 +27,13 @@ char *strcat(); #include /* used for database accesses only ... all else uses wega calls */ #include +#ifdef __FreeBSD__ +#define DATABASE "/var/spool/uucp/remotelines" +#define LOCKROOT "/var/spool/uucp/LCK..\0xxxxxxxxxxxxxxxxxxxxxxxxxx" +#else #define DATABASE "/usr/spool/uucp/remotelines" #define LOCKROOT "/usr/spool/uucp/LCK..\0xxxxxxxxxxxxxxxxxxxxxxxxxx" +#endif /* note: extra space required by strcat */ #define NEEDNULL 21 /* index where \0 is .. */ @@ -62,7 +67,19 @@ char can = CAN; char esc = ESC; char exc = EXEC; +#ifdef __FreeBSD__ +#include +#include +#define TCGETA TIOCGETA +#define TCSETA TIOCSETA +#define NCC NCCS +#define TAB3 OXTABS +#define CBAUD 0010017 +#define TCFLSH TCIOFLUSH +#define termio termios +#else #include +#endif #include #include #include @@ -77,7 +94,11 @@ static int lockfd,pterm; static struct termio targ; /* defined in termio.h */ static struct termio tflags, ptflags; /* original tty flags */ static struct termio txlflags, ptxlflags; /* xlucent flags */ +#ifdef __FreeBSD__ +#define curint SIG_DFL +#else int (*curint)(); /* initial SIGINT value */ +#endif xlucent (term, targp, savterm) /* make terminal interface translucent and */ int term; /* return the previous configuration */ @@ -90,7 +111,9 @@ struct termio *targp, *savterm; savterm->c_oflag = targp->c_oflag; savterm->c_cflag = targp->c_cflag; savterm->c_lflag = targp->c_lflag; +#ifndef __FreeBSD__ savterm->c_line = targp->c_line; +#endif for (i = 0; i < NCC; i++) savterm->c_cc[i] = targp->c_cc[i]; @@ -142,7 +165,9 @@ struct termio *targp, *savterm; savterm->c_oflag = targp->c_oflag; savterm->c_cflag = targp->c_cflag; savterm->c_lflag = targp->c_lflag; +#ifndef __FreeBSD__ savterm->c_line = targp->c_line; +#endif for (i = 0; i < NCC; i++) savterm->c_cc[i] = targp->c_cc[i]; @@ -163,7 +188,9 @@ struct termio *savterm, *targp; targp->c_oflag = savterm->c_oflag; targp->c_cflag = savterm->c_cflag; targp->c_lflag = savterm->c_lflag; +#ifndef __FreeBSD__ targp->c_line = savterm->c_line; +#endif for (i = 0; i < NCC; i++) targp->c_cc[i] = savterm->c_cc[i]; ioctl (term, TCSETA, targp); @@ -175,6 +202,9 @@ term_to_wega (pterm) /* send all input from terminal to wega */ int pterm; { char c; +#ifdef __FreeBSD__ + void cleanup(); +#endif while (1) /* do forever */ { @@ -239,6 +269,9 @@ int parent; /* transfers to detect user abort requests */ } +#ifdef __FreeBSD__ +void +#endif total_abort () /* set flag to indicate all xfers to stop */ { signal (SIGQUIT, total_abort); /* set up the signal call again */ @@ -246,12 +279,18 @@ total_abort () /* set flag to indicate all xfers to stop */ } +#ifdef __FreeBSD__ +void +#endif single_abort () /* set flag to stop xfer in progress */ { signal (SIGTERM, single_abort); /* set up the signal call again */ onestop = 1; } +#ifdef __FreeBSD__ +void +#endif time_out () /* set flag to indicate a read timed out */ { signal (SIGALRM, time_out); /* set up the signal call again */ @@ -665,14 +704,22 @@ char **argv; { char c, wega_to_term(); FILE *dbf; /* file descriptor for database */ +#ifdef __FreeBSD__ + 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 */ char *eof,*nxtdev; /* end of file on database */ inithookup = 1; signal(SIGHUP, cleanup); /* watch for hangups */ /* get current SIGINT value, watch for interrupts before going to raw mode */ +#ifdef __FreeBSD__ + signal(SIGINT, intrupt); +#else curint = signal(SIGINT, intrupt); +#endif signal(SIGALRM, time_out); /* set up timeout for initial hookup */ /* attempt to open database file */ @@ -872,6 +919,9 @@ char *device; signal(SIGINT, curint); /* reset to original SIGINT value */ } +#ifdef __FreeBSD__ +void +#endif cleanup() /* interrupt or hang up, so exit gracefully */ { write(pterm, "logout\n", 7); @@ -892,6 +942,9 @@ logout() /* logout processing */ /* * this routine is used by both parent and child */ +#ifdef __FreeBSD__ +void +#endif intrupt() { unlink(locknm);