Re: [dev] sbase installed first impressions

2016-10-04 Thread stephen Turner
Thanks Alex. I have followed landley as well and he is pretty sharp
especially on history. He does make a valid point that we really don't
need the file system laid out the way it is, and i can see why people
would like to have it set up more simply like stali. I myself was
tempted with the simplicity but it just doesn't feel right to me.

One thought does occur to me, I have been quoted posix in this thread
for reasons why features are not included and yet this isn't posix.
That being said, i wouldn't mind trying to help add something such as
a script for example to provide an option for the traditional layout
for those who opt for it. The question would be the implementation
method. Perhaps taking a play from "make suckless-box-install" and
calling it "make traditional-install" or such. I will inevitably
script something out for myself if this isn't available so i don't see
any reason not to contribute unless its considered out of scope for
the project.

On Tue, Oct 4, 2016 at 5:48 PM, Alexander Keller  wrote:
> The stali filesystem is explained by:
> http://sta.li/filesystem
>
> If you want to know why Suckless chose to fix it:
> http://lists.busybox.net/pipermail/busybox/2010-December/074114.html
>



Re: [dev] sbase installed first impressions

2016-10-04 Thread stephen Turner
Thanks for all the great feedback!

I installed sbase and ubase but it doesn't appear that suckless
assigns them to the proper directories e.g. /bin /sbin, /usr/bin,
/usr/sbin however everything is placed into /usr/local/bin. I assume
there was a thought or reason? Perhaps leaving it open for choice? I
was reading this site on posix directory structure[0] and not all the
programs belong to any one directory but it doesn't get specific on
which programs belong where lending itself to more of a judgement call
i suppose. Would you consider this a good reference or is there better
reading material for this? Sorry if i ask some odd questions, It seems
the posix way is cleaner and proper than gnu and I'm trying to stick
to it.

Side note: The readme for ubase doesn't list pcc as a known good
compiler but it appears to have done the job.

[0] http://www.linux4beginners.info/linux-how-to/directory-structure-posix/



Re: [dev] sbase installed first impressions

2016-10-03 Thread Greg Reagle
On Mon, Oct 3, 2016, at 17:23, stephen Turner wrote:
> I see a few items have the -i removed, I can't say i use the
> interactive mode but i assume you removed it due to redundancy and so
> i'm curious how you would normally do that the suckless way.

This probably sucks since I am not an expert shell script programmer,
but here is an idea for a function in rc that is like rm -i:

