new upstream release (3.3.0); modify package compatibility for Stretch
[ossec-hids.git] / src / win32 / setup-shared.c
old mode 100755 (executable)
new mode 100644 (file)
index 8b450ae..01b36e5
@@ -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 <stdio.h>
 #include <stdlib.h>
 #include <string.h>
 #include <dirent.h>
 #include <time.h>
 #include <windows.h>
+
 #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 */