Files
cpp-project-template/third_party/microprofile/stb/tools/trailing_whitespace.c
tqcq c8b9782baa
Some checks failed
sm-rpc / build (Debug, aarch64-linux-gnu) (push) Failing after 13m15s
sm-rpc / build (Release, mipsel-linux-gnu) (push) Failing after 13m1s
sm-rpc / build (Release, host.gcc) (push) Failing after 13m14s
sm-rpc / build (Release, arm-linux-gnueabihf) (push) Failing after 13m35s
sm-rpc / build (Release, aarch64-linux-gnu) (push) Failing after 13m56s
sm-rpc / build (Debug, mipsel-linux-gnu) (push) Failing after 14m22s
sm-rpc / build (Debug, host.gcc) (push) Failing after 14m49s
sm-rpc / build (Debug, arm-linux-gnueabihf) (push) Failing after 15m13s
feat add microprile, remove prometheus
2025-08-25 11:23:55 +08:00

33 lines
790 B
C

#define STB_DEFINE
#include "stb.h"
int main(int argc, char **argv)
{
int i;
for (i=1; i < argc; ++i) {
int len;
FILE *f;
char *s = stb_file(argv[i], &len);
char *end, *src, *dest;
if (s == NULL) {
printf("Couldn't read file '%s'.\n", argv[i]);
continue;
}
end = s + len;
src = dest = s;
while (src < end) {
char *start=0;
while (src < end && *src != '\n' && *src != '\r')
*dest++ = *src++;
while (dest-1 > s && (dest[-1] == ' ' || dest[-1] == '\t'))
--dest;
while (src < end && (*src == '\n' || *src == '\r'))
*dest++ = *src++;
}
f = fopen(argv[i], "wb");
fwrite(s, 1, dest-s, f);
fclose(f);
}
return 0;
}