diff --git a/c/data/nlines/1 b/c/data/nlines/1 deleted file mode 100644 index 928a8893c..000000000 --- a/c/data/nlines/1 +++ /dev/null @@ -1 +0,0 @@ -a=wye,b=eks,i=0,x=0.641593543645736508,y=0.262688053894177098 diff --git a/c/data/nlines/10 b/c/data/nlines/10 new file mode 100644 index 000000000..aa771bb87 --- /dev/null +++ b/c/data/nlines/10 @@ -0,0 +1,10 @@ +a=wye,b=eks,i=0,x=0.641593543645736508,y=0.262688053894177098 +a=eks,b=zee,i=1,x=0.827614412562742041,y=0.715431942006308552 +a=zee,b=zee,i=2,x=0.923068348748175560,y=0.009737410587136359 +a=zee,b=pan,i=3,x=0.000047786161325772,y=0.803142013402256216 +a=zee,b=hat,i=4,x=0.676537984365847889,y=0.573903236805416328 +a=eks,b=pan,i=5,x=0.097245026890768221,y=0.397166953141413148 +a=zee,b=eks,i=6,x=0.508101613497408899,y=0.663818050950680916 +a=pan,b=wye,i=7,x=0.833840054382495643,y=0.349794006603674046 +a=eks,b=wye,i=8,x=0.350414154748625195,y=0.410698860143636768 +a=wye,b=hat,i=9,x=0.393088969119400222,y=0.646303989759787867 diff --git a/c/tools/catm.c b/c/tools/catm.c index 49b4b8d7f..8d72a6cc3 100644 --- a/c/tools/catm.c +++ b/c/tools/catm.c @@ -29,7 +29,7 @@ static int do_stream(char* file_name) { perror("fstat"); exit(1); } - char* sof = mmap(NULL, (size_t)stat.st_size, PROT_READ, MAP_FILE|MAP_PRIVATE, fd, (off_t)0); + char* sof = mmap(NULL, (size_t)stat.st_size, PROT_READ|PROT_WRITE, MAP_FILE|MAP_PRIVATE, fd, (off_t)0); if (sof == MAP_FAILED) { perror("mmap"); exit(1); @@ -41,9 +41,10 @@ static int do_stream(char* file_name) { while (p < eof) { if (*p == '\n') { - p++; + *p = 0; eol = p; emit(sol, eol, output_stream); + p++; sol = p; } else { p++;