build: tidy up and simplify setmode() detection and use

- move macro to `curl_setup.h` (from curlx), and rename.
  It's required by src, test servers, libtests. Also used by unit/tunit,
  (which is fixable but this patch doesn't touch it.)
- special-case it for Windows/Cygwin/MS-DOS.
- build: drop `setmode()`/`_setmode()` detection.
  This also avoids detecting the different `setmode()` on BSDs,
  and a lot of complexity and overhead.
- use `CURL_O_BINARY`.

Follow-up to 250d613763 #15787
Follow-up to 5e70566094 #15169

Closes #20539
This commit is contained in:
Viktor Szakats 2026-02-07 17:57:39 +01:00
parent 2c0019b085
commit cdfc8dc7ad
No known key found for this signature in database
19 changed files with 32 additions and 103 deletions

View file

@ -824,9 +824,9 @@ static int test_mqttd(int argc, const char *argv[])
snprintf(loglockfile, sizeof(loglockfile), "%s/%s/mqtt-%s.lock",
logdir, SERVERLOGS_LOCKDIR, ipv_inuse);
CURLX_SET_BINMODE(stdin);
CURLX_SET_BINMODE(stdout);
CURLX_SET_BINMODE(stderr);
CURL_BINMODE(stdin);
CURL_BINMODE(stdout);
CURL_BINMODE(stderr);
install_signal_handlers(FALSE);

View file

@ -1290,9 +1290,9 @@ static int test_sockfilt(int argc, const char *argv[])
}
}
CURLX_SET_BINMODE(stdin);
CURLX_SET_BINMODE(stdout);
CURLX_SET_BINMODE(stderr);
CURL_BINMODE(stdin);
CURL_BINMODE(stdout);
CURL_BINMODE(stderr);
install_signal_handlers(false);

View file

@ -858,9 +858,9 @@ static int test_socksd(int argc, const char *argv[])
}
}
CURLX_SET_BINMODE(stdin);
CURLX_SET_BINMODE(stdout);
CURLX_SET_BINMODE(stderr);
CURL_BINMODE(stdin);
CURL_BINMODE(stdout);
CURL_BINMODE(stderr);
install_signal_handlers(false);