Re: [dev] [sbase] [patch v3] Who(1) patches

2013-08-06 Thread Galos, David
I have written the manpage, and pushed this. I have also cleaned
up who, and addedthe '-l' flag.

> Good stuff!
Except for the way that strings were handled when adding '-m'
Both ttyname and strrchr could have easily returned NULL, so
that should have been checked for. I've fixed this in the cleanup.



Re: [dev] surf-0.6-searchengine

2013-08-06 Thread Markus Teich

Am 2013-08-07 00:04, schrieb Ari Malinen:
The way I always get around this search vs. URI schema dilemma for 
URLs in
my DNS search domain is by appending a slash to the end, which at 
least makes

Chromium behave as expected.


I added detection of url if there is slash at the end of line.


You are just making the heuristic more complicated.
Personally I like the dictionary approach, where i just put the key 
followed by
a space in front of the search string and the browser opens the 
respective
search engine. Everything that does not start with a search engine 
keyword

followed by a space is interpreted as an url.
I can live with the only(?) drawback, that i have to input two more 
characters

per search on my most used search engine.

--Markus



Re: [dev] surf-0.6-searchengine

2013-08-06 Thread Ari Malinen
>The way I always get around this search vs. URI schema dilemma for URLs in
>my DNS search domain is by appending a slash to the end, which at least makes
>Chromium behave as expected.

I added detection of url if there is slash at the end of line.

