This repository has been archived by the owner on Jun 20, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
2.8.0: Improve performance, write baz-cat in C and corectness fixes
Signed-off-by: Ari Archer <[email protected]>
- Loading branch information
Ari Archer
committed
Oct 22, 2022
1 parent
afdd49d
commit 02d3bd9
Showing
5 changed files
with
52 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
#include <stdio.h> | ||
|
||
/* | ||
* Improved performance, C89 compatible cat(1) for `baz` usage, | ||
* this will read input and then print it | ||
*/ | ||
|
||
int main(void) { | ||
static char c; | ||
|
||
/* | ||
* This is kind of an implementation of puts lol, | ||
* it doesn't really slow down the program, but | ||
* I have to read it char-by-char to support | ||
* unicode | ||
*/ | ||
while ((c = getchar()) != EOF) | ||
putchar(c); | ||
|
||
#ifdef MANUAL_FLUSH | ||
/* | ||
* Enable this with -DMANUAL_FLUSH if you want | ||
* to manually flush stdout on call, although | ||
* C already has auto flushing to cover most | ||
* cases and this just slows the program down | ||
*/ | ||
|
||
fflush(stdout); | ||
#endif | ||
|
||
return 0; | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters