summaryrefslogtreecommitdiff
path: root/examples/network/index-pack.c
diff options
context:
space:
mode:
authorEdward Thomson <ethomson@edwardthomson.com>2013-01-23 17:38:00 -0600
committerEdward Thomson <ethomson@edwardthomson.com>2013-01-23 17:38:00 -0600
commitc27e211219574324ef9eaf7980b04e5e08189169 (patch)
treeeefc9714fbc603383a438458a3c280905ae81444 /examples/network/index-pack.c
parent0d52cb4aea2e0af1b8a4a8557e26c9edf85c96db (diff)
downloadlibgit2-c27e211219574324ef9eaf7980b04e5e08189169.tar.gz
update examples to work on windows
Diffstat (limited to 'examples/network/index-pack.c')
-rw-r--r--examples/network/index-pack.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/examples/network/index-pack.c b/examples/network/index-pack.c
index 4d3dc84d6..3fc4f3288 100644
--- a/examples/network/index-pack.c
+++ b/examples/network/index-pack.c
@@ -5,7 +5,18 @@
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
-#include <unistd.h>
+#ifdef _WIN32
+# include <io.h>
+# include <Windows.h>
+
+# define open _open
+# define read _read
+# define close _close
+
+#define ssize_t unsigned int
+#else
+# include <unistd.h>
+#endif
#include "common.h"
// This could be run in the main loop whilst the application waits for
@@ -22,8 +33,9 @@ int index_pack(git_repository *repo, int argc, char **argv)
{
git_indexer_stream *idx;
git_transfer_progress stats = {0, 0};
- int error, fd;
+ int error;
char hash[GIT_OID_HEXSZ + 1] = {0};
+ int fd;
ssize_t read_bytes;
char buf[512];