add getline impl
This commit is contained in:
parent
86d72ffba3
commit
1da71680f7
5 changed files with 64 additions and 3 deletions
|
|
@ -5,6 +5,7 @@ include(GNUInstallDirs)
|
|||
macro(compile_tool name)
|
||||
file(GLOB ${name}_SRC ${name}/*.c)
|
||||
add_executable(${name} ${${name}_SRC})
|
||||
target_link_libraries(${name} PRIVATE GearSrc)
|
||||
install_target(${name})
|
||||
endmacro()
|
||||
|
||||
|
|
|
|||
|
|
@ -2,14 +2,16 @@
|
|||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <GearSrc/File.h>
|
||||
|
||||
#include <stb_image_write.h>
|
||||
|
||||
#define CHECK(s) ((linelen > strlen(s)) && memcmp(line, s, strlen(s)) == 0)
|
||||
|
||||
int main() {
|
||||
char* line = NULL;
|
||||
size_t linesize;
|
||||
ssize_t linelen;
|
||||
int linesize;
|
||||
int linelen;
|
||||
int iw, ih;
|
||||
unsigned char* font = NULL;
|
||||
int c;
|
||||
|
|
@ -17,7 +19,7 @@ int main() {
|
|||
int y = 0;
|
||||
int w, h;
|
||||
|
||||
while((linelen = getline(&line, &linesize, stdin)) != -1) {
|
||||
while((linelen = GSFileGetLine(&line, &linesize, stdin)) != -1) {
|
||||
linelen--;
|
||||
|
||||
line[linelen] = 0;
|
||||
Loading…
Add table
Add a link
Reference in a new issue