Re: [dev] libutil/eprintf clarification patch (to the Evil_Bob's request)

From: FRIGN <dev_AT_frign.de>
Date: Mon, 21 Dec 2015 09:11:52 +0100

On Mon, 21 Dec 2015 02:11:49 +0100
"e_AT_bestmx.net" <e_AT_bestmx.net> wrote:

Hey Eugene,

> in response to the request made by Evil_Bob on OFTC#suckless
> i hereby supply the patch "sbase"
> and the proposed version of "eprintf.c"
> as i believe it should look like.
>
> http://file.bestmx.net/ee/suckless/

let me break it down for you:
In sbase, we have this more or less "scheme" how function naming
works.
For instance, we have a self-checking function called "estrdup"
to do a "strdup".
The issue here is that in some cases, we need those error-functions
to return a specific status number (other than 1). This is where
we would implement a function called "enstrdup"
Now, what you did here is rip out this status code handling which
is so vital. This will never get merged like that.

Let's first identify the problem (thanks for stating that in your
mail). Every patch has a purpose, and should not be reasoned with
"because it should look like that". If you actually had given an
explanation, everybody would see that this patch is balls.

The issue is, that within usage(), we call eprintf. Every usage-
format-string starts with a "usage" and in the past, for debugging,
it was useful to prepend error messages with the argv0 of the program
(so you knew in long pipelines where the problem was).
Back then it was only a define for DEBUG or something, but after
a while we dropped the DEBUG flag and always enabled the argv0-print.

The only problem was, that it looked a bit silly for the usage-string,
so we added a check if the string begins with "usage" and only print
the argv0 if it is not. Problem solved.
Eugene doesn't like this approach, because he thinks that a library
function shouldn't have derivative behaviour depending on it's input.

I thought about this tonight and came to the conclusion that this
"hack" doesn't introduce too many problems.
In the end, we're talking about eprintf here, the function that
kills the bloody program. It's like as if we discussed the health
benefits of the lethal injection.

Cheers

FRIGN

-- 
FRIGN <dev_AT_frign.de>
Received on Mon Dec 21 2015 - 09:11:52 CET

This archive was generated by hypermail 2.3.0 : Mon Dec 21 2015 - 09:24:06 CET