aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGisle Vanem <gvanem@yahoo.no>2013-10-24 15:21:16 +0200
committerDaniel Stenberg <daniel@haxx.se>2013-10-27 15:48:57 +0100
commit6fe619be7a5e6c04b8f558f07de48ecffcb21c64 (patch)
treebae3bb27113e15207a5db3b065ca9a2fac6971b7
parent1e39b95682781fd9117eef094f6fd8c58b443610 (diff)
docs/examples/httpput.c: fix build for MSVC
"Dan Fandrich" <dan@coneharvesters.com> wrote: >> But I'm not sure <unistd.h> is needed at all. > > It's needed for close(2). But the only reason that's needed is because fstat > is used instead of stat(2); if you fix that, then you could remove that > include altogether. Okay. I've tested the following with MSVC and MingW. htttput.c now simply uses stat():
-rw-r--r--docs/examples/httpput.c7
1 files changed, 1 insertions, 6 deletions
diff --git a/docs/examples/httpput.c b/docs/examples/httpput.c
index fbbca9448..2e9dc2170 100644
--- a/docs/examples/httpput.c
+++ b/docs/examples/httpput.c
@@ -22,8 +22,6 @@
#include <stdio.h>
#include <fcntl.h>
#include <sys/stat.h>
-#include <unistd.h>
-
#include <curl/curl.h>
/*
@@ -59,7 +57,6 @@ int main(int argc, char **argv)
CURL *curl;
CURLcode res;
FILE * hd_src ;
- int hd ;
struct stat file_info;
char *file;
@@ -72,9 +69,7 @@ int main(int argc, char **argv)
url = argv[2];
/* get the file size of the local file */
- hd = open(file, O_RDONLY) ;
- fstat(hd, &file_info);
- close(hd) ;
+ stat(file, &file_info);
/* get a FILE * of the same file, could also be made with
fdopen() from the previous descriptor, but hey this is just