the session readers use getline(3), which a Windows CRT does not have
Building the Windows TUI by hand -- the first local build since the CI file went away -- stopped in src/tools/session_tools.c: `getline` was an implicit declaration there, which this GCC treats as an error. src/session.c had a private fgetc() shim for exactly that; the session-list scan is newer and used the POSIX call directly, and only the Windows build notices. The shim moves to os_compat as os_getline(): getline(3) itself on Unix, the fgetc() loop on Windows, one prototype in the header so a caller reads the same everywhere. src/session.c drops its copy and calls it; the scan does too (its `ssize_t` becomes `long long`, which Windows has). make check is green on Linux, the Windows cross build now finishes and packages (dist/cst-agent-0.9.7-windows-x86_64.zip plus the NSIS setup), and the static Linux tarball was rebuilt with it.
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
#define CST_OS_COMPAT_H
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdio.h>
|
||||
#include <time.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
@@ -12,6 +13,13 @@ extern "C" {
|
||||
#define OS_PATH_MAX 4096
|
||||
#endif
|
||||
|
||||
/* --- text --- */
|
||||
/* One line of a file into *lineptr, growing it as needed: POSIX getline(3),
|
||||
* which a MinGW CRT does not have (the session file readers used it directly
|
||||
* and only the Windows build noticed). Returns the number of bytes read -- 0
|
||||
* for an empty line -- or -1 at the end of the file. */
|
||||
long long os_getline(char **lineptr, size_t *n, FILE *stream);
|
||||
|
||||
/* --- path --- */
|
||||
int os_path_is_abs(const char *p);
|
||||
/* Join with native separator; out always uses '/' on Unix and '\\' on Win for
|
||||
|
||||
Reference in New Issue
Block a user