Advertisement
Guest User

Untitled

a guest
Jun 26th, 2011
716
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 0.80 KB | None | 0 0
  1. --- unowfs.c    2011-06-26 19:10:44 -0300
  2. +++ unowfs_new.c    2011-06-26 19:50:53 -0300
  3. @@ -1,7 +1,10 @@
  4.  /*
  5.   * Utility to extract files from OWFS file system images.
  6.   *
  7. + * On Unix
  8.   * $ gcc -Wall unowfs.c -o unowfs
  9. + * On Windows
  10. + * $ gcc -Wall unowfs.c -lws2_32 -o unowfs.exe
  11.   *
  12.   * Craig Heffner, 20 June 2011
  13.   * http://www.devttys0.com
  14. @@ -15,7 +18,12 @@
  15.  #include <unistd.h>
  16.  #include <sys/stat.h>
  17.  #include <sys/types.h>
  18. +#ifdef UNIX
  19.  #include <arpa/inet.h>
  20. +#endif
  21. +#ifdef _WIN32
  22. +#include <winsock2.h>
  23. +#endif
  24.  
  25.  #define MAGIC "owowowowowowowowowowowowowowowow"
  26.  #define MAGIC_SIZE 32
  27. @@ -79,7 +87,11 @@
  28.         goto end;
  29.     }
  30.  
  31. +#ifdef UNIX
  32.     if(mkdir(dir, (S_IRWXU | S_IRWXG | S_IRWXO)) < 0)
  33. +#elseif defined _WIN32
  34. +   if(mkdir(dir) < 0)
  35. +#endif
  36.     {
  37.         perror(dir);
  38.         goto end;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement