1 /* @(#) $Id: ./src/win32/setup-shared.c, 2011/09/08 dcid Exp $
4 /* Copyright (C) 2009 Trend Micro Inc.
7 * This program is a free software; you can redistribute it
8 * and/or modify it under the terms of the GNU General Public
9 * License (version 2) as published by the FSF - Free Software
18 #include <sys/types.h>
22 #include "os_regex/os_regex.h"
24 #define OSSECCONF "ossec.conf"
25 #define OS_MAXSTR 1024
28 /* Checks if a file exist. */
29 int fileexist(char *file)
34 fp = fopen(file, "r");
43 /* Grep for a string in a file. */
44 int dogrep(char *file, char *str)
46 char line[OS_MAXSTR +1];
50 fp = fopen(file, "r");
55 memset(line, '\0', OS_MAXSTR +1);
57 /* Reading file and looking for str */
58 while(fgets(line, OS_MAXSTR, fp) != NULL)
60 if(OS_Match(str, line))
72 /* Check if dir exists */
73 int direxist(char *dir)
87 /* Get Windows main directory */
88 void get_win_dir(char *file, int f_size)
90 ExpandEnvironmentStrings("%WINDIR%", file, f_size);
94 strncpy(file, "C:\\WINDOWS", f_size);