From dunaj.in-passau.de!pf Thu Jan 19 13:50:08 1995
Return-Path: <pf@dunaj.in-passau.de>
Received: by greenie.muc.de (/\==/\ Smail3.1.24.1 #24.2)
	id <m0rUwJH-0002SaC@greenie.muc.de>; Thu, 19 Jan 95 13:49 MET
Received: from kirk.fmi.uni-passau.de ([132.231.1.20]) by colin.muc.de with SMTP id <25582-2>; Thu, 19 Jan 1995 13:49:45 +0100
Received: from pcdonner.fmi.uni-passau.de by kirk.fmi.uni-passau.de with SMTP id AA19557
  (5.65c8/IDA-1.4.4 for <gert@greenie.muc.de>); Thu, 19 Jan 1995 13:47:48 +0100
Received: from IN-Passau.DE by pcdonner.fmi.uni-passau.de with bsmtp
	(Linux Smail3.1.28.1) id m0rUwIi-0002yqC; Thu, 19 Jan 95 13:49 MET
Received: by IN-Passau.DE (Linux Smail3.1.28.1)
	id m0rUkd9-0007UWC; Thu, 19 Jan 95 01:21 MET
Received: (from pf@localhost) by dunaj.in-passau.de (8.6.9/8.6.9) id SAA00141 for gert@greenie.muc.de; Wed, 18 Jan 1995 18:35:31 +0100
From: Philipp Florschuetz <pf@dunaj.in-passau.de>
Message-Id: <199501181735.SAA00141@dunaj.in-passau.de>
Subject: mgetty police.h creatix
To: gert@greenie.muc.de
Date: Wed, 18 Jan 1995 18:35:28 +0100
X-Mailer: ELM [version 2.4 PL23]
Content-Type: text
Content-Length: 36384     
X-Status: 
Status: RO

Wie besprochen sende ich Ihnen mein policy.h file und der Vollstaendigkeit
halber auch das Makefile. (Da meine Konfiguration lange zurueckliegt,
weiss ich nicht mehr genau, was wo ist...)

Selbstverstaendlich ohne Gewaehr fuer irgendeine Art der Brauchbarkeit.
Wie gesagt, das Ding tuts bei mir fuer Daten und Fax jeweils ein- und 
abgehend. (Creatix LC144VF)

Getestet mit PROM 1.41, und duerftig getestet mit PROM 1.5.

Mit freundlichen Gruessen,  Philipp Florschuetz
--------------------------------------------------------------------------


#ident "@(#)policy.h	1.63 94/09/18 Copyright (c) Gert Doering"

/* this is the file where all configuration for mgetty / sendfax is done
 */

/* main configuration file
 * definitions in this file can override the defaults compiled into the
 * program
 * NOT USED YET.
 */
#define CONFIG_FILE "/usr/local/lib/mgetty-config"

/* login dispatcher config file
 *
 * In this file, you can configure which "login" program (default /bin/login)
 * to call for what user name.
 *
 * You could use it to call "uucico" for all users starting with "U*"
 * (works only with Taylor UUCP 1.04 with my patch), or to call a fido
 * mailer for fido calls (only if -DFIDO defined)...
 * See the samples in the example mgetty.login file.
 *
 * WARNING: make sure that this file isn't world-accessable (SECURITY!)
 *
 * If you want to call /bin/login in any case, do not define this
 *
 * WARNING2: THE FORMAT OF THIS FILE HAS BEEN CHANGED BETWEEN MGETTY
 *           VERSIONS 0.19 AND 0.20! CHECK YOUR CONFIGURATION!
 */
#define LOGIN_CFG_FILE "/usr/local/lib/mgetty+sendfax/login.config"

/* default login program
 *
 * If LOGIN_CFG_FILE is not defined, or does not exist, or doesn't
 * have a default entry, this program is called for user logins.
 * Normally, this is "/bin/login", just a few systems put "login"
 * elsewhere (e.g. Free/NetBSD in "/usr/bin/login").
 */
#define DEFAULT_LOGIN_PROGRAM "/bin/login"

/* If you want to use /etc/gettydefs to set tty flags, define this
 */
/* #define USE_GETTYDEFS */

/* Name of the "gettydefs" file (used only if USE_GETTYDEFS is set)
 */
#define GETTYDEFS "/etc/gettydefs"

/* If no gettydefs "tag" is specified on the command line, use
 * this setting (from GETTYDEFS) as default (only if compiled with
 * USE_GETTYDEFS set)
 */
#define GETTYDEFS_DEFAULT_TAG "n"


/* access modes */

/* user id of the "uucp" user. The tty device will be owned by this user,
 * so parallel dial-out of uucico will be possible
 */
#define UUCPID	"uucp"

/* access mode for the line while getty has it - it should be accessible
 * by uucp / uucp, but not by others (imagine someone dialing into your
 * system and using another modem to dial to another country...)
 */
#define FILE_MODE 0660

/* security: optionally, mgetty can system() this, to kill any dangling
 * processes on the current tty. A %s is replaced with the tty device.
 * NOT NEEDED on SCO, SunOS 4 or Linux!
 */
/* #define EXEC_FUSER "exec fuser -k -f %s >/dev/null 2>&1" */


/* logging */

/* system console - if a severe error happens at startup, mgetty writes
 * a message to this file and aborts
 * On SCO, this may be /dev/syscon!
 */
#define CONSOLE "/dev/console"

/* Name of the mgetty log file
 * e.g. "/usr/spool/log/mgetty.log.%s"
 * a "%s" will be replaced by the device name, e.g. "tty2a"
 */
#define LOG_PATH "/var/adm/mgetty_log.%s"

/* Default log error level threshold. Possible error levels are
 * L_FATAL, L_ERROR, L_WARN, L_AUDIT, L_MESG, L_NOISE, L_JUNK (see mgetty.h)
 */
#define LOG_LEVEL L_MESG

/* Whether "\n"s in the modem response should start a new line
 * in the logfile
 */
/* #define LOG_CR_NEWLINE */

/* System administrator - if a severe error happens (lprintf called
 * with log_level L_FATAL) and writing to CONSOLE is not possible,
 * the logfile will be mailed to him
 */
#define ADMIN	"root"

/* Syslog
 *
 * If you want logging messages of type L_AUDIT, L_ERROR and L_FATAL
 * to go to the "syslog", define this.
 * mgetty will use the facility "LOG_AUTH", and the priorities
 * LOG_NOTICE, LOG_ERR and LOG_ALERT, respectively.
 */
/* #define SYSLOG */

/* Syslog facility
 *
 * This is the facility mgetty uses for logging. Ususally, this will be
 * LOG_AUTH, but on some systems, this may not exist, try LOG_DAEMON
 * instead (or look into the syslog manpage for available options)
 */
#define SYSLOG_FC LOG_AUTH

/* login stuff */

/* System name - printed at login prompt
 * If you do not define this, the uname() call will be used
 */
#define SYSTEM	"dunaj"

/* Login prompt
 * The "@", "\\D" and "\\T" escapes will be replaced by SYSTEM, the
 * current date and time, respectively.
 * override with "-p <prompt>" switch
 */
#define LOGIN_PROMPT	"@  \\D  \\T  login: "

/* On SVR4, maybe on other systems too, you can cause the 'login' program
 * to prompt with the same string as mgetty did, instead of the standard
 * "login:" prompt. The string will be passed to the 'login' program
 * in the environment variable TTYPROMPT.
 * This is done by putting "login" into a special (brain-dead) "ttymon"-
 * compatibility mode. In that mode, mgetty doesn't ask for a login name
 * at all, so mgetty won't work if you enable that feature and your
 * login program doesn't support it. (You can see if it doesn't work
 * if the user gets a double login prompt or none at all).
 * To use that feature, define ENV_TTYPROMPT.
 */
/* #define ENV_TTYPROMPT */

/* Maximum time before login name has to be entered (in seconds)
 * (after that time a warning will be issued, after that, the call is
 * dropped). To disable that feature, do not define it.
 */
#define MAX_LOGIN_TIME	60

/* nologin file
 *
 * If that file exists, a ringing phone won't be answered (see manual).
 * "%s" will be replaced by the device name.
 */
#define NOLOGIN_FILE "/etc/nologin.%s"


/* misc */

/* how to find mgetty..
 *
 * If you define this, mgetty will create a file with the given name and
 * put its process ID in it. A "%s" will be replaced by the device id.
 */
#define MGETTY_PID_FILE	"/etc/mg-pid.%s"

/* Path for the lock files. A %s will be replaced with the device name,
 * e.g. tty2a -> /usr/spool/uucp/LCK..tty2a
 * Make sure that this is the same file that your uucico uses for
 * locking!
 */

#if defined (SVR4) || defined(sunos4)
# define LOCK_PATH "/var/spool/locks"
# define LOCK      "/var/spool/locks/LCK..%s"
#else
# ifdef sgi
#  define LOCK	"/usr/spool/locks/LCK..%s"
# endif
# ifdef _AIX
#  define LOCK	"/etc/locks/LCK..%s"
# endif
#endif

#ifndef LOCK
#define LOCK "/usr/spool/uucp/LCK..%s"
#endif
  
/* Set this to "1" if your system uses binary lock files (i.e., the pid
 * as four byte integer in host byte order written to the lock file)
 * If it is "0", HDB locking will be used - the PID will be written as
 * 10 byte ascii, with a trailing newline
 * (Just check "LOCK" while uucico or pcomm or ... are running to find
 * out what lock files are used on your system)
 */
#define LOCKS_BINARY 1

/* Lower case locks - change all device names to lowercase for locking
 * purposes.
 *
 * If you're using a SCO Unix system with those "tty1a/tty1A" device
 * pairs, you'll have to define this.
 */
/* #define LOCKS_LOWERCASE */


/* the default speed used by mgetty - override it with "-s <speed>"
 *
 * WARNING: ZyXELs *can* do faxreceive with 38400, but a lot other modems,
 * especially such based on the rockwell chipset can *not*. So, if
 * your fax receive fails mysteriously, timing out waiting for "OK", try
 * setting this to B19200
 */
#define DEFAULT_PORTSPEED	B38400

/* the modem initialization string
 *
 * this sample string is for ZyXELs, for other modems you'll have to
 *     replace &H3 (rts/cts flow control), &K4 (enable v42bis) and &N0
 *     (answer with all known protocols).
 * For instructions how to setup various other modems, look into
 *     mgetty.texi ("modems" section) and check your modem manual
 * For some modems, an initial "\d" is needed.
 * If you need a "\" in the modem command, give it as "\\\\".
 * Maybe the best "initialization" would be to setup everything 
 *     properly in the nvram profile, and just send the modem an
 *     "ATZ". I just like to make sure the most important things are
 *     always set...
 * If you wish to use ZyXEL callerid, add "S40.2=1"
 * The modem must answer with "OK" (!!!) - otherwise, change mgetty.c
 */
#define MODEM_INIT_STRING          "AT&F0S0=0Q0&D3&K6"

/* command termination string
 *
 * for most modems, terminating the AT... command with "\r" is
 * sufficient and "\r\n" also works without doing harm.
 * Unfortunately, for the Courier HST, you've to use *only* \r,
 * otherwise ATA won't work (immediate NO CARRIER), and for some
 * ZyXELs, you have to use \r\n (no OK otherwise).
 * So, try one, and if it doesn't work, try the other.
 */
#define MODEM_CMD_SUFFIX "\r"

/* "keep alive"
 *
 * mgetty can periodically check whether the modem is still alive
 * by issueing an "AT\r" command and checking for the "OK"
 * Define here, in seconds, how often mgetty should check. For normal
 * reliable modems, once an hour should be sufficient...
 * If you use "-1", or don't define this at all, mgetty won't check.
 */
#define MODEM_CHECK_TIME 3600


/* modem mode
 *
 * DEFAULT_MODEMTYPE specifies the default way mgetty+sendfax handle a
 * faxmodem. You have four choices:
 *   "data" - data only, no faxing available (for sendfax, equal to "auto")
 *   "cls2" - use AT+FCLASS=2
 *   "c2.0" - use AT+FCLASS=2.0
 *   "auto" - try "2.0", then "2", then fall to "data".
 *
 * Normally, you can leave this to "auto", but if you have a modem that
 * can do class 2.0 and class 2, and 2.0 doesn't work, then you could try
 * setting it to "cls2".
 * You can override this define with the "-C <mode>" switch.
 */
#define DEFAULT_MODEMTYPE "auto"


/* the main fax spool directory
 */
#define FAX_SPOOL	"/usr/spool/fax"

/* where incoming faxes go to
 * getty needs write permissions!
 */
#ifdef __STDC__
# define FAX_SPOOL_IN	FAX_SPOOL"/incoming"
#else
# define FAX_SPOOL_IN	"/usr/spool/fax/incoming"
#endif

/* some modems are a little bit slow - after sending a response (OK)
 * to the host, it will take some time before they can accept the next
 * command - specify the amount needed in data mode here (in
 * milliseconds). Normally, 50 ms should be sufficient. (On a slow
 * machine it may even work without any delay at all)
 *
 * Be warned: if your machine isn't able to sleep for less than one
 * second, this may cause problems.
 */
#define DO_CHAT_SEND_DELAY 50
 /* and this is the delay before sending each command while in fax mode
  */
#define FAX_COMMAND_DELAY 50

/* incoming faxes will be chown()ed to this uid and gid
 */
#define FAX_IN_OWNER	0
#define FAX_IN_GROUP	14

/* incoming faxes will be chmod()ed to this mode
 * (if you do not define this, the file mode will be controlled by
 * mgetty's umask)
 */
#define FAX_FILE_MODE 0660

/* FLOW CONTROL
 *
 * There are basically two types of flow control:
 * - hardware flow control: pull the RTS/CTS lines low to stop the other
 *   side from spilling out data too fast
 * - sofware flow control: send an Xoff-Character to tell the other
 *   side to stop sending, send an Xon to restart
 * obviously, use of Xon/Xoff has the disadvantage that you cannot send
 * those characters in your data anymore, but additionally, hardware flow
 * control is normally faster and more reliable
 *
 * mgetty can use multiple flow control variants:
 * FLOW_NONE  - no flow control at all (absolutely not recommended)
 * FLOW_HARD  - use RTS/CTS flow control (if available on your machine)
 * FLOW_SOFT  - use Xon/Xoff flow control, leave HW lines alone
 * FLOW_BOTH  - use both types simultaneously, if possible
 *
 * Note that few operating systems allow both types to be used together.
 *
 * mgetty won't (cannot!) notice if your settings don't work, but you'll
 * see it yourself: you'll experience character losses, garbled faxes,
 * low data throughput,..., if the flow control settings are wrong
 *
 * If in doubt what to use, try both and compare results.
 * (if you use FAS or SAS with the recommended settings, FLOW_HARD is a
 * "don't care" since the driver will use RTS/CTS anyway)
 *
 * If you use an atypical system, check whether tio_set_flow_control in
 * tio.c does the right thing for your system.
 */

/* This is the flow control used for normal data (login) connections
 * Set it to FLOW_HARD except in very special cases.
 */
#define DATA_FLOW	FLOW_HARD

/* This is the flow control used for incoming fax connections
 * Wrong settings will result in missing lines or erroneous lines
 * in most of the received faxes.
 * Most faxmodems expect Xon/Xoff, few honour the RTS line.
 */
#define FAXREC_FLOW	FLOW_HARD | FLOW_SOFT

/* And this is for sending faxes
 *
 * Wrong settings here will typically result in that the first few
 * centimeters of a transmitted fax look perfect, and then (the buffer
 * has filled up), the rest is more or less illegible junk.
 * For most faxes, this has to be FLOW_SOFT, though the Supra and ZyXEL
 * modems will (sometimes) do hardware flow control, too. Try it.
 *
 * If you see a large number of [11] and [13] characters in the sendfax
 * log file, your modem is propably doing software flow control - and
 * you've definitely set FAXSEND_FLOW to FLOW_HARD...
 */
#define FAXSEND_FLOW	FLOW_HARD | FLOW_SOFT
 
/* if your faxmodem switches to 19200 bps just after sending the "+FCON"
 * message to the host, define this. (Not important if you have the
 * portspeed set to 19200 anyway).
 * Some Tornado and Supra modems are know to do this.
 * ZyXELs do *not* do this, except if explicitely told to do so.
 *
 * You can see if this happens if mgetty gets the "+FCON" response,
 * starts the fax receiver, and times out waiting for OK, receiving
 * nothing or just junk.
 */
#define FAX_RECEIVE_USE_B19200

/* some genius at US Robotics obviously decided that the above method
 * of switching baud rates is broken, and came up with something new
 * --- broken as well (why bother switching rates at all?) --- this
 * and other USR Courier Fax follies will be handled by enabling the
 * following define (if you have an USR faxmodem that does *not* need
 * this, please send me a mail!)
 */
/* #define FAX_USRobotics */

/* name of the logfile for outgoing faxes
 */
#ifdef __STDC__
# define FAX_LOG		FAX_SPOOL"/Faxlog"
#else
# define FAX_LOG		"/usr/spool/fax/Faxlog"
#endif

/* local station ID
 * 20 character string, most faxmodem allow all ascii characters 32..127,
 * but some do only allow digits and blank
 * AT+FLID=? should tell you what's allowed and what not.
 */
#define FAX_STATION_ID	"49 89 1234567"

/* ------ sendfax-specific stuff follows here -------- */

/* the baudrate used for *sending* faxes. ZyXELs can handle 38400,
 * SUPRAs (and other rockwell-based faxmodems) do not
 * I recommend 38400, since 19200 may be to slow for 14400 bps faxmodems!
 */
#define FAX_SEND_BAUD B38400

/* switch baud rate after +FCLASS=2
 *
 * some weird modems require that you initialize the modem with one
 * baud rate (e.g. 2400 or 9600 for cheap 2400+fax modems, or `smart'
 * modems that insist on staying locked to 38400 (ELSA!)), but switch
 * to another baud rate, typically 19200, immediately after receiving
 * the "AT+FCLASS=2" command.
 *
 * If the following is defined, sendfax will switch to the speed given
 * here after sending AT+FCLASS=2.
 *
 * Only try fiddling with this if sendfax times out during modem
 * initialization, receiving junk instead of "OK" or "ERROR" (logfile!)
 */
/* #define FAX_SEND_SWITCHBD B19200 */

/* this is the command to set the modem to use the desired flow control.
 * For hardware handshake, this could be AT&H3 for the ZyXEL, &K3 for
 * Rockwell-Based modems or AT\\Q3&S0 for Exar-Based Modems (i.e. some GVC's)
 * If you don't want extra initalization, do not define it.
 */
#define FAX_MODEM_HANDSHAKE "AT&K6"

/* This is the modem command used for dialing. The phone number will
 * get appended right after the string. Normally, "ATD" or "ATDP" should
 * suffice, but in some situations (company telephone systems) you might
 * need something like "ATx0DT0wP" (switch of dial-tone recognition, tone-
 * dial a "0", wait for dial-tone, pulse dial the rest)
 */
#define FAX_DIAL_PREFIX "ATDT"

/* When sending a fax, if the other side says "page bad, retrain
 * requested", sendfax will retry the page. Specifiy here the maximum
 * number of retries (I recommend 3) before hanging up.
 *
 * If you set it to "0", sendfax will *never* retransmit a page (only
 * do this if you know that your modem returns +FPTS:2 even if the
 * page arrived properly, but be warned - you wont' be able to react
 * properly to transmission errors!)
 */
#define FAX_SEND_MAX_TRIES 3

/* the device(s) used for faxing
 * multiple devices can be separated by ":", e.g. "tty1a:tty2a"
 * (without (!) leading /dev/)
 */
#define FAX_MODEM_TTYS	"ttyS1"

/* some modems, notably some GVC modems and the german telecom approved
 * ZyXEL EG+ have the annoying behaviour of lowering and raising the
 * DCD line during the pre- and post-page handshake (when sending).
 *
 * If your modem does this, sendfax will terminate immediately after
 * starting to send the first page, or between the first and second
 * page, and the fax log file will show something like
 * "read failed, I/O error".
 *
 * If you define this, sendfax will (try to) ignore that line
 */

/* #define FAX_SEND_IGNORE_CARRIER */

/* Xon or not?
 *
 * the first issues of the class 2 drafts required that the program waits
 * for an Xon character before sending the page data. Later versions
 * removed that. Sendfax can do both, default is to wait for it.
 *
 * If you get an error message "... waiting for XON" when trying to
 * send a fax, try this one. Some ELSA modems are know to need it.
 */
/* #define FAXSEND_NO_XON */


/* define mailer that accepts destination on command line and mail text
 * on stdin. For mailers with user friendly interfaces, (such as mail,
 * mailx, elm), include an appropriate subject line in the command
 * definition. If using a mail agent (such as sendmail), that reads
 * mail headers, define NEED_MAIL_HEADERS.
 */
#ifdef SVR4
# define MAILER		"/usr/bin/mailx -s 'Incoming facsimile message'"
#else
# ifdef _AIX
#  define MAILER	"/usr/sbin/sendmail"
#  define NEED_MAIL_HEADERS
# endif
#endif

#ifndef MAILER
# define MAILER		"/usr/lib/sendmail"
# define NEED_MAIL_HEADERS
#endif

/* where to send notify mail about incoming faxes to
 * (remember to create an mail alias if no such user exists!)
 */
#define MAIL_TO		"faxadmin"

/* after a fax has arrived, mgetty can call a program for further
 * processing of this fax.
 *
 * (e.g.: printing of the fax, sending as MIME mail, displaying in an X
 * window (the latter one could be tricky) ...)
 *
 * It will be called as:
 * <program> <result code> "<sender_id>" <#pgs> <pg1> <pg2>...
 * 
 * Define the name of this program here
 * If you don't want this type of service, do not define it at all
 */
#define FAX_NOTIFY_PROGRAM "/usr/local/lib/mgetty+sendfax/new_fax"

/* default minimum space required on spooling partition for receiving a FAX
 */
#define	MINFREESPACE (1024 * 1024)

/* if this file exists, it can be used to control what callers
 * are allowed in.  If undefined, the functionality is omitted.
 */
/* #define CNDFILE "/usr/local/lib/mgetty+sendfax/dialin.config" */


---------------------------------------------------------------------
Makefile
--------------


# Makefile for the mgetty fax package
#
# SCCS-ID: %W% %E% (c) Gert Doering
#
# this is the C compiler to use (on SunOS, the standard "cc" does not
# grok my code, so please use gcc there).
CC=gcc
#CC=cc
#
#### C Compiler Flags ####
#
# For SCO Unix 3.2v4, it may be necessary to define -D__STDC__=0
# If you have problems with dial-in / dial-out on the same line (e.g.
# 'cu' telling you "CAN'T ACCESS DEVICE"), you should try -DBROKEN_SCO_324
# If the compiler barfs about my getopt() prototype, change it (mgetty.h)
# If the linker cannot find "syslog()" (compiled with SYSLOG defined),
# link "-lsocket".
#
# On SCO Unix 3.2.2, select(S) refuses to sleep less than a second,
# so use poll(S) instead. Define -DUSE_POLL
#
# For Systems with a "login uid" (man setluid()), define -DSECUREWARE
# (All SCO Systems have this). Maybe you've to link some special library
# for it, on SCO it's "-lprot_s".
#
#
# Add "-DSVR4" to compile on System V Release 4 unix
# For SVR4.2, add "-DSVR4 -DSVR42" to the CFLAGS line.
#
# For Linux, you don't have to define anything
#
# For SunOS 4.x, please define -Dsunos4.
#   (We can't use "#ifdef sun" because that's defined on solaris as well)
#   Be warned, Hardware handshake (and serial operations in general)
#   work a lot more reliably with patch 100513-04 (jumbo tty patch)!
#
# For Solaris 2.x, please define -Dsolaris2, which will automatically
#   #define SVR4.
#
# Add "-DISC" to compile on Interactive Unix. For posixized ISC 4.0 you
# may have to add -D_POSIX_SOURCE
#
# For IBM AIX, you don't have to define anything, but be warned: the
# port is not fully complete. Something still breaks. Use -DUSE_POLL!
#
# Add "-D_3B1_ -DUSE_READ -D_NOSTDLIB_H -DSHORT_FILENAMES" to compile
# on the AT&T 3b1 machine -g.t.
#
# Add "-DMEIBE" to compile on the Panasonic (Matsushita Electric
#	industry) BE workstation
#
# When compiling on HP/UX, make sure that the compiler defines _HPUX_SOURCE, 
#     if it doesn't, add "-D_HPUX_SOURCE" to the CFLAGS line.
#
# For (otherwise not mentioned) systems with BSD utmp handling, define -DBSD
#
# Add "-D_NOSTDLIB_H" if you don't have <stdlib.h>
#
# Add "-DPOSIX_TERMIOS" to use POSIX termios.h, "-DSYSV_TERMIO" to use
#     the System 5 termio.h style. (Default set in tio.h)
#
# For machines without the select() call:
#     Add "-DUSE_POLL" if you don't have select, but do have poll
#     Add "-DUSE_READ" if you don't have select or poll (ugly)
#
# For older SVR systems (with a filename length restriction to 14
#     characters), define -DSHORT_FILENAMES
#
# For Systems that default to non-interruptible system calls (symptom:
# timeouts in do_chat() don't work reliably) but do have siginterrupt(),
# define -DHAVE_SIGINTERRUPT. This is the default if BSD is defined.
#
# For Systems with broken termios / VMIN/VTIME mechanism (symptom: mgetty
# hangs in "waiting for line to clear"), define -DBROKEN_VTIME. Notably
# this hits FreeBSD 0.9 and some SVR4.2 users...
#
# If you don't have *both* GNU CC and GNU AS, remove "-pipe"
#
# Disk statistics:
#
# The following macros select one of 5 different variants of partition
# information grabbing.  AIX, Linux, 3b1 and SVR4 systems will figure
# this out themselves.  You can test whether you got this right by
# running "make testdisk".  If it fails, consult getdisk.c for
# further instructions.
#
#	    BSDSTATFS     - BSD/hp-ux/SunOS/Dynix/vrios
#			    2-parameter statfs()
#	    ULTRIXSTATFS  - Ultrix wacko statfs
#	    SVR4	  - SVR4 statvfs()
#	    SVR3	  - SVR3/88k/Apollo/SCO 4-parameter statfs()
#	    USTAT	  - ustat(), no statfs etc.
#
#CFLAGS=-Wall -O2 -pipe -DSECUREWARE -DUSE_POLL
CFLAGS=-O2 -Wall -pipe -DFIDO
#CFLAGS=-O -DSVR4
#CFLAGS=-O -DSVR4 -DSVR42
#CFLAGS=-O -DUSE_POLL
#CFLAGS=-Wall -g -O2 -pipe
# 3B1: You can remove _NOSTDLIB_H and USE_READ if you have the
# networking library and gcc.
#CFLAGS=-D_3B1_ -D_NOSTDLIB_H -DUSE_READ -DSHORT_FILENAMES
#CFLAGS=-std -DPOSIX_TERMIOS -O2 -D_BSD -DBSD	# for OSF/1 (w/ /bin/cc)

#
# LDFLAGS specify flags to pass to the linker. You could specify
# additional libraries here, special link flags, ...
#
# To use the "setluid()" function on SCO, link "-lprot", and to use
# the "syslog()" function, link "-lsocket".
#
# For SVR4(.2) and Solaris 2, you may need "-lsocket -lnsl" for syslog().
#
# For the 3B1, add "-s -shlib"
#
# For ISC, add "-linet -lpt" (and -lcposix, if necessary)
#
# For Sequent Dynix/ptx, you have to add "-lsocket"
#
# For OSF/1, add "-lbsd".
#
LDFLAGS=
#LDFLAGS=-lprot -lsocket
#LDFLAGS=-s -shlib
#LDFLAGS=-lsocket
#LDFLAGS=-lbsd					# OSF/1
#
#
# the following things are mainly used for ``make install''
#
#
# program to use for installing files
#
# if your systems doesn't have one, use the shell script that I provide
# in "inst.sh" (taken from X11R5)
INSTALL=install -c -o bin -g bin
#INSTALL=installbsd -c -o bin -g bin		# OSF/1
#INSTALL=/usr/ucb/install -c -o bin -g bin	# AIX
#
# where the mgetty + sendfax binaries live (used for "make install")
#
SBINDIR=/sbin
#
# where the user executable binaries live
#
BINDIR=/usr/local/bin
#
# where the config files go to (check vs. policy.h!)
#
LIBDIR=/usr/local/lib/mgetty+sendfax
#
# the fax spool directory
#
FAX_SPOOL=/usr/spool/fax
FAX_SPOOL_IN=$(FAX_SPOOL)/incoming
FAX_SPOOL_OUT=$(FAX_SPOOL)/outgoing
#
# Where section 1 manual pages should be placed
MAN1DIR=/usr/man/man1
#
# Where section 4 manual pages (mgettydefs.4) should be placed
MAN4DIR=/usr/man/man4
#
# Section 5 man pages (faxqueue.5)
MAN5DIR=/usr/man/man5
#
# Section 8 man pages (sendfax.8)
MAN8DIR=/usr/man/man8
#
# Where the GNU Info-Files are located
#
INFODIR=/usr/info
#
#
# A shell that understands bourne-shell syntax
# (on some ultrix systems, you may need /bin/sh5 here)
#
SHELL=/bin/sh
#
# If you have problems with the awk-programs in the fax/ shell scripts,
# try using "nawk" or "gawk" (or whatever works...) here
# needed on most SunOS/Solaris/ISC versions.
#
AWK=awk
#
# An echo program that understands escapes like "\n" for newline or
# "\c" for "no-newline-at-end". On SunOS, this is /usr/5bin/echo, in the
# bash, it's "echo -e"
# (don't forget the quotes, otherwise compiling mksed will break!!)
#
# If you do not have *any* echo program at all that will understand "\c",
# please use the "mg.echo" program provided in the compat/ subdirectory.
# Set ECHO="mg.echo" and INSTALL_MECHO to mg.echo
#
ECHO="echo"
#
# INSTALL_MECHO=mg.echo

#
# for mgetty, that's it. If you want to use Klaus Weidner's voice
# extentions, go ahead (don't forget to read the manual!)
#
#
# All the files needed will be put here,
# except for binaries, which are put into BINDIR (defined above)

VOICE_DIR=/usr/spool/voice

# To maintain security, I recommend creating a new group for
# users who are allowed to manipulate the recorded voice messages.
PHONE_GROUP=phone
PHONE_PERMS=770

# ZYXEL_ROM should be set to 601, 610, 611, 612, ... to match
# your ROM release. This affects adpcm conversion and the
# voice initialization.

ZYXEL_ROM=612

# Add -DNO_STRSTR to CFLAGS if you don't have strstr().

# create hard/soft links, add `-s' if you want symlinks
LN=ln -s
#LN=/usr/5bin/ln

#
# Nothing to change below this line
#
VS=21
#
#
OBJS=mgetty.o logfile.o do_chat.o locks.o utmp.o logname.o login.o \
     mg_m_init.o faxrec.o faxsend.o faxlib.o faxhng.o \
     io.o gettydefs.o tio.o config.o cnd.o getdisk.o goodies.o

SFAXOBJ=sendfax.o logfile.o locks.o faxlib.o faxsend.o faxrec.o \
     io.o tio.o faxhng.o cnd.o getdisk.o

all:	mgetty sendfax g3-tools fax-stuff

mgetty: $(OBJS)
	$(CC) -o mgetty $(OBJS) $(LDFLAGS)

sendfax: $(SFAXOBJ)
	$(CC) -o sendfax $(SFAXOBJ) $(LDFLAGS)

g3-tools:
	cd tools ; $(MAKE) "CC=$(CC)" "CFLAGS=$(CFLAGS) -I.." "LDFLAGS=$(LDFLAGS)" all

fax-stuff:
	cd fax ; $(MAKE) "CC=$(CC)" "CFLAGS=$(CFLAGS) -I.." "LDFLAGS=$(LDFLAGS)" all

contrib-all: 
	cd contrib ; $(MAKE) "CC=$(CC)" "CFLAGS=$(CFLAGS) -I.." "LDFLAGS=$(LDFLAGS)" all

getdisk: getdisk.c
	$(CC) $(CFLAGS) -DTESTDISK getdisk.c -o getdisk

testdisk:	getdisk
	./getdisk / .

# README PROBLEMS
DISTRIB=README.1st THANKS TODO BUGS FTP FAQ inittab.aix inst.sh version.h \
	Makefile ChangeLog policy.h-dist login.cfg.in dialin.config \
        mgetty.c mgetty.h ugly.h do_chat.c logfile.c logname.c locks.c \
	mg_m_init.c faxrec.c faxsend.c faxlib.c fax_lib.h sendfax.c \
	io.c tio.c tio.h gettydefs.c config.c config.h login.c faxhng.c \
	cnd.c getdisk.c mksed.c utmp.c mg_utmp.h syslibs.h goodies.c \
	patches/pbmtog3.p1 patches/taylor104.p1 \
	patches/ecu320.p1 patches/pnmtops.p1 patches/dip337.p1 \
	fax/faxspool.in fax/faxrunq.in fax/faxq.in fax/faxrm.in \
	fax/faxcvt fax/printfax \
	fax/cour24i.pbm fax/Makefile fax/etc-magic fax/faxheader \
	tools/Makefile tools/g3cat.c tools/g3topbm.c tools/g3.c tools/g3.h \
	tools/pbmtog3.c tools/run_tbl.c \
	compat/mg.echo.c \
	contrib/README contrib/scrts.c contrib/pbmscale.c \
	contrib/g3toxwd.c contrib/g3tolj.c \
	contrib/g3toxwd.1 contrib/g3tolj.1 \
	contrib/3b1 contrib/faxin.c contrib/Makefile contrib/lp-fax \
	contrib/faxiobe.sh contrib/sun.readme contrib/xforms.note \
	contrib/gslp-iso.p contrib/dvi-fax \
	contrib/log_diags contrib/readme.supra contrib/ttyenable \
	samples/new_fax.lj samples/new_fax.mail samples/new_fax.pbm \
	samples/new_fax.mime samples/new_fax.hpa \
	samples/coverpg.pbm samples/coverpg.ps \
	dialog/Makefile dialog/faxv.in dialog/listen.in \
	doc/Makefile doc/modems.db doc/mgetty.texi doc/fhng-codes \
	doc/g3topbm.1in doc/g3cat.1in doc/sendfax.8in doc/faxspool.1in \
	doc/faxrunq.1in doc/faxq.1in doc/faxrm.1in doc/mgettydefs.4in \
	doc/pbmtog3.1in doc/faxqueue.5in doc/mgetty.8in \
	doc/coverpg.1in \
	voice/MANIFEST \
	voice/ChangeLog voice/Makefile voice/README voice/TODO \
	voice/voclib.c voice/voclib.h voice/vpaths.c voice/zplay.c \
	voice/vanswer.c voice/vmodem.c voice/vmodem.h \
	voice/pvffft.c voice/vg_fft.in \
	voice/pvfmain.c voice/pvflib.c voice/pvflib.h voice/pvflin.c \
	voice/pvfutil.c voice/pvfadpcm.c voice/pvfau.c voice/pvfvoc.c \
	voice/pvfsine.c \
	voice/rsynth-0.9.linuxA.pch voice/speakdate.sh voice/speakdate.pl \
	voice/vg_button.in voice/vg_dtmf.in voice/vg_message.in \
	voice/vg_nmp.in voice/vg_say.in voice/play_messages.in \
	voice/vg_call.in \
	voice/pvf.1 voice/zplay.1

noident: policy.h
	    for file in $(DISTRIB) policy.h ; do \
	    echo "$$file..."; \
	    case $$file in \
	      *.c) \
		mv -f $$file tmp-noident; \
		sed -e "s/^#ident\(.*\)$$/static char sccsid[] =\1;/" <tmp-noident >$$file; \
		;; \
	      *.h) \
		mv -f $$file tmp-noident; \
		f=`basename $$file .h`; \
		sed -e "s/^#ident\(.*\)$$/static char sccs_$$f[] =\1;/" <tmp-noident >$$file; \
		;; \
	    esac; \
	done
	$(MAKE) all

