[dev] [sbase] [PATCH] cp: Rename -d option to -P

2014-12-07 Thread Michael Forney
The -d option is a GNU extension and is equivalent to its "-P --preserve=links" options. Since we don't implement the --preserve=links functionality anyway (it means preserve hard links between files), just call it -P, which is specified by POSIX. Additionally, there is no need to check for cp_Pf

[dev] [sbase] [PATCH] ls: Always leave room for the NULL byte in the link target

2014-12-07 Thread Michael Forney
Otherwise, if the length of the link target is the same as BUFSIZ, we will try to write past the end of buf. --- ls.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ls.c b/ls.c index b48391b..a2fb5cb 100644 --- a/ls.c +++ b/ls.c @@ -291,7 +291,7 @@ output(Entry *ent)

[dev] [sbase] [PATCH v3] ls: Handle symlinks to directories properly

2014-12-07 Thread Michael Forney
Also, implement the -H and -L options. --- Again, not sure how to handle the long line. ls.1 | 9 - ls.c | 32 2 files changed, 28 insertions(+), 13 deletions(-) diff --git a/ls.1 b/ls.1 index ec61bee..792b07b 100644 --- a/ls.1 +++ b/ls.1 @@ -3,7 +3,7 @@

Re: [dev] [sbase] [PATCH v2] ls: List directory contents if file is a symlink to a directory

2014-12-07 Thread Michael Forney
On Sun, Dec 07, 2014 at 03:43:36PM -0800, Eric Pruitt wrote: > I don't know if this is the correct behavior. Whether or not a symlink > to a directory has its contents shown with GNU ls depends on whether or > not there's a slash present and the flags used: > > playground$ mkdir AFolder >

Re: [dev] [sbase] [PATCH v2] ls: List directory contents if file is a symlink to a directory

2014-12-07 Thread Eric Pruitt
I don't know if this is the correct behavior. Whether or not a symlink to a directory has its contents shown with GNU ls depends on whether or not there's a slash present and the flags used: playground$ mkdir AFolder playground$ touch AFolder/Horse playground$ ln -s AFolder SymbolicLin

[dev] [sbase] [PATCH v2] ls: List directory contents if file is a symlink to a directory

2014-12-07 Thread Michael Forney
--- Not sure if you want to break up the long line. Up to you. Another possibility is if (S_ISLINK(ent->mode)) stat(path, &st); ent->isdir = S_ISDIR(st.st_mode); which looks nicer, but I'm not sure if stat(2) is required to not modify the st argument if it fails.

[dev] Re: [sbase] [PATCH] ls: List directory contents if file is a symlink to a directory

2014-12-07 Thread Michael Forney
On Sun, Dec 07, 2014 at 10:40:42PM +, Michael Forney wrote: > --- > ls.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > diff --git a/ls.c b/ls.c > index b48391b..90193cc 100644 > --- a/ls.c > +++ b/ls.c > @@ -21,6 +21,7 @@ typedef struct { > off_t size; > time_t mt

[dev] [sbase] [PATCH] ls: List directory contents if file is a symlink to a directory

2014-12-07 Thread Michael Forney
--- ls.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ls.c b/ls.c index b48391b..90193cc 100644 --- a/ls.c +++ b/ls.c @@ -21,6 +21,7 @@ typedef struct { off_t size; time_t mtime; ino_t ino; + int isdir; } Entry; static int entcmp(const vo