/*//////
//
// header for wsng.c package
//
*/

#ifndef _WSNG_H_
#define _WSNG_H_

#include	<stdio.h>
#include	<stdlib.h>
#include	<strings.h>
#include	<string.h>
#include	<netdb.h>
#include	<errno.h>
#include	<unistd.h>
#include	<sys/types.h>
#include	<sys/stat.h>
#include	<sys/param.h>
#include	<sys/time.h>
#include	<sys/wait.h>
#include        <time.h>
#include	<signal.h>
#include        <dirent.h>
#include        <unistd.h>
#include	"socklib.h"
#include	"varlib.h"

#define	oops(m,x)	{ perror(m); exit(x); }

/*
// prototypes
*/

void    initAlarm();
void    initVarTable();
void    initExtTable();
int	initSocket(int, char *a[], char [], int *);
int     getLine(char *buffer, FILE *input_stream);
void    set_ticker( int n_msecs );
void    killZombies();
void	read_til_crnl(FILE *);
void    extractQuery(char *item);
void	process_rq( char *rq, FILE *fp);
char	*modify_argument(char *arg, int len);
void    header( FILE *fp, char *content_type, char *resultStr );
void	cannot_do(FILE *fp);
void    do_403(FILE *fp, int cmdType);
void	do_404(char *item, FILE *fp, int cmdType);
void	do_cat(char *f, FILE *fpsock, int cmdType);
void	do_exec( char *prog, FILE *fp, int cmdType);
void	do_ls(char *dir, FILE *fp, int cmdType);
char    *readTable(char *str);
int	isadir(char *f);
int	not_exist(char *f);
int     usrRead(char *f);
int	ends_in_cgi(char *f);
char 	*file_type(char *f);
char    *rfc822_time(time_t thetime);
void    fatal(char *errStr);

struct fileTypes {char extension[BUFSIZ]; 
                  char fileType[BUFSIZ]; };

#endif /* _WSNG_ */
