Re: [hackers] [slock] Use argv0 instead of passing "slock:" to die every time || FRIGN

2016-02-15 Thread Anselm R Garbe
On 14 February 2016 at 02:14, wrote: > commit b02c4d452a7942d4be3c69e6f98dafd35a2e4e78 > Author: FRIGN > AuthorDate: Sun Feb 14 02:13:54 2016 +0100 > Commit: FRIGN > CommitDate: Sun Feb 14 02:13:54 2016 +0100 > > Use argv0 instead of passing "slock:" to die every time > > diff --git

Re: [hackers] [slock] Use argv0 instead of passing "slock:" to die every time || FRIGN

2016-02-15 Thread Dimitris Papastamos
On Mon, Feb 15, 2016 at 11:37:15AM +0100, FRIGN wrote: > On Mon, 15 Feb 2016 10:34:15 + > Dimitris Papastamos wrote: > > Hey Dimitris, > > > Yes this pattern is used in sbase. There is no point however > > replicating it to other projects. > > so how would you approach this? If slock was o

Re: [hackers] [slock] Use argv0 instead of passing "slock:" to die every time || FRIGN

2016-02-15 Thread Markus Teich
FRIGN wrote: > we came up with this in sbase/ubase as an idiomatic way to set argv0 > for tools that don't use arg.h. > We need argv0 here because I moved the prepending of the argv[0] into > die(), and thus we need to store the argv0 in a global variable. Heyho frign, sure, but I asked why you w

Re: [hackers] [slock] Use argv0 instead of passing "slock:" to die every time || FRIGN

2016-02-15 Thread FRIGN
On Mon, 15 Feb 2016 10:34:15 + Dimitris Papastamos wrote: Hey Dimitris, > Yes this pattern is used in sbase. There is no point however > replicating it to other projects. so how would you approach this? If slock was only a main()-function, one could've thought to just pass argv[0] to each

Re: [hackers] [slock] Use argv0 instead of passing "slock:" to die every time || FRIGN

2016-02-15 Thread Dimitris Papastamos
On Mon, Feb 15, 2016 at 11:30:59AM +0100, FRIGN wrote: > On Mon, 15 Feb 2016 11:22:08 +0100 > Markus Teich wrote: > > Hey Markus, > > > why this `argc--, argv++` shenanigans? I think it's more confusing rather > > than > > helping. > > we came up with this in sbase/ubase as an idiomatic way to

Re: [hackers] [slock] Use argv0 instead of passing "slock:" to die every time || FRIGN

2016-02-15 Thread FRIGN
On Mon, 15 Feb 2016 11:22:08 +0100 Markus Teich wrote: Hey Markus, > why this `argc--, argv++` shenanigans? I think it's more confusing rather than > helping. we came up with this in sbase/ubase as an idiomatic way to set argv0 for tools that don't use arg.h. We need argv0 here because I moved

Re: [hackers] [slock] Use argv0 instead of passing "slock:" to die every time || FRIGN

2016-02-15 Thread Markus Teich
g...@suckless.org wrote: > + argv0 = argv[0], argc--, argv++; > - if (argc >= 2 && fork() == 0) { > + if (argc >= 1 && fork() == 0) { > if (dpy) > close(ConnectionNumber(dpy)); > - execvp(argv[1], argv+1); > - die("slock: exec