| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
| |
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
| |
See feature_test_macros(7)
|
|
|
|
|
|
| |
Some of these types cannot assumed to be unsigned long, etc. Those type
differences cause build failures on OpenBSD. This commit casts them
properly.
|
|
|
|
| |
Signed-off-by: Runxi Yu <me@runxiyu.org>
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
| |
Signed-off-by: Runxi Yu <me@runxiyu.org>
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
|
| |
"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>
|
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
| |
Signed-off-by: Runxi Yu <me@runxiyu.org>
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
| |
Signed-off-by: Runxi Yu <me@runxiyu.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
| |
Signed-off-by: Ferass El Hafidi <vitali64pmemail@protonmail.com>
|
|
|
|
| |
Signed-off-by: Ferass El Hafidi <vitali64pmemail@protonmail.com>
|
|
|
|
| |
Signed-off-by: Ferass El Hafidi <vitali64pmemail@protonmail.com>
|
|
|
|
| |
Signed-off-by: Ferass El Hafidi <vitali64pmemail@protonmail.com>
|
|
|
|
| |
Signed-off-by: Ferass El Hafidi <vitali64pmemail@protonmail.com>
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
| |
Signed-off-by: Ferass El Hafidi <vitali64pmemail@protonmail.com>
|
|
|
|
| |
Signed-off-by: Ferass El Hafidi <vitali64pmemail@protonmail.com>
|
|
|
|
|
| |
Reported-by: Leah Rowe <leah@libreboot.org>
Signed-off-by: Ferass El Hafidi <vitali64pmemail@protonmail.com>
|
|
|
|
| |
Signed-off-by: Ferass El Hafidi <vitali64pmemail@protonmail.com>
|
|
|
|
| |
Signed-off-by: Ferass El Hafidi <vitali64pmemail@protonmail.com>
|
|
|
|
| |
Signed-off-by: Ferass El Hafidi <vitali64pmemail@protonmail.com>
|
|
|
|
|
|
|
| |
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>
|
|
|
|
| |
Signed-off-by: Ferass El Hafidi <vitali64pmemail@protonmail.com>
|
|
|
|
| |
Signed-off-by: Ferass El Hafidi <vitali64pmemail@protonmail.com>
|
|
|
|
| |
Signed-off-by: Ferass El Hafidi <vitali64pmemail@protonmail.com>
|
|
|
|
| |
Signed-off-by: Ferass El Hafidi <vitali64pmemail@protonmail.com>
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
| |
It's useless
Signed-off-by: Ferass El Hafidi <vitali64pmemail@protonmail.com>
|
|
|
|
| |
Signed-off-by: Ferass El Hafidi <vitali64pmemail@protonmail.com>
|
|
|
|
| |
Signed-off-by: Ferass El Hafidi <vitali64pmemail@protonmail.com>
|
|
|
|
| |
Signed-off-by: Ferass El Hafidi <vitali64pmemail@protonmail.com>
|
|
|
|
| |
Signed-off-by: Ferass El Hafidi <vitali64pmemail@protonmail.com>
|
|
|
|
| |
Signed-off-by: Ferass El Hafidi <vitali64pmemail@protonmail.com>
|
|
|
|
| |
Signed-off-by: Ferass El Hafidi <vitali64pmemail@protonmail.com>
|
|
|
|
| |
Signed-off-by: Ferass El Hafidi <vitali64pmemail@protonmail.com>
|
|
|
|
| |
Signed-off-by: Ferass El Hafidi <vitali64pmemail@protonmail.com>
|
|
|
|
| |
Signed-off-by: Ferass El Hafidi <vitali64pmemail@protonmail.com>
|
|
|
|
| |
Signed-off-by: Ferass El Hafidi <vitali64pmemail@protonmail.com>
|
|
|
|
| |
Signed-off-by: Ferass El Hafidi <vitali64pmemail@protonmail.com>
|
|
|
|
| |
Signed-off-by: Ferass El Hafidi <vitali64pmemail@protonmail.com>
|