Compare commits

...

2 commits

Author SHA1 Message Date
Eric
59bd416dc7 improve Makefile 2025-06-11 23:26:43 +02:00
Eric
06b8c2a046 repair line wrap bug
A new line is wrongfully added to empty input when using the line wrap
option.
2025-05-30 13:28:47 +02:00
2 changed files with 5 additions and 5 deletions

View file

@ -1,7 +1,7 @@
CC = gcc CC ::= gcc
CFLAGS = -Og -g -Wall -Wextra -Werror CFLAGS ::= -Og -g -Wall -Wextra -Werror
objects = main.o input.o output.o encode.o objects ::= $(patsubst %.c, %.o, $(wildcard *.c))
b64 : $(objects) b64 : $(objects)
$(CC) -o b64 $(objects) $(CC) -o b64 $(objects)
@ -12,4 +12,4 @@ main.o output.o : output.h
.PHONY : clean .PHONY : clean
clean : clean :
rm -f b64 $(objects) -rm -f b64 $(objects)

2
main.c
View file

@ -58,7 +58,7 @@ main(int argc, char *argv[])
fwrite(obuf, sizeof(*obuf), n, (out) ? out : stdout); fwrite(obuf, sizeof(*obuf), n, (out) ? out : stdout);
} }
} else if (wrp) { } else if (wrp) {
last = 0; last = '\n';
while ((n = fread(obuf, sizeof(*obuf), OCTETBUF, (in) ? in : stdin))) { while ((n = fread(obuf, sizeof(*obuf), OCTETBUF, (in) ? in : stdin))) {
n = encode(obuf, n, sbuf, url); n = encode(obuf, n, sbuf, url);
last = printw((out) ? out : stdout, sbuf, n); last = printw((out) ? out : stdout, sbuf, n);