Re: [dev] Re: [st] [PATCH] Avoid buffer overflows in the case of key-mapped strings.

2013-10-15 Thread Roberto E. Vargas Caballero
> There is a compile time boundary
> check on the number of tags in dwm. 
> Still, considering sl software is targeted at elite users
> it's not necessary IMO.
> 

Ok, after reading the opinion of other developers I think we should
avoid the comparision. And I don't agree it is difficult catch this error,
it will cause a segmentation fault each time the key is pressed, so you
only have to attach and debugger and look the stack trace. It will
take only 2 minutes of your life fix the problem.


Best regards,

-- 
Roberto E. Vargas Caballero
___
'Write programs that do one thing and do it well. Write programs to work
together. Write programs to handle text streams, because that is a
universal interface'

(Doug McIlroy)

In Other Words - Don't design like polkit or systemd
___



[dev] [patch] [sbase] Implement the basic binary operations for test(1)

2013-10-15 Thread sin
Implement the basic binary operations.
>From 7d5836d27ed1d1a1d4bbd0349946b99228e6102c Mon Sep 17 00:00:00 2001
From: sin 
Date: Tue, 15 Oct 2013 14:30:14 +0100
Subject: [PATCH] Implement the basic binary operations for test(1)

---
 test.c |   38 +-
 1 file changed, 37 insertions(+), 1 deletion(-)

diff --git a/test.c b/test.c
index 0c5b969..a312839 100644
--- a/test.c
+++ b/test.c
@@ -105,7 +105,43 @@ unary(const char *op, const char *arg)
 bool
 binary(const char *arg1, const char *op, const char *arg2)
 {
-   eprintf("not yet implemented\n");
+   int i;
+   long narg1, narg2;
+   enum operator { EQ, GE, GT, LE, LT, NE, STREQ, STRNOTEQ } oper;
+   char *optexts[] = { "-eq", "-ge", "-gt", "-le", "-lt", "-ne",
+   "=", "!="
+   };
+
+   for (i = 0; i < LEN(optexts); i++) {
+   if (strcmp(op, optexts[i]) == 0) {
+   oper = i;
+   switch (oper) {
+   case STREQ:
+   return strcmp(arg1, arg2) == 0;
+   case STRNOTEQ:
+   return strcmp(arg1, arg2) != 0;
+   default:
+   narg1 = estrtol(arg1, 0);
+   narg2 = estrtol(arg2, 0);
+   switch (oper) {
+   case EQ:
+   return narg1 == narg2;
+   case GE:
+   return narg1 >= narg2;
+   case GT:
+   return narg1 > narg2;
+   case LE:
+   return narg1 <= narg2;
+   case LT:
+   return narg1 < narg2;
+   case NE:
+   return narg1 != narg2;
+   default:
+   usage();
+   }
+   }
+   }
+   }
return false;
 }
 
-- 
1.7.10.4



Re: [dev] music db editor

2013-10-15 Thread Martti Kühne
On Sat, Oct 12, 2013 at 01:18:50AM -0700, Evan Buswell wrote:
> mpd is actually about 50% orthogonal to what I want to do. It
> maintains a database in order to play files. I'm pretty OK with the
> actual players out there. The primary purpose here is not playing
> music but managing and editing the metadata associated with music
> files; I just threw in the call-an-external-player feature since, if
> you already have a means to select a bunch of files based on tags (for
> inspection/editing), this might literally be about three lines of code
> extra. Although code is not the only consideration, so perhaps that
> doesn't belong.
> 

First of all: Welcome.

2.: A top-post only thread? Are you people kidding me?

3.: I don't have any need to collect metadata about my music I run off mpd, and
if I had the need, I could build symlink trees from my already sane directory
structure:

music/A/Artist/Album/trackname.flac

That way I could add whatever metadata I could think of on any point in the
tree - and in actual filesystem metadata, since, that's where metadata goes,
right? As an example, I could list albums by different artists in a "weird"
directory and link all the weird music there, residents, die antwoord, etc.

I myself have a lot of unknown artist id3v2 tags and broken encodings in that
data, but I don't much need to give one, since I know where to find my stuff...

Also, where's the code? I'd be interested to try stuff out, especially 3 figure
SLOC projects as it's tradition in this part of the net...

cheers!
mar77i



Re: [dev] music db editor

2013-10-15 Thread sin
On Sat, Oct 12, 2013 at 07:19:36AM -0400, Manolo Martínez wrote:
> About this, one of the few gtk programs I cannot do without is easytag.
> In particular, its ability to find and download metadata from cddb based
> on the files to be tagged. Does anyone here use another program for this
> purpose?

Have a look at http://git.2f30.org/musicfix/

Thanks,
sin