Revert "Imported Upstream version 7.44.0"
[platform/upstream/curl.git] / src / tool_parsecfg.c
index 39b43ee..c5d390b 100644 (file)
@@ -5,7 +5,7 @@
  *                            | (__| |_| |  _ <| |___
  *                             \___|\___/|_| \_\_____|
  *
- * Copyright (C) 1998 - 2015, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2014, Daniel Stenberg, <daniel@haxx.se>, et al.
  *
  * This software is licensed as described in the file COPYING, which
  * you should have received as part of this distribution. The terms
@@ -69,7 +69,7 @@ int parseconfig(const char *filename, struct GlobalConfig *global)
         /* Check if the file exists - if not, try CURLRC in the same
          * directory as our executable
          */
-        file = fopen(filebuffer, FOPEN_READTEXT);
+        file = fopen(filebuffer, "r");
         if(file != NULL) {
           fclose(file);
           filename = filebuffer;
@@ -114,8 +114,8 @@ int parseconfig(const char *filename, struct GlobalConfig *global)
 #endif
   }
 
-  if(strcmp(filename, "-"))
-    file = fopen(filename, FOPEN_READTEXT);
+  if(strcmp(filename,"-"))
+    file = fopen(filename, "r");
   else
     file = stdin;
 
@@ -187,27 +187,24 @@ int parseconfig(const char *filename, struct GlobalConfig *global)
         param = line; /* parameter starts here */
         while(*line && !ISSPACE(*line))
           line++;
+        *line = '\0'; /* zero terminate */
 
-        if(*line) {
-          *line = '\0'; /* zero terminate */
-
-          /* to detect mistakes better, see if there's data following */
+        /* to detect mistakes better, see if there's data following */
+        line++;
+        /* pass all spaces */
+        while(*line && ISSPACE(*line))
           line++;
-          /* pass all spaces */
-          while(*line && ISSPACE(*line))
-            line++;
-
-          switch(*line) {
-          case '\0':
-          case '\r':
-          case '\n':
-          case '#': /* comment */
-            break;
-          default:
-            warnf(operation->global, "%s:%d: warning: '%s' uses unquoted "
-                  "white space in the line that may cause side-effects!\n",
-                  filename, lineno, option);
-          }
+
+        switch(*line) {
+        case '\0':
+        case '\r':
+        case '\n':
+        case '#': /* comment */
+          break;
+        default:
+          warnf(operation, "%s:%d: warning: '%s' uses unquoted white space in"
+                " the line that may cause side-effects!\n",
+                filename, lineno, option);
         }
       }
 
@@ -264,7 +261,7 @@ int parseconfig(const char *filename, struct GlobalConfig *global)
            res != PARAM_VERSION_INFO_REQUESTED &&
            res != PARAM_ENGINES_REQUESTED) {
           const char *reason = param2text(res);
-          warnf(operation->global, "%s:%d: warning: '%s' %s\n",
+          warnf(operation, "%s:%d: warning: '%s' %s\n",
                 filename, lineno, option, reason);
         }
       }