diff options
| author | Xavier Del Campo Romero <xavi92@disroot.org> | 2026-09-06 00:52:48 +0200 |
|---|---|---|
| committer | Xavier Del Campo Romero <xavi92@disroot.org> | 2026-09-26 23:30:45 +0200 |
| commit | bd7e4225d18207250cc312be601ae1615f62f0ad (patch) | |
| tree | 8378788f0f6d42ea0612011f5adeba6bccb50ae7 /src/prc1 | |
| parent | 3c0819236e4f07c8f57aaf1ca46d0d68aa761558 (diff) | |
| download | prc-bd7e4225d18207250cc312be601ae1615f62f0ad.tar.gz | |
Add prc front-end
Diffstat (limited to 'src/prc1')
| -rw-r--r-- | src/prc1/CMakeLists.txt | 3 | ||||
| -rw-r--r-- | src/prc1/kw.c | 2 | ||||
| -rw-r--r-- | src/prc1/prc1.c | 9 |
3 files changed, 9 insertions, 5 deletions
diff --git a/src/prc1/CMakeLists.txt b/src/prc1/CMakeLists.txt index 3579ca6..e2b9ad4 100644 --- a/src/prc1/CMakeLists.txt +++ b/src/prc1/CMakeLists.txt @@ -36,4 +36,5 @@ set_target_properties(prc1 PROPERTIES C_STANDARD 99 C_EXTENSIONS OFF) if(CMAKE_BUILD_TYPE STREQUAL "Debug") target_compile_options(prc1 PRIVATE -Og) endif() -# install(TARGETS prc1) +include(GNUInstallDirs) +install(TARGETS prc1 DESTINATION ${CMAKE_INSTALL_LIBEXECDIR}/${PROJECT_NAME}) diff --git a/src/prc1/kw.c b/src/prc1/kw.c index d5e22ca..c72ac97 100644 --- a/src/prc1/kw.c +++ b/src/prc1/kw.c @@ -18,7 +18,7 @@ static const char *kws[] = /* built-in functions */ "display", "warn", /* flow control */ - "while", "if", "else", "end", "return", "go", "label", "default", + "while", "if", "else", "end", "return", "go", "label", /*"default",*/ /* prepositions */ "by", "from", "to", "than", "of", "etc", /* comparators */ diff --git a/src/prc1/prc1.c b/src/prc1/prc1.c index 69165ba..6378907 100644 --- a/src/prc1/prc1.c +++ b/src/prc1/prc1.c @@ -14,16 +14,19 @@ int main(int argc, char *argv[]) FILE *f = stdin; int opened = 0, ret = EXIT_FAILURE; - if (argc != 2) + for (int i = 1; i < argc; i++) + fprintf(stderr, "[%d]=%s\n", i, argv[i]); + + if (argc < 2) { - fprintf(stderr, "%s: error: missing input file\n", *argv); + fprintf(stderr, "%s [options ...] file\n", *argv); goto end; } else if (strcmp(argv[1], "-")) { if (!(f = fopen(argv[1], "rb"))) { - fprintf(stderr, "failed to open %s: %s\n", argv[1], + fprintf(stderr, "%s: failed to open %s: %s\n", *argv, argv[1], strerror(errno)); goto end; } |
