/*
 * W-NEWS       A simple NEWS processing package.
 *		libwnews.h - definitions for the wnews library
 *
 * Version:     @(#)libwnews.h     4.50    03-Feb-1995
 *
 * Authors:	Edvard Tuinder, <ed@ow.org>
 *		Miquel van Smoorenburg, <miquels@drinkel.ow.org>
 *              Copyright 1988-1993 MicroWalt Corporation
 *		Copyright 1994,1995 Cistron Software C.V.
 *
 *              This program is free software; you can redistribute it and/or
 *              modify it under the terms of the GNU General Public License
 *              as published by the Free Software Foundation; either version
 *              2 of the License, or (at your option) any later version.
 */
#include "wnews.h"
#include "wtypes.h"


#ifndef FALSE
#   define FALSE	0
#endif
#ifndef TRUE
#   define TRUE		1
#endif

#define ERROR		-1
#define OK		0

#define SLEEP_TIME	6	/* Time between lock tries */
#define MAXTRY		10	/* Number of lock tries */

#define MAKE_LOCK	0
#define REMOVE_LOCK	1
#define NO_LOCK		2

#define LOGINFO		001
#define LOGERR		002
#define LOGSYS		004

#define NILSYS		(SYS *)NULL


#ifndef _PRO
#   ifdef __STDC__
#	define _PRO(func, args)	func args
#   else
#	define _PRO(func, args)	func ()
#   endif /* __STDC__ */
#endif /* ! _PRO */

/* Global variables. */
extern SYS *sys;		/* Pointer to the in-core sys file */
extern int debug;		/* Turn debug on and off */
#if HAVE_LONGACT
extern int have_longact;	/* 5 o 10 digit active file. */
#endif

/* Prototypes */

/* active.c */
_PRO( ACT *next_group, (void)						);
_PRO( ACT *get_group, (char *group, int lock)				);
_PRO( int testgroup, (char *group)					);
_PRO( void act_upd, (ACT *a)						);
_PRO( void act_close, (void)						);
_PRO( void act_lock, (void)						);
_PRO( void act_unlock, (void)						);
_PRO( ACT *act_rd, (void)						);

/* moderate.c */
_PRO( int check_group, (char *group, char *artname, char *approved)	);

/* syscall.c */
_PRO( int wsystem, (char *cmd)						);
_PRO( void wexec, (char *cmd, int sh_ok)					);
_PRO( int wspawn, (char *cmd, char *in, char *out)			);
_PRO( FILE *wpopen, (char *cmd, char *mode)				);
_PRO( int wpclose, (FILE *fp)						);
_PRO( int wunlink, (char *file)						);
_PRO( int wchmod, (char *file, mode_t mode)				);
_PRO( int wmkdir, (char *dir, mode_t mode)				);
_PRO( int wrmdir, (char *dir)						);

/* history.c */
_PRO( void hist_init, (char *fname)					);
_PRO( void hist_close, (void)						);
_PRO( void hist_add, (char *msgid, char *name, unsigned int artno,
			time_t time, int dbmonly)			);
_PRO( int hist_chk, (char *msgid)					);
_PRO( void hist_del, (char *msgid, char *name, unsigned int artno)	);
_PRO( void hist_print, (char *msgid, char *data, int len, FILE *fp)	);

/* xtime.c */
_PRO( char *xtime, (time_t *salt)					);

/* util.c */
_PRO( char *gtof, (char *)						);
_PRO( int strnicmp, (char *s1, char *s2, int len)			);
_PRO( int any, (char *s1, char *s2)					);
_PRO( char *strsave, (char *s)						);
_PRO( long free_space, (char *dir)					);
_PRO( int wmkspooldir, (char *name, int isgroup)			);
_PRO( time_t wmktime, (struct tm *timeptr)				);

/* sys.c */
_PRO( int sys_rd, (void)						);
_PRO( int mod_match, (char *name, char *list)				);
_PRO( int group_match, (char *name, char *list)				);
_PRO( int ngmatch, (SYS *sysent, char *dist, char *groups)		);

/* logmsg.c */
_PRO( void log_open, (void)						);
_PRO( void log_close, (void)						);
#if defined(USE_STDARG) || defined(USE_VARARGS)
_PRO( void logmsg, (int level, char *msg, ...)				);
#else
_PRO( void logmsg, (int level, char *msg)				);
#endif

/* lock.c */
_PRO( int wlock, (char *path, int fd)					);
_PRO( void wunlock, (char *path, int fd)				);

/* packers.c */
_PRO( char *p_uncomp, (char *hdr)					);
_PRO( char *p_comp, (char *name)					);
_PRO( int p_ratio, (char *name)						);
_PRO( char *p_header, (char *name)					);

/* hostname.c */
_PRO( char *hostname, (void)						);

/* DON'T ADD ANYTING AFTER THIS LINE !!!!!!! */
