Re: [dev] [stali] What happened to stali?

From: Evan Gates <evan.gates_AT_gmail.com>
Date: Thu, 16 Oct 2014 11:16:44 -0700

Hello,

On Thu, Oct 16, 2014 at 2:16 AM, Dimitris Papastamos <sin_AT_2f30.org> wrote:
> I kind of like this particular implementation of test(1). Are there any
> obvious deficiencies compared to the sbase implementation?

I haven't found any but that doesn't mean they aren't there.

> I will have a look at it in more detail later. I think we should replace
> the sbase implementation with this one though.

To make things easier I've tried to change it to the sbase style. I
made everything static, changed from int to bool, moved declarations
to the top of blocks, got rid of white space after keywords, moved
declarations out of for loops, changed strcmp() to explicit checks
against 0, got rid of the designated initializers.

I left most of the functions on single lines as I think that improves
readability even though it doesn't follow the norm of having the
function name first on a line. I kept the functions in an order to not
add declarations at the top of the file, as that would have nearly
doubled the length. I went with error messages instead of a usage()
but that's easy to change if need be.

When erroring out at the end of a function I got "control reaches end
of non-void function" warnings. I went with

return enprintf(...), 0;

Is there a better way to do this? (Tried switching to c11 and using
_Noreturn for the eprintf family but that didn't work).

I've attached the file itself, and a patch generated using git
format-patch (hope I did that correctly). For further changes feel
free to either ask for a new patch or make them yourself.

Off topic question about the suckless style, why are for loop initial
declarations and mixed code and declarations shunned? I tend to use
the for loop declarations when the variable isn't needed outside the
loop's scope, and declare other variables that have a limited use when
they are needed (often could be accomplished in ansi C by using a new
block).

-emg

Received on Thu Oct 16 2014 - 20:16:44 CEST

This archive was generated by hypermail 2.3.0 : Thu Oct 16 2014 - 20:24:08 CEST