mirror of
https://gitlab.com/80486DX2-66/gists
synced 2024-12-27 05:40:17 +05:30
freadln.c: test: support POSIX sleep
This commit is contained in:
parent
8f8ee0eb53
commit
60e8d00b5b
@ -4,6 +4,9 @@
|
|||||||
* The `freadln` function reads a line from STDIN into a string, allocating
|
* The `freadln` function reads a line from STDIN into a string, allocating
|
||||||
* memory for it.
|
* memory for it.
|
||||||
*
|
*
|
||||||
|
* NOTE: Test: Declare macro POSIX when compiling if you're using a POSIX
|
||||||
|
* system.
|
||||||
|
*
|
||||||
* TODO: Figure out potential problems
|
* TODO: Figure out potential problems
|
||||||
* TODO: Add 'flushing' of STDIN (while there are characters, read them) before
|
* TODO: Add 'flushing' of STDIN (while there are characters, read them) before
|
||||||
* the input reading loop to avoid input queues
|
* the input reading loop to avoid input queues
|
||||||
@ -76,7 +79,11 @@ int freadln(FILE* f, char** output, size_t* length_out) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifdef TEST
|
#ifdef TEST
|
||||||
# if defined(_WIN32) || defined(WIN32)
|
# if POSIX
|
||||||
|
# include <unistd.h>
|
||||||
|
# define SLEEP_FN sleep
|
||||||
|
# define DO_SLEEP 1
|
||||||
|
# elif defined(_WIN32) || defined(WIN32)
|
||||||
# include <windows.h>
|
# include <windows.h>
|
||||||
# define SLEEP_FN(x) Sleep((DWORD) x)
|
# define SLEEP_FN(x) Sleep((DWORD) x)
|
||||||
# define DO_SLEEP 1
|
# define DO_SLEEP 1
|
||||||
|
Loading…
Reference in New Issue
Block a user