aboutsummaryrefslogtreecommitdiff
path: root/core/basename.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* 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>
* 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.
* treewide: readd copyrightsFerass El Hafidi2023-04-101-0/+3
| | | | Signed-off-by: Ferass El Hafidi <vitali64pmemail@protonmail.com>
* all: use SPDX identifiers and add a new MAINTAINERS file.Ferass El Hafidi2023-02-161-28/+1
| | | | Signed-off-by: Ferass El Hafidi <vitali64pmemail@protonmail.com>
* core/common.*: Move them somewhere else so they can be used by non-POSIX utilsFerass El Hafidi2023-01-111-2/+2
| | | | Signed-off-by: Ferass El Hafidi <vitali64pmemail@protonmail.com>
* *: Update Copyright dateFerass 'Vitali64' EL HAFIDI2023-01-051-1/+1
| | | | Signed-off-by: Ferass 'Vitali64' EL HAFIDI <vitali64pmemail@protonmail.com>
* (happy new year!) sh: Fix compiler errors && core/: Move print_usage to ↵Ferass 'Vitali64' EL HAFIDI2023-01-051-3/+2
| | | | | | common.h and add errprint() Signed-off-by: Ferass 'Vitali64' EL HAFIDI <vitali64pmemail@protonmail.com>
* core/, Makefile, box: Get rid of version.h and use -DVERSION in CFLAGS instead.Ferass 'Vitali64' EL HAFIDI2022-12-251-6/+1
| | | | Signed-off-by: Ferass 'Vitali64' EL HAFIDI <vitali64pmemail@protonmail.com>
* Makefile: Add more utilities in CORE && core/: Use one single function for ↵Ferass 'Vitali64' EL HAFIDI2022-12-041-8/+5
| | | | | | printing usage. Signed-off-by: Ferass 'Vitali64' EL HAFIDI <vitali64pmemail@protonmail.com>
* core/: No more compiler warnings! (Threat all warnings as errors)Ferass 'Vitali64' EL HAFIDI2022-11-261-1/+1
| | | | Signed-off-by: Ferass 'Vitali64' EL HAFIDI <vitali64pmemail@protonmail.com>
* Relicense fases core under the 3BSD && Convert all manpages to scdoc && Link ↵Ferass 'Vitali64' EL HAFIDI2022-11-101-12/+23
| | | | | | to the new mailing list Signed-off-by: Ferass 'Vitali64' EL HAFIDI <vitali64pmemail@protonmail.com>
* core/all: Add compile time on the help textFerass 'Vitali64' EL HAFIDI2022-08-141-2/+7
| | | | Signed-off-by: Ferass 'Vitali64' EL HAFIDI <vitali64pmemail@protonmail.com>
* core/*: remove help text where it's uselessFerass 'Vitali64' EL HAFIDI2022-07-231-6/+0
| | | | Signed-off-by: Ferass 'Vitali64' EL HAFIDI <vitali64pmemail@protonmail.com>
* core/*: Put the main function at the top and other functions at the bottomFerass 'Vitali64' EL HAFIDI2022-07-221-7/+8
| | | | Signed-off-by: Ferass 'Vitali64' EL HAFIDI <vitali64pmemail@protonmail.com>
* core/*: reformat help textFerass 'Vitali64' EL HAFIDI2022-07-191-2/+2
| | | | Signed-off-by: Ferass 'Vitali64' EL HAFIDI <vitali64pmemail@protonmail.com>
* core: add basenameFerass 'Vitali64' EL HAFIDI2022-07-091-0/+70
Signed-off-by: Ferass 'Vitali64' EL HAFIDI <vitali64pmemail@protonmail.com>