fn rmi {
for (arg) {
printf 'Remove "%s"' $arg
~ $arg /* || printf ' relative to %s' `{pwd}
printf '?\n'
reply=`{line}
~ $reply [yY]* && rm $arg
}
}

For those of you who might not be too familiar with rc, see
http://doc.cat-v.org/plan_9/4th_edition/papers/rc and
http://www.in-ulm.de/~mascheck/bourne/unix-faq.shell.rc

This could also be implemented as a shell script.  And it could also be
implement (as a function or shell script) in (mk)sh if you like that
better.



Re: [dev] sbase installed first impressions

2016-10-03 Thread Michael Forney
On Mon, Oct 3, 2016 at 5:02 PM, stephen Turner
 wrote:
> Thanks for the links i will check it out! Also i wasn't aware of the
> -F function, playing with it now and that is a big help with working
> around the whole color bit. Clearly the / is for directories. How are
> the rest used? Surprisingly even google doesn't know. From what i
> could see they didn't label links and such so not very helpful in that
> respect but at least i wont try to vi a directory or cd to a file.

It is documented in POSIX:
http://pubs.opengroup.org/onlinepubs/9699919799/utilities/ls.html#tag_20_73_04



Re: [dev] sbase installed first impressions

2016-10-03 Thread stephen Turner
Thanks for the links i will check it out! Also i wasn't aware of the
-F function, playing with it now and that is a big help with working
around the whole color bit. Clearly the / is for directories. How are
the rest used? Surprisingly even google doesn't know. From what i
could see they didn't label links and such so not very helpful in that
respect but at least i wont try to vi a directory or cd to a file.

On Mon, Oct 3, 2016 at 7:43 PM, Evan Gates  wrote:
> On Mon, Oct 3, 2016 at 4:34 PM, stephen Turner
>  wrote:
>> @Evan
>> I am not too fluent at advanced shell at the moment so help me out
>> with this one please, I checked the advanced scripting guide but want
>> to make sure i understand this.
>
> Please do not read that, it's full of practices that are outdated and
> in many cases it is plane wrong. Instead check out the bash guide[0]
> and the accompanying bash faq[1] and bash pitfalls[2]. Although the
> wiki is bash specific it also covers POSIX sh very well.
>
>> s() { ls -F "$@" | cols; }
>> s() implies that you have created an alias for ls as "s" and the () is
>> to listen for what follows for the flags "-h etc"?
>
> It's a function definition.
>
>> {} is to encapsulate the real commands,
>
> The body of a function is a compound command, meaning it's one of:
> a list in braces
> a list in parens
> a loop (for, while until)
> an if statement (with following elif, else)
> a case statement
>
> That said most often you'll see braces.
>
>> ls -F "$@" the "$@" is to pass along the flags from s()?
>
> "$@" expands to the positional parameters (arguments) and must be
> quoted otherwise you can run into further word splitting and glob
> expansion (this is true for all expansions/substitutions).
>
>> and for the ; at the end of cols, i assume this terminates in a way
>> that prevents it from grabbing further input?
>
> A terminator is needed before the closing brace, both newline and
> semicolon are accepted.
>
> [0] http://mywiki.wooledge.org/BashGuide
> [1] http://mywiki.wooledge.org/BashFAQ
> [2] http://mywiki.wooledge.org/BashPitfalls
>



Re: [dev] sbase installed first impressions

2016-10-03 Thread Evan Gates
On Mon, Oct 3, 2016 at 4:34 PM, stephen Turner
 wrote:
> @Evan
> I am not too fluent at advanced shell at the moment so help me out
> with this one please, I checked the advanced scripting guide but want
> to make sure i understand this.

Please do not read that, it's full of practices that are outdated and
in many cases it is plane wrong. Instead check out the bash guide[0]
and the accompanying bash faq[1] and bash pitfalls[2]. Although the
wiki is bash specific it also covers POSIX sh very well.

> s() { ls -F "$@" | cols; }
> s() implies that you have created an alias for ls as "s" and the () is
> to listen for what follows for the flags "-h etc"?

It's a function definition.

> {} is to encapsulate the real commands,

The body of a function is a compound command, meaning it's one of:
a list in braces
a list in parens
a loop (for, while until)
an if statement (with following elif, else)
a case statement

That said most often you'll see braces.

> ls -F "$@" the "$@" is to pass along the flags from s()?

"$@" expands to the positional parameters (arguments) and must be
quoted otherwise you can run into further word splitting and glob
expansion (this is true for all expansions/substitutions).

> and for the ; at the end of cols, i assume this terminates in a way
> that prevents it from grabbing further input?

A terminator is needed before the closing brace, both newline and
semicolon are accepted.

[0] http://mywiki.wooledge.org/BashGuide
[1] http://mywiki.wooledge.org/BashFAQ
[2] http://mywiki.wooledge.org/BashPitfalls



Re: [dev] sbase installed first impressions

2016-10-03 Thread Evan Gates
> I have never had ls without color or column included (i'm spoiled) and
> google isn't being overly helpful at the moment. I found the cols
> command and ls | cols solved that so i can just create an alias, what
> about getting color? Is there a suckless solution?

An alias won't work here as you couldn't pass names to ls, and you
want to make sure you don't use cols when you use ls -l. As such I use
this (put in your .profile or similar):

s() { ls -F "$@" | cols; }

I like the indicators from -F, and naming it s leaves ls alone for other uses.



Re: [dev] sbase installed first impressions

2016-10-03 Thread FRIGN
On Mon, 3 Oct 2016 17:23:50 -0400
stephen Turner  wrote:

Hey Stephen,

> Background first. I'm running a simple kernel, busybox, make, pcc,
> musl, binutils (patched for ash) environment. Its run from ram so i
> can trash the environment as many times as i care to reboot. That
> being said I decided to install suckless in place allowing it to
> overwrite the busybox links just for kicks. So far just sbase was
> installed.
> 
> I had to tweak the config.mk (expected i assume?)
> PREFIX=/
> MANPREFIX=/usr/local/share/man (keeping with suckless default here,
> removed variable)
> CC=pcc
> LDFLAGS= (removed -s as it was not supported)

yes, it is expected to change config.mk for your environments. in 99%
of the cases you don't need to change the defaults though.

> It compiled and installed faster than expected but then the code was
> smaller than expected too, very impressive size! Immediately i decided
> to check and see if it overwrote the busybox links and it did but i
> also noticed there is no color or column views? Reviewing the Readme
> shows that color isn't listed as one of the removed features just fyi
> unless it has a short hand from --color that i didn't know.

This is because color is not part of Posix, but a GNUism. For column
views, use the cols(1) utility that is shipped with sbase. There is no
reason to implement that in each single utility. Just invoke

ls | cols

as you already found out yourself. The Unix philosophy states that you
should have one tool that does one thing and does it well; in this case
this is cols(1) whose only job is to columnize output. ls(1) is complex
enough already, so we really don't want to worry about columnizing
output as well.

> I have never had ls without color or column included (i'm spoiled) and
> google isn't being overly helpful at the moment. I found the cols
> command and ls | cols solved that so i can just create an alias, what
> about getting color? Is there a suckless solution?

The suckless solution is just not to use color at all. It takes a while
to get used to, but it's really not necessary. It's like syntax
highlighting.

> I see a few items have the -i removed, I can't say i use the
> interactive mode but i assume you removed it due to redundancy and so
> i'm curious how you would normally do that the suckless way.

There is no compelling reason for interactive mode. rm(1) for instance
is a tool and you should just use it properly. Give it the proper
arguments and be done with it; write a thin wrapper script if you
really want an interactive mode, but there really is no reason to have
it. It's a gimmick, but maybe you can give really compelling reasons to
include it.

> Otherwise i haven't used it much but seems to be just as expected, a
> gnu comparable cli. I need to update my scripts and then i will start
> using this instead of busybox.

I'm glad you like it! If you find any bugs, please report them!

Cheers

FRIGN

-- 
FRIGN