From: Lukas Krickl Date: Mon, 20 Nov 2023 18:33:25 +0000 (+0100) Subject: Made '-' a constant X-Git-Url: https://git.krickl.dev/?a=commitdiff_plain;h=78403e02b225c38392fd9a6bd0ab0fca85c63d75;p=ulas%2F.git Made '-' a constant --- diff --git a/include/ulas.h b/include/ulas.h index 0f37c43..2937c39 100644 --- a/include/ulas.h +++ b/include/ulas.h @@ -5,6 +5,9 @@ #include #include +// if this is used as a path use stdin or stdout instead +#define ULAS_STDFILEPATH "-" + #define ULAS_PATHMAX 4096 #define ULAS_LINEMAX 4096 #define ULAS_OUTBUFMAX 64 @@ -66,16 +69,16 @@ } /** - * Output target files + * Output target files */ -// input file for source reader +// input file for source reader extern FILE *ulasin; -// source code output target +// source code output target extern FILE *ulasout; // error output target extern FILE *ulaserr; -// assembly listing output +// assembly listing output extern FILE *ulaslstout; // symbol list output extern FILE *ulassymout; diff --git a/src/ulas.c b/src/ulas.c index 903b739..a8b259e 100644 --- a/src/ulas.c +++ b/src/ulas.c @@ -56,7 +56,7 @@ struct ulas_config ulas_cfg_from_env(void) { } FILE *ulas_fopen(const char *path, const char *mode, FILE *stdfile) { - if (!path || strncmp(path, "-", 1) == 0) { + if (!path || strncmp(path, ULAS_STDFILEPATH, 1) == 0) { return stdfile; } FILE *f = fopen(path, mode);