Re: Issue with 'src/utils.c'
Tim Rühsen <[email protected]> Sun, 23 Jun 2024 20:23:41 +0200
| Newsgroups | gmane.comp.web.wget.general |
|---|---|
| Message-ID | <[email protected]> |
Hi Gisle, the wget ML is [email protected] ;) These kind of compatibility issues should be handled by gnulib (ML is [email protected]). In src/gnutls.c, the same code is done like this: #ifdef F_GETFL int flags = fcntl (fd, F_GETFL, 0); if (flags >= 0) { if (fcntl (fd, F_SETFL, flags | O_NONBLOCK)) return -1; } #else /* XXX: Assume it was blocking before. */ const int one = 1; if (ioctl (fd, FIONBIO, &one) < 0) return -1; #endif Can you test something like the above, especially the ioctl call? Regarding -DSTANDLONE - is this documented somewhere and what is it even good for? To me it looks like the biggest problem is that several object files are linked together that have their own main() function. Like in /usr/bin/ld: main.o: in function `main': /home/tim/src/wget/src/main.c:1362: multiple definition of `main'; html-parse.o:/home/tim/src/wget/src/html-parse.c:1193: first defined here /usr/bin/ld: netrc.o: in function `main': /home/tim/src/wget/src/netrc.c:550: multiple definition of `main'; html-parse.o:/home/tim/src/wget/src/html-parse.c:1193: first defined here Btw, Wget2 has a library (libwget) that you can use in your application code. Let me know whatever you need, and we can possibly add it under examples/ . Regards, Tim On 6/22/24 11:26, Gisle Vanem wrote: > Hello Tim. > > Since it seems Wget does not have a mailing-list > or Github repo (I'd wish), I send you this report. > > Compiling latest Wget ('git pull' today) and using cl/clang-cl on Win-10, > I'm getting this compile error: > utils.c(1306,29): error: use of undeclared identifier 'F_GETFL' > 1306 | int flags = fcntl(fd, F_GETFL, 0); > | ^ > utils.c(1307,17): error: use of undeclared identifier 'F_SETFL' > 1307 | fcntl(fd, F_SETFL, flags | O_NONBLOCK); > | ^ > 2 errors generated. > > -------------- > > Due to the commit > http://git.savannah.gnu.org/cgit/wget.git/commit/src/utils.c?id=196ce0abd67b9c905c600a217a7d2dd667216081 > it seems. > > One cannot do this on Windows. I patched it like this: > --- a/src/utils.c 2024-06-22 06:12:34 > +++ b/utils.c 2024-06-22 11:05:50 > @@ -1303,8 +1303,10 @@ > if (HYPHENP (file)) > { > fd = fileno (stdin); > +#ifndef WIN32 > int flags = fcntl(fd, F_GETFL, 0); > fcntl(fd, F_SETFL, flags | O_NONBLOCK); > +#endif > inhibit_close = true; > /* Note that we don't inhibit mmap() in this case. If stdin is > redirected from a regular file, mmap() will still work. */ > > ---------------------------- > > And BTW, linking netrc.exe (-DSTANDALONE), causes a link-error: > netrc.obj : error LNK2005: program_argstring already defined in main.obj > > Fixed by: > --- a/src/netrc.c 2024-06-22 06:12:34 > +++ b/netrc.c 2024-06-22 11:10:47 > @@ -543,8 +543,6 @@ > #include <sys/stat.h> > #include "exits.h" > > -const char *program_argstring = NULL; /* Needed by warc.c */ > - > int > main (int argc, char **argv) > { > >
OpenPGP_signature.asc
(application/pgp-signature, 840 B)
-----BEGIN PGP SIGNATURE----- wsF5BAABCAAjFiEEHLJ9vJhhSy1YQWRtCDAttqJnBCgFAmZ4aC0FAwAAAAAACgkQCDAttqJnBChj zA//be6cK8lojJQl/6nAmmHRqWg7/hSJzk/cqADd+5PmhmPAxlaiS+p4l9X7qVPKH6/4wBccA/HS SKoiTDRgFrW+gnJJ9gr3h4zW18YHbjTGU4Q4K59dfA7C7yy/DGpQFyagOGVQ8wQN944Nno6oSGoO HYdEiqKL5v4en9v/uPtEzlLx9520UHunELp5iR3G0v6m1Z/jNnJOj9JAVdLQIiRdGQ4CZEflY+WP 1RF5qL+Gj4VORAO+UzOaTSkeG1BfMIKenLnuQwZ4BIREXwO2hvteGaXLKjjxYb23o+gQ85t2aciv QgVCa0VlImPMK+iMDa6B93DkcG5erjMYXz9XvZf/3LEm0O+DgTWRV3C3+l2MZzq+zNWIqa1PcjB3 LFyAfwqf1ARYyTXP9g1CVl96NFb2hYNmCf80ee1iJFMeYq7o3GV1R5NXx5fccsNaLvw4KxEfj1bz gyqOgqJdMlvslYjNxizGPtvtB7apZs5QqBMoVrsZqWD/Im8jWndFhbgFhFgdZOsLzLXBVVWEihfx 292GTCDfBJ17H2vG/ZTHMlOTh+AjnEJtUprRPyYXZsfjrGEMUpSSfJpffiKO3O5M+/lJzqa8QNLj Kza9nC7d1EfUOm83KzWIZjbCwFDteVkOdRPzk+GgQ3Ne1rqy0VZtv0kDne4qceP/dR8TEQ8PuPxy QGA= =ha/4 -----END PGP SIGNATURE-----