some mingw fixes

Thu, 03 Aug 2017 10:37:52 +0200

author
Olaf Wintermann <olaf.wintermann@gmail.com>
date
Thu, 03 Aug 2017 10:37:52 +0200
changeset 267
171498cb2137
parent 266
8c44c5919691
child 268
2610eecfc5e5

some mingw fixes

fflush after printf's in assistant.c
avoid redefinition of file mode macros
correct include order for winsucks2.h

dav/assistant.c file | annotate | diff | comparison | revisions
libidav/crypto.c file | annotate | diff | comparison | revisions
libidav/utils.h file | annotate | diff | comparison | revisions
--- a/dav/assistant.c	Tue Jul 11 20:45:32 2017 +0200
+++ b/dav/assistant.c	Thu Aug 03 10:37:52 2017 +0200
@@ -41,6 +41,7 @@
     char *value = NULL;
     while(!value) {
         printf("%s: ", cfgname);
+        fflush(stdout);
         line = util_readline(stdin);
         if(line.length == 0 || !line.ptr) {
             fprintf(stderr, "%s must be not empty\n", cfgname);
@@ -58,6 +59,7 @@
     char *value = NULL;
     while(!value) {
         printf("%s (optional): ", cfgname);
+        fflush(stdout);
         line = util_readline(stdin);
         if(line.length == 0 || !line.ptr) {
             if(line.ptr) {
@@ -74,6 +76,7 @@
 
 char* assistant_gethiddenoptcfg(char *cfgname) {
     printf("%s (optional): ", cfgname);
+    fflush(stdout);
     char *pw = util_password_input("");
     if(pw[0] == 0) {
         free(pw);
@@ -88,6 +91,7 @@
     char *value = NULL;
     while(!value) {
         printf("%s (default: %s): ", cfgname, defval);
+        fflush(stdout);
         line = util_readline(stdin);
         if(line.length == 0 || !line.ptr) {
             if(line.ptr) {
--- a/libidav/crypto.c	Tue Jul 11 20:45:32 2017 +0200
+++ b/libidav/crypto.c	Thu Aug 03 10:37:52 2017 +0200
@@ -29,9 +29,9 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
+#include <libidav/utils.h>
 #include <openssl/rand.h>
 
-#include <libidav/utils.h>
 #include "crypto.h"
 
 #if OPENSSL_VERSION_NUMBER < 10000000
--- a/libidav/utils.h	Tue Jul 11 20:45:32 2017 +0200
+++ b/libidav/utils.h	Thu Aug 03 10:37:52 2017 +0200
@@ -29,16 +29,22 @@
 #ifndef UTILS_H
 #define	UTILS_H
 
+#ifdef _WIN32
+#include <winsock2.h>
+#include <io.h>
+#endif /* _WIN32 */
+
 #include <sys/types.h>
 #include <libxml/tree.h>
 #include <ucx/string.h>
 #include <sys/stat.h>
 #include <inttypes.h>
+
 #include <curl/curl.h>
 #include "webdav.h"
 
-#ifdef _WIN32
-#include <io.h>
+#ifndef S_IRWXG
+/* if one is not defined, the others are probably also not defined */
 #define S_IRWXG 070
 #define S_IRGRP 040
 #define S_IWGRP 020
@@ -47,7 +53,7 @@
 #define S_IROTH  04
 #define S_IWOTH  02
 #define S_IXOTH  01
-#endif /* _WIN32 */
+#endif /* S_IRWXG */
 
 #ifdef	__cplusplus
 extern "C" {

mercurial