k9core

Unnamed repository
Log | Files | Refs | LICENSE

commit 74047ab07f22e75b819e8ca45a06f890d93266fa
parent 8a477a0cb700cfd057d9d932016a21f492a58737
Author: qorg11 <qorg@vxempire.xyz>
Date:   Fri, 11 Dec 2020 18:46:17 +0100

proto -l in ls

ls requires *serious* revision since its code is fucking
horrible. i'll see what i do about it (please help)

Diffstat:
Msrc/ls.c | 14++++++++++----
1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/src/ls.c b/src/ls.c @@ -6,10 +6,10 @@ int main(int argc, char *argv[]) { int c; - int all, show_slash; - all = show_slash = 0; + int all, show_slash, show_line; + all = show_slash = show_line = 0; - while ((c = getopt(argc,argv,"ap")) != -1) + while ((c = getopt(argc,argv,"lap")) != -1) { switch(c) { @@ -19,6 +19,9 @@ main(int argc, char *argv[]) case 'p': show_slash = 1; break; + case 'l': + show_line = 1; + break; } } @@ -31,9 +34,12 @@ main(int argc, char *argv[]) { if(ent->d_name[0] == '.' && !all) continue; + if(!show_line) { if(ent->d_type == DT_DIR && show_slash) printf("%s/ ",ent->d_name); - else printf("%s ",ent->d_name); + else printf("%s ",ent->d_name); + } + else printf("%s\n",ent->d_name); } } puts("");