On Tue, Aug 6, 2013 at 11:01 PM, Truls Becken  wrote:
> On 2013-08-06, at 21:35, Chris Down wrote:
>
>> On 2013-08-06 21:27, Truls Becken wrote:
>>> The advantage of the approach on the wiki is that you can have multiple
>>> search engines configured, or really, URL shortcuts with optional string
>>> substitution. Firefox has the same thing.
>>
>> I, for one, only really use one search engine, but I agree that this method 
>> is
>> inflexible in that way (although that's fairly implicit in the method).
>
>
> It's not only useful for multiple search engines. You could for instance have
> a shortcut for running your default search engine against a specific site,
> or as in one of the examples on the wiki, to look up words in a dictionary,
> or simply as a shortcut to a page with no argument at all.
>
> -Truls


surf-0.6-searchengine.diff
Description: Binary data


Re: [dev] surf-0.6-searchengine

2013-08-06 Thread Truls Becken
On 2013-08-06, at 21:35, Chris Down wrote:

> On 2013-08-06 21:27, Truls Becken wrote:
>> The advantage of the approach on the wiki is that you can have multiple
>> search engines configured, or really, URL shortcuts with optional string
>> substitution. Firefox has the same thing.
> 
> I, for one, only really use one search engine, but I agree that this method is
> inflexible in that way (although that's fairly implicit in the method).


It's not only useful for multiple search engines. You could for instance have
a shortcut for running your default search engine against a specific site,
or as in one of the examples on the wiki, to look up words in a dictionary,
or simply as a shortcut to a page with no argument at all.

-Truls


Re: [dev] daemon for DWM

2013-08-06 Thread Markus Teich

Am 2013-08-06 15:52, schrieb Martti Kühne:

mar77i@asus77i:~$ 0+445
-bash: 0+445: command not found
mar77i@asus77i:~$ a=(0+445)
mar77i@asus77i:~$ echo $a
0+445

holy crap, that's what happens. Weren't you looking for this instead:

mar77i@asus77i:~$ a=$(( 5554 - 1000 ))
mar77i@asus77i:~$ echo $a
4554

so, you're misusing bash's array syntax to concatenate a string with
the output from a useless cat.
Hmm, after writing this you could be using IFS=+, but then again,
you'd have nonsensical "subtractions" on the last two lines you
posted, unless... No, I just don't believe you set IFS=+-.
The most interesting thing I find that you keep prepending 'let' to
your assignments, presumaby FOR the BASIC look of it. NEXT. Enough of
this, pretty much because I know bash pretty well, I'd say it's
probably futile to try to review something as naturally ugly and
confusing as bash, but this indeed was pretty far off...


As i said, it is just a bunch of stackoverflow answers patched together 
by try-and-error.
Thanks for pointing out, HOW ugly it is. I probably will start the C 
version very soon. ;)


--Markus



Re: [dev] surf-0.6-searchengine

2013-08-06 Thread Chris Down
On 2013-08-06 21:27, Truls Becken wrote:
> The advantage of the approach on the wiki is that you can have multiple
> search engines configured, or really, URL shortcuts with optional string
> substitution. Firefox has the same thing.

I, for one, only really use one search engine, but I agree that this method is
inflexible in that way (although that's fairly implicit in the method).

> Also, there is no heuristic, which means it sucks less.

I agree that heuristic detection of search times vs. URI schemas sucks pretty
bad, but if it could hit a good success rate (which is probably does), it's not
that bad, as long as it's only an optional patch and not in the codebase.

The way I always get around this search vs. URI schema dilemma for URLs in
my DNS search domain is by appending a slash to the end, which at least makes
Chromium behave as expected.


pgpbskuAaFgln.pgp
Description: PGP signature


Re: [dev] surf-0.6-searchengine

2013-08-06 Thread Truls Becken
On 2013-07-31, at 10:40, Ari Malinen wrote:

> I wrote patch which adds search engine integration. If you
> provide url which is not valid then surf passes it to search
> engine. I see this as better approach than the searchengines
> patch from surf.suckless.org.

The advantage of the approach on the wiki is that you can have
multiple search engines configured, or really, URL shortcuts
with optional string substitution. Firefox has the same thing.

Also, there is no heuristic, which means it sucks less.

-Truls



Re: [dev] surf-0.6-searchengine

2013-08-06 Thread Ari Malinen
Thanks for feedback. I improved the url detection a bit. Now it
considers input as url if it has dot and doesnt contain spaces. It
also considers "localhost" as url. Now the search string can contain
dots if it also contains spaces. DNS search domains could be solved
with DNS query but i think that would increase latency a bit.

It would be nice if this patch could be added to surf.suckless.org.

On Tue, Aug 6, 2013 at 2:05 PM, Joerg Jung  wrote:
>
> Am 06.08.2013 um 10:51 schrieb Chris Down :
>
>> On 2013-08-06 10:31, Joerg Jung wrote:
>>> In you patch "not valid" means "contains no dot", this makes it impossible
>>> to search for something with a dot, e.g.: e.g. :)
>>> Maybe look for a (starting) space instead?
>>
>> If that's true, it also makes it impossible to go to URLs that are covered by
>> your DNS search domain without manually adding it to the end (which is 
>> something
>> I often do).
>
> Good point.


surf-0.6-searchengine.diff
Description: Binary data


Re: [dev] Announcing ubase - the ugly/unportable base

2013-08-06 Thread Galos, David
> I'm happy to maintain this and maybe host it at suckless.org as
> we do not currently have an ml at 2f30 for easily managing patches.
Good luck, I would be terrified to start maintaining such a project.

Also, mount looks easy to implement, so I'll see if I can whip up
a linux mount for you



Re: [dev] Re: coreutils / moreutils - DC a directory counter

2013-08-06 Thread Martti Kühne
On Mon, Jul 29, 2013 at 6:39 AM, Paul Hoffman  wrote:
>
> I just read something about using LD_PRELOAD for this.  Write a library
> that implements open(2), munging the file path and then calling the
> "real" open(2).  Then you just set LD_PRELOAD in the environment of the
> scripts and Bob's your uncle.
>


Nice how I find this idea again here, after the BEAUTIFUL day when
systemd munged my /tmp path, leaving me puzzled about what the hell
was going on... rage.
Otoh, the munging could work, unless the hashed filesystem would
overflow PATH_MAX. Measured on the amount of sanity in the system
which OP announced, this could be solved by injecting slashes into the
filename.

cheers!
mar77i



Re: [dev] daemon for DWM

2013-08-06 Thread Martti Kühne
mar77i@asus77i:~$ 0+445
-bash: 0+445: command not found
mar77i@asus77i:~$ a=(0+445)
mar77i@asus77i:~$ echo $a
0+445

holy crap, that's what happens. Weren't you looking for this instead:

mar77i@asus77i:~$ a=$(( 5554 - 1000 ))
mar77i@asus77i:~$ echo $a
4554

so, you're misusing bash's array syntax to concatenate a string with
the output from a useless cat.
Hmm, after writing this you could be using IFS=+, but then again,
you'd have nonsensical "subtractions" on the last two lines you
posted, unless... No, I just don't believe you set IFS=+-.
The most interesting thing I find that you keep prepending 'let' to
your assignments, presumaby FOR the BASIC look of it. NEXT. Enough of
this, pretty much because I know bash pretty well, I'd say it's
probably futile to try to review something as naturally ugly and
confusing as bash, but this indeed was pretty far off...

cheers!
mar77i



Re: [dev] [dmenu:stest] [patch] Add an option to reverse matches

2013-08-06 Thread Martin Kühl
On Tue, Aug 6, 2013 at 11:10 AM, Bastien Dejean  wrote:
>
> From 23cc463e6e52d0ca975ee077c91f06bb9a2748f0 Mon Sep 17 00:00:00 2001
> From: Bastien Dejean 
> Date: Wed, 24 Apr 2013 12:06:52 +0200
> Subject: [PATCH] Add an option to select non-matching files

cf. http://lists.suckless.org/dev/1202/11237.html



Re: [dev] [sbase] [patch v3] Who(1) patches

2013-08-06 Thread Galos, David
> v3 of the who(1) patchset.
Good stuff! I'd rather not push until the manpage
is updated with the m option, though



[dev] Announcing ubase - the ugly/unportable base

2013-08-06 Thread sin
Hi all,

After a recent discussion about including things like df(1)
in sbase we agreed that sbase should be free of unportable code.
I've quickly hacked together ubase[1].  I've taken sbase, stripped
it out and added an $(OS) var in config.mk.

Have a look at the code and let me know if there is anything
you'd like to see in terms of code organization etc.

I'm happy to maintain this and maybe host it at suckless.org as
we do not currently have an ml at 2f30 for easily managing patches.

Thanks for your time,
sin

[1] http://git.2f30.org/ubase/



Re: [dev] surf-0.6-searchengine

2013-08-06 Thread Joerg Jung

Am 06.08.2013 um 10:51 schrieb Chris Down :

> On 2013-08-06 10:31, Joerg Jung wrote:
>> In you patch "not valid" means "contains no dot", this makes it impossible
>> to search for something with a dot, e.g.: e.g. :)
>> Maybe look for a (starting) space instead?
> 
> If that's true, it also makes it impossible to go to URLs that are covered by
> your DNS search domain without manually adding it to the end (which is 
> something
> I often do).

