aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--LICENSE21
-rw-r--r--README.md20
-rw-r--r--rf.c12
-rw-r--r--rfile7
4 files changed, 58 insertions, 2 deletions
diff --git a/LICENSE b/LICENSE
new file mode 100644
index 0000000..2de8f20
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,21 @@
+MIT License
+
+Copyright (c) 2026 czjstmax <jstmaxlol at disroot dot org>
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
diff --git a/README.md b/README.md
index 86d40be..41ca9dc 100644
--- a/README.md
+++ b/README.md
@@ -4,6 +4,26 @@ a **suckless** and **minimal**, **POSIX C99** alternative to `Makefile`/`justfil
---
+## install `rf`
+
+you can either install the AUR package `rf` with your favourite AUR helper
+
+or build rfile manually with `gcc` or any other POSIX C99 compiler
+
+---
+
+## extra compile options
+
+you can enable the following flags to enable extra feautures for `rf`:
+
+> using `gcc` you can do `gcc -D FLAG_NAME ...`
+
+- `RF_EXTRAS`: enables all `EXTRA_*` features
+- `RF_EXTRA_MORE_COMMENTS`: enables `//` and `--` comments for `rfile`s
+- `RF_HIDDEN_CMD`: hides the `$ cmd` for commands
+
+---
+
## `rfile` syntax & features
- `#` -> ignore line (comment)
diff --git a/rf.c b/rf.c
index b78524a..441f105 100644
--- a/rf.c
+++ b/rf.c
@@ -15,8 +15,8 @@
#define _POSIX_C_SOURCE 200809L
#define RUNFILE_VER_MAJ 1
-#define RUNFILE_VER_MIN 2
-#define RUNFILE_VER_FIX 5
+#define RUNFILE_VER_MIN 3
+#define RUNFILE_VER_FIX 0
/*
*> rfile version system
@@ -89,6 +89,12 @@ int main(int argc, char **argv)
else if (cmd[0] == '#') /* TODO: strchr() up to # and trim cmd to only skip
the commented-out part to allow in-line comments */
continue;
+ #if defined(RF_EXTRAS) || defined(RF_EXTRA_MORE_COMMENTS)
+ else if (strncmp(cmd, "// ", 3) == 0)
+ continue;
+ else if (strncmp(cmd, "-- ", 3) == 0)
+ continue;
+ #endif
else if (strcmp(cmd, "}") == 0 || strcmp(line, "}") == 0) {
in_section = false;
@@ -148,7 +154,9 @@ int main(int argc, char **argv)
char *expanded = expand_vars(cmd);
+ #if !defined(RF_HIDDEN_CMD)
printf("$ %s\n", expanded);
+ #endif
if (wordexp(expanded, &p, 0) != 0) {
fprintf(stderr, "wordexp failed\n");
diff --git a/rfile b/rfile
index f38ab34..2daa06b 100644
--- a/rfile
+++ b/rfile
@@ -8,8 +8,10 @@
@inp=rf.c
@out=rf
@opts=-Wall -Wextra -pedantic -std=c99
+@editor=$EDITOR
# build
+@: building rf..
@cc @inp -o @out @opts
# install section
@@ -22,6 +24,11 @@ install {
# clean section
clean {
+ @: removing rf binary..
rm @out
}
+edit {
+ @: opening default editor..
+ @editor rf.c
+}