aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFerass El Hafidi <vitali64pmemail@protonmail.com>2023-01-28 18:33:47 +0100
committerFerass El Hafidi <vitali64pmemail@protonmail.com>2023-01-28 18:33:47 +0100
commit9b5d1ac0f97be475cb8c07dd297f106a5b09a9e8 (patch)
tree051ff97c1edf18b6a34225298bcf207e23475fe2
parent3e2adc3fa04a2b3421b2f2d68f6c9155c0329f32 (diff)
downloadfases-9b5d1ac0f97be475cb8c07dd297f106a5b09a9e8.tar.gz
fases-9b5d1ac0f97be475cb8c07dd297f106a5b09a9e8.zip
core/ls: Use OPERANDS instead of (char *)params in getopt() and remove the -R option.
Signed-off-by: Ferass El Hafidi <vitali64pmemail@protonmail.com>
-rw-r--r--core/ls.c10
1 files changed, 2 insertions, 8 deletions
diff --git a/core/ls.c b/core/ls.c
index 78d219d..b137735 100644
--- a/core/ls.c
+++ b/core/ls.c
@@ -45,7 +45,7 @@
#define REQ_ERRPRINT /* Require errprint() from ../common/common.h */
#define DESCRIPTION "Print <directory>'s contents to standard output.\
If no directory is specified, print the current directory's contents."
-#define OPERANDS "[-1aACRimlpgno] [directory]"
+#define OPERANDS "[-1aACimlpgno] [directory]"
#include "../common/common.h"
char *argv0;
@@ -57,13 +57,12 @@ int main(int argc, char *argv[]) {
int status = 0;
int success = 0;
int argument, i;
- char* params = "aACR1imlpgno";
argv0 = strdup(argv[0]);
for (i=0; i<256; i++) {
param[i]=0;
}
- while ((argument = getopt(argc, argv, params)) != -1) {
+ while ((argument = getopt(argc, argv, OPERANDS)) != -1) {
if (argument == '?') {
print_usage(argv[0], DESCRIPTION, OPERANDS, VERSION);
return 1;
@@ -138,11 +137,6 @@ int ls(char *path) {
return errprint(argv0, path, errno);
}
- if (param['R']) {
- printf("The previous ls -R implementation had so much "
- "flaws that it got removed from the ls codebase.\n");
- return 0;
- }
while ((dirtree = readdir(directory)) != NULL) {
name = dirtree->d_name;