X-Git-Url: http://ftp.carnet.hr/carnet-debian/scm?a=blobdiff_plain;ds=sidebyside;f=src%2Fwin32%2Fsetup-shared.c;fp=src%2Fwin32%2Fsetup-shared.c;h=01b36e506801a88f9ac455269bccfc4e0cb81fa4;hb=3f728675941dc69d4e544d3a880a56240a6e394a;hp=8b450ae6a05be7f6940c67f3113ad077aea98e23;hpb=927951d1c1ad45ba9e7325f07d996154a91c911b;p=ossec-hids.git diff --git a/src/win32/setup-shared.c b/src/win32/setup-shared.c old mode 100755 new mode 100644 index 8b450ae..01b36e5 --- a/src/win32/setup-shared.c +++ b/src/win32/setup-shared.c @@ -1,6 +1,3 @@ -/* @(#) $Id: ./src/win32/setup-shared.c, 2011/09/08 dcid Exp $ - */ - /* Copyright (C) 2009 Trend Micro Inc. * All rights reserved. * @@ -10,7 +7,6 @@ * Foundation */ - #include #include #include @@ -19,81 +15,76 @@ #include #include #include + #include "os_regex/os_regex.h" #define OSSECCONF "ossec.conf" #define OS_MAXSTR 1024 -/* Checks if a file exist. */ +/* Check if a file exists */ int fileexist(char *file) { FILE *fp; - /* Opening file */ + /* Open file */ fp = fopen(file, "r"); - if(!fp) - return(0); + if (!fp) { + return (0); + } fclose(fp); - return(1); + return (1); } - -/* Grep for a string in a file. */ +/* Grep for a string in a file */ int dogrep(char *file, char *str) { - char line[OS_MAXSTR +1]; + char line[OS_MAXSTR + 1]; FILE *fp; - /* Opening file */ + /* Open file */ fp = fopen(file, "r"); - if(!fp) - return(0); + if (!fp) { + return (0); + } - /* Clearing memory */ - memset(line, '\0', OS_MAXSTR +1); + /* Clear memory */ + memset(line, '\0', OS_MAXSTR + 1); - /* Reading file and looking for str */ - while(fgets(line, OS_MAXSTR, fp) != NULL) - { - if(OS_Match(str, line)) - { + /* Read file and look for str */ + while (fgets(line, OS_MAXSTR, fp) != NULL) { + if (OS_Match(str, line)) { fclose(fp); - return(1); + return (1); } } fclose(fp); - return(0); + return (0); } - /* Check if dir exists */ int direxist(char *dir) { DIR *dp; - /* Opening dir */ + /* Open dir */ dp = opendir(dir); - if(dp == NULL) - return(0); + if (dp == NULL) { + return (0); + } closedir(dp); - return(1); + return (1); } - /* Get Windows main directory */ void get_win_dir(char *file, int f_size) { ExpandEnvironmentStrings("%WINDIR%", file, f_size); - if(!direxist(file)) - { + if (!direxist(file)) { strncpy(file, "C:\\WINDOWS", f_size); } } - - -/* EOF */