ftp.nice.ch/pub/next/tools/ups/upsdeamon.N.bs.tar.gz#/upsd/ups_folder/common.h

This is common.h in view mode; [Download] [Up]

/*
**	c o m m o n . h
**
**	common header file for UPS monitor daemon
**
**	Arthur W. Neilson III
**	art@pilikia.pegasus.com
**	Sat Mar 30 1991
*/

#include <stdio.h>
#include <string.h>
#include <fcntl.h>
#include <time.h>
/*
#include <std.h>
*/
#include <sys/types.h>
#include <sys/tty.h>
#include <sys/signal.h>
#include <sys/stat.h>

#include "version.h"

#define ERR		-1		/* error return value */
#define SH		"/bin/sh"	/* shell to exec shutdown command */
#define WALL		"/bin/wall"	/* utility to broadcast messages */
#define CONSOLE		"/dev/console"	/* console device */
#define ROOT		"/"		/* root directory for chdir */
#define SECS_PER_MIN	60		/* number of secs in a minute */
#define MAX_TIME	30		/* maximum delay time allowed */
#define LOG_PERMS	0600		/* logfile permissions on create */
#define LOG_FLAGS	O_WRONLY | O_APPEND	/* logfile open flags */

/* default tuneable parameter values */
#define UPS_PORT	"/dev/cub"	/* UPS port device name */
#define UPS_SHUT	"/etc/UPS/upsdown.csh"	/* shutdown command */
#define UPS_LOG		"./upslog"	/* UPS log file pathname */
#define UPS_FAIL	"./upsfail"     /* UPS fail message file name */
#define UPS_REST	"./upsrest"     /* UPS restore message file name */
#define UPS_TIME	1		/* default delay time (minutes) */
#define UPS_INTERVAL	10		/* poll interval time (seconds) */

/* environment variable names */
#define UPSPORT		"UPSPORT"
#define UPSSHUT		"UPSSHUT"
#define UPSLOG		"UPSLOG"
#define UPSFAIL		"UPSFAIL"
#define UPSREST		"UPSREST"
#define UPSTIME		"UPSTIME"

/* UPS log messages */
#define START_MSG	"UPS daemon started"
#define OPEN_MSG	"Error opening UPS port"
#define BATTERY_MSG	"UPS switch to battery backup"
#define ONLINE_MSG	"UPS switch to online power"
#define SHUTDOWN_MSG	"Shutdown command executed"
#define TERM_MSG	"Caught termination signal"

/* common globals */
extern char	*ups_port;		/* UPS device name */
extern char	*ups_shut;		/* system shutdown command */
extern char	*ups_log;		/* UPS log file name */
extern char	*ups_fail;		/* UPS failure message file name */
extern char	*ups_rest;		/* UPS restore message file name */
extern int	ups_time;		/* delay time before shutdown */
extern int	ups_fd;			/* UPS port descriptor */
extern int	log_fd;			/* log file descriptor */
extern int	interval;
extern int	state;			/* state of ups */

#define UPS_LINE	0
#define UPS_BATTERY	1	

These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.