sedscript: mksed
	./mksed >sedscript
	chmod 700 sedscript

mksed: mksed.c policy.h Makefile
	$(CC) $(CFLAGS) -DBINDIR=\"$(BINDIR)\" -DSBINDIR=\"$(SBINDIR)\" \
		-DLIBDIR=\"$(LIBDIR)\" \
		-DFAX_SPOOL_OUT=\"$(FAX_SPOOL_OUT)\" \
		-DAWK=\"$(AWK)\" \
		-DECHO=\"$(ECHO)\" \
		-DSHELL=\"$(SHELL)\" \
		-DVOICE_DIR=\"$(VOICE_DIR)\" \
	-o mksed mksed.c

policy.h-dist: policy.h
	@rm -f policy.h-dist
	cp policy.h policy.h-dist
	@chmod u+w policy.h-dist

version.h: $(DISTRIB)
	if expr $(VS) : ".[13579]" >/dev/null ; then \
	    date=`date "+%B%d"` ;\
	    echo "static char * mgetty_version = \"experimental test release 0.$(VS)-$$date\";" >version.h ;\
	else \
	    echo "static char * mgetty_version = \"official release 0.$(VS)\";" >version.h ;\
	fi

mgetty0$(VS).tar.gz:	$(DISTRIB)
	rm -f mgetty-0.$(VS)
	ln -sf . mgetty-0.$(VS)
	echo "$(DISTRIB)" \
	    | tr " " "\\012" \
	    | sed -e 's;^;mgetty-0.$(VS)/;g' \
	    | gtar cvvfT mgetty0$(VS).tar -
	gzip -f -9 -v mgetty0$(VS).tar

tar:	mgetty0$(VS).tar.gz

mg.uue:	mgetty0$(VS).tar.gz
	uuencode mgetty0.$(VS)-`date +%b%d`.tar.gz <mgetty0$(VS).tar.gz >mg.uue

uu:	mg.uue

uu2:	mg.uue
	split -3600 mg.uue mg.uu.

# this is for automatic uploading to the beta site. 
# DO NOT USE IT if you're not ME! Please!
#
beta:	mgetty0$(VS).tar.gz
	test `hostname` = greenie.muc.de || exit 1
# local
	cp mgetty0$(VS).tar.gz /pub/uploads/
# beta ftp site
	echo "ftp -v ftp.informatik.tu-muenchen.de <<EOF" >ftp.sh
#	echo "ftp -v -n ftp <<EOF" >ftp.sh
#	echo "user ftp gert@greenie.muc.de" >>ftp.sh
	echo "cd ~ftp/tmp" >>ftp.sh
	echo "bin" >>ftp.sh
	echo "hash" >>ftp.sh
	echo "put mgetty0"$(VS)".tar.gz mgetty0"$(VS)-`date +%b%d`.tar.gz >>ftp.sh
	echo "quit" >>ftp.sh
	sh ftp.sh
	rm ftp.sh


shar1:	$(DISTRIB)
	shar -M -c -l 40 -n mgetty+sendfax-0.$(VS) -a -o mgetty.sh $(DISTRIB)

