fix warnings

This commit is contained in:
2025-09-06 14:02:57 -04:00
parent baf086ab4b
commit a51f8c8075
2 changed files with 12 additions and 5 deletions

View File

@@ -113,6 +113,7 @@ int create_project(manifest_t manifest)
".POSIX:\nCC ::= gcc\nCFLAGS ::= -std=c23 -Wall -Wextra -Wpedantic\n\nall: %s\n\nclean\n\t$(RM) %s", ".POSIX:\nCC ::= gcc\nCFLAGS ::= -std=c23 -Wall -Wextra -Wpedantic\n\nall: %s\n\nclean\n\t$(RM) %s",
manifest.project, manifest.project); manifest.project, manifest.project);
break; break;
case BCOUNT:
default: default:
abort(); abort();
} }
@@ -131,14 +132,18 @@ int create_project(manifest_t manifest)
case UNL: case UNL:
cfprintf("COPYING", "%s", UNLICENSE_txt); cfprintf("COPYING", "%s", UNLICENSE_txt);
break; break;
case LCOUNT:
default: default:
abort(); abort();
} }
if (!manifest.git) { if (!manifest.git) {
fprintf(stderr, "Initializing git reposity"); fprintf(stderr, "Initializing git reposity");
system("git init --quiet"); status = system("git init --quiet");
fprintf(stderr, ", done.\n"); if (status)
fprintf(stderr, ", failed.\n");
else
fprintf(stderr, ", done.\n");
} }
if (manifest.build == AUTOTOOLS) { if (manifest.build == AUTOTOOLS) {
@@ -157,8 +162,10 @@ int create_project(manifest_t manifest)
} }
if (manifest.open_editor) { if (manifest.open_editor) {
snprintf(buffer, BUFSIZ, "nvim %s", main_source); snprintf(buffer, BUFSIZ, "$EDITOR %s", main_source);
system(buffer); status = system(buffer);
if (status)
fprintf(stderr, "Could not open editor");
} }
return 0; return 0;

View File

@@ -67,7 +67,7 @@ int getopt_long(int argc, char *const argv[], const char *optstring,
} }
if (argv[optind][1] == '-') { if (argv[optind][1] == '-') {
const char *arg = argv[optind] + 2; const char *arg = argv[optind] + 2;
const char *eq = strchr(arg, '='); char *eq = strchr(arg, '=');
size_t len = eq ? (size_t)(eq - arg) : strlen(arg); size_t len = eq ? (size_t)(eq - arg) : strlen(arg);
for (int i = 0; longopts[i].name; i++) { for (int i = 0; longopts[i].name; i++) {
if (strncmp(arg, longopts[i].name, len) == 0 && if (strncmp(arg, longopts[i].name, len) == 0 &&