diff options
author | Aaron Ball <nullspoon@oper.io> | 2021-01-17 23:52:11 -0700 |
---|---|---|
committer | Aaron Ball <nullspoon@oper.io> | 2021-01-17 23:52:11 -0700 |
commit | 8a35f9a21fe0c58aabf964c4863e758c43065c27 (patch) | |
tree | 8c59dff45dca634b2ace1891ff01ea228155f117 | |
parent | 192b938dbced8c02ce0b8869a797a31285e7e34e (diff) | |
download | oper.io-8a35f9a21fe0c58aabf964c4863e758c43065c27.tar.gz oper.io-8a35f9a21fe0c58aabf964c4863e758c43065c27.tar.xz |
j2_cat:switch printf to puts where appropriate
This should reduce cpu cycles since the format strings were unused other
than just to print to stdout.
-rw-r--r-- | src/j2.c | 6 |
1 files changed, 3 insertions, 3 deletions
@@ -78,7 +78,7 @@ int j2_cat(char* path) { varstart = j2_strstr(line); if(!varstart) { - printf("%s", line); + fputs(line, stdout); continue; } varend = j2_readvar(varstart, buf, J2_MAXBUF); @@ -87,13 +87,13 @@ int j2_cat(char* path) { // (this overwrites the first { that opens the variable def) *varstart = '\0'; // Because of the inserted null byte, this will print from byte 0 to there - printf("%s", line); + fputs(line, stdout); // Execute the variable directive and print the output if(strncmp(buf, "shell ", 6) == 0) { // Execute the provided shell command and print that value = runsh(&buf[6]); - printf("%s", value); + fputs(value, stdout); free(value); } else { // Print the referenced environment variable |