shar:	$(DISTRIB)
	shar -M $(DISTRIB) >mgetty0$(VS).sh

doc-tar:
	cd doc ; $(MAKE) "VS=$(VS)" doc-tar

policy.h:
	@echo
	@echo "You have to create your local policy.h first."
	@echo "Copy policy.h-dist and edit it."
	@echo
	@exit 1

clean:
	rm -f *.o getdisk
	cd tools ; $(MAKE) clean
	cd fax ; $(MAKE) clean
	cd contrib ; $(MAKE) clean
	cd doc ; $(MAKE) clean
	cd voice ; $(MAKE) clean

fullclean:
	rm -f *.o mgetty sendfax testgetty getdisk mksed sedscript *~
	cd tools ; $(MAKE) fullclean
	cd fax ; $(MAKE) fullclean
	cd contrib ; $(MAKE) fullclean
	cd doc ; $(MAKE) fullclean
	cd voice ; $(MAKE) fullclean

login.config: login.cfg.in sedscript
	./sedscript <login.cfg.in >login.config

install: mgetty sendfax login.config
#
# binaries
#
	-test -d $(SBINDIR) || ( mkdir $(SBINDIR) ; chmod 755 $(SBINDIR) )
	-mv -f $(SBINDIR)/mgetty $(SBINDIR)/mgetty.old
	-mv -f $(SBINDIR)/sendfax $(SBINDIR)/sendfax.old
	$(INSTALL) -s -m 700 mgetty $(SBINDIR)
	$(INSTALL) -s -m 700 sendfax $(SBINDIR)
