diff options
author | Brandon Scott <xeons@users.noreply.github.com> | 2019-11-16 04:39:36 -0600 |
---|---|---|
committer | Andreas Kling <awesomekling@gmail.com> | 2019-11-16 12:50:50 +0100 |
commit | 3069988a757f0f7b9fed78336c5006efa2303d23 (patch) | |
tree | 8ab03a0611baa328169d55eb84c9e81058869435 /Libraries/LibC/stdio.cpp | |
parent | bda36853c984633adc894e204d9fcef42ac3aa24 (diff) | |
download | serenity-3069988a757f0f7b9fed78336c5006efa2303d23.zip |
LibC: Implemented getc_unlocked, stubbed flockfile
Implemented getc_unlocked and stubbed out flockfile() and funlockfile().
Diffstat (limited to 'Libraries/LibC/stdio.cpp')
-rw-r--r-- | Libraries/LibC/stdio.cpp | 25 |
1 files changed, 21 insertions, 4 deletions
diff --git a/Libraries/LibC/stdio.cpp b/Libraries/LibC/stdio.cpp index 7a1cdc9069..85e30d0fdb 100644 --- a/Libraries/LibC/stdio.cpp +++ b/Libraries/LibC/stdio.cpp @@ -140,12 +140,17 @@ int getc(FILE* stream) return fgetc(stream); } +int getc_unlocked(FILE* stream) +{ + return fgetc(stream); +} + int getchar() { return getc(stdin); } -ssize_t getdelim(char **lineptr, size_t *n, int delim, FILE *stream) +ssize_t getdelim(char** lineptr, size_t* n, int delim, FILE* stream) { char *ptr, *eptr; if (*lineptr == nullptr || *n == 0) { @@ -170,7 +175,7 @@ ssize_t getdelim(char **lineptr, size_t *n, int delim, FILE *stream) return ptr - *lineptr; } if (ptr + 2 >= eptr) { - char *nbuf; + char* nbuf; size_t nbuf_sz = *n * 2; ssize_t d = ptr - *lineptr; if ((nbuf = static_cast<char*>(realloc(*lineptr, nbuf_sz))) == nullptr) { @@ -184,7 +189,7 @@ ssize_t getdelim(char **lineptr, size_t *n, int delim, FILE *stream) } } -ssize_t getline(char **lineptr, size_t *n, FILE *stream) +ssize_t getline(char** lineptr, size_t* n, FILE* stream) { return getdelim(lineptr, n, '\n', stream); } @@ -413,7 +418,7 @@ int vsnprintf(char* buffer, size_t size, const char* fmt, va_list ap) __vsnprintf_space_remaining = size; int ret = printf_internal(sized_buffer_putch, buffer, fmt, ap); if (__vsnprintf_space_remaining) { - buffer[ret] = '\0'; + buffer[ret] = '\0'; } return ret; } @@ -616,6 +621,18 @@ int vfscanf(FILE* stream, const char* fmt, va_list ap) return vsscanf(buffer, fmt, ap); } +void flockfile(FILE* filehandle) +{ + (void)filehandle; + dbgprintf("FIXME: Implement flockfile()\n"); +} + +void funlockfile(FILE* filehandle) +{ + (void)filehandle; + dbgprintf("FIXME: Implement funlockfile()\n"); +} + FILE* tmpfile() { dbgprintf("FIXME: Implement tmpfile()\n"); |