aboutsummaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* mkdir: initialize successRunxi Yu2024-08-091-1/+1
|
* cat: initialize errRunxi Yu2024-08-091-1/+1
|
* Use a new build system for everything, and revamp directories.Runxi Yu2024-08-0662-525/+252
| | | | | | | | | | | Previously there was quite a bit of sed(1)'ing going on on each source file, and a bit of copying them to box_tmp. Now we use preprocessor directives instead, things should be much cleaner. And since it's a pain to prefix strings, move all programs out of subdirs. I've also clarified the Makefile system a bit. I'm unsure how to make standalone programs with POSIX Make, so currently we only generate fases-in-a-box.
* common.mk, sh/Makefile: s/$(NOLINKER)/-c/gHEADmasterRunxi Yu2024-07-272-2/+2
| | | | | I previously changed this in the main Makefile but forgot to port it over to the other Makefiles.
* Add codeberg CIRunxi Yu2024-07-271-0/+14
|
* Add a main COPYING fileRunxi Yu2024-07-271-0/+11
|
* core/ed.c: Prototype printUsage and print_errorRunxi Yu2024-07-271-2/+2
| | | | | | | | | print_error() was declared as "void print_error();" but defined with parameters "const char *error, int help_mode". Declarations without prototypes are unsupported. printUsage also gains "void" as its prototype in this commit, just to be explicit.
* core/touch.c: Set _XOPEN_SOURCE to 700Runxi Yu2024-07-271-1/+1
| | | | See feature_test_macros(7)
* core/ls.c: Cast before printfRunxi Yu2024-07-271-2/+2
| | | | | | Some of these types cannot assumed to be unsigned long, etc. Those type differences cause build failures on OpenBSD. This commit casts them properly.
* MAINTAINERS: Update runxiyu's file listRunxi Yu2024-07-271-0/+4
| | | | Signed-off-by: Runxi Yu <me@runxiyu.org>
* core/more.c: Initialize read_file = 1 and success = 0Runxi Yu2024-07-271-2/+1
| | | | | | | | | success is always set anyway, so moving it up is simply a matter of code style. read_file could be uninitalized when used, which leads to UB. Signed-off-by: Runxi Yu <me@runxiyu.org>
* core/tail.c: Initialize *file to NULL, and lines to 10Runxi Yu2024-07-271-5/+2
| | | | | | | | | | C doesn't initialize uninitalized variables to a "zero value" by default. if (!lines) lines = 10; wouldn't work if lines contains garbage values (which it almost always does). Kinda similar for file. Signed-off-by: Runxi Yu <me@runxiyu.org>
* core/touch.c: Fix param loop condition, and print usage on unknown flagsRunxi Yu2024-07-271-2/+6
| | | | | | | | i < 256 && (param[i] = 0) as a loop condition doesn't work because the value of assignments is the rvalue, which means that the loop will not run. Initialization using a for loop should be unnecessary anyway. Signed-off-by: Runxi Yu <me@runxiyu.org>
* core/ed.c: Initialize filedes to -1Runxi Yu2024-07-271-4/+4
| | | | Signed-off-by: Runxi Yu <me@runxiyu.org>
* core/tail.c: Initialize "files_lines"Runxi Yu2024-07-271-1/+1
| | | | | | | | file_lines used to be uninitialized, which causes UB whenever file_lines++ is used; nothing happens before that so it's not even an edge case. Signed-off-by: Runxi Yu <me@runxiyu.org>
* core/basename.c: Initialize "status"Runxi Yu2024-07-271-1/+1
| | | | | | | | "status" used to be uninitialized when the if (argc == 3 ...) block is entered. If strlen(argv[2]) is 0, i.e. if argv[2] is an empty string, undefined behavior occurs. Signed-off-by: Runxi Yu <me@runxiyu.org>
* Make, and generate box.cRunxi Yu2024-07-271-2/+94
| | | | | | | | | | I'm not really sure how the build system works, and I'm probably going to overhaul it with one that uses preprocessor directives instead. For example, `make all` should generate everything as an independent binaries, while `make box` should produce a single box. Instead of using sed, we could use -DMAKING_BOX and #ifdef. Signed-off-by: Runxi Yu <me@runxiyu.org>
* Makefile: Simplify some of the commentsRunxi Yu2024-07-272-17/+11
| | | | | | | | | | | | I don't think many of these comments are necessary. Also there's no need to use variables for simple options like -c and -std=c99. In the future, I also intend to use a less hacky build system for producing the "box" binary. Perhaps some sort of ELF symbol mapping, or simply using preprocessor directives. Sed is not the best tool for those purposes. Signed-off-by: Runxi Yu <me@runxiyu.org>
* Add myself to MAINTAINERSRunxi Yu2024-07-271-5/+15
| | | | Signed-off-by: Runxi Yu <me@runxiyu.org>
* ln: Count arguments after parsing optionsRunxi Yu2024-07-251-5/+5
| | | | | | | | | Previously, argc is always expected to be 3 (program name, source, destination), without regard for any arguments. This check was done before parsing options, so effectively, the usage of any options would cause the check to fail. This commit causes argument counting to happen after options parsing.
* basename: handle empty argumentsRunxi Yu2024-07-251-1/+7
| | | | | | | | | | | | check that the suffix is non-empty: If strlen(argv[2]) < 1, the for loop would not run, and the status would be uninitialized. This commit causes the suffix to be ignored if it is empty. print empty line when input name is empty: If basename(3) receives an empty string or a null pointer, it returns the string ".", but we want basename(1) to just output an empty line when the input is empty.
* core/cmp: exit loop on EOF rather than null bytesRunxi Yu2024-07-251-4/+2
| | | | Signed-off-by: Runxi Yu <me@runxiyu.org>
* core/cmp: compare fgetc to EOF and use int not charRunxi Yu2024-07-251-2/+3
| | | | | | | | | | | | | | | | Thie solves: box_tmp/cmp_box.c: In function ‘cmp_main’: box_tmp/cmp_box.c:41:25: error: comparison is always false due to limited range of data type [-Werror=type-limits] 41 | if (ch1 == EOF || ch2 == EOF) { | ^~ box_tmp/cmp_box.c:41:39: error: comparison is always false due to limited range of data type [-Werror=type-limits] 41 | if (ch1 == EOF || ch2 == EOF) { | ^~ cc1: all warnings being treated as errors make: *** [Makefile:42: box] Error 1 Signed-off-by: Runxi Yu <me@runxiyu.org>
* extras/: clarify licensing, it's supposed to be GPL-3.0+, not 3BSDFerass El Hafidi2024-05-102-2/+2
| | | | Signed-off-by: Ferass El Hafidi <vitali64pmemail@protonmail.com>
* core/: tputFerass El Hafidi2023-04-142-0/+41
| | | | Signed-off-by: Ferass El Hafidi <vitali64pmemail@protonmail.com>
* config.mk: add version nameFerass El Hafidi2023-04-111-1/+1
| | | | Signed-off-by: Ferass El Hafidi <vitali64pmemail@protonmail.com>
* common/common.c: typofixFerass El Hafidi2023-04-111-1/+1
| | | | Signed-off-by: Ferass El Hafidi <vitali64pmemail@protonmail.com>
* core/tty: fix compiler errorFerass El Hafidi2023-04-111-1/+2
| | | | Signed-off-by: Ferass El Hafidi <vitali64pmemail@protonmail.com>
* common/common.c: new format for print_usage()Ferass El Hafidi2023-04-111-3/+2
| | | | | | | | | Here's how it's supposed to look like: fases cat (d84hd34s): Concatenate files to stdout Usage: cat [file...] Signed-off-by: Ferass El Hafidi <vitali64pmemail@protonmail.com>
* core/wc: rewind(file) won't work with stdinFerass El Hafidi2023-04-101-1/+1
| | | | Signed-off-by: Ferass El Hafidi <vitali64pmemail@protonmail.com>
* treewide: readd copyrightsFerass El Hafidi2023-04-1047-1/+149
| | | | Signed-off-by: Ferass El Hafidi <vitali64pmemail@protonmail.com>
* core/ln: return errnoFerass El Hafidi2023-04-091-2/+1
| | | | | Reported-by: Leah Rowe <leah@libreboot.org> Signed-off-by: Ferass El Hafidi <vitali64pmemail@protonmail.com>
* core/ln: only support 2 arguments (not counting argv[0] before getopt())Ferass El Hafidi2023-04-091-1/+1
| | | | Signed-off-by: Ferass El Hafidi <vitali64pmemail@protonmail.com>
* core/ln: get rid of useless for loopFerass El Hafidi2023-04-091-15/+13
| | | | Signed-off-by: Ferass El Hafidi <vitali64pmemail@protonmail.com>
* core/utilities.csv: remove, not neededFerass El Hafidi2023-04-091-2/+0
| | | | Signed-off-by: Ferass El Hafidi <vitali64pmemail@protonmail.com>
* core/: get rid of viFerass El Hafidi2023-04-082-211/+0
| | | | | | | It's poorly implemented and ugly, it segfaults and doesn't compile with -Werr. The time is now! Signed-off-by: Ferass El Hafidi <vitali64pmemail@protonmail.com>
* core/ln: fix error handling!Ferass El Hafidi2023-04-081-3/+3
| | | | Signed-off-by: Ferass El Hafidi <vitali64pmemail@protonmail.com>
* core/ln: don't use *paramsFerass El Hafidi2023-04-081-1/+1
| | | | Signed-off-by: Ferass El Hafidi <vitali64pmemail@protonmail.com>
* core/ln: get rid of *params, uselessFerass El Hafidi2023-04-081-1/+1
| | | | Signed-off-by: Ferass El Hafidi <vitali64pmemail@protonmail.com>
* core/ln: handle errors when calling remove()Ferass El Hafidi2023-04-081-1/+1
| | | | Signed-off-by: Ferass El Hafidi <vitali64pmemail@protonmail.com>
* */Makefile: reduce duplicationFerass El Hafidi2023-04-083-40/+23
| | | | | | | Both core/Makefile and extras/Makefile were almost identical. This commit unifies the identical parts in one file. Signed-off-by: Ferass El Hafidi <vitali64pmemail@protonmail.com>
* core/Makefile: remove test suiteFerass El Hafidi2023-04-081-17/+0
| | | | | | It's useless Signed-off-by: Ferass El Hafidi <vitali64pmemail@protonmail.com>
* Makefile: add '-pedantic' to CFLAGSFerass El Hafidi2023-04-081-1/+1
| | | | Signed-off-by: Ferass El Hafidi <vitali64pmemail@protonmail.com>
* man/: unlink.1Ferass El Hafidi2023-04-061-0/+25
| | | | Signed-off-by: Ferass El Hafidi <vitali64pmemail@protonmail.com>
* core/uname: fix argument parsingFerass El Hafidi2023-03-311-2/+2
| | | | Signed-off-by: Ferass El Hafidi <vitali64pmemail@protonmail.com>
* core/rm: argv[0] -> argv0 (typo)Ferass El Hafidi2023-03-311-1/+1
| | | | Signed-off-by: Ferass El Hafidi <vitali64pmemail@protonmail.com>
* core/more: don't exit on EOFFerass El Hafidi2023-03-312-4/+2
| | | | Signed-off-by: Ferass El Hafidi <vitali64pmemail@protonmail.com>
* core/ln: TODO -- fix error handlingFerass El Hafidi2023-03-312-1/+1
| | | | Signed-off-by: Ferass El Hafidi <vitali64pmemail@protonmail.com>
* core/chown: fix argv handlingFerass El Hafidi2023-03-301-6/+5
| | | | Signed-off-by: Ferass El Hafidi <vitali64pmemail@protonmail.com>
* core/*: Return errprint.Ferass El Hafidi2023-03-0413-13/+29
| | | | Signed-off-by: Ferass El Hafidi <vitali64pmemail@protonmail.com>