#
# data files
#
	test -d $(LIBDIR) || ( mkdir $(LIBDIR) ; chmod 755 $(LIBDIR) )
	test -f $(LIBDIR)/login.config || \
		$(INSTALL) -o root -m 600 login.config $(LIBDIR)/
	test -f $(LIBDIR)/dialin.config || \
		$(INSTALL) -o root -m 600 dialin.config $(LIBDIR)/
#
# test for outdated stuff
#
	-@if test -f $(LIBDIR)/mgetty.login ; \
	then \
	    echo "WARNING: the format of $(LIBDIR)/mgetty.login has " ;\
	    echo "been changed. Because of this, to avoid confusions, it's called " ;\
	    echo "$(LIBDIR)/login.config now." ;\
	    echo "" ;\
	fi
#
# fax spool directories
#
	test -d $(FAX_SPOOL) || \
		( mkdir $(FAX_SPOOL) ; chmod 755 $(FAX_SPOOL) )
	test -d $(FAX_SPOOL_IN) || \
		( mkdir $(FAX_SPOOL_IN) ; chmod 755 $(FAX_SPOOL_IN) )
	test -d $(FAX_SPOOL_OUT) || \
		( mkdir $(FAX_SPOOL_OUT) ; chmod 1777 $(FAX_SPOOL_OUT) )
