-/* $OpenBSD: distopt.c,v 1.11 2009/10/27 23:59:42 deraadt Exp $ */
+/* $OpenBSD: distopt.c,v 1.12 2015/01/20 06:02:30 guenther Exp $ */
/*
* Copyright (c) 1983 Regents of the University of California.
/*
* Distfile Option Information
*/
-DISTOPTINFO distoptinfo[] = {
+struct distoptinfo {
+ opt_t do_value;
+ char *do_name;
+ char *do_arg;
+ size_t arg_size;
+} distoptinfo[] = {
{ DO_CHKNFS, "chknfs", NULL, 0},
{ DO_CHKREADONLY, "chkreadonly", NULL, 0},
{ DO_CHKSYM, "chksym", NULL, 0},
/*
* Get a Distfile Option entry named "name".
*/
-DISTOPTINFO *
+static struct distoptinfo *
getdistopt(char *name, int *len)
{
int i;
parsedistopts(char *str, opt_t *optptr, int doerrs)
{
char *string, *optstr;
- DISTOPTINFO *distopt;
+ struct distoptinfo *distopt;
int len;
/* strtok() is destructive */
-/* $OpenBSD: message.c,v 1.23 2015/01/20 03:14:52 guenther Exp $ */
+/* $OpenBSD: message.c,v 1.24 2015/01/20 06:02:30 guenther Exp $ */
/*
* Copyright (c) 1983 Regents of the University of California.
/*
* Message Types
*/
-MSGTYPE msgtypes[] = {
+struct msgtype {
+ int mt_type; /* Type (bit) */
+ char *mt_name; /* Name of message type */
+} msgtypes[] = {
{ MT_CHANGE, "change" },
{ MT_INFO, "info" },
{ MT_NOTICE, "notice" },
{ 0 },
};
-static void msgsendstdout(MSGFACILITY *, int, int, char *);
-static void msgsendsyslog(MSGFACILITY *, int, int, char *);
-static void msgsendfile(MSGFACILITY *, int, int, char *);
-static void msgsendnotify(MSGFACILITY *, int, int, char *);
+/*
+ * Description of message facilities
+ */
+struct msgfacility {
+ /* compile time initialized data */
+ int mf_msgfac; /* One of MF_* from below */
+ char *mf_name; /* Name of this facility */
+ void (*mf_sendfunc) /* Function to send msg */
+ (struct msgfacility *, int, int, char *);
+ /* run time initialized data */
+ int mf_msgtypes; /* Bitmask of MT_* from above*/
+ char *mf_filename; /* Name of file */
+ FILE *mf_fptr; /* File pointer to output to */
+};
+
+static void msgsendstdout(struct msgfacility *, int, int, char *);
+static void msgsendsyslog(struct msgfacility *, int, int, char *);
+static void msgsendfile(struct msgfacility *, int, int, char *);
+static void msgsendnotify(struct msgfacility *, int, int, char *);
/*
* Message Facilities
*/
-MSGFACILITY msgfacility[] = {
+struct msgfacility msgfacility[] = {
{ MF_STDOUT, "stdout", msgsendstdout },
{ MF_FILE, "file", msgsendfile },
{ MF_SYSLOG, "syslog", msgsendsyslog },
{ 0 },
};
-static MSGFACILITY *getmsgfac(char *);
-static MSGTYPE *getmsgtype(char *);
-static char *setmsgtypes(MSGFACILITY *, char *);
+static struct msgfacility *getmsgfac(char *);
+static struct msgtype *getmsgtype(char *);
+static char *setmsgtypes(struct msgfacility *, char *);
static void _message(int, char *);
static void _debugmsg(int, char *);
static void _error(const char *);
/*
* Get the Message Facility entry "name"
*/
-static MSGFACILITY *
+static struct msgfacility *
getmsgfac(char *name)
{
int i;
/*
* Get the Message Type entry named "name"
*/
-static MSGTYPE *
+static struct msgtype *
getmsgtype(char *name)
{
int i;
* indicated by string "str".
*/
static char *
-setmsgtypes(MSGFACILITY *msgfac, char *str)
+setmsgtypes(struct msgfacility *msgfac, char *str)
{
static char ebuf[BUFSIZ];
char *cp;
char *strptr, *word;
- MSGTYPE *mtp;
+ struct msgtype *mtp;
/*
* MF_SYSLOG is the only supported message facility for the server
static char ebuf[BUFSIZ], msgbuf[MSGBUFSIZ];
char *cp, *optstr;
char *word;
- MSGFACILITY *msgfac;
+ struct msgfacility *msgfac;
if (msgstr == NULL)
return("NULL message string");
* For rdistd, this is really the rdist client.
*/
static void
-msgsendstdout(MSGFACILITY *msgfac, int mtype, int flags, char *msgbuf)
+msgsendstdout(struct msgfacility *msgfac, int mtype, int flags, char *msgbuf)
{
char cmd;
* Send a message to facility "syslog"
*/
static void
-msgsendsyslog(MSGFACILITY *msgfac, int mtype, int flags, char *msgbuf)
+msgsendsyslog(struct msgfacility *msgfac, int mtype, int flags, char *msgbuf)
{
int syslvl = 0;
* Send a message to a "file" facility.
*/
static void
-msgsendfile(MSGFACILITY *msgfac, int mtype, int flags, char *msgbuf)
+msgsendfile(struct msgfacility *msgfac, int mtype, int flags, char *msgbuf)
{
if (msgfac->mf_fptr == NULL)
return;
* Same method as msgsendfile()
*/
static void
-msgsendnotify(MSGFACILITY *msgfac, int mtype, int flags, char *msgbuf)
+msgsendnotify(struct msgfacility *msgfac, int mtype, int flags, char *msgbuf)
{
char *tempfile;
-/* $OpenBSD: types.h,v 1.5 2003/05/14 01:34:35 millert Exp $ */
+/* $OpenBSD: types.h,v 1.6 2015/01/20 06:02:30 guenther Exp $ */
#ifndef __myTYPES_H__
#define __myTYPES_H__
#define DO_DEFOWNER 0x0800000
#define DO_SPARSE 0x1000000 /* XXX not implemented */
-/*
- * Dist option information
- */
typedef long opt_t;
-struct _distoptinfo {
- opt_t do_value;
- char *do_name;
- char *do_arg;
- size_t arg_size;
-};
-typedef struct _distoptinfo DISTOPTINFO;
/* Debug Message types */
#define DM_CALL 0x01
#define DM_MISC 0x10
#define DM_ALL 0x17
-/*
- * Description of a message type
- */
-struct _msgtype {
- int mt_type; /* Type (bit) */
- char *mt_name; /* Name of message type */
-};
-typedef struct _msgtype MSGTYPE;
-
/*
* Message Type definitions
*/
MT_INFO|MT_NOTICE|\
MT_SYSLOG|MT_VERBOSE)
-/*
- * Description of message facilities
- */
-typedef struct _msgfacility MSGFACILITY;
-
-struct _msgfacility {
- /* compile time initialized data */
- int mf_msgfac; /* One of MF_* from below */
- char *mf_name; /* Name of this facility */
- void (*mf_sendfunc) /* Function to send msg */
- (MSGFACILITY *, int, int, char *);
- /* run time initialized data */
- int mf_msgtypes; /* Bitmask of MT_* from above*/
- char *mf_filename; /* Name of file */
- FILE *mf_fptr; /* File pointer to output to */
-};
-
/*
* Message Facilities
*/