fix: correct clang-format and other files
This commit is contained in:
108
.clang-format
Normal file
108
.clang-format
Normal file
@@ -0,0 +1,108 @@
|
||||
---
|
||||
AccessModifierOffset: -4
|
||||
AlignAfterOpenBracket: Align
|
||||
AlignConsecutiveAssignments: false
|
||||
AlignConsecutiveDeclarations: false
|
||||
AlignEscapedNewlines: Left
|
||||
AlignOperands: true
|
||||
AlignTrailingComments: false
|
||||
AllowAllParametersOfDeclarationOnNextLine: false
|
||||
AllowShortBlocksOnASingleLine: false
|
||||
AllowShortCaseLabelsOnASingleLine: false
|
||||
AllowShortFunctionsOnASingleLine: None
|
||||
AllowShortIfStatementsOnASingleLine: false
|
||||
AllowShortLoopsOnASingleLine: false
|
||||
AlwaysBreakAfterDefinitionReturnType: None
|
||||
AlwaysBreakAfterReturnType: None
|
||||
AlwaysBreakBeforeMultilineStrings: false
|
||||
AlwaysBreakTemplateDeclarations: false
|
||||
BinPackArguments: true
|
||||
BinPackParameters: true
|
||||
BraceWrapping:
|
||||
AfterClass: false
|
||||
AfterControlStatement: false
|
||||
AfterEnum: false
|
||||
AfterFunction: true
|
||||
AfterNamespace: true
|
||||
AfterObjCDeclaration: false
|
||||
AfterStruct: false
|
||||
AfterUnion: false
|
||||
AfterExternBlock: false
|
||||
BeforeCatch: false
|
||||
BeforeElse: false
|
||||
IndentBraces: false
|
||||
SplitEmptyFunction: true
|
||||
SplitEmptyRecord: true
|
||||
SplitEmptyNamespace: true
|
||||
BreakBeforeBinaryOperators: None
|
||||
BreakBeforeBraces: Custom
|
||||
BreakBeforeInheritanceComma: false
|
||||
BreakBeforeTernaryOperators: false
|
||||
BreakConstructorInitializersBeforeComma: false
|
||||
BreakConstructorInitializers: BeforeComma
|
||||
BreakAfterJavaFieldAnnotations: false
|
||||
BreakStringLiterals: false
|
||||
ColumnLimit: 80
|
||||
CommentPragmas: '^ IWYU pragma:'
|
||||
CompactNamespaces: false
|
||||
ConstructorInitializerAllOnOneLineOrOnePerLine: false
|
||||
ConstructorInitializerIndentWidth: 8
|
||||
ContinuationIndentWidth: 8
|
||||
Cpp11BracedListStyle: false
|
||||
DerivePointerAlignment: false
|
||||
DisableFormat: false
|
||||
ExperimentalAutoDetectBinPacking: false
|
||||
FixNamespaceComments: false
|
||||
|
||||
IncludeBlocks: Preserve
|
||||
IncludeCategories:
|
||||
- Regex: '.*'
|
||||
Priority: 1
|
||||
IncludeIsMainRegex: '(Test)?$'
|
||||
IndentCaseLabels: false
|
||||
IndentGotoLabels: false
|
||||
IndentPPDirectives: None
|
||||
IndentWidth: 8
|
||||
IndentWrappedFunctionNames: false
|
||||
JavaScriptQuotes: Leave
|
||||
JavaScriptWrapImports: true
|
||||
KeepEmptyLinesAtTheStartOfBlocks: false
|
||||
MacroBlockBegin: ''
|
||||
MacroBlockEnd: ''
|
||||
MaxEmptyLinesToKeep: 1
|
||||
NamespaceIndentation: None
|
||||
ObjCBinPackProtocolList: Auto
|
||||
ObjCBlockIndentWidth: 8
|
||||
ObjCSpaceAfterProperty: true
|
||||
ObjCSpaceBeforeProtocolList: true
|
||||
|
||||
PenaltyBreakAssignment: 10
|
||||
PenaltyBreakBeforeFirstCallParameter: 30
|
||||
PenaltyBreakComment: 10
|
||||
PenaltyBreakFirstLessLess: 0
|
||||
PenaltyBreakString: 10
|
||||
PenaltyExcessCharacter: 100
|
||||
PenaltyReturnTypeOnItsOwnLine: 60
|
||||
|
||||
PointerAlignment: Right
|
||||
ReflowComments: false
|
||||
SortIncludes: false
|
||||
SortUsingDeclarations: false
|
||||
SpaceAfterCStyleCast: false
|
||||
SpaceAfterTemplateKeyword: true
|
||||
SpaceBeforeAssignmentOperators: true
|
||||
SpaceBeforeCtorInitializerColon: true
|
||||
SpaceBeforeInheritanceColon: true
|
||||
SpaceBeforeParens: ControlStatementsExceptForEachMacros
|
||||
SpaceBeforeRangeBasedForLoopColon: true
|
||||
SpaceInEmptyParentheses: false
|
||||
SpacesBeforeTrailingComments: 1
|
||||
SpacesInAngles: false
|
||||
SpacesInContainerLiterals: false
|
||||
SpacesInCStyleCastParentheses: false
|
||||
SpacesInParentheses: false
|
||||
SpacesInSquareBrackets: false
|
||||
Standard: Cpp03
|
||||
TabWidth: 8
|
||||
UseTab: Always
|
||||
...
|
||||
7
.clangd
Normal file
7
.clangd
Normal file
@@ -0,0 +1,7 @@
|
||||
CompileFlags:
|
||||
Add: [-x, c, -std=c2x]
|
||||
|
||||
Diagnostics:
|
||||
ClangTidy:
|
||||
Add: [clang-diagnostic-*]
|
||||
Remove: []
|
||||
5
.gitignore
vendored
Normal file
5
.gitignore
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
bin/
|
||||
build/
|
||||
*.o
|
||||
config.mak
|
||||
config.status
|
||||
@@ -1,3 +0,0 @@
|
||||
PREFIX=/usr/local
|
||||
CFLAGS=-pedantic -O0 -ggdb -Wall -Wextra -Wpedantic -fno-omit-frame-pointer -DDEBUG
|
||||
CC=gcc
|
||||
@@ -1,44 +0,0 @@
|
||||
#!/bin/sh
|
||||
# DO NOT MODIFY. THIS IS A AUTOGENERATED SCRIPT FROM 'configure'
|
||||
#
|
||||
# COMPILATION (Linux - POSIX):
|
||||
# ./config.status
|
||||
#
|
||||
#
|
||||
# LICENSE: BSD-3-Clause
|
||||
#
|
||||
# Copyright (c) 2025 GCK
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions are met:
|
||||
#
|
||||
# 1. Redistributions of source code must retain the above copyright notice, this
|
||||
# list of conditions and the following disclaimer.
|
||||
#
|
||||
# 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
# this list of conditions and the following disclaimer in the documentation
|
||||
# and/or other materials provided with the distribution.
|
||||
#
|
||||
# 3. Neither the name of the copyright holder nor the names of its
|
||||
# contributors may be used to endorse or promote products derived from
|
||||
# this software without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#
|
||||
|
||||
printf "config.status: recreating config.mak... "
|
||||
{
|
||||
printf "PREFIX=%s\n" "/usr/local"
|
||||
printf "CFLAGS=%s\n" "-pedantic -O0 -ggdb -Wall -Wextra -Wpedantic -fno-omit-frame-pointer -DDEBUG"
|
||||
printf "CC=%s\n" "gcc"
|
||||
} > config.status
|
||||
printf "done\n"
|
||||
50
lib/err.c
50
lib/err.c
@@ -51,7 +51,8 @@
|
||||
#define NOTE "\x1B[1;94m"
|
||||
#define HINT "\x1B[38;5;166m"
|
||||
|
||||
static bool err_support_color(void) {
|
||||
static bool err_support_color(void)
|
||||
{
|
||||
#ifdef NOCOLOR
|
||||
return false;
|
||||
#else
|
||||
@@ -84,9 +85,10 @@ static bool err_support_color(void) {
|
||||
return false;
|
||||
}
|
||||
if (strstr(term, "color") || strstr(term, "xterm") ||
|
||||
strstr(term, "screen") || strstr(term, "vt100") || strstr(term, "rxvt") ||
|
||||
strstr(term, "ansi") || strstr(term, "linux") ||
|
||||
strstr(term, "konsole") || strstr(term, "vte") || strstr(term, "kitty") ||
|
||||
strstr(term, "screen") || strstr(term, "vt100") ||
|
||||
strstr(term, "rxvt") || strstr(term, "ansi") ||
|
||||
strstr(term, "linux") || strstr(term, "konsole") ||
|
||||
strstr(term, "vte") || strstr(term, "kitty") ||
|
||||
strstr(term, "wezterm") || strstr(term, "gnome")) {
|
||||
cached = 1;
|
||||
return true;
|
||||
@@ -96,7 +98,8 @@ static bool err_support_color(void) {
|
||||
#endif
|
||||
}
|
||||
|
||||
void errorf(const char *format, ...) {
|
||||
void errorf(const char *format, ...)
|
||||
{
|
||||
va_list args;
|
||||
va_start(args, format);
|
||||
|
||||
@@ -111,7 +114,8 @@ void errorf(const char *format, ...) {
|
||||
|
||||
va_end(args);
|
||||
}
|
||||
void fatalf(const char *format, ...) {
|
||||
void fatalf(const char *format, ...)
|
||||
{
|
||||
va_list args;
|
||||
va_start(args, format);
|
||||
|
||||
@@ -129,7 +133,8 @@ void fatalf(const char *format, ...) {
|
||||
fputs("program terminated.\n", stderr);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
void warnf(const char *format, ...) {
|
||||
void warnf(const char *format, ...)
|
||||
{
|
||||
va_list args;
|
||||
va_start(args, format);
|
||||
|
||||
@@ -144,7 +149,8 @@ void warnf(const char *format, ...) {
|
||||
|
||||
va_end(args);
|
||||
}
|
||||
void notef(const char *format, ...) {
|
||||
void notef(const char *format, ...)
|
||||
{
|
||||
va_list args;
|
||||
va_start(args, format);
|
||||
|
||||
@@ -159,7 +165,8 @@ void notef(const char *format, ...) {
|
||||
|
||||
va_end(args);
|
||||
}
|
||||
void hintf(const char *format, ...) {
|
||||
void hintf(const char *format, ...)
|
||||
{
|
||||
va_list args;
|
||||
va_start(args, format);
|
||||
|
||||
@@ -180,14 +187,29 @@ void hintf(const char *format, ...) {
|
||||
va_end(args);
|
||||
}
|
||||
|
||||
void errorfa(int code) { errorf(strerror(code)); }
|
||||
void errorfa(int code)
|
||||
{
|
||||
errorf(strerror(code));
|
||||
}
|
||||
|
||||
void fatalfa(int code) { fatalf(strerror(code)); }
|
||||
void fatalfa(int code)
|
||||
{
|
||||
fatalf(strerror(code));
|
||||
}
|
||||
|
||||
void notefa(int code) { notef(strerror(code)); }
|
||||
void notefa(int code)
|
||||
{
|
||||
notef(strerror(code));
|
||||
}
|
||||
|
||||
void warnfa(int code) { warnf(strerror(code)); }
|
||||
void warnfa(int code)
|
||||
{
|
||||
warnf(strerror(code));
|
||||
}
|
||||
|
||||
void hintfa(int code) { hintf(strerror(code)); }
|
||||
void hintfa(int code)
|
||||
{
|
||||
hintf(strerror(code));
|
||||
}
|
||||
|
||||
/* end of file err.c */
|
||||
|
||||
15
lib/flag.c
15
lib/flag.c
@@ -43,7 +43,8 @@
|
||||
static char *nextchar;
|
||||
|
||||
int getopt_long(int argc, char *const argv[], const char *optstring,
|
||||
const struct option *longopts, int *longindex) {
|
||||
const struct option *longopts, int *longindex)
|
||||
{
|
||||
if (nextchar == NULL || *nextchar == '\0') {
|
||||
if (optind >= argc)
|
||||
return -1;
|
||||
@@ -62,20 +63,24 @@ int getopt_long(int argc, char *const argv[], const char *optstring,
|
||||
strlen(longopts[i].name) == len) {
|
||||
if (longindex)
|
||||
*longindex = i;
|
||||
if (longopts[i].has_arg == required_argument) {
|
||||
if (longopts[i].has_arg ==
|
||||
required_argument) {
|
||||
if (eq)
|
||||
optarg = (char *)eq + 1;
|
||||
else if (optind + 1 < argc)
|
||||
optarg = argv[++optind];
|
||||
else
|
||||
return '?';
|
||||
} else if (longopts[i].has_arg == optional_argument)
|
||||
optarg = eq ? (char *)eq + 1 : NULL;
|
||||
} else if (longopts[i].has_arg ==
|
||||
optional_argument)
|
||||
optarg = eq ? (char *)eq + 1 :
|
||||
NULL;
|
||||
else
|
||||
optarg = NULL;
|
||||
optind++;
|
||||
if (longopts[i].flag) {
|
||||
*longopts[i].flag = longopts[i].val;
|
||||
*longopts[i].flag =
|
||||
longopts[i].val;
|
||||
return 0;
|
||||
}
|
||||
return longopts[i].val;
|
||||
|
||||
23
lib/fs.c
23
lib/fs.c
@@ -62,7 +62,8 @@
|
||||
#define RETURN(code) fatalfa(code)
|
||||
#endif
|
||||
|
||||
char *fs_read(const char *path) {
|
||||
char *fs_read(const char *path)
|
||||
{
|
||||
FILE *fptr = fopen(path, "r");
|
||||
if (!fptr) {
|
||||
#if defined(FS_ERROR_ON)
|
||||
@@ -97,7 +98,8 @@ char *fs_read(const char *path) {
|
||||
return buf;
|
||||
}
|
||||
|
||||
bool fs_exists(const char *path) {
|
||||
bool fs_exists(const char *path)
|
||||
{
|
||||
FILE *fptr;
|
||||
bool exists;
|
||||
|
||||
@@ -112,7 +114,8 @@ bool fs_exists(const char *path) {
|
||||
return exists;
|
||||
}
|
||||
|
||||
int fs_append(const char *path, const char *format, ...) {
|
||||
int fs_append(const char *path, const char *format, ...)
|
||||
{
|
||||
FILE *fp = fopen(path, "a");
|
||||
if (!fp)
|
||||
RETURN(errno);
|
||||
@@ -133,9 +136,13 @@ int fs_append(const char *path, const char *format, ...) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
int fs_del(const char *path) { RETURN(remove(path)); }
|
||||
int fs_del(const char *path)
|
||||
{
|
||||
RETURN(remove(path));
|
||||
}
|
||||
|
||||
int fs_new(const char *path) {
|
||||
int fs_new(const char *path)
|
||||
{
|
||||
size_t len;
|
||||
int fd;
|
||||
|
||||
@@ -163,7 +170,8 @@ int fs_new(const char *path) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
int fs_write(const char *path, const char *format, ...) {
|
||||
int fs_write(const char *path, const char *format, ...)
|
||||
{
|
||||
FILE *fptr = fopen(path, "w");
|
||||
if (!fptr)
|
||||
RETURN(-1);
|
||||
@@ -184,7 +192,8 @@ int fs_write(const char *path, const char *format, ...) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
FILE *fs_temp() {
|
||||
FILE *fs_temp()
|
||||
{
|
||||
FILE *fptr = tmpfile();
|
||||
|
||||
if (!fptr) {
|
||||
|
||||
@@ -44,13 +44,18 @@
|
||||
/* TODO(vx-clutch): default this to argv[0] */
|
||||
const char *prog_name = "";
|
||||
|
||||
void set_prog_name(char *name) { prog_name = prog_name ? basename(name) : ""; }
|
||||
void set_prog_name(char *name)
|
||||
{
|
||||
prog_name = prog_name ? basename(name) : "";
|
||||
}
|
||||
|
||||
void emit_try_help() {
|
||||
void emit_try_help()
|
||||
{
|
||||
printf("Try '%s --help' for more information\n", prog_name);
|
||||
}
|
||||
|
||||
void emit_version() {
|
||||
void emit_version()
|
||||
{
|
||||
printf("\
|
||||
%s %s %d\n\
|
||||
Copyright (C) %d GCK.\n\
|
||||
@@ -61,7 +66,8 @@ There is NO WARRNTY, to the extent permitted by law.\n\
|
||||
}
|
||||
|
||||
int parse_standard_options(int argc, char **argv, void (*print_help)(),
|
||||
void (*print_version)()) {
|
||||
void (*print_version)())
|
||||
{
|
||||
for (int i = 0; i < argc; ++i) {
|
||||
if (!strcmp(argv[i], "--help")) {
|
||||
print_help();
|
||||
|
||||
15
lib/say.c
15
lib/say.c
@@ -44,19 +44,22 @@
|
||||
|
||||
#include "xmem.h"
|
||||
|
||||
void alert() {
|
||||
void alert()
|
||||
{
|
||||
fputs("\a", stderr);
|
||||
fflush(stderr);
|
||||
return;
|
||||
}
|
||||
|
||||
int vasprintf(char **result, const char *fmt, va_list ap) {
|
||||
int vasprintf(char **result, const char *fmt, va_list ap)
|
||||
{
|
||||
int total_width = strlen(fmt) + 1;
|
||||
*result = (char *)xmalloc(total_width);
|
||||
return vsprintf(*result, fmt, ap);
|
||||
}
|
||||
|
||||
int asprintf(char **buf, const char *fmt, ...) {
|
||||
int asprintf(char **buf, const char *fmt, ...)
|
||||
{
|
||||
int status;
|
||||
va_list ap;
|
||||
va_start(ap, fmt);
|
||||
@@ -65,7 +68,8 @@ int asprintf(char **buf, const char *fmt, ...) {
|
||||
return status;
|
||||
}
|
||||
|
||||
int say(const char *restrict format, ...) {
|
||||
int say(const char *restrict format, ...)
|
||||
{
|
||||
struct winsize w;
|
||||
if (ioctl(STDOUT_FILENO, TIOCGWINSZ, &w) == -1) {
|
||||
va_list args;
|
||||
@@ -93,7 +97,8 @@ int say(const char *restrict format, ...) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
_Noreturn void die(const char *msg) {
|
||||
_Noreturn void die(const char *msg)
|
||||
{
|
||||
fputs(msg, stderr);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
17
lib/textc.c
17
lib/textc.c
@@ -39,29 +39,36 @@
|
||||
|
||||
#include "textc.h"
|
||||
|
||||
char *str_dup(char *s) {
|
||||
char *str_dup(char *s)
|
||||
{
|
||||
char *new = xmalloc(strlen(s) + 1);
|
||||
strcpy(new, s);
|
||||
return new;
|
||||
}
|
||||
|
||||
char *tostrupr(char *s) {
|
||||
char *tostrupr(char *s)
|
||||
{
|
||||
char *new = str_dup(s);
|
||||
for (int i = 0; new[i] != '\0'; ++i)
|
||||
new[i] = toupper((unsigned char)new[i]);
|
||||
return new;
|
||||
}
|
||||
|
||||
char *tostrlwr(char *s) {
|
||||
char *tostrlwr(char *s)
|
||||
{
|
||||
char *new = str_dup(s);
|
||||
for (int i = 0; new[i] != '\0'; ++i)
|
||||
new[i] = tolower((unsigned char)new[i]);
|
||||
return new;
|
||||
}
|
||||
|
||||
char *textc_trim(char *s) { return NULL; }
|
||||
char *textc_trim(char *s)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
char *textc_pad_left(int count, char *s, char pad) {
|
||||
char *textc_pad_left(int count, char *s, char pad)
|
||||
{
|
||||
char *buffer = xmalloc(strlen(s) + 1);
|
||||
|
||||
free(buffer);
|
||||
|
||||
14
lib/xmem.c
14
lib/xmem.c
@@ -40,19 +40,25 @@
|
||||
|
||||
#include "xmem.h"
|
||||
|
||||
void *ensure_nonnull(void *ptr) {
|
||||
void *ensure_nonnull(void *ptr)
|
||||
{
|
||||
if (ptr == NULL)
|
||||
fatalf("memory exhausted");
|
||||
return ptr;
|
||||
}
|
||||
|
||||
void *xmalloc(size_t size) { return ensure_nonnull(malloc(size)); }
|
||||
void *xmalloc(size_t size)
|
||||
{
|
||||
return ensure_nonnull(malloc(size));
|
||||
}
|
||||
|
||||
void *xrealloc(void *ptr, size_t size) {
|
||||
void *xrealloc(void *ptr, size_t size)
|
||||
{
|
||||
return ensure_nonnull(realloc(ptr, size));
|
||||
}
|
||||
|
||||
void *xcalloc(size_t nmemb, size_t size) {
|
||||
void *xcalloc(size_t nmemb, size_t size)
|
||||
{
|
||||
return ensure_nonnull(calloc(nmemb, size));
|
||||
}
|
||||
|
||||
|
||||
30
src/yait.c
30
src/yait.c
@@ -67,11 +67,13 @@
|
||||
|
||||
typedef enum { MIT, GPL, BSD, UNL } licence_t;
|
||||
|
||||
static const struct option longopts[] = {{"author", required_argument, 0, 'a'},
|
||||
static const struct option longopts[] = {
|
||||
{ "author", required_argument, 0, 'a' },
|
||||
{ "licence", required_argument, 0, 'l' },
|
||||
{ "quiet", no_argument, 0, 'q' },
|
||||
{ "force", no_argument, 0, 'f' },
|
||||
{0, 0, 0, 0}};
|
||||
{ 0, 0, 0, 0 }
|
||||
};
|
||||
|
||||
static int exit_status;
|
||||
|
||||
@@ -80,7 +82,8 @@ static void print_version();
|
||||
|
||||
static char *source_replace(const char *restrict template,
|
||||
const char *restrict package,
|
||||
const char *restrict author) {
|
||||
const char *restrict author)
|
||||
{
|
||||
/*
|
||||
* XXX(vx-clutch):
|
||||
* - package token : {{PACKAGE}}
|
||||
@@ -94,7 +97,8 @@ static char *source_replace(const char *restrict template,
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static char *get_name() {
|
||||
static char *get_name()
|
||||
{
|
||||
int fds[2];
|
||||
if (pipe(fds) == -1)
|
||||
goto sysuser;
|
||||
@@ -110,7 +114,8 @@ static char *get_name() {
|
||||
dup2(fds[1], STDOUT_FILENO);
|
||||
close(fds[0]);
|
||||
close(fds[1]);
|
||||
execlp("git", "git", "config", "--get", "user.name", (char *)NULL);
|
||||
execlp("git", "git", "config", "--get", "user.name",
|
||||
(char *)NULL);
|
||||
_exit(127);
|
||||
}
|
||||
|
||||
@@ -137,14 +142,16 @@ sysuser: {
|
||||
return str_dup("author");
|
||||
}
|
||||
|
||||
static int get_year() {
|
||||
static int get_year()
|
||||
{
|
||||
time_t now = time(NULL);
|
||||
struct tm *t = localtime(&now);
|
||||
|
||||
return t->tm_year + 1900;
|
||||
}
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
int optc;
|
||||
int lose = 0;
|
||||
char *package;
|
||||
@@ -160,7 +167,8 @@ int main(int argc, char **argv) {
|
||||
|
||||
parse_standard_options(argc, argv, print_help, print_version);
|
||||
|
||||
while ((optc = getopt_long(argc, argv, "a:l:EqfS", longopts, NULL)) != -1)
|
||||
while ((optc = getopt_long(argc, argv, "a:l:EqfS", longopts, NULL)) !=
|
||||
-1)
|
||||
switch (optc) {
|
||||
case 'a':
|
||||
if (optarg) {
|
||||
@@ -1029,7 +1037,8 @@ end of file TODO\
|
||||
return exit_status;
|
||||
}
|
||||
|
||||
static void print_help() {
|
||||
static void print_help()
|
||||
{
|
||||
printf("Usage: %s [OPTION]... [project-name]...\n", PROGRAM);
|
||||
fputs("\
|
||||
Generates an opinionated C project.\n",
|
||||
@@ -1050,7 +1059,8 @@ Generates an opinionated C project.\n",
|
||||
exit(exit_status);
|
||||
}
|
||||
|
||||
static void print_version() {
|
||||
static void print_version()
|
||||
{
|
||||
printf("%s %s %d\n", prog_name, VERSION, COMMIT);
|
||||
|
||||
printf("Copyright (C) %d GCK.\n", YEAR);
|
||||
|
||||
Reference in New Issue
Block a user