Good point.


[dev] [dmenu:stest] [patch] Add an option to reverse matches

2013-08-06 Thread Bastien Dejean
>From 23cc463e6e52d0ca975ee077c91f06bb9a2748f0 Mon Sep 17 00:00:00 2001
From: Bastien Dejean 
Date: Wed, 24 Apr 2013 12:06:52 +0200
Subject: [PATCH] Add an option to select non-matching files

---
 stest.1 | 3 +++
 stest.c | 8 +---
 2 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/stest.1 b/stest.1
index bb48f45..18a1ba2 100644
--- a/stest.1
+++ b/stest.1
@@ -67,6 +67,9 @@ Test that files are not empty.
 .B \-u
 Test that files have their set-user-ID flag set.
 .TP
+.B \-v
+Inverse the sense of matching, to select non-matching files.
+.TP
 .B \-w
 Test that files are writable.
 .TP
diff --git a/stest.c b/stest.c
index e1dcf36..813bd2b 100644
--- a/stest.c
+++ b/stest.c
@@ -22,7 +22,7 @@ main(int argc, char *argv[]) {
DIR *dir;
int opt;
 
-   while((opt = getopt(argc, argv, "abcdefghln:o:pqrsuwx")) != -1)
+   while((opt = getopt(argc, argv, "abcdefghln:o:pqrsuwxv")) != -1)
switch(opt) {
case 'n': /* newer than file */
case 'o': /* older than file */
@@ -59,8 +59,9 @@ main(int argc, char *argv[]) {
 void
 test(const char *path, const char *name) {
struct stat st, ln;
+   bool m;
 
-   if(!stat(path, &st) && (FLAG('a') || name[0] != '.')  /* hidden 
files  */
+   m = !stat(path, &st) && (FLAG('a') || name[0] != '.')  /* 
hidden files  */
&& (!FLAG('b') || S_ISBLK(st.st_mode))/* block 
special */
&& (!FLAG('c') || S_ISCHR(st.st_mode))/* 
character special */
&& (!FLAG('d') || S_ISDIR(st.st_mode))/* 
directory */
@@ -75,7 +76,8 @@ test(const char *path, const char *name) {
&& (!FLAG('s') || st.st_size > 0) /* not 
empty */
&& (!FLAG('u') || st.st_mode & S_ISUID)   /* 
set-user-id flag  */
&& (!FLAG('w') || access(path, W_OK) == 0)/* 
writable  */
-   && (!FLAG('x') || access(path, X_OK) == 0)) { /* 
executable*/
+   && (!FLAG('x') || access(path, X_OK) == 0);   /* 
executable*/
+   if((!FLAG('v') && m) || (FLAG('v') && !m)) {
if(FLAG('q'))
exit(0);
match = true;
-- 
1.8.2.1



Re: [dev] surf-0.6-searchengine

2013-08-06 Thread Chris Down
On 2013-08-06 10:31, Joerg Jung wrote:
> In you patch "not valid" means "contains no dot", this makes it impossible
> to search for something with a dot, e.g.: e.g. :)
> Maybe look for a (starting) space instead?

If that's true, it also makes it impossible to go to URLs that are covered by
your DNS search domain without manually adding it to the end (which is something
I often do).


pgp5OKmMpy4Pw.pgp
Description: PGP signature


[dev] [sbase] [patch v3] Who(1) patches

2013-08-06 Thread sin
v3 of the who(1) patchset.
>From 5ee1ca2d61d351d7059d27eba124b68adb957e18 Mon Sep 17 00:00:00 2001
From: sin 
Date: Mon, 5 Aug 2013 15:59:49 +0100
Subject: [PATCH 1/3] Implement -m for who

---
 who.c | 18 +++---
 1 file changed, 15 insertions(+), 3 deletions(-)

diff --git a/who.c b/who.c
index ae969d6..756363e 100644
--- a/who.c
+++ b/who.c
@@ -1,6 +1,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -15,8 +16,17 @@ main(int argc, char **argv)
FILE *ufp;
time_t t;
char timebuf[sizeof "-mm-dd hh:mm"];
+   bool mflag = false;
 
-   if(argc!=1)
+   ARGBEGIN {
+   case 'm':
+   mflag = true;
+   break;
+   default:
+   usage();
+   } ARGEND;
+
+   if (argc > 0)
usage();
 
if (!(ufp = fopen(_PATH_UTMP, "r"))) {
@@ -25,6 +35,9 @@ main(int argc, char **argv)
while(fread((char *)&usr, sizeof(usr), 1, ufp) == 1) {
if (!*usr.ut_name || !*usr.ut_line)
continue;
+   if (mflag && strcmp(usr.ut_line,
+   strrchr(ttyname(STDIN_FILENO), '/') + 1))
+   continue;
t = usr.ut_time;
strftime(timebuf, sizeof timebuf, "%Y-%m-%d %H:%M", 
localtime(&t));
printf("%-8s %-12s %-16s\n", usr.ut_name, usr.ut_line, timebuf);
@@ -36,6 +49,5 @@ main(int argc, char **argv)
 void
 usage(void)
 {
-   eprintf("usage: who\n");
+   eprintf("usage: who [-m]\n");
 }
-
-- 
1.8.3.4

>From b79fa641dce58c6efbd909851994198c65a99725 Mon Sep 17 00:00:00 2001
From: sin 
Date: Mon, 5 Aug 2013 16:04:49 +0100
Subject: [PATCH 2/3] No need to cast to (char *)

---
 who.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/who.c b/who.c
index 756363e..823142b 100644
--- a/who.c
+++ b/who.c
@@ -32,7 +32,7 @@ main(int argc, char **argv)
if (!(ufp = fopen(_PATH_UTMP, "r"))) {
eprintf("fopen:");
}
-   while(fread((char *)&usr, sizeof(usr), 1, ufp) == 1) {
+   while(fread(&usr, sizeof(usr), 1, ufp) == 1) {
if (!*usr.ut_name || !*usr.ut_line)
continue;
if (mflag && strcmp(usr.ut_line,
-- 
1.8.3.4

>From a6fad7366977b7a1b6cc0f8de538abb720465133 Mon Sep 17 00:00:00 2001
From: sin 
Date: Mon, 5 Aug 2013 16:12:01 +0100
Subject: [PATCH 3/3] Ignore tilde in ut_line

---
 who.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/who.c b/who.c
index 823142b..6093a84 100644
--- a/who.c
+++ b/who.c
@@ -33,7 +33,8 @@ main(int argc, char **argv)
eprintf("fopen:");
}
while(fread(&usr, sizeof(usr), 1, ufp) == 1) {
-   if (!*usr.ut_name || !*usr.ut_line)
+   if (!*usr.ut_name || !*usr.ut_line ||
+   usr.ut_line[0] == '~')
continue;
if (mflag && strcmp(usr.ut_line,
strrchr(ttyname(STDIN_FILENO), '/') + 1))
-- 
1.8.3.4



Re: [dev] surf-0.6-searchengine

2013-08-06 Thread Joerg Jung

Am 31.07.2013 um 10:40 schrieb Ari Malinen :

> https://github.com/defer-/my-projects/blob/master/surf-0.6-searchengine.diff
> 
> I wrote patch which adds search engine integration. If you dont
> provide any arguments surf loads homepage. If you provide url which is
> not valid then surf passes it to search engine.

In you patch "not valid" means "contains no dot", this makes it impossible
to search for something with a dot, e.g.: e.g. :)
Maybe look for a (starting) space instead?

> You can configure
> homepage and searchengine values in config.h. I see this as better
> approach than the searchengines patch from surf.suckless.org.

Yes, I really like this simple approach.
Any chance to get this committed to the mainline head of surf?

Regards,
Joerg




Re: [dev] Wayland st!!??

2013-08-06 Thread Roberto E. Vargas Caballero
> I'm the author of the port. I'm not sure how the suckless community
> feels about Wayland, but it seems like the core protocol is fairly
> lightweight, depends only on libffi, and is refreshing to work with
> compared to X. Weston's goals are perhaps more orthogonal to suckless,
> but I think there is potential for a suckless compositor.

Your port seems very interesting, but it is a big modification to st,
which makes difficult any merge from master branch. I don't know
the opinion of other st developers, but I think could be a good option
factorize the code and allow different display codes.


-- 
Roberto E. Vargas Caballero

k...@shike2.com
http://www.shike2.com