mirror of
https://gitlab.com/80486DX2-66/gists
synced 2024-11-15 05:45:55 +05:30
34 lines
1006 B
C
34 lines
1006 B
C
/*
|
|
* freadln.h
|
|
*
|
|
* Author: Intel A80486DX2-66
|
|
* License: Creative Commons Zero 1.0 Universal
|
|
*/
|
|
|
|
#ifndef _FREADLN_H
|
|
#define _FREADLN_H
|
|
|
|
#include <errno.h>
|
|
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
|
|
typedef size_t freadln_length_type;
|
|
|
|
enum freadln_status {
|
|
freadln_OK = -2,
|
|
freadln_ERROR
|
|
};
|
|
|
|
#define freadln_success_epilogue do { \
|
|
(*output)[length] = '\0'; \
|
|
if (length_out == NULL) \
|
|
return length; \
|
|
else { \
|
|
*length_out = length; \
|
|
return freadln_OK; \
|
|
} \
|
|
} while (0);
|
|
|
|
ssize_t freadln(char** output);
|
|
#endif /* _FREADLN_H */
|