libc: Add EXIT_SUCCESS, EXIT_FAILURE, RAND_MAX and BUFSIZ
This commit is contained in:
parent
dd9b90d69d
commit
06f9ffc184
@ -9,7 +9,7 @@ int main()
|
||||
return 1;
|
||||
}
|
||||
|
||||
char buf[32];
|
||||
char buf[BUFSIZ];
|
||||
fgets(buf, sizeof(buf), fp);
|
||||
|
||||
printf("%s\n", buf);
|
||||
|
@ -10,7 +10,7 @@ int main()
|
||||
return 1;
|
||||
}
|
||||
|
||||
char buf[32];
|
||||
char buf[BUFSIZ];
|
||||
fgets(buf, sizeof(buf), fp);
|
||||
|
||||
if (ferror(fp))
|
||||
|
@ -8,6 +8,7 @@
|
||||
#include <bits/seek.h>
|
||||
|
||||
#define FOPEN_MAX 32
|
||||
#define BUFSIZ 32
|
||||
|
||||
typedef struct
|
||||
{
|
||||
|
@ -2,8 +2,14 @@
|
||||
#define _STDLIB_H
|
||||
|
||||
#include <bits/macros.h>
|
||||
#include <limits.h>
|
||||
#include <stddef.h>
|
||||
|
||||
#define EXIT_SUCCESS 0
|
||||
#define EXIT_FAILURE 1
|
||||
|
||||
#define RAND_MAX INT_MAX
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
|
@ -13,8 +13,8 @@ void file_read_buf(FILE* stream)
|
||||
{
|
||||
if (!stream->f_buf)
|
||||
{
|
||||
stream->f_buf = (char*)malloc(32); // FIXME: Handle errors.
|
||||
stream->f_bufrsize = 32;
|
||||
stream->f_buf = (char*)malloc(BUFSIZ); // FIXME: Handle errors.
|
||||
stream->f_bufrsize = BUFSIZ;
|
||||
}
|
||||
stream->f_bufoff = 0;
|
||||
ssize_t nread = read(stream->f_fd, stream->f_buf, stream->f_bufrsize);
|
||||
|
Loading…
Reference in New Issue
Block a user