Revert "Update to 7.40.1"
[platform/upstream/curl.git] / docs / examples / sepheaders.c
index 7402e35..63ea993 100644 (file)
@@ -5,7 +5,7 @@
  *                            | (__| |_| |  _ <| |___
  *                             \___|\___/|_| \_\_____|
  *
- * Copyright (C) 1998 - 2014, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2011, 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
@@ -53,26 +53,23 @@ int main(void)
   /* send all data to this function  */
   curl_easy_setopt(curl_handle, CURLOPT_WRITEFUNCTION, write_data);
 
-  /* open the header file */
-  headerfile = fopen(headerfilename, "wb");
-  if(!headerfile) {
+  /* open the files */
+  headerfile = fopen(headerfilename,"wb");
+  if (headerfile == NULL) {
     curl_easy_cleanup(curl_handle);
     return -1;
   }
-
-  /* open the body file */
-  bodyfile = fopen(bodyfilename, "wb");
-  if(!bodyfile) {
+  bodyfile = fopen(bodyfilename,"wb");
+  if (bodyfile == NULL) {
     curl_easy_cleanup(curl_handle);
-    fclose(headerfile);
     return -1;
   }
 
   /* we want the headers be written to this file handle */
-  curl_easy_setopt(curl_handle, CURLOPT_HEADERDATA, headerfile);
+  curl_easy_setopt(curl_handle,   CURLOPT_HEADERDATA, headerfile);
 
   /* we want the body be written to this file handle instead of stdout */
-  curl_easy_setopt(curl_handle, CURLOPT_WRITEDATA, bodyfile);
+  curl_easy_setopt(curl_handle,   CURLOPT_WRITEDATA, bodyfile);
 
   /* get it! */
   curl_easy_perform(curl_handle);