#
# g3 tool programs
#
	cd tools ; $(MAKE) install INSTALL="$(INSTALL)" \
				BINDIR=$(BINDIR) LIBDIR=$(LIBDIR)
#
# fax programs / scripts / font file
#
	cd fax ; $(MAKE) install INSTALL="$(INSTALL)" \
				 BINDIR=$(BINDIR) LIBDIR=$(LIBDIR)
#
# compatibility
#
	if [ ! -z "$(INSTALL_MECHO)" ] ; then \
	    cd compat ; \
	    gcc -o mg.echo mg.echo.c && \
	    $(INSTALL) -s -m 755 mg.echo $(BINDIR) ; \
	fi
#
# documentation
#
	cd doc ; $(MAKE) install INSTALL="$(INSTALL)" \
				MAN1DIR=$(MAN1DIR) \
				MAN4DIR=$(MAN4DIR) \
				MAN5DIR=$(MAN5DIR) \
				MAN8DIR=$(MAN8DIR) \
				INFODIR=$(INFODIR)

#
# voice extensions, consult the `voice' chapter in the documentation
#

vgetty:
	@$(MAKE) mgetty
	cd voice; $(MAKE) CFLAGS="$(CFLAGS)" CC="$(CC)" LDFLAGS="$(LDFLAGS)" \
	LN="$(LN)" ZYXEL_ROM=$(ZYXEL_ROM) VOICE_DIR="$(VOICE_DIR)" \
	vgetty-all

