diff --git a/.clang-format b/.clang-format new file mode 100644 index 0000000..a699815 --- /dev/null +++ b/.clang-format @@ -0,0 +1,23 @@ +TabWidth: 2 +IndentWidth: 2 +ContinuationIndentWidth: 2 +UseTab: Never +AllowShortBlocksOnASingleLine: Always +AllowShortCaseLabelsOnASingleLine: false +AllowShortEnumsOnASingleLine: true +AllowShortIfStatementsOnASingleLine: false +AllowShortLoopsOnASingleLine: false +AlwaysBreakAfterDefinitionReturnType: None +PenaltyReturnTypeOnItsOwnLine: 255 +IndentCaseLabels: true +SpaceBeforeParens: ControlStatements +AlignAfterOpenBracket: AlwaysBreak +BinPackArguments: false +BinPackArguments: false +PointerAlignment: Left +BreakBeforeBraces: Attach +SortIncludes: false +AllowAllArgumentsOnNextLine: false +AllowAllParametersOfDeclarationOnNextLine: false +AlignEscapedNewlines: Left + diff --git a/main.c b/main.c index 56862d7..a6cd917 100644 --- a/main.c +++ b/main.c @@ -33,7 +33,7 @@ WITH REGARD TO THIS SOFTWARE. /* clang-format on */ -struct dirent *dir; +struct dirent* dir; typedef struct Lexicon { int len, refs[512]; @@ -57,16 +57,16 @@ char *ccat(char *dst, char c) { int len = slen(dst); dst[len] = c; dst[len + 1] /* clang-format on */ -int fpinject(FILE *f, Lexicon *l, char *filepath); +int fpinject(FILE* f, Lexicon* l, char* filepath); -int error(char *msg, char *val) { +int error(char* msg, char* val) { printf("Error: %s(%s)\n", msg, val); return 0; } -int ismetanav(char *name) { return scmp(name, "meta.nav"); } +int ismetanav(char* name) { return scmp(name, "meta.nav"); } -int findf(Lexicon *l, char *f) { +int findf(Lexicon* l, char* f) { int i; char filename[64]; scat(scsw(stlc(scpy(f, filename, 64)), ' ', '_'), ".htm"); @@ -76,7 +76,7 @@ int findf(Lexicon *l, char *f) { return -1; } -void fpedited(FILE *f, char *path) { +void fpedited(FILE* f, char* path) { struct stat attr; stat(path, &attr); fputs("", f); @@ -84,7 +84,7 @@ void fpedited(FILE *f, char *path) { fputs("", f); } -int fpportal(FILE *f, Lexicon *l, char *s, int head) { +int fpportal(FILE* f, Lexicon* l, char* s, int head) { int target; char srcpath[64], filename[64]; target = findf(l, s); @@ -94,14 +94,18 @@ int fpportal(FILE *f, Lexicon *l, char *s, int head) { filename[0] = 0; scat(scat(scat(srcpath, "inc/"), scpy(s, filename, 64)), ".htm"); if (head) - fprintf(f, "