1 /* @(#) $Id: setup-shared.c,v 1.3 2009/06/24 18:53:10 dcid Exp $ */
3 /* Copyright (C) 2009 Trend Micro Inc.
6 * This program is a free software; you can redistribute it
7 * and/or modify it under the terms of the GNU General Public
8 * License (version 3) as published by the FSF - Free Software
17 #include <sys/types.h>
21 #include "os_regex/os_regex.h"
23 #define OSSECCONF "ossec.conf"
24 #define OS_MAXSTR 1024
27 /* Checks if a file exist. */
28 int fileexist(char *file)
33 fp = fopen(file, "r");
42 /* Grep for a string in a file. */
43 int dogrep(char *file, char *str)
45 char line[OS_MAXSTR +1];
49 fp = fopen(file, "r");
54 memset(line, '\0', OS_MAXSTR +1);
56 /* Reading file and looking for str */
57 while(fgets(line, OS_MAXSTR, fp) != NULL)
59 if(OS_Match(str, line))
71 /* Check if dir exists */
72 int direxist(char *dir)
86 /* Get Windows main directory */
87 void get_win_dir(char *file, int f_size)
89 ExpandEnvironmentStrings("%WINDIR%", file, f_size);
93 strncpy(file, "C:\\WINDOWS", f_size);