Simplify the clang example template.

pull/9/head
Joshua Potter 2023-11-23 04:10:04 -07:00
parent be95ee0fc5
commit 81500d3087
6 changed files with 13 additions and 16 deletions

9
main.c
View File

@ -4,6 +4,8 @@
#include "config.h"
#include "dyn_array.h"
const char *ENV_SPEC_ROOT_DIR = "SPEC_ROOT_DIR";
int main(int argc, char **argv) {
int num = 0;
@ -12,8 +14,10 @@ int main(int argc, char **argv) {
exit(EXIT_FAILURE);
}
const char *root_dir = getenv(ENV_SPEC_ROOT_DIR);
struct Config config;
switch (load_config(argv[1], &config)) {
switch (load_config(root_dir, argv[1], &config)) {
case ENV_SPEC_ROOT_DIR_MISSING:
fprintf(stderr, "Must specify $SPEC_ROOT_DIR environment variable.");
exit(EXIT_FAILURE);
@ -23,9 +27,6 @@ int main(int argc, char **argv) {
case INVALID_TARGET:
fprintf(stderr, "Target spec `%s` is invalid.", argv[1]);
exit(EXIT_FAILURE);
default:
// A return value of `0` indicates no issue.
break;
}
free_config(&config);

View File

@ -1,7 +1,3 @@
#!/usr/bin/env bash
if [ -z "$VERSION" ]; then
VERSION="default"
fi
cp "$VERSION/flake.nix" "$OUT"
cp -r "template/*" "$OUT"

View File

@ -1,5 +0,0 @@
{
"versions": [
"default"
]
}

View File

@ -0,0 +1,3 @@
#!/usr/bin/env bash
use flake

View File

@ -14,7 +14,6 @@
pkgs = nixpkgs.legacyPackages.${system};
codelldb = pkgs.writeShellScriptBin "codelldb" ''
#!/usr/bin/env bash
exec ${pkgs.vscode-extensions.vadimcn.vscode-lldb}/share/vscode/extensions/vadimcn.vscode-lldb/adapter/codelldb "$@"
'';
in

View File

@ -0,0 +1,3 @@
#include <stdlib.h>
int main(int argc, char **argv) { return EXIT_SUCCESS; }