1 /* 2 * retail - a logfile monitoring utility 3 * 4 * Copyright (C) Y2K (2000) A.L.Lambert 5 * 6 * This program is free software; you can redistribute it and/or modify 7 * it under the terms of the GNU General Public License as published by 8 * the Free Software Foundation; either version 2, or (at your option) 9 * any later version. 10 * 11 * This program is distributed in the hope that it will be useful, 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 * GNU General Public License for more details. 15 * 16 * You should have received a copy of the GNU General Public License 17 * along with this program; if not, write to the Free Software 18 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 19 */ 20 21 /* global variables */ 22 extern short int retval; /* what value do we return at the end of all this */ 23 extern short int debug; /* do we go into debug mode? (developer test only */ 24 extern FILE *in_file; /* the files we'll be reading for input */ 25 extern FILE *in_stat; /* the file we're using to store our place in in_file */ 26 extern char *st_filename; /* the var we store the name of the offset file */ 27 28 extern char **files; /* an array of all the file's we'll be opening */ 29 extern char *suffix; /* suffix of the file we open to store stats in */ 30 extern char *prefix; /* prefix directory for where we put stats files */ 31 32 /* structure for our info on the file */ 33 typedef struct { 34 long int ipos; /* last position as an int */ 35 char apos[64]; /* last position in ascii */ 36 char *last_line; /* last known line in the file */ 37 } FILE_STAT; 38 39 extern FILE_STAT f; 40 41 /* our local functions */ 42 int proc_args(int argc, char **argv); 43 int open_infile(char *fname); 44 int open_stfile(char *fname); 45 int read_stfile(); 46 int read_infile(); 47 int write_stfile(); 48 int close_files(); 49 int local_cleanup(); 50