char *mingw_getcwd(char *pointer, int len);
#define getcwd mingw_getcwd
+char *mingw_getenv(const char *name);
+#define getenv mingw_getenv
+
struct hostent *mingw_gethostbyname(const char *host);
#define gethostbyname mingw_gethostbyname
void mingw_execvp(const char *cmd, char *const *argv);
#define execvp mingw_execvp
+static inline unsigned int git_ntohl(unsigned int x)
+{ return (unsigned int)ntohl(x); }
+#define ntohl git_ntohl
+
sig_handler_t mingw_signal(int sig, sig_handler_t handler);
#define signal mingw_signal
+/*
+ * ANSI emulation wrappers
+ */
+
+int winansi_fputs(const char *str, FILE *stream);
+int winansi_printf(const char *format, ...) __attribute__((format (printf, 1, 2)));
+int winansi_fprintf(FILE *stream, const char *format, ...) __attribute__((format (printf, 2, 3)));
+#define fputs winansi_fputs
+#define printf(...) winansi_printf(__VA_ARGS__)
+#define fprintf(...) winansi_fprintf(__VA_ARGS__)
+
/*
* git specific compatibility
*/
#define PATH_SEP ';'
#define PRIuMAX "I64u"
+void mingw_open_html(const char *path);
+#define open_html mingw_open_html
+
/*
* helpers
*/
char **copy_environ(void);
void free_environ(char **env);
char **env_setenv(char **env, const char *name);
+
+/*
+ * A replacement of main() that ensures that argv[0] has a path
+ */
+
+#define main(c,v) dummy_decl_mingw_main(); \
+static int mingw_main(); \
+int main(int argc, const char **argv) \
+{ \
+ argv[0] = xstrdup(_pgmptr); \
+ return mingw_main(argc, argv); \
+} \
+static int mingw_main(c,v)