diff options
Diffstat (limited to '')
-rw-r--r-- | ChangeLog | 9 | ||||
-rw-r--r-- | config.h.in | 14 | ||||
-rwxr-xr-x | configure | 4 | ||||
-rw-r--r-- | configure.ac | 4 | ||||
-rw-r--r-- | etc.c | 26 | ||||
-rw-r--r-- | file.c | 16 | ||||
-rw-r--r-- | ftp.c | 19 | ||||
-rw-r--r-- | indep.c | 10 | ||||
-rw-r--r-- | istream.c | 13 | ||||
-rw-r--r-- | local.c | 12 | ||||
-rw-r--r-- | main.c | 36 | ||||
-rw-r--r-- | rc.c | 6 | ||||
-rw-r--r-- | terms.c | 83 | ||||
-rw-r--r-- | url.c | 11 |
14 files changed, 243 insertions, 20 deletions
@@ -1,7 +1,8 @@ 2007-05-23 NOKUBI Takatsugu <knok@daionet.gr.jp> - - * [w3m-dev 04246] Re: road to 0.5.2 - * configure.ac: delete nsl and dl for cross building. + * [w3m-dev 04155] w3m mingw patch + * config.h, configure.ac, etc.c, file.c, ftp.c, indep.c, istream.c, + local.c, main.c, rc.c, terms.c, url.c: fix for minpw, except for + deleting nsl and dl from configure.ac. * configure: regenerated. 2007-05-23 Hiroyuki Ito <ZXB01226@nifty.com> @@ -8850,4 +8851,4 @@ a * [w3m-dev 03276] compile error on EWS4800 * release-0-2-1 * import w3m-0.2.1 -$Id: ChangeLog,v 1.986 2007/05/23 13:15:36 inu Exp $ +$Id: ChangeLog,v 1.987 2007/05/23 15:06:05 inu Exp $ diff --git a/config.h.in b/config.h.in index 09283fa..313616c 100644 --- a/config.h.in +++ b/config.h.in @@ -166,9 +166,15 @@ typedef RETSIGTYPE MySignalHandler; #define SIGNAL_RETURN @SIGNAL_RETURN@ #ifdef HAVE_SIGSETJMP +#ifdef __MINGW32_VERSION +# define SETJMP(env) setjmp(env) +# define LONGJMP(env,val) longjmp(env, val) +# define JMP_BUF jmp_buf +#else # define SETJMP(env) sigsetjmp(env,1) # define LONGJMP(env,val) siglongjmp(env,val) # define JMP_BUF sigjmp_buf +#endif /* __MINGW32_VERSION */ #else # define SETJMP(env) setjmp(env) # define LONGJMP(env,val) longjmp(env) @@ -233,4 +239,12 @@ typedef RETSIGTYPE MySignalHandler; #define BUNZIP2_NAME "bunzip2" #define INFLATE_NAME "inflate" +#ifdef __MINGW32_VERSION +#define SIGKILL SIGTERM +#define S_IXGRP 0 +#define S_IXOTH 0 +#define S_IRWXG 0 +#define S_IRWXO 0 +#endif /* __MINGW32_VERSION */ + #endif /* CONFIG_H_SEEN */ @@ -6220,7 +6220,7 @@ cat >>confdefs.h <<_ACEOF _ACEOF -for lib in bsd BSD 44bsd socket dld +for lib in bsd BSD 44bsd socket nsl dld dl do lib=$lib { echo "$as_me:$LINENO: checking for -l$lib" >&5 @@ -8072,7 +8072,7 @@ _ACEOF case "$host_os" in - *cygwin*|*os2-emx*) + *cygwin*|*os2-emx*|*mingw*) cat >>confdefs.h <<\_ACEOF #define USE_BINMODE_STREAM 1 _ACEOF diff --git a/configure.ac b/configure.ac index 5e2e53f..29370a4 100644 --- a/configure.ac +++ b/configure.ac @@ -82,7 +82,7 @@ AC_W3M_MAILER AC_W3M_EXT_BROWSER dnl Checks for ext libs -for lib in bsd BSD 44bsd socket dld +for lib in bsd BSD 44bsd socket nsl dld dl do AC_W3M_EXTLIBS($lib) done @@ -109,7 +109,7 @@ AC_DEFINE(AUXBIN_TARGETS, "$AUXBIN_TARGETS") AC_SUBST(USE_BINMODE_STREAM) case "$host_os" in - *cygwin*|*os2-emx*) + *cygwin*|*os2-emx*|*mingw*) AC_DEFINE(USE_BINMODE_STREAM) ;; esac @@ -1,6 +1,8 @@ -/* $Id: etc.c,v 1.80 2006/04/07 13:21:11 inu Exp $ */ +/* $Id: etc.c,v 1.81 2007/05/23 15:06:05 inu Exp $ */ #include "fm.h" +#ifndef __MINGW32_VERSION #include <pwd.h> +#endif #include "myctype.h" #include "html.h" #include "local.h" @@ -1310,9 +1312,13 @@ romanAlphabet(int n) static void reset_signals(void) { +#ifdef SIGHUP mySignal(SIGHUP, SIG_DFL); /* terminate process */ +#endif mySignal(SIGINT, SIG_DFL); /* terminate process */ +#ifdef SIGQUIT mySignal(SIGQUIT, SIG_DFL); /* terminate process */ +#endif mySignal(SIGTERM, SIG_DFL); /* terminate process */ mySignal(SIGILL, SIG_DFL); /* create core image */ mySignal(SIGIOT, SIG_DFL); /* create core image */ @@ -1355,8 +1361,10 @@ setup_child(int child, int i, int f) { reset_signals(); mySignal(SIGINT, SIG_IGN); +#ifndef __MINGW32_VERSION if (!child) SETPGRP(); +#endif /* __MINGW32_VERSION */ close_tty(); close_all_fds_except(i, f); QuietMessage = TRUE; @@ -1364,6 +1372,7 @@ setup_child(int child, int i, int f) TrapSignal = FALSE; } +#ifndef __MINGW32_VERSION pid_t open_pipe_rw(FILE ** fr, FILE ** fw) { @@ -1421,6 +1430,7 @@ open_pipe_rw(FILE ** fr, FILE ** fw) err0: return (pid_t) - 1; } +#endif /* __MINGW32_VERSION */ void myExec(char *command) @@ -1433,6 +1443,7 @@ myExec(char *command) void mySystem(char *command, int background) { +#ifndef __MINGW32_VERSION if (background) { #ifndef __EMX__ flush_tty(); @@ -1447,6 +1458,7 @@ mySystem(char *command, int background) #endif } else +#endif /* __MINGW32_VERSION */ system(command); } @@ -1516,6 +1528,13 @@ myEditor(char *cmd, char *file, int line) return tmp; } +#ifdef __MINGW32_VERSION +char * +expandName(char *name) +{ + return getenv("HOME"); +} +#else char * expandName(char *name) { @@ -1559,6 +1578,7 @@ expandName(char *name) rest: return name; } +#endif char * file_to_url(char *file) @@ -1898,7 +1918,11 @@ mymktime(char *timestr) #ifdef INET6 #include <sys/socket.h> #endif /* INET6 */ +#ifndef __MINGW32_VERSION #include <netdb.h> +#else +#include <winsock.h> +#endif char * FQDN(char *host) { @@ -1,4 +1,4 @@ -/* $Id: file.c,v 1.253 2007/05/23 13:07:44 inu Exp $ */ +/* $Id: file.c,v 1.254 2007/05/23 15:06:05 inu Exp $ */ #include "fm.h" #include <sys/types.h> #include "myctype.h" @@ -1602,9 +1602,17 @@ getAuthCookie(struct http_auth *hauth, char *auth_header, getpassphrase(proxy ? "Proxy Password: " : "Password: ")); #else +#ifndef __MINGW32_VERSION *pwd = Strnew_charp((char *) getpass(proxy ? "Proxy Password: " : "Password: ")); +#else + term_raw(); + *pwd = Strnew_charp((char *) + inputLine(proxy ? "Proxy Password: " : + "Password: ", NULL, IN_PASSWORD)); + term_cbreak(); +#endif /* __MINGW32_VERSION */ #endif } } @@ -7901,6 +7909,7 @@ _MoveFile(char *path1, char *path2) int _doFileCopy(char *tmpf, char *defstr, int download) { +#ifndef __MINGW32_VERSION Str msg; Str filen; char *p, *q = NULL; @@ -8007,6 +8016,7 @@ _doFileCopy(char *tmpf, char *defstr, int download) if (PreserveTimestamp && !is_pipe && !stat(tmpf, &st)) setModtime(p, st.st_mtime); } +#endif /* __MINGW32_VERSION */ return 0; } @@ -8021,6 +8031,7 @@ doFileMove(char *tmpf, char *defstr) int doFileSave(URLFile uf, char *defstr) { +#ifndef __MINGW32_VERSION Str msg; Str filen; char *p, *q; @@ -8117,6 +8128,7 @@ doFileSave(URLFile uf, char *defstr) if (PreserveTimestamp && uf.modtime != -1) setModtime(p, uf.modtime); } +#endif /* __MINGW32_VERSION */ return 0; } @@ -8187,6 +8199,7 @@ inputAnswer(char *prompt) static void uncompress_stream(URLFile *uf, char **src) { +#ifndef __MINGW32_VERSION pid_t pid1; FILE *f1; char *expand_cmd = GUNZIP_CMDNAME; @@ -8270,6 +8283,7 @@ uncompress_stream(URLFile *uf, char **src) } UFhalfclose(uf); uf->stream = newFileStream(f1, (void (*)())fclose); +#endif /* __MINGW32_VERSION */ } static FILE * @@ -1,6 +1,8 @@ -/* $Id: ftp.c,v 1.37 2006/04/07 13:21:11 inu Exp $ */ +/* $Id: ftp.c,v 1.38 2007/05/23 15:06:05 inu Exp $ */ #include <stdio.h> +#ifndef __MINGW32_VERSION #include <pwd.h> +#endif /* __MINGW32_VERSION */ #include <Str.h> #include <signal.h> #include <setjmp.h> @@ -14,10 +16,14 @@ #include <malloc.h> #endif /* DEBUG */ +#ifndef __MINGW32_VERSION #include <sys/socket.h> #include <netinet/in.h> #include <netdb.h> #include <arpa/inet.h> +#else +#include <winsock.h> +#endif /* __MINGW32_VERSION */ typedef struct _FTP { char *host; @@ -371,7 +377,14 @@ openFTPStream(ParsedURL *pu, URLFile *uf) term_cbreak(); } else { +#ifndef __MINGW32_VERSION pwd = Strnew_charp((char *)getpass("Password: ")); +#else + term_raw(); + pwd = Strnew_charp(inputLine("Password: ", NULL, IN_PASSWORD)); + pwd = Str_conv_to_system(pwd); + term_cbreak(); +#endif /* __MINGW32_VERSION */ } add_auth_cookie_flag = TRUE; } @@ -380,8 +393,12 @@ openFTPStream(ParsedURL *pu, URLFile *uf) else if (ftppasswd != NULL && *ftppasswd != '\0') pass = ftppasswd; else { +#ifndef __MINGW32_VERSION struct passwd *mypw = getpwuid(getuid()); tmp = Strnew_charp(mypw ? mypw->pw_name : "anonymous"); +#else + tmp = Strnew_charp("anonymous"); +#endif __MINGW32_VERSION Strcat_char(tmp, '@'); pass = tmp->ptr; } @@ -1,7 +1,9 @@ -/* $Id: indep.c,v 1.37 2006/04/07 13:21:11 inu Exp $ */ +/* $Id: indep.c,v 1.38 2007/05/23 15:06:05 inu Exp $ */ #include "fm.h" #include <stdio.h> +#ifndef __MINGW32_VERSION #include <pwd.h> +#endif /* __MINGW32_VERSION */ #include <sys/param.h> #include <sys/types.h> #include <stdlib.h> @@ -225,6 +227,7 @@ expandPath(char *name) p = name; if (*p == '~') { p++; +#ifndef __MINGW32_VERSION if (IS_ALPHA(*p)) { char *q = strchr(p, '/'); if (q) { /* ~user/dir... */ @@ -238,8 +241,9 @@ expandPath(char *name) if (!passent) goto rest; extpath = Strnew_charp(passent->pw_dir); - } - else if (*p == '/' || *p == '\0') { /* ~/dir... or ~ */ + } else +#endif /* __MINGW32_VERSION */ + if (*p == '/' || *p == '\0') { /* ~/dir... or ~ */ extpath = Strnew_charp(getenv("HOME")); } else @@ -1,4 +1,4 @@ -/* $Id: istream.c,v 1.25 2006/04/07 13:21:11 inu Exp $ */ +/* $Id: istream.c,v 1.26 2007/05/23 15:06:05 inu Exp $ */ #include "fm.h" #include "myctype.h" #include "istream.h" @@ -6,6 +6,9 @@ #ifdef USE_SSL #include <openssl/x509v3.h> #endif +#ifdef __MINGW32_VERSION +#include <winsock.h> +#endif #define uchar unsigned char @@ -617,13 +620,21 @@ ssl_get_certificate(SSL * ssl, char *hostname) static void basic_close(int *handle) { +#ifdef __MINGW32_VERSION + closesocket(*(int *)handle); +#else close(*(int *)handle); +#endif } static int basic_read(int *handle, char *buf, int len) { +#ifdef __MINGW32_VERSION + return recv(*(int *)handle, buf, len, 0); +#else return read(*(int *)handle, buf, len); +#endif } static void @@ -1,4 +1,4 @@ -/* $Id: local.c,v 1.34 2007/04/19 12:07:04 inu Exp $ */ +/* $Id: local.c,v 1.35 2007/05/23 15:06:05 inu Exp $ */ #include "fm.h" #include <string.h> #include <stdio.h> @@ -16,6 +16,10 @@ #include "local.h" #include "hash.h" +#ifdef __MINGW32_VERSION +#include <winsock.h> +#endif + #define CGIFN_NORMAL 0 #define CGIFN_LIBDIR 1 #define CGIFN_CGIBIN 2 @@ -194,8 +198,10 @@ check_local_cgi(char *file, int status) return -1; if (S_ISDIR(st.st_mode)) return -1; +#ifndef __MINGW32_VERSION if ((st.st_uid == geteuid() && (st.st_mode & S_IXUSR)) || (st.st_gid == getegid() && (st.st_mode & S_IXGRP)) || (st.st_mode & S_IXOTH)) /* executable */ return 0; +#endif return -1; } @@ -354,6 +360,9 @@ localcgi_post(char *uri, char *qstr, FormList *request, char *referer) pid_t pid; char *file = uri, *name = uri, *path_info = NULL, *tmpf = NULL; +#ifdef __MINGW32_VERSION + return NULL; +#else status = cgi_filename(uri, &file, &name, &path_info); if (check_local_cgi(file, status) < 0) return NULL; @@ -413,4 +422,5 @@ localcgi_post(char *uri, char *qstr, FormList *request, char *referer) file, mybasename(file), strerror(errno)); exit(1); return NULL; +#endif } @@ -1,4 +1,4 @@ -/* $Id: main.c,v 1.254 2007/05/23 12:34:20 inu Exp $ */ +/* $Id: main.c,v 1.255 2007/05/23 15:06:05 inu Exp $ */ #define MAINPROGRAM #include "fm.h" #include <signal.h> @@ -24,6 +24,12 @@ extern int do_getch(); #endif /* defined(USE_GPM) || defined(USE_SYSMOUSE) */ #endif +#ifdef __MINGW32_VERSION +#include <winsock.h> + +WSADATA WSAData; +#endif + #define DSTR_LEN 256 Hist *LoadHist; @@ -64,7 +70,11 @@ static char *MarkString = NULL; static char *SearchString = NULL; int (*searchRoutine) (Buffer *, char *); +#ifndef __MINGW32_VERSION JMP_BUF IntReturn; +#else +_JBTYPE IntReturn[_JBLEN]; +#endif /* __MINGW32_VERSION */ static void delBuffer(Buffer *buf); static void cmd_loadfile(char *path); @@ -753,6 +763,23 @@ main(int argc, char **argv, char **envp) sock_init(); #endif +#ifdef __MINGW32_VERSION + { + int err; + WORD wVerReq; + + wVerReq = MAKEWORD(1, 1); + + err = WSAStartup(wVerReq, &WSAData); + if (err != 0) + { + fprintf(stderr, "Can't find winsock\n"); + return 1; + } + _fmode = _O_BINARY; + } +#endif + FirstTab = NULL; LastTab = NULL; nTab = 0; @@ -5728,6 +5755,9 @@ w3m_exit(int i) #ifdef USE_NNTP disconnectNews(); #endif +#ifdef __MINGW32_VERSION + WSACleanup(); +#endif exit(i); } @@ -6452,7 +6482,9 @@ download_action(struct parsed_tagarg *arg) for (; arg; arg = arg->next) { if (!strncmp(arg->arg, "stop", 4)) { pid = (pid_t) atoi(&arg->arg[4]); +#ifndef __MINGW32_VERSION kill(pid, SIGKILL); +#endif } else if (!strncmp(arg->arg, "ok", 2)) pid = (pid_t) atoi(&arg->arg[2]); @@ -6486,7 +6518,9 @@ stopDownload(void) for (d = FirstDL; d != NULL; d = d->next) { if (d->ok) continue; +#ifndef __MINGW32_VERSION kill(d->pid, SIGKILL); +#endif unlink(d->lock); } } @@ -1,4 +1,4 @@ -/* $Id: rc.c,v 1.105 2007/05/23 13:07:44 inu Exp $ */ +/* $Id: rc.c,v 1.106 2007/05/23 15:06:06 inu Exp $ */ /* * Initialization file etc. */ @@ -1126,7 +1126,11 @@ do_mkdir(const char *dir, long mode) return mkdir(abs, mode); } #else /* not __EMX__ */ +#ifdef __MINGW32_VERSION +#define do_mkdir(dir,mode) mkdir(dir) +#else #define do_mkdir(dir,mode) mkdir(dir,mode) +#endif /* not __MINW32_VERSION */ #endif /* not __EMX__ */ void @@ -1,4 +1,4 @@ -/* $Id: terms.c,v 1.55 2006/04/07 13:21:12 inu Exp $ */ +/* $Id: terms.c,v 1.56 2007/05/23 15:06:06 inu Exp $ */ /* * An original curses library for EUC-kanji by Akinori ITO, December 1989 * revised by Akinori ITO, January 1995 @@ -15,7 +15,11 @@ #ifdef HAVE_SYS_SELECT_H #include <sys/select.h> #endif +#ifndef __MINGW32_VERSION #include <sys/ioctl.h> +#else +#include <winsock.h> +#endif /* __MINGW32_VERSION */ #ifdef USE_MOUSE #ifdef USE_GPM #include <gpm.h> @@ -287,6 +291,42 @@ typedef struct sgttyb TerminalMode; #define MODEFLAG(d) ((d).sg_flags) #endif /* HAVE_SGTTY_H */ +#ifdef __MINGW32_VERSION +/* dummy struct */ +typedef unsigned char cc_t; +typedef unsigned int speed_t; +typedef unsigned int tcflag_t; + +#define NCCS 32 +struct termios + { + tcflag_t c_iflag; /* input mode flags */ + tcflag_t c_oflag; /* output mode flags */ + tcflag_t c_cflag; /* control mode flags */ + tcflag_t c_lflag; /* local mode flags */ + cc_t c_line; /* line discipline */ + cc_t c_cc[NCCS]; /* control characters */ + speed_t c_ispeed; /* input speed */ + speed_t c_ospeed; /* output speed */ + }; +typedef struct termios TerminalMode; +#define TerminalSet(fd,x) (0) +#define TerminalGet(fd,x) (0) +#define MODEFLAG(d) (0) + +/* dummy defines */ +#define SIGHUP (0) +#define SIGQUIT (0) +#define ECHO (0) +#define ISIG (0) +#define VEOF (0) +#define ICANON (0) +#define IXON (0) +#define IXOFF (0) + +char *ttyname(int); +#endif /* __MINGW32_VERSION */ + #define MAX_LINE 200 #define MAX_COLUMN 400 @@ -511,6 +551,7 @@ set_tty(void) void ttymode_set(int mode, int imode) { +#ifndef __MINGW32_VERSION TerminalMode ioval; TerminalGet(tty, &ioval); @@ -525,11 +566,13 @@ ttymode_set(int mode, int imode) printf("Error occured while set %x: errno=%d\n", mode, errno); reset_exit(SIGNAL_ARGLIST); } +#endif } void ttymode_reset(int mode, int imode) { +#ifndef __MINGW32_VERSION TerminalMode ioval; TerminalGet(tty, &ioval); @@ -544,6 +587,7 @@ ttymode_reset(int mode, int imode) printf("Error occured while reset %x: errno=%d\n", mode, errno); reset_exit(SIGNAL_ARGLIST); } +#endif /* __MINGW32_VERSION */ } #ifndef HAVE_SGTTY_H @@ -2172,3 +2216,40 @@ touch_cursor() #endif } #endif + +#ifdef __MINGW32_VERSION + +int tgetent(char *bp, char *name) +{ + return 0; +} + +int tgetnum(char *id) +{ + return -1; +} + +int tgetflag(char *id) +{ + return 0; +} + +char *tgetstr(char *id, char **area) +{ + id = ""; +} + +char *tgoto(char *cap, int col, int row) +{ +} + +int tputs(char *str, int affcnt, int (*putc)(char)) +{ +} + +char *ttyname(int tty) +{ + return "CON"; +} + +#endif /* __MINGW32_VERSION */ @@ -1,10 +1,14 @@ -/* $Id: url.c,v 1.94 2006/12/10 10:49:23 inu Exp $ */ +/* $Id: url.c,v 1.95 2007/05/23 15:06:06 inu Exp $ */ #include "fm.h" +#ifndef __MINGW32_VERSION #include <sys/types.h> #include <sys/socket.h> #include <netinet/in.h> #include <arpa/inet.h> #include <netdb.h> +#else +#include <winsock.h> +#endif /* __MINGW32_VERSION */ #include <signal.h> #include <setjmp.h> @@ -31,6 +35,11 @@ #define write(a,b,c) write_s(a,b,c) #endif /* __WATT32__ */ +#ifdef __MINGW32_VERSION +#define write(a,b,c) send(a,b,c, 0) +#define close(fd) closesocket(fd) +#endif + #ifdef INET6 /* see rc.c, "dns_order" and dnsorders[] */ int ai_family_order_table[7][3] = { |