vgetty-install: sedscript
	cd voice; $(MAKE) CFLAGS="$(CFLAGS)" CC="$(CC)" LDFLAGS="$(LDFLAGS)" \
	BINDIR="$(BINDIR)" SBINDIR="$(SBINDIR)" LIBDIR="$(LIBDIR)" \
	MAN1DIR="$(MAN1DIR)" INSTALL="$(INSTALL)" \
	PHONE_GROUP="$(PHONE_GROUP)" PHONE_PERMS="$(PHONE_PERMS)" \
	LN="$(LN)" ZYXEL_ROM=$(ZYXEL_ROM) VOICE_DIR="$(VOICE_DIR)" \
	vgetty-install

######## anything below this line was generated by gcc -MM *.c
cnd.o : cnd.c syslibs.h policy.h mgetty.h ugly.h 
config.o : config.c syslibs.h mgetty.h ugly.h config.h 
do_chat.o : do_chat.c syslibs.h mgetty.h ugly.h policy.h tio.h 
faxhng.o : faxhng.c mgetty.h ugly.h 
faxlib.o : faxlib.c mgetty.h ugly.h policy.h fax_lib.h 
faxrec.o : faxrec.c syslibs.h mgetty.h ugly.h tio.h policy.h fax_lib.h 
faxsend.o : faxsend.c syslibs.h mgetty.h ugly.h tio.h policy.h fax_lib.h 
files.o : files.c mgetty.h ugly.h policy.h 
getdisk.o : getdisk.c policy.h mgetty.h ugly.h 
gettydefs.o : gettydefs.c syslibs.h mgetty.h ugly.h policy.h 
goodies.o : goodies.c syslibs.h mgetty.h ugly.h 
io.o : io.c syslibs.h mgetty.h ugly.h 
locks.o : locks.c mgetty.h ugly.h policy.h 
logfile.o : logfile.c mgetty.h ugly.h policy.h 
login.o : login.c mgetty.h ugly.h config.h policy.h mg_utmp.h 
logname.o : logname.c syslibs.h mgetty.h ugly.h policy.h tio.h mg_utmp.h 
mg_m_init.o : mg_m_init.c syslibs.h mgetty.h ugly.h tio.h policy.h fax_lib.h 
mgetty.o : mgetty.c syslibs.h mgetty.h ugly.h policy.h tio.h mg_utmp.h 
mksed.o : mksed.c mgetty.h ugly.h policy.h 
sendfax.o : sendfax.c syslibs.h mgetty.h ugly.h tio.h policy.h fax_lib.h 
tio.o : tio.c mgetty.h ugly.h tio.h 
utmp.o : utmp.c mgetty.h ugly.h mg_utmp.h 

----------------------------------------------------------------------


