Compare commits

..

No commits in common. "master" and "1.0" have entirely different histories.
master ... 1.0

3 changed files with 13 additions and 20 deletions

View file

@ -11,9 +11,9 @@ INCS =
LIBS = LIBS =
# flags # flags
CPPFLAGS = -DVERSION=\"${VERSION}\" -D_XOPEN_SOURCE=500 CPPFLAGS = -DVERSION=\"${VERSION}\"
CFLAGS = -std=c99 -pedantic -Wall -Os ${INCS} ${CPPFLAGS} CFLAGS = -std=c99 -pedantic -Wall -Os ${INCS} ${CPPFLAGS}
LDFLAGS = -static -s ${LIBS} LDFLAGS = -s ${LIBS}
# compiler and linker # compiler and linker
CC = cc CC = cc

25
slow.c
View file

@ -1,3 +1,4 @@
#define _XOPEN_SOURCE 500
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h> #include <stdio.h>
#include <unistd.h> #include <unistd.h>
@ -6,18 +7,12 @@
char *argv0; char *argv0;
static void usage(void); void usage() {
void
usage()
{
fprintf(stderr, "usage: %s [-t usec] [-f]\n", argv0); fprintf(stderr, "usage: %s [-t usec] [-f]\n", argv0);
exit(1); exit(EXIT_FAILURE);
} }
int int main(int argc, char *argv[]) {
main(int argc, char *argv[])
{
char buffer; char buffer;
size_t nread; size_t nread;
useconds_t useconds = 1000000; // default 1 second useconds_t useconds = 1000000; // default 1 second
@ -36,20 +31,18 @@ main(int argc, char *argv[])
while ((nread = fread(&buffer, 1, sizeof buffer, stdin)) > 0) { while ((nread = fread(&buffer, 1, sizeof buffer, stdin)) > 0) {
usleep(useconds); usleep(useconds);
if (fwrite(&buffer, 1, nread, stdout) != nread) { if (fwrite(&buffer, 1, nread, stdout) != nread) {
fprintf(stderr, "stdout: write error"); fprintf(stderr, "stdout: write error");
exit(1); exit(EXIT_FAILURE);
} }
if (flush) {
if (flush)
fflush(stdout); fflush(stdout);
} }
}
if (ferror(stdin)) { if (ferror(stdin)) {
fprintf(stderr, "stdin: read error"); fprintf(stderr, "stdin: read error");
exit(1); exit(EXIT_FAILURE);
} }
return 0; return EXIT_SUCCESS;
} }