Re: [hackers] [slock] No need for usage() || FRIGN

2016-02-15 Thread Markus Teich
Dimitris Papastamos wrote:
> On Mon, Feb 15, 2016 at 11:35:11AM +0100, FRIGN wrote:
> > My considerations here were that it was quite arbitrary not to document -h,
> > given we "allow" a command to be passed to slock as second + further
> > arguments.  However, I respect your stances on this and will revert it, but
> > also document -h in the manpage.
> 
> The right way to do this is to consider -h an invalid option.  For invalid
> options always print usage.

Heyho,

then we would have to assume users don't have *any* binary starting with a `-`
that they might want to run after locking, but I can still live with that.

--Markus



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 would *shift* argc and argv right at the start of
main. If someone reads just the fork exec part and assumes argv[0] is `slock`,
this is confusing and forcing the reader to search for the place where argv is
changed.

--Markus



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: execvp %s failed: %s\n", argv[1], strerror(errno));
> + execvp(argv[0], argv);
> + die("execvp %s failed: %s\n", argv[0], strerror(errno));

Heyho frign,

why this `argc--, argv++` shenanigans? I think it's more confusing rather than
helping.

--Markus



Re: [hackers] [slock] No need for usage() || FRIGN

2016-02-15 Thread Markus Teich
Christoph Lohmann wrote:
> On Sun, 14 Feb 2016 10:46:52 +0100 g...@suckless.org wrote:
> > 1) if you are running off git, -v will show the last stable
> >release, effectively making this option useless.
> >people running stable versions leave open an attack surface
> >this way in case there are vulnerabilities found.
> >99% of the people are also using package managers to keep
> >their software up to date, instead of running $TOOL -v to
> >check how old it is.
> > 2) -h is a sad excuse for not just looking at the manual page
> >(man 1 slock). Given we accept a post_lock_command, we can't
> >be as liberal and just intercept certain flags.
> 
> This is suckless software, which should be useful even without a manpage or a
> package manager.

Heyho,

I have to agree with Christoph here. People running off git can just use the rev
id they are using. I don't get what you mean with the attack surface sentence.
I think we can ignore the possibility of someone wanting to call his custom `-h`
or `-v` binary when the screen is locked and revert the commit.

--Markus



[hackers] [vis] [PATCH] fix {, }, (, ) movements

2016-02-02 Thread Markus Teich
- Split the functions, so the algorithms are more clear
- Paragraph movements work backwards
- Paragraph movements work consistently with \r\n line breaks always placing the
  cursor on the first character of the first empty line before/after the
  paragraph
- Sentence movements now work better at BOF/EOF
- save a few lines of code
---
 text-motions.c | 141 -
 1 file changed, 68 insertions(+), 73 deletions(-)

diff --git a/text-motions.c b/text-motions.c
index f406da3..6f8d0b4 100644
--- a/text-motions.c
+++ b/text-motions.c
@@ -357,89 +357,84 @@ size_t text_word_start_prev(Text *txt, size_t pos) {
return text_customword_start_prev(txt, pos, is_word_boundry);
 }
 
-static size_t text_paragraph_sentence_next(Text *txt, size_t pos, bool 
sentence) {
-   char c;
-   bool content = false, paragraph = false;
-   Iterator it = text_iterator_get(txt, pos);
-   while (text_iterator_byte_next(, )) {
-   content |= !isspace((unsigned char)c);
-   if (sentence && (c == '.' || c == '?' || c == '!') && 
text_iterator_byte_next(, ) && isspace((unsigned char)c)) {
-   if (c == '\n' && text_iterator_byte_next(, )) {
-   if (c == '\r')
-   text_iterator_byte_next(, );
-   } else {
-   while (text_iterator_byte_get(, ) && c == 
' ')
-   text_iterator_byte_next(, NULL);
-   }
-   break;
-   }
-   if (c == '\n' && text_iterator_byte_next(, )) {
-   if (c == '\r')
-   text_iterator_byte_next(, );
-   content |= !isspace((unsigned char)c);
-   if (c == '\n')
-   paragraph = true;
-   }
-   if (content && paragraph)
-   break;
-   }
-   return it.pos;
-}
-
-static size_t text_paragraph_sentence_prev(Text *txt, size_t pos, bool 
sentence) {
-   char prev, c;
-   bool content = false, paragraph = false;
-
-   Iterator it = text_iterator_get(txt, pos);
-   if (!text_iterator_byte_get(, ))
-   return pos;
-
-   while (text_iterator_byte_prev(, )) {
-   content |= !isspace((unsigned char)c) && c != '.' && c != '?' 
&& c != '!';
-   if (sentence && content && (c == '.' || c == '?' || c == '!') 
&& isspace((unsigned char)prev)) {
-   do text_iterator_byte_next(, NULL);
-   while (text_iterator_byte_get(, ) && 
isspace((unsigned char)c));
-   break;
-   }
-   if (c == '\r')
-   text_iterator_byte_prev(, );
-   if (c == '\n' && text_iterator_byte_prev(, )) {
-   content |= !isspace((unsigned char)c);
-   if (c == '\r')
-   text_iterator_byte_prev(, );
-   if (c == '\n') {
-   paragraph = true;
-   if (content) {
-   do text_iterator_byte_next(, NULL);
-   while (text_iterator_byte_get(, ) 
&& isspace((unsigned char)c));
-   break;
-   }
-   }
-   }
-   if (content && paragraph) {
-   do text_iterator_byte_next(, NULL);
-   while (text_iterator_byte_get(, ) && 
!isspace((unsigned char)c));
-   break;
-   }
-   prev = c;
-   }
-   return it.pos;
-}
-
 size_t text_sentence_next(Text *txt, size_t pos) {
-   return text_paragraph_sentence_next(txt, pos, true);
+   char c, prev = 'X';
+   Iterator it = text_iterator_get(txt, pos), rev = text_iterator_get(txt, 
pos);
+
+   if (!text_iterator_byte_get(, ))
+   return pos;
+
+   while (text_iterator_byte_get(, ) && isspace((unsigned 
char)prev))
+   text_iterator_byte_prev(, NULL);
+   prev = rev.pos == 0 ? '.' : prev; /* simulate punctuation at BOF */
+
+   do {
+   if ((prev == '.' || prev == '?' || prev == '!') && 
isspace((unsigned char)c)) {
+   do text_iterator_byte_next(, NULL);
+   while (text_iterator_byte_get(, ) && 
isspace((unsigned char)c));
+   return it.pos;
+   }
+   prev = c;
+   } while (text_iterator_byte_next(, ));
+   return it.pos;
 }
 
 size_t text_sentence_prev(Text *txt, size_t pos) {
-   return text_paragraph_sentence_prev(txt, pos, true);
+   char c, prev = 'X';
+   bool content = false;
+   Iterator it = text_iterator_get(txt, 

[hackers] [vis] [PATCH] Rename stderr field to err

2016-01-31 Thread Markus Teich
The name `stderr` was confused by the compiler with the following defines:
$ grep -r "define stderr"
./dependency/install/usr/include/stdio.h:#define stderr (stderr)
./dependency/sources/musl-1.1.12/include/stdio.h:#define stderr (stderr)
---
 vis-cmds.c | 20 ++--
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/vis-cmds.c b/vis-cmds.c
index bc23193..9b2c887 100644
--- a/vis-cmds.c
+++ b/vis-cmds.c
@@ -36,7 +36,7 @@ typedef struct {/* used to keep context when dealing 
with external proce
Vis *vis;   /* editor instance */
Text *txt;  /* text into which received data will be inserted */
size_t pos; /* position at which to insert new data */
-   Buffer stderr;  /* used to store everything the process writes to 
stderr */
+   Buffer err; /* used to store everything the process writes to 
stderr */
 } Filter;
 
 /** ':'-command implementations */
@@ -815,7 +815,7 @@ static ssize_t read_stdout(void *context, char *data, 
size_t len) {
 
 static ssize_t read_stderr(void *context, char *data, size_t len) {
Filter *filter = context;
-   buffer_append(>stderr, data, len);
+   buffer_append(>err, data, len);
return len;
 }
 
@@ -829,7 +829,7 @@ static bool cmd_filter(Vis *vis, Filerange *range, enum 
CmdOpt opt, const char *
.pos = range->end != EPOS ? range->end : view_cursor_get(view),
};
 
-   buffer_init();
+   buffer_init();
 
/* The general idea is the following:
 *
@@ -864,12 +864,12 @@ static bool cmd_filter(Vis *vis, Filerange *range, enum 
CmdOpt opt, const char *
vis_info_show(vis, "Command cancelled");
else if (status == 0)
vis_info_show(vis, "Command succeded");
-   else if (filter.stderr.len > 0)
-   vis_info_show(vis, "Command failed: %s", filter.stderr.data);
+   else if (filter.err.len > 0)
+   vis_info_show(vis, "Command failed: %s", filter.err.data);
else
vis_info_show(vis, "Command failed");
 
-   buffer_release();
+   buffer_release();
 
return !vis->cancel_filter && status == 0;
 }
@@ -898,7 +898,7 @@ static bool cmd_pipe(Vis *vis, Filerange *range, enum 
CmdOpt opt, const char *ar
.pos = 0,
};
 
-   buffer_init();
+   buffer_init();
 
int status = vis_pipe(vis, , range, argv, read_stdout_new, 
read_stderr);
 
@@ -906,12 +906,12 @@ static bool cmd_pipe(Vis *vis, Filerange *range, enum 
CmdOpt opt, const char *ar
vis_info_show(vis, "Command cancelled");
else if (status == 0)
vis_info_show(vis, "Command succeded");
-   else if (filter.stderr.len > 0)
-   vis_info_show(vis, "Command failed: %s", filter.stderr.data);
+   else if (filter.err.len > 0)
+   vis_info_show(vis, "Command failed: %s", filter.err.data);
else
vis_info_show(vis, "Command failed");
 
-   buffer_release();
+   buffer_release();
 
return !vis->cancel_filter && status == 0;
 }
-- 
2.4.10




[hackers] [vis] [PATCH] Fix to/till movements

2016-01-19 Thread Markus Teich
Some corner cases allowed to move between lines with the to/till movements.

The change in find_prev serves two purposes. When searching for a string which
the cursor is already above the match, this match is returned (pos += len).
Secondly there was a failure when searching for strings with len == 1 which lead
to `matched == 0` which was always true, even if the string was not found,
therefore leading to a wrong return value.
---

 text-motions.c | 11 ++-
 vis-motions.c  |  8 ++--
 2 files changed, 12 insertions(+), 7 deletions(-)

diff --git a/text-motions.c b/text-motions.c
index 824f3a9..550466b 100644
--- a/text-motions.c
+++ b/text-motions.c
@@ -79,13 +79,15 @@ static size_t find_prev(Text *txt, size_t pos, const char 
*s, bool line) {
if (!s)
return pos;
size_t len = strlen(s), matched = len - 1;
-   Iterator it = text_iterator_get(txt, pos), sit;
+   Iterator it, sit;
if (len == 0)
return pos;
-   for (char c; text_iterator_byte_get(, ); ) {
+   pos += len;
+   it = text_iterator_get(txt, pos);
+   for (char c; text_iterator_byte_prev(, ); ) {
if (c == s[matched]) {
if (matched == 0)
-   break;
+   return it.pos;
if (matched == len - 1)
sit = it;
matched--;
@@ -93,11 +95,10 @@ static size_t find_prev(Text *txt, size_t pos, const char 
*s, bool line) {
it = sit;
matched = len - 1;
}
-   text_iterator_byte_prev(, NULL);
if (line && c == '\n')
break;
}
-   return matched == 0 ? it.pos : pos;
+   return pos;
 }
 
 size_t text_find_prev(Text *txt, size_t pos, const char *s) {
diff --git a/vis-motions.c b/vis-motions.c
index 0cb0252..3369051 100644
--- a/vis-motions.c
+++ b/vis-motions.c
@@ -53,6 +53,8 @@ static size_t mark_line_goto(Vis *vis, File *file, size_t 
pos) {
 
 static size_t to(Vis *vis, Text *txt, size_t pos) {
char c;
+   if (pos == text_line_end(txt, pos))
+   return pos;
size_t hit = text_line_find_next(txt, pos+1, vis->search_char);
if (!text_byte_get(txt, hit, ) || c != vis->search_char[0])
return pos;
@@ -61,6 +63,8 @@ static size_t to(Vis *vis, Text *txt, size_t pos) {
 
 static size_t till(Vis *vis, Text *txt, size_t pos) {
size_t hit = to(vis, txt, pos+1);
+   if (pos == text_line_end(txt, pos))
+   return pos;
if (hit != pos)
return text_char_prev(txt, hit);
return pos;
@@ -68,7 +72,7 @@ static size_t till(Vis *vis, Text *txt, size_t pos) {
 
 static size_t to_left(Vis *vis, Text *txt, size_t pos) {
char c;
-   if (pos == 0)
+   if (pos == text_line_begin(txt, pos))
return pos;
size_t hit = text_line_find_prev(txt, pos-1, vis->search_char);
if (!text_byte_get(txt, hit, ) || c != vis->search_char[0])
@@ -77,7 +81,7 @@ static size_t to_left(Vis *vis, Text *txt, size_t pos) {
 }
 
 static size_t till_left(Vis *vis, Text *txt, size_t pos) {
-   if (pos == 0)
+   if (pos == text_line_begin(txt, pos))
return pos;
size_t hit = to_left(vis, txt, pos-1);
if (hit != pos)
-- 
2.4.10




Re: [hackers] [slock] add option to run command after screen is locked

2015-12-26 Thread Markus Teich
Quentin Rameau wrote:
> > +   die("surf: execvp %s failed: %s\n", argv[1], strerror(errno));
>  ^--- but that's slock here ;)

Heyho Quentin,

oops, will be fixed.

--Markus



[hackers] [PATCH] add option to run command after screen is locked

2015-12-26 Thread Markus Teich
---


Heyho,

I wrote a patch to support running arbitrary commands after slock has
succesfully locked the screen. Mainly this is useful for suspending the system
after it has been locked like `slock s2ram`. If there are no objections, I will
merge it upstream.

--Markus


 slock.c | 12 ++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/slock.c b/slock.c
index 6be8f22..b8d3d6e 100644
--- a/slock.c
+++ b/slock.c
@@ -289,7 +289,7 @@ lockscreen(Display *dpy, int screen)
 static void
 usage(void)
 {
-   fprintf(stderr, "usage: slock [-v]\n");
+   fprintf(stderr, "usage: slock [-v|POST_LOCK_CMD]\n");
exit(1);
 }
 
@@ -303,7 +303,8 @@ main(int argc, char **argv) {
 
if ((argc == 2) && !strcmp("-v", argv[1]))
die("slock-%s, © 2006-2015 slock engineers\n", VERSION);
-   else if (argc != 1)
+
+   if ((argc == 2) && !strcmp("-h", argv[1]))
usage();
 
 #ifdef __linux__
@@ -339,6 +340,13 @@ main(int argc, char **argv) {
return 1;
}
 
+   if (argc >= 2 && fork() == 0) {
+   if (dpy)
+   close(ConnectionNumber(dpy));
+   execvp(argv[1], argv+1);
+   die("surf: execvp %s failed: %s\n", argv[1], strerror(errno));
+   }
+
/* Everything is now blank. Now wait for the correct password. */
 #ifdef HAVE_BSD_AUTH
readpw(dpy);
-- 
2.4.10




Re: [hackers] [sent] [PATCH 2/2] replace farbfeld with libnetpbm

2015-12-11 Thread Markus Teich
Grant Mathews wrote:
> Aside from those points: would rewriting the patch to not use libnetpbm,
> but to use the Netpbm helpers instead, be acceptable?

Heyho Grant,

no it will not, but as noted in the other mail you are welcome to push your
patch to the wiki.

--Markus



Re: [hackers] [sent] [PATCH 2/2] replace farbfeld with libnetpbm

2015-12-11 Thread Markus Teich
Heyho Grant,

Grant Mathews wrote:
> On Thu, Dec 10, 2015 at 04:39:49PM +0100, FRIGN wrote:
> > Netpbm is arguably almost more complex than BMP and not easy to handle.
> 
> It's literally the top result when I search for the phrase "simplest image
> format".

So your world is limited by the first ten pages of a search engine?

> > We could discuss it if it was widely used,
> 
> Again, it's the top result for simplest image format: people use it.
> dcraw uses it, it's supported by every image viewer I've ever installed,
> and it shows up in enough random places that I'd consider it pretty
> standard.
> 
> farbfeld is used nowhere, and sets the bar for "widely used" quite low.

It's obvious, that pnm is used by more people than farbfeld atm, however that
doesn't make it better. farbfeld was just announced a few weeks ago. If we would
just go by widespread usage, we probably would all write crappy shit in C++ with
boost.

> > but the main point is: __You need a library to handle it__ and it's
> > not that much of a popular format to justify installing a library for
> > it.
> 
> You don't actually need a library for it, I'm just really lazy and the
> library handles all the hard parts for me.
> 
> If the library "requirement" is the only sticking point, it'd be pretty
> easy to fix that.

No it's not, but it was the main motivation for dropping libpng in the first
place and we had quite a bit of discussion for the change on the slcon and the
ML as well.

> > I don't know about you guys, but I don't have libpbm installed on my
> > computer and even though ffmpeg for instance offers support, I might
> > be having a hard time finding a format ffmpeg _doesn't_ support.
> 
> I don't have farbfeld installed on my computer, and ffmpeg doesn't even
> support it.

Right, then install it, it's easy! If you're running gentoo and lazy, I can even
provide you with an ebuild from my overlay.

> > A question for the diligent reader: Can you read in a netpbm file without
> > first looking into the docs?
> 
> I, uh, what? Are you proposing a format that doesn't require explanation?
> Without any sort of docs (or reverse engineering), *no* format is readable.
> Though, to be fair, PAM comes close: the header is pure ASCII, and fairly
> self-explanatory.

Let's put it that way: I just had a look at the user manual[0] and after reading
about the same length as the farbfeld README and FORMAT files, I noticed I don't
have time to read the full doc and the only useful thing I learned was that
there are different formats for color, grayscale and b/w images, so netpbm seems
to redundantly do the job compression algorithms were written for.

> Really, I just want this tool to be usable. Requiring some ridiculously
> obscure image format for no reason takes this from "something I might
> want to use" to "something nobody is going to use".

Well nobody is forcing you to use it. You're also welcome to put your unaccepted
patch on the wiki. Maybe there are other fans of netpbm who would want to use
it? Have you read the README and FORMAT files from farbfeld? It only takes 5
minutes.

--Markus


0: http://netpbm.sourceforge.net/doc/



Re: [hackers] [sent] [PATCH 2/2] replace farbfeld with libnetpbm

2015-12-10 Thread Markus Teich
FRIGN wrote:
> __You need a library to handle it__ and it's not that much of a popular format
> to justify installing a library for it.

Heyho,

like FRIGN pointed out correctly this patch would negate the effort and goal of
the switch to farbfeld. sent with farbfeld uses a separate process instead of
linking to a library and is therefore more UNIXy and sucks less. The patch won't
be merged.

--Markus



Re: [hackers] [PATCH] [sent] Quick patch to replace png with farbfeld

2015-12-08 Thread Markus Teich
FRIGN wrote:
> Dimitris Papastamos  wrote:
> > This also works with jpg and gif and others.  The 2ff wrapper will use
> > imagemagick conversion tools.  This is temporary as jpg2ff and gif2ff will
> > also be implemented.
> 
> As a side note, the 2ff-filter can also receive png-images and already
> automatically call png2ff when it detects a png.  If you look at the 2ff
> script, you'll notice how simple it is really.

Heyho,

as you guys can see from the push hook mails, I just merged the second farbfeld
patch from Dimitris. Since case-switching in sent (the filters array) and in 2ff
again seems kind of redundant, I would remove the filter array and regex code
again and just call filter() on the 2ff script. Of course this only works, if
2ff does not go „full pipeline“ and continues to support handling one argument.

I also noticed you used `/ 257` to convert from uint16_t to uint8_t, which I
fixed in the transparency patch to be `/ 256`.

Another change I want to make is combining the open and read function. Then we
would know if every image could be loaded correctly before even starting the
presentation, which prevents erroring out right in the middle of your talk, when
some image could not be loaded from advance().

I also pushed an update to sent/index.md in the wiki describing the new
situation.

--Markus



Re: [hackers] [sent] Support farbfeld as an intermediate format || sin

2015-12-08 Thread Markus Teich
Dimitris Papastamos wrote:
> > +   for (bin = NULL, i = 0; i < LEN(filters); i++) {
> > +   if (regcomp(, filters[i].regex,
> > +   REG_NOSUB | REG_EXTENDED | REG_ICASE))
> > +   continue;
> > +   if (!regexec(, filename, 0, NULL, 0)) {
> > +   bin = filters[i].bin;
> > +   break;
> > +   }
> > +   }
> 
> I forgot an if (!bin) return NULL sort of thing here.

Heyho Dimitris,

thanks, fixed.

--Markus



Re: [hackers] [sent][PATCH] Use background color for transparent PNG images

2015-12-04 Thread Markus Teich
Heyho,

Alexis wrote:
> It makes sense not to merge this patch, when a switch to farbfeld is
> due for the next release. Any rough plans on when this will happen?

As always: When I can spare the time. ;)

Dimitris already wrote two patches, which I just have to check and try out, so
it shouldn't take too long.

> I had a look at farbfeld and look forward to the support for it in sent. Will
> farbfeld transparency be supported in sent from the beginning?

That is the plan.

--Markus



Re: [hackers] [PATCH] Use right click as previous and enable scrolling to switch slides

2015-11-25 Thread Markus Teich
Carlos Torres wrote:
> Assuming this is for sent

Heyho Carlos,

Yes it was and it has already been applied a few hours later. Patches sent on
the hackers list don't need an acknowledgement that they have been applied,
since you can clearly see that from the mail which is sent by the git hook.

--Markus



Re: [hackers] [sent] Bail out before allocating slides if file is empty

2015-11-18 Thread Markus Teich
Quentin Rameau wrote:
> In load() we allocated slides before checking if we actually read anything
> from the FILE fp and then continue with an allocated but “empty” space wich
> would lead to errors.

Heyho,

of course that is another fix for the problem related to memory sanitazion. I
merged it, thanks. I still leave my fix (checking for slidecount instead of
checking pointers), since it is more verbose than the old version: If no slides
were read, die with usage message.

--Markus



Re: [hackers] [sent] drw.c: Avoid potential memory leak in drw_cur_create()

2015-11-18 Thread Markus Teich
Quentin Rameau wrote:
> If drw was NULL, memory was still allocated for cur.

Heyho Quentin,

thanks, I applied it.

The drw code of sent diverged from the drw code of dmenu/dwm/… a couple of
months ago. I submitted my changes earlier this year, they were never merged
into upstream libdrw. Now we have two different histories and should probably
try to merge them again as soon as possible. I don't know, when I will have time
to do it, so volunteers are welcome.

--Markus



Re: [hackers] [dwm] setfullscreen: don't process the property twice

2015-11-02 Thread Markus Teich
Quentin Rameau wrote:
>   if(fullscreen) {
> - …
> + if(!c->isfullscreen) {
> + …
> + }
>   }
> - else {
> + else if(c->isfullscreen) {

Heyho Quentin,

you should merge the conditions of the first two nested if statements and change
the else if to hold the complete condition `(!fullscreen && c->isfullscreen)`.

--Markus



Re: [hackers] [dwm] setfullscreen: don't process the property twice

2015-11-02 Thread Markus Teich
Quentin Rameau wrote:
> Humm, why should I exactly?
> 
> if(fullscreen) {
>   if(!c->isfullscreen)
> } else if(c->isfullscreen)
> 
> against
> 
> if(fullscreen && !c->isfullscreen)
> else if (!fullscreen && c->isfullscreen)
> 
> For me the second form is less understandable and has more unnecessary checks.

Heyho Quentin,

the second form saves one indentation level, two lines and allows to understand
the else if condition without having to read the if condition first.

--Markus



Re: [hackers] [surf] [PATCH] fix style path generation

2015-10-18 Thread Markus Teich
Christoph Lohmann wrote:
> Please use  git‐format‐patch(1) to get the appropriate authorship in the git
> log.

Heyho Christoph,

You can actually just call `git am FILENAME` with FILENAME being the email
including headers and git will apply the patch just fine with correct
authorship. I thought this was the recommended way, since patchers can just use
`git send-email` and maintainers can just use `git am` without the need for
anyone to handle attachments.

--Markus



Re: [hackers] [surf] [PATCH] fix style path generation

2015-10-18 Thread Markus Teich
Christoph Lohmann wrote:
> With  the  git‐format‐patch you can have multiple lines for the descrip‐ tion
> of the patch. Now it’s just your header. That’s the  reason  why  I like this
> more.

Heyho Christoph,

This also works with `git send-email`: Just put the extended commit description
above the `---` line / it is automatically put there, when the commit already
has one.

--Markus



[hackers] [surf] [PATCH] fix style path generation

2015-10-18 Thread Markus Teich
---


Heyho,

attached patch fixes building the styledir/stylefile path for the new
buildfile/buildpath semantics.

--Markus


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

diff --git a/surf.c b/surf.c
index 0fae80b..b99a84b 100644
--- a/surf.c
+++ b/surf.c
@@ -1263,7 +1263,7 @@ setup(void) {
styles[i].regex = NULL;
}
styles[i].style = buildfile(
-   g_strconcat(styledir,
+   g_strconcat(styledir, "/",
styles[i].style, NULL));
}
} else {
-- 
2.4.10




Re: [hackers] [surf] Fix ssl failure detection || Quentin Rameau

2015-07-15 Thread Markus Teich
g...@suckless.org wrote:
 + if (webkit_web_view_get_tls_info(c-view, NULL, tlsflags) 
 + tlsflags) {

Heyho,

I would switch the test around and check for `tlsflags` first. It probably
doesn't affect the binary, but is easier to read for humans.

--Markus



<    1   2