make it compile on FreeBSD
This commit is contained in:
parent
f362f4ae2f
commit
b9499ee45b
|
|
@ -9,7 +9,8 @@ INCL = /usr/include
|
||||||
BIN = is ready for installation in /bin
|
BIN = is ready for installation in /bin
|
||||||
|
|
||||||
# Cflags
|
# Cflags
|
||||||
CFLAGS = -O -s
|
#CFLAGS = -O -s
|
||||||
|
LDFLAGS = -lcompat
|
||||||
|
|
||||||
#
|
#
|
||||||
# Abhaengigkeiten und Aktionen
|
# Abhaengigkeiten und Aktionen
|
||||||
|
|
@ -19,21 +20,21 @@ default: putfile getfile local
|
||||||
|
|
||||||
putfile: putfile.c $(INCL)/sgtty.h $(INCL)/sys/types.h \
|
putfile: putfile.c $(INCL)/sgtty.h $(INCL)/sys/types.h \
|
||||||
$(INCL)/sys/stat.h $(INCL)/signal.h
|
$(INCL)/sys/stat.h $(INCL)/signal.h
|
||||||
$(CC) $(CFLAGS) putfile.c -o $@
|
$(CC) $(CFLAGS) putfile.c -o $@ $(LDFLAGS)
|
||||||
$(ECHO) $@ $(BIN)
|
$(ECHO) $@ $(BIN)
|
||||||
$(ECHO) with mode: 751 owner: bin group: 0
|
$(ECHO) with mode: 751 owner: bin group: 0
|
||||||
|
|
||||||
local: local.c $(INCL)/sgtty.h
|
local: local.c $(INCL)/sgtty.h
|
||||||
$(CC) $(CFLAGS) local.c -o $@
|
$(CC) $(CFLAGS) local.c -o $@ $(LDFLAGS)
|
||||||
$(ECHO) $@ $(BIN)
|
$(ECHO) $@ $(BIN)
|
||||||
$(ECHO) with mode: 751 owner: bin group: 0
|
$(ECHO) with mode: 751 owner: bin group: 0
|
||||||
|
|
||||||
getfile: getfile.c $(INCL)/sgtty.h $(INCL)/signal.h
|
getfile: getfile.c $(INCL)/sgtty.h $(INCL)/signal.h
|
||||||
$(CC) $(CFLAGS) getfile.c -o $@
|
$(CC) $(CFLAGS) getfile.c -o $@ $(LDFLAGS)
|
||||||
$(ECHO) $@ $(BIN)
|
$(ECHO) $@ $(BIN)
|
||||||
$(ECHO) with mode: 751 owner: bin group: 0
|
$(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
|
$(INCL)/sys/types.h $(INCL)/sys/stat.h $(INCL)/pwd.h
|
||||||
$(CC) $(CFLAGS) remote.c -o $@
|
$(CC) $(CFLAGS) remote.c -o $@
|
||||||
$(ECHO) $@ $(BIN)
|
$(ECHO) $@ $(BIN)
|
||||||
|
|
|
||||||
|
|
@ -41,7 +41,11 @@ int argc;
|
||||||
char **argv;
|
char **argv;
|
||||||
|
|
||||||
{
|
{
|
||||||
|
#ifdef __FreeBSD__
|
||||||
|
void time_out();
|
||||||
|
#else
|
||||||
int time_out();
|
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 */
|
||||||
|
|
@ -234,6 +238,9 @@ char **argv;
|
||||||
printf ("\ngetfile: unable to un-write protect the terminal\n");
|
printf ("\ngetfile: unable to un-write protect the terminal\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef __FreeBSD__
|
||||||
|
void
|
||||||
|
#endif
|
||||||
time_out()
|
time_out()
|
||||||
{
|
{
|
||||||
signal(SIGALRM,time_out);
|
signal(SIGALRM,time_out);
|
||||||
|
|
|
||||||
|
|
@ -42,7 +42,11 @@ int argc;
|
||||||
char **argv;
|
char **argv;
|
||||||
|
|
||||||
{
|
{
|
||||||
|
#ifdef __FreeBSD__
|
||||||
|
void time_out();
|
||||||
|
#else
|
||||||
int time_out();
|
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 */
|
||||||
|
|
@ -200,6 +204,9 @@ char **argv;
|
||||||
printf ("\nputfile: unable to un-write protect the terminal\n");
|
printf ("\nputfile: unable to un-write protect the terminal\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef __FreeBSD__
|
||||||
|
void
|
||||||
|
#endif
|
||||||
time_out()
|
time_out()
|
||||||
{
|
{
|
||||||
signal(SIGALRM,time_out);
|
signal(SIGALRM,time_out);
|
||||||
|
|
|
||||||
|
|
@ -27,8 +27,13 @@ char *strcat();
|
||||||
#include <stdio.h> /* used for database accesses only ... all else uses
|
#include <stdio.h> /* used for database accesses only ... all else uses
|
||||||
wega calls */
|
wega calls */
|
||||||
#include <pwd.h>
|
#include <pwd.h>
|
||||||
|
#ifdef __FreeBSD__
|
||||||
|
#define DATABASE "/var/spool/uucp/remotelines"
|
||||||
|
#define LOCKROOT "/var/spool/uucp/LCK..\0xxxxxxxxxxxxxxxxxxxxxxxxxx"
|
||||||
|
#else
|
||||||
#define DATABASE "/usr/spool/uucp/remotelines"
|
#define DATABASE "/usr/spool/uucp/remotelines"
|
||||||
#define LOCKROOT "/usr/spool/uucp/LCK..\0xxxxxxxxxxxxxxxxxxxxxxxxxx"
|
#define LOCKROOT "/usr/spool/uucp/LCK..\0xxxxxxxxxxxxxxxxxxxxxxxxxx"
|
||||||
|
#endif
|
||||||
/* note: extra space required by strcat */
|
/* note: extra space required by strcat */
|
||||||
#define NEEDNULL 21 /* index where \0 is .. */
|
#define NEEDNULL 21 /* index where \0 is .. */
|
||||||
|
|
||||||
|
|
@ -62,7 +67,19 @@ char can = CAN;
|
||||||
char esc = ESC;
|
char esc = ESC;
|
||||||
char exc = EXEC;
|
char exc = EXEC;
|
||||||
|
|
||||||
|
#ifdef __FreeBSD__
|
||||||
|
#include <termios.h>
|
||||||
|
#include <sys/ttycom.h>
|
||||||
|
#define TCGETA TIOCGETA
|
||||||
|
#define TCSETA TIOCSETA
|
||||||
|
#define NCC NCCS
|
||||||
|
#define TAB3 OXTABS
|
||||||
|
#define CBAUD 0010017
|
||||||
|
#define TCFLSH TCIOFLUSH
|
||||||
|
#define termio termios
|
||||||
|
#else
|
||||||
#include <termio.h>
|
#include <termio.h>
|
||||||
|
#endif
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
|
|
@ -77,7 +94,11 @@ 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 */
|
||||||
static struct termio txlflags, ptxlflags; /* xlucent flags */
|
static struct termio txlflags, ptxlflags; /* xlucent flags */
|
||||||
|
#ifdef __FreeBSD__
|
||||||
|
#define curint SIG_DFL
|
||||||
|
#else
|
||||||
int (*curint)(); /* initial SIGINT value */
|
int (*curint)(); /* initial SIGINT value */
|
||||||
|
#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 */
|
||||||
|
|
@ -90,7 +111,9 @@ struct termio *targp, *savterm;
|
||||||
savterm->c_oflag = targp->c_oflag;
|
savterm->c_oflag = targp->c_oflag;
|
||||||
savterm->c_cflag = targp->c_cflag;
|
savterm->c_cflag = targp->c_cflag;
|
||||||
savterm->c_lflag = targp->c_lflag;
|
savterm->c_lflag = targp->c_lflag;
|
||||||
|
#ifndef __FreeBSD__
|
||||||
savterm->c_line = targp->c_line;
|
savterm->c_line = targp->c_line;
|
||||||
|
#endif
|
||||||
for (i = 0; i < NCC; i++)
|
for (i = 0; i < NCC; i++)
|
||||||
savterm->c_cc[i] = targp->c_cc[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_oflag = targp->c_oflag;
|
||||||
savterm->c_cflag = targp->c_cflag;
|
savterm->c_cflag = targp->c_cflag;
|
||||||
savterm->c_lflag = targp->c_lflag;
|
savterm->c_lflag = targp->c_lflag;
|
||||||
|
#ifndef __FreeBSD__
|
||||||
savterm->c_line = targp->c_line;
|
savterm->c_line = targp->c_line;
|
||||||
|
#endif
|
||||||
for (i = 0; i < NCC; i++)
|
for (i = 0; i < NCC; i++)
|
||||||
savterm->c_cc[i] = targp->c_cc[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_oflag = savterm->c_oflag;
|
||||||
targp->c_cflag = savterm->c_cflag;
|
targp->c_cflag = savterm->c_cflag;
|
||||||
targp->c_lflag = savterm->c_lflag;
|
targp->c_lflag = savterm->c_lflag;
|
||||||
|
#ifndef __FreeBSD__
|
||||||
targp->c_line = savterm->c_line;
|
targp->c_line = savterm->c_line;
|
||||||
|
#endif
|
||||||
for (i = 0; i < NCC; i++)
|
for (i = 0; i < NCC; i++)
|
||||||
targp->c_cc[i] = savterm->c_cc[i];
|
targp->c_cc[i] = savterm->c_cc[i];
|
||||||
ioctl (term, TCSETA, targp);
|
ioctl (term, TCSETA, targp);
|
||||||
|
|
@ -175,6 +202,9 @@ term_to_wega (pterm) /* send all input from terminal to wega */
|
||||||
int pterm;
|
int pterm;
|
||||||
{
|
{
|
||||||
char c;
|
char c;
|
||||||
|
#ifdef __FreeBSD__
|
||||||
|
void cleanup();
|
||||||
|
#endif
|
||||||
|
|
||||||
while (1) /* do forever */
|
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 */
|
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 */
|
||||||
|
|
@ -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 */
|
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
|
||||||
|
#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 */
|
||||||
|
|
@ -665,14 +704,22 @@ 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();
|
||||||
|
#else
|
||||||
int total_abort(), single_abort(), time_out(), cleanup(), intrupt();
|
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);
|
||||||
|
#else
|
||||||
curint = signal(SIGINT, intrupt);
|
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 */
|
||||||
|
|
@ -872,6 +919,9 @@ char *device;
|
||||||
signal(SIGINT, curint); /* reset to original SIGINT value */
|
signal(SIGINT, curint); /* reset to original SIGINT value */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef __FreeBSD__
|
||||||
|
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);
|
||||||
|
|
@ -892,6 +942,9 @@ logout() /* logout processing */
|
||||||
/*
|
/*
|
||||||
* this routine is used by both parent and child
|
* this routine is used by both parent and child
|
||||||
*/
|
*/
|
||||||
|
#ifdef __FreeBSD__
|
||||||
|
void
|
||||||
|
#endif
|
||||||
intrupt()
|
intrupt()
|
||||||
{
|
{
|
||||||
unlink(locknm);
|
unlink(locknm);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue