Re: [hackers] [sbase] [PATCH 10/10] cp: Check result of utimensat

2016-12-05 Thread Quentin Rameau
> LGTM

Please stop writing that, full sentences are clearer.



Re: [hackers] [dwm] [PATCH] break up long config line

2016-12-05 Thread Anselm R Garbe
On 5 December 2016 at 15:55, Markus Teich  wrote:
> Markus Teich wrote:
>> Anselm R Garbe wrote:
>> > Why, are you entering command line options also on separate lines?
>>
>> Nope, but my command line input mostly is way shorter, because I don't have 
>> to
>> enter a declaration in front of it and if I have such a special case like
>> color schemes, I tend to put them away in a "config" file, e.g. creating an
>> alias in `.mkshrc`. In the rare cases where I have complex and long 
>> arguments,
>> yes indeed I enter them on the same line, and that's a mess. ;)
>
> thanks for merging the other patches. I could not change your opinion on this
> one then?

Not really, it is too much cosmetic for me ;)

-Anselm



Re: [hackers] [sbase] [PATCH 07/10] concat: Use plain read/write instead of buffered stdio

2016-12-05 Thread Silvan Jegen
On Sun, Dec 04, 2016 at 09:55:09PM -0800, Michael Forney wrote:
> If we are just copying data from one file to another, we don't need to
> fill a complete buffer, just read a chunk at a time, and write it to the
> output.
> ---
>  cat.c| 34 ++
>  libutil/concat.c | 24 ++--
>  libutil/cp.c | 42 --
>  sponge.c | 31 +--
>  text.h   |  1 -
>  util.h   |  1 +
>  xinstall.c   | 25 -
>  7 files changed, 70 insertions(+), 88 deletions(-)
> 
> diff --git a/cat.c b/cat.c
> index e3741aa..55585dd 100644
> --- a/cat.c
> +++ b/cat.c
> @@ -1,22 +1,11 @@
>  /* See LICENSE file for copyright and license details. */
> -#include 
> +#include 
>  #include 
>  #include 
>  
> -#include "text.h"
>  #include "util.h"
>  
>  static void
> -uconcat(FILE *fp1, const char *s1, FILE *fp2, const char *s2)
> -{
> - int c;
> -
> - setbuf(fp2, NULL);
> - while ((c = getc(fp1)) != EOF)
> - putc(c, fp2);
> -}
> -
> -static void
>  usage(void)
>  {
>   eprintf("usage: %s [-u] [file ...]\n", argv0);
> @@ -25,37 +14,34 @@ usage(void)
>  int
>  main(int argc, char *argv[])
>  {
> - FILE *fp;
> - int ret = 0;
> - void (*cat)(FILE *, const char *, FILE *, const char *) = 
> + int fd, ret = 0;
>  
>   ARGBEGIN {
>   case 'u':
> - cat = 
>   break;
>   default:
>   usage();
>   } ARGEND
>  
>   if (!argc) {
> - cat(stdin, "", stdout, "");
> + if (concat(0, "", 1, "") < 0)
> + ret = 1;
>   } else {
>   for (; *argv; argc--, argv++) {
>   if (!strcmp(*argv, "-")) {
>   *argv = "";
> - fp = stdin;
> - } else if (!(fp = fopen(*argv, "r"))) {
> - weprintf("fopen %s:", *argv);
> + fd = 0;
> + } else if ((fd = open(*argv, O_RDONLY)) < 0) {
> + weprintf("open %s:", *argv);
>   ret = 1;
>   continue;
>   }
> - cat(fp, *argv, stdout, "");
> - if (fp != stdin && fshut(fp, *argv))
> + if (concat(fd, *argv, 1, "") < 0)
>   ret = 1;
> + if (fd != 0)
> + close(fd);
>   }
>   }
>  
> - ret |= fshut(stdin, "") | fshut(stdout, "");
> -
>   return ret;
>  }
> diff --git a/libutil/concat.c b/libutil/concat.c
> index fad9471..3f617e2 100644
> --- a/libutil/concat.c
> +++ b/libutil/concat.c
> @@ -1,19 +1,23 @@
>  /* See LICENSE file for copyright and license details. */
> -#include 
> +#include 
>  
> -#include "../text.h"
>  #include "../util.h"
>  
> -void
> -concat(FILE *fp1, const char *s1, FILE *fp2, const char *s2)
> +int
> +concat(int f1, const char *s1, int f2, const char *s2)
>  {
>   char buf[BUFSIZ];
> - size_t n;
> + ssize_t n;
>  
> - while ((n = fread(buf, 1, sizeof(buf), fp1))) {
> - fwrite(buf, 1, n, fp2);
> -
> - if (feof(fp1) || ferror(fp1) || ferror(fp2))
> - break;
> + while ((n = read(f1, buf, sizeof(buf))) > 0) {
> + if (writeall(f2, buf, n) < 0) {
> + weprintf("write %s:", s2);
> + return -1;
> + }
> + }
> + if (n < 0) {
> + weprintf("read %s:", s1);
> + return -1;
>   }
> + return 0;
>  }
> diff --git a/libutil/cp.c b/libutil/cp.c
> index c398962..8cd0a7d 100644
> --- a/libutil/cp.c
> +++ b/libutil/cp.c

The stdio.h #include can now also be removed from libutil/cp.c.


> @@ -12,7 +12,6 @@
>  #include 
>  
>  #include "../fs.h"
> -#include "../text.h"
>  #include "../util.h"
>  
>  int cp_aflag  = 0;
> @@ -27,7 +26,7 @@ int
>  cp(const char *s1, const char *s2, int depth)
>  {
>   DIR *dp;
> - FILE *f1, *f2;
> + int f1, f2;
>   struct dirent *d;
>   struct stat st;
>   struct timespec times[2];
> @@ -112,43 +111,34 @@ cp(const char *s1, const char *s2, int depth)
>   return 0;
>   }
>   } else {
> - if (!(f1 = fopen(s1, "r"))) {
> - weprintf("fopen %s:", s1);
> + if ((f1 = open(s1, O_RDONLY)) < 0) {
> + weprintf("open %s:", s1);
>   cp_status = 1;
>   return 0;
>   }
> - if (!(f2 = fopen(s2, "w"))) {
> - if (cp_fflag) {
> - if (unlink(s2) < 0 && errno != ENOENT) {
> - weprintf("unlink %s:", s2);
> - cp_status 

Re: [hackers] [sbase] [PATCH 04/10] Don't use buffered IO (fread) when not appropriate

2016-12-05 Thread Silvan Jegen
Hi

Some comments below.

On Sun, Dec 04, 2016 at 09:55:06PM -0800, Michael Forney wrote:
> fread reads the entire requested size (BUFSIZ), which causes tools to
> block if only small amounts of data are available at a time. At best,
> this causes unnecessary copies and inefficiency, at worst, tools like
> tee and cat are almost unusable in some cases since they only display
> large chunks of data at a time.
> ---
>  cksum.c | 31 +--
>  crypt.h |  2 +-
>  libutil/crypt.c | 37 +++--
>  od.c| 42 ++
>  tee.c   | 39 +++
>  5 files changed, 82 insertions(+), 69 deletions(-)
> 
> diff --git a/cksum.c b/cksum.c
> index 570ca81..b53ec17 100644
> --- a/cksum.c
> +++ b/cksum.c
> @@ -1,7 +1,9 @@
>  /* See LICENSE file for copyright and license details. */
> +#include 
>  #include 
>  #include 

This include is not needed anymore.


>  #include 
> +#include 
>  
>  #include "util.h"
>  
> @@ -61,19 +63,20 @@ static const unsigned long crctab[] = { 
> 0x,
>  };
>  
>  static void
> -cksum(FILE *fp, const char *s)
> +cksum(int fd, const char *s)
>  {
> - size_t len = 0, i, n;
> + ssize_t n;
> + size_t len = 0, i;
>   uint32_t ck = 0;
>   unsigned char buf[BUFSIZ];
>  
> - while ((n = fread(buf, 1, sizeof(buf), fp))) {
> + while ((n = read(fd, buf, sizeof(buf))) > 0) {
>   for (i = 0; i < n; i++)
>   ck = (ck << 8) ^ crctab[(ck >> 24) ^ buf[i]];
>   len += n;
>   }
> - if (ferror(fp)) {
> - weprintf("fread %s:", s ? s : "");
> + if (n < 0) {
> + weprintf("read %s:", s ? s : "");
>   ret = 1;
>   return;
>   }
> @@ -92,29 +95,29 @@ cksum(FILE *fp, const char *s)
>  int
>  main(int argc, char *argv[])
>  {
> - FILE *fp;
> + int fd;
>  
>   argv0 = argv[0], argc--, argv++;
>  
>   if (!argc) {
> - cksum(stdin, NULL);
> + cksum(0, NULL);
>   } else {
>   for (; *argv; argc--, argv++) {
>   if (!strcmp(*argv, "-")) {
>   *argv = "";
> - fp = stdin;
> - } else if (!(fp = fopen(*argv, "r"))) {
> - weprintf("fopen %s:", *argv);
> + fd = 0;
> + } else if ((fd = open(*argv, O_RDONLY)) < 0) {
> + weprintf("open %s:", *argv);
>   ret = 1;
>   continue;
>   }
> - cksum(fp, *argv);
> - if (fp != stdin && fshut(fp, *argv))
> - ret = 1;
> + cksum(fd, *argv);
> + if (fd != 0)
> + close(fd);
>   }
>   }
>  
> - ret |= fshut(stdin, "") | fshut(stdout, "");
> + ret |= fshut(stdout, "");
>  
>   return ret;
>  }
> diff --git a/crypt.h b/crypt.h
> index e0cc08d..2fd2932 100644
> --- a/crypt.h
> +++ b/crypt.h
> @@ -8,5 +8,5 @@ struct crypt_ops {
>  
>  int cryptcheck(int, char **, struct crypt_ops *, uint8_t *, size_t);
>  int cryptmain(int, char **, struct crypt_ops *, uint8_t *, size_t);
> -int cryptsum(struct crypt_ops *, FILE *, const char *, uint8_t *);
> +int cryptsum(struct crypt_ops *, int, const char *, uint8_t *);
>  void mdprint(const uint8_t *, const char *, size_t);
> diff --git a/libutil/crypt.c b/libutil/crypt.c
> index 6991c39..e285614 100644
> --- a/libutil/crypt.c
> +++ b/libutil/crypt.c
> @@ -1,8 +1,10 @@
>  /* See LICENSE file for copyright and license details. */
> +#include 
>  #include 
>  #include 
>  #include 
>  #include 
> +#include 
>  
>  #include "../crypt.h"
>  #include "../text.h"
> @@ -41,7 +43,7 @@ static void
>  mdchecklist(FILE *listfp, struct crypt_ops *ops, uint8_t *md, size_t sz,
>  int *formatsucks, int *noread, int *nonmatch)
>  {
> - FILE *fp;
> + int fd;
>   size_t bufsiz = 0;
>   int r;
>   char *line = NULL, *file, *p;
> @@ -59,12 +61,12 @@ mdchecklist(FILE *listfp, struct crypt_ops *ops, uint8_t 
> *md, size_t sz,
>   file += 2;
>   for (p = file; *p && *p != '\n' && *p != '\r'; p++); /* strip 
> newline */
>   *p = '\0';
> - if (!(fp = fopen(file, "r"))) {
> - weprintf("fopen %s:", file);
> + if ((fd = open(file, O_RDONLY)) < 0) {
> + weprintf("open %s:", file);
>   (*noread)++;
>   continue;
>   }
> - if (cryptsum(ops, fp, file, md)) {
> + if (cryptsum(ops, fd, file, md)) {
>   (*noread)++;
>   continue;
>   }
> @@ -77,7 +79,7 @@ 

[hackers] [dwm][PATCH] generalize dmenumon so any command may use it

2016-12-05 Thread Ian Remmler
---
 config.def.h | 4 ++--
 dwm.c| 3 +--
 2 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/config.def.h b/config.def.h
index ba9a240..0f1749f 100644
--- a/config.def.h
+++ b/config.def.h
@@ -55,8 +55,8 @@ static const Layout layouts[] = {
 #define SHCMD(cmd) { .v = (const char*[]){ "/bin/sh", "-c", cmd, NULL } }
 
 /* commands */
-static char dmenumon[2] = "0"; /* component of dmenucmd, manipulated in 
spawn() */
-static const char *dmenucmd[] = { "dmenu_run", "-m", dmenumon, "-fn", 
dmenufont, "-nb", col_gray1, "-nf", col_gray3, "-sb", col_cyan, "-sf", 
col_gray4, NULL };
+static char monarg[2] = "0"; /* set to ascii value of current monitor number 
by spawn() */
+static const char *dmenucmd[] = { "dmenu_run", "-m", monarg, "-fn", dmenufont, 
"-nb", col_gray1, "-nf", col_gray3, "-sb", col_cyan, "-sf", col_gray4, NULL };
 static const char *termcmd[]  = { "st", NULL };
 
 static Key keys[] = {
diff --git a/dwm.c b/dwm.c
index d27cb67..a530589 100644
--- a/dwm.c
+++ b/dwm.c
@@ -1643,8 +1643,7 @@ sigchld(int unused)
 void
 spawn(const Arg *arg)
 {
-   if (arg->v == dmenucmd)
-   dmenumon[0] = '0' + selmon->num;
+   monarg[0] = '0' + selmon->num;
if (fork() == 0) {
if (dpy)
close(ConnectionNumber(dpy));
-- 
2.10.2




Re: [hackers] [dwm] [PATCH] break up long config line

2016-12-05 Thread Markus Teich
Markus Teich wrote:
> Anselm R Garbe wrote:
> > Why, are you entering command line options also on separate lines?
> 
> Nope, but my command line input mostly is way shorter, because I don't have to
> enter a declaration in front of it and if I have such a special case like
> color schemes, I tend to put them away in a "config" file, e.g. creating an
> alias in `.mkshrc`. In the rare cases where I have complex and long arguments,
> yes indeed I enter them on the same line, and that's a mess. ;)

Heyho Anselm,

thanks for merging the other patches. I could not change your opinion on this
one then?

--Markus



Re: [hackers] [dwm] applied Ivan Delalande's NET_SUPPORTING_WM_CHECK patch for gtk3 compatibility || Anselm R Garbe

2016-12-05 Thread Hiltjo Posthuma
On Mon, Dec 05, 2016 at 01:51:36PM +0100, Silvan Jegen wrote:
> On Mon, Dec 5, 2016 at 1:45 PM, Markus Teich  
> wrote:
> > Anselm R Garbe wrote:
> >> I agree, but my MUA couldn't detect a proper attachment.
> >
> > Heyho Anselm,
> >
> > `git am` also works with the whole source-text of a mail. For example with 
> > mutt
> > you can create a local patches.mbox maildir on your filesystem and then 
> > copy the
> > mail source there with `C`. Then `git am PATH/TO/patches.mbox/cur/FILENAME` 
> > does
> > the trick.
> 
> It's also possible to just pipe the text of an email directly to 'git
> am' by using mutt's '|' command (obviously you will have to run mutt
> from your repo dir for this to work).
> 

Or do:
| cat >/tmp/patch
cd repodir
git am /tmp/patch

-- 
Kind regards,
Hiltjo



Re: [hackers] [sbase] [PATCH 10/10] cp: Check result of utimensat

2016-12-05 Thread Silvan Jegen
On Mon, Dec 5, 2016 at 6:55 AM, Michael Forney  wrote:
> POSIX says that if duplicating the modification/access times fails, then
> an error should be written to stderr.
> ---
>  libutil/cp.c | 6 --
>  1 file changed, 4 insertions(+), 2 deletions(-)

LGTM

> diff --git a/libutil/cp.c b/libutil/cp.c
> index 339c892..15e4ce5 100644
> --- a/libutil/cp.c
> +++ b/libutil/cp.c
> @@ -142,8 +142,10 @@ cp(const char *s1, const char *s2, int depth)
> if (!S_ISLNK(st.st_mode)) {
> times[0] = st.st_atim;
> times[1] = st.st_mtim;
> -   utimensat(AT_FDCWD, s2, times, 0);
> -
> +   if (utimensat(AT_FDCWD, s2, times, 0) < 0) {
> +   weprintf("utimensat %s:", s2);
> +   cp_status = 1;
> +   }
> if (chown(s2, st.st_uid, st.st_gid) < 0) {
> weprintf("chown %s:", s2);
> cp_status = 1;
> --
> 2.11.0
>
>



Re: [hackers] [sbase] [PATCH 06/10] xinstall: Check result of fchmod

2016-12-05 Thread Silvan Jegen
On Mon, Dec 5, 2016 at 6:55 AM, Michael Forney  wrote:
> ---
>  xinstall.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)

LGTM

> diff --git a/xinstall.c b/xinstall.c
> index bf921fb..5a0e390 100644
> --- a/xinstall.c
> +++ b/xinstall.c
> @@ -119,7 +119,8 @@ install(const char *s1, const char *s2, int depth)
> }
> concat(f1, s1, f2, s2);
>
> -   fchmod(fileno(f2), mode);
> +   if (fchmod(fileno(f2), mode) < 0)
> +   eprintf("fchmod %s:", s2);
>
> if (fclose(f2) == EOF)
> eprintf("fclose %s:", s2);
> --
> 2.11.0
>
>



Re: [hackers] [sbase] [PATCH 03/10] libutil: Add writeall utility function

2016-12-05 Thread Silvan Jegen
On Mon, Dec 5, 2016 at 6:55 AM, Michael Forney  wrote:
> writeall makes successive write calls to write an entire buffer to the
> output file descriptor. It returns the number of bytes written, or -1 on
> the first error.
> ---
>  Makefile   |  3 ++-
>  libutil/writeall.c | 21 +
>  util.h |  3 +++
>  3 files changed, 26 insertions(+), 1 deletion(-)
>  create mode 100644 libutil/writeall.c


LGTM


Cheers,

Silvan

> diff --git a/Makefile b/Makefile
> index 25bab70..a337ead 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -79,7 +79,8 @@ LIBUTILSRC =\
> libutil/strlcpy.c\
> libutil/strsep.c\
> libutil/strtonum.c\
> -   libutil/unescape.c
> +   libutil/unescape.c\
> +   libutil/writeall.c
>
>  LIB = $(LIBUTF) $(LIBUTIL)
>
> diff --git a/libutil/writeall.c b/libutil/writeall.c
> new file mode 100644
> index 000..4725ced
> --- /dev/null
> +++ b/libutil/writeall.c
> @@ -0,0 +1,21 @@
> +/* See LICENSE file for copyright and license details. */
> +#include 
> +
> +#include "../util.h"
> +
> +ssize_t
> +writeall(int fd, const void *buf, size_t len)
> +{
> +   const char *p = buf;
> +   ssize_t n;
> +
> +   while (len) {
> +   n = write(fd, p, len);
> +   if (n <= 0)
> +   return n;
> +   p += n;
> +   len -= n;
> +   }
> +
> +   return p - (const char *)buf;
> +}
> diff --git a/util.h b/util.h
> index b5860dc..eaad3ce 100644
> --- a/util.h
> +++ b/util.h
> @@ -62,6 +62,9 @@ char *strsep(char **, const char *);
>  int enregcomp(int, regex_t *, const char *, int);
>  int eregcomp(regex_t *, const char *, int);
>
> +/* io */
> +ssize_t writeall(int, const void *, size_t);
> +
>  /* misc */
>  void enmasse(int, char **, int (*)(const char *, const char *, int));
>  void fnck(const char *, const char *, int (*)(const char *, const char *, 
> int), int);
> --
> 2.11.0
>
>



Re: [hackers] [dwm] applied Ivan Delalande's NET_SUPPORTING_WM_CHECK patch for gtk3 compatibility || Anselm R Garbe

2016-12-05 Thread Silvan Jegen
On Mon, Dec 5, 2016 at 1:45 PM, Markus Teich  wrote:
> Anselm R Garbe wrote:
>> I agree, but my MUA couldn't detect a proper attachment.
>
> Heyho Anselm,
>
> `git am` also works with the whole source-text of a mail. For example with 
> mutt
> you can create a local patches.mbox maildir on your filesystem and then copy 
> the
> mail source there with `C`. Then `git am PATH/TO/patches.mbox/cur/FILENAME` 
> does
> the trick.

It's also possible to just pipe the text of an email directly to 'git
am' by using mutt's '|' command (obviously you will have to run mutt
from your repo dir for this to work).


Cheers,

Silvan



Re: [hackers] [sbase] [PATCH 02/10] od: Fix buffer overflow if -N flag is larger than BUFSIZ

2016-12-05 Thread Silvan Jegen
Hi

On Mon, Dec 5, 2016 at 6:55 AM, Michael Forney  wrote:
> Previously, if max was specified, od will call read with that size,
> potentially overflowing buf with data read from the file.
> ---
>  od.c | 11 +--
>  1 file changed, 5 insertions(+), 6 deletions(-)
>
> diff --git a/od.c b/od.c
> index 9b83501..b5884e7 100644
> --- a/od.c
> +++ b/od.c
> @@ -132,20 +132,19 @@ od(FILE *fp, char *fname, int last)
> size_t i;
> unsigned char buf[BUFSIZ];
> static off_t addr;
> -   size_t buflen;
> +   size_t n;
>
> while (skip - addr > 0) {
> -   buflen = fread(buf, 1, MIN(skip - addr, BUFSIZ), fp);
> -   addr += buflen;
> +   n = fread(buf, 1, MIN(skip - addr, sizeof(buf)), fp);
> +   addr += n;
> if (feof(fp) || ferror(fp))
> return;
> }
> if (!line)
> line = emalloc(linelen);
>
> -   while ((buflen = fread(buf, 1, max >= 0 ?
> -  max - (addr - skip) : BUFSIZ, fp))) {
> -   for (i = 0; i < buflen; i++, addr++) {
> +   while ((n = fread(buf, 1, MIN((size_t)max - (addr - skip), 
> sizeof(buf)), fp))) {

>From what I understand, max is an off_t which is signed and set to -1
(if not changed by a command line flag). If we cast this to the
unsigned size_t we get a very big number in the case where 'max' is
not set by a flag and the buffer size is used instead. Looks correct
to me.

The brackets around 'addr - skip' are not needed but I assume they are
there for documentation purposes (and they were present before the
patch too) so

LGTM


Cheers,

Silvan


> +   for (i = 0; i < n; i++, addr++) {
> line[lineoff++] = buf[i];
> if (lineoff == linelen) {
> printline(line, lineoff, addr - lineoff + 1);
> --
> 2.11.0
>
>



Re: [hackers] [dwm] applied Ivan Delalande's NET_SUPPORTING_WM_CHECK patch for gtk3 compatibility || Anselm R Garbe

2016-12-05 Thread Markus Teich
Anselm R Garbe wrote:
> I agree, but my MUA couldn't detect a proper attachment.

Heyho Anselm,

`git am` also works with the whole source-text of a mail. For example with mutt
you can create a local patches.mbox maildir on your filesystem and then copy the
mail source there with `C`. Then `git am PATH/TO/patches.mbox/cur/FILENAME` does
the trick.

--Markus



Re: [hackers] [sbase] [PATCH 01/10] crypt: Add some missing error checks for cryptsum

2016-12-05 Thread Silvan Jegen
Hi

And thanks for the patches!

Comments below.

On Mon, Dec 5, 2016 at 6:55 AM, Michael Forney  wrote:
> Previously, if a file failed to read in a checksum list, it would be
> reported as not matched rather than a read failure.
>
> Also, if reading from stdin failed, previously a bogus checksum would be
> printed anyway.
> ---
>  libutil/crypt.c | 16 ++--
>  1 file changed, 10 insertions(+), 6 deletions(-)
>
> diff --git a/libutil/crypt.c b/libutil/crypt.c
> index 3f849ba..6991c39 100644
> --- a/libutil/crypt.c
> +++ b/libutil/crypt.c
> @@ -64,7 +64,10 @@ mdchecklist(FILE *listfp, struct crypt_ops *ops, uint8_t 
> *md, size_t sz,
> (*noread)++;
> continue;
> }
> -   cryptsum(ops, fp, file, md);
> +   if (cryptsum(ops, fp, file, md)) {
> +   (*noread)++;
> +   continue;
> +   }
> r = mdcheckline(line, md, sz);
> if (r == 1) {
> printf("%s: OK\n", file);
> @@ -125,8 +128,10 @@ cryptmain(int argc, char *argv[], struct crypt_ops *ops, 
> uint8_t *md, size_t sz)
> int ret = 0;
>
> if (argc == 0) {
> -   cryptsum(ops, stdin, "", md);
> -   mdprint(md, "", sz);
> +   if (cryptsum(ops, stdin, "", md))
> +   ret = 1;

The return values in crypt.c are not consistent which tripped me up here.

"cryptsum" returns 1 on error (as does "cryptmain") but "mdcheckline"
returns 0 (or -1) on error and 1 on success. For consistency we should
change "mdcheckline" to return 1/-1 on error and 0 on success.

If we make that change it should be in a different patch though.

> +   else
> +   mdprint(md, "", sz);
> } else {
> for (; *argv; argc--, argv++) {
> if ((*argv)[0] == '-' && !(*argv)[1]) {
> @@ -137,11 +142,10 @@ cryptmain(int argc, char *argv[], struct crypt_ops 
> *ops, uint8_t *md, size_t sz)
> ret = 1;
> continue;
> }
> -   if (cryptsum(ops, fp, *argv, md)) {
> +   if (cryptsum(ops, fp, *argv, md))
> ret = 1;
> -   } else {
> +   else
> mdprint(md, *argv, sz);
> -   }

This is a style change and some people may thus want to have it put in
a separate patch. I think combining such a minor change with this
patch is fine.

This patch LGTM!


Cheers,

Silvan


> if (fp != stdin && fshut(fp, *argv))
> ret = 1;
> }
> --
> 2.11.0
>
>



Re: [hackers] [sbase] [PATCH 05/10] tail: Use getc and putc instead of concat

2016-12-05 Thread Hiltjo Posthuma
On Sun, Dec 04, 2016 at 09:55:07PM -0800, Michael Forney wrote:
> The FILE streams are buffered, so the end result is essentially the
> same, except now lines are printed as they are read since we don't wait
> until the entire buffer is filled.
> 
> This also fixes an issue where only part of the lines during the follow
> were printed if they contained NUL bytes.
> ---
>  tail.c | 22 +-
>  1 file changed, 13 insertions(+), 9 deletions(-)
> 
> diff --git a/tail.c b/tail.c
> index 711707f..ad97308 100644
> --- a/tail.c
> +++ b/tail.c
> @@ -20,6 +20,7 @@ dropinit(FILE *fp, const char *str, size_t n)
>   char *buf = NULL;
>   size_t size = 0, i = 1;
>   ssize_t len;
> + int c;
>  
>   if (mode == 'n') {
>   while (i < n && (len = getline(, , fp)) > 0)
> @@ -30,7 +31,10 @@ dropinit(FILE *fp, const char *str, size_t n)
>   i++;
>   }
>   free(buf);
> - concat(fp, str, stdout, "");
> + while ((c = fgetc(fp)) != EOF) {
> + if (fputc(c, stdout) == EOF)
> + break;
> + }
>  }
>  
>  static void
> @@ -88,9 +92,9 @@ main(int argc, char *argv[])
>  {
>   struct stat st1, st2;
>   FILE *fp;
> - size_t tmpsize, n = 10;
> - int fflag = 0, ret = 0, newline = 0, many = 0;
> - char *numstr, *tmp;
> + size_t n = 10;
> + int fflag = 0, ret = 0, newline = 0, many = 0, c;
> + char *numstr;
>   void (*tail)(FILE *, const char *, size_t) = taketail;
>  
>   ARGBEGIN {
> @@ -141,13 +145,13 @@ main(int argc, char *argv[])
>   ret = 1;
>   continue;
>   }
> - for (tmp = NULL, tmpsize = 0;;) {
> - while (getline(, , fp) > 0) {
> - fputs(tmp, stdout);
> - fflush(stdout);
> + for (;;) {
> + while ((c = fgetc(fp)) != EOF) {
> + if (fputc(c, stdout) == EOF)
> + eprintf("fputc :");
>   }
>   if (ferror(fp))
> - eprintf("readline %s:", *argv);
> + eprintf("fgetc %s:", *argv);
>   clearerr(fp);
>   /* ignore error in case file was removed, we 
> continue
>* tracking the existing open file descriptor */
> -- 
> 2.11.0
> 
> 

Hey Michael,

Just wondering: did you test if this will be much slower? Ideally test with
both musl and glibc.

-- 
Kind regards,
Hiltjo



Re: [hackers] [sbase] [PATCH 09/10] tail: Use fstat in case file is removed

2016-12-05 Thread Michael Forney
On Mon, Dec 5, 2016 at 1:20 AM, Hiltjo Posthuma  wrote:
> On Sun, Dec 04, 2016 at 09:55:11PM -0800, Michael Forney wrote:
>> ---
>>  tail.c | 16 +++-
>>  1 file changed, 7 insertions(+), 9 deletions(-)
>>
>> diff --git a/tail.c b/tail.c
>> index ad97308..000be62 100644
>> --- a/tail.c
>> +++ b/tail.c
>> @@ -133,7 +133,7 @@ main(int argc, char *argv[])
>>   }
>>   if (many)
>>   printf("%s==> %s <==\n", newline ? "\n" : "", 
>> *argv);
>> - if (stat(*argv, ) < 0)
>> + if (fstat(fileno(fp), ) < 0)
>>   eprintf("stat %s:", *argv);
>
> The error message should be "fstat" here instead of "stat".

Thanks, I've updated it locally and will send a v2 patch set later.



Re: [hackers] [sbase] [PATCH 09/10] tail: Use fstat in case file is removed

2016-12-05 Thread Hiltjo Posthuma
On Sun, Dec 04, 2016 at 09:55:11PM -0800, Michael Forney wrote:
> ---
>  tail.c | 16 +++-
>  1 file changed, 7 insertions(+), 9 deletions(-)
> 
> diff --git a/tail.c b/tail.c
> index ad97308..000be62 100644
> --- a/tail.c
> +++ b/tail.c
> @@ -133,7 +133,7 @@ main(int argc, char *argv[])
>   }
>   if (many)
>   printf("%s==> %s <==\n", newline ? "\n" : "", 
> *argv);
> - if (stat(*argv, ) < 0)
> + if (fstat(fileno(fp), ) < 0)
>   eprintf("stat %s:", *argv);

The error message should be "fstat" here instead of "stat".

>   if (!(S_ISFIFO(st1.st_mode) || S_ISREG(st1.st_mode)))
>   fflag = 0;
> @@ -153,15 +153,13 @@ main(int argc, char *argv[])
>   if (ferror(fp))
>   eprintf("fgetc %s:", *argv);
>   clearerr(fp);
> - /* ignore error in case file was removed, we 
> continue
> -  * tracking the existing open file descriptor */
> - if (!stat(*argv, )) {
> - if (st2.st_size < st1.st_size) {
> - fprintf(stderr, "%s: file 
> truncated\n", *argv);
> - rewind(fp);
> - }
> - st1 = st2;
> + if (fstat(fileno(fp), ) < 0)
> + eprintf("fstat:");
> + if (st2.st_size < st1.st_size) {
> + fprintf(stderr, "%s: file truncated\n", 
> *argv);
> + rewind(fp);
>   }
> + st1 = st2;
>   sleep(1);
>   }
>   }
> -- 
> 2.11.0
> 
> 

-- 
Kind regards,
Hiltjo



Re: [hackers] [dwm] applied Ivan Delalande's NET_SUPPORTING_WM_CHECK patch for gtk3 compatibility || Anselm R Garbe

2016-12-05 Thread Anselm R Garbe
Hi Hiltjo,

On 5 December 2016 at 10:18, Hiltjo Posthuma  wrote:
> I think its better to use `git am` next time to apply the original patches.
> This way the original author, commit message/reason/explanation is archived
> aswell.

I agree, but my MUA couldn't detect a proper attachment.

-Anselm



Re: [hackers] [sbase] [PATCH 00/10] IO improvements and some bug fixes

2016-12-05 Thread Michael Forney
On Mon, Dec 5, 2016 at 12:51 AM, Michael Forney  wrote:
> On Sun, Dec 4, 2016 at 11:27 PM, Laslo Hunhold  wrote:
>> fgetc/fputc really can slow down your program, which I noticed when I
>> wrote farbfeld-filters. Working on a buffer-basis rather than a
>> char-by-char-basis really speeds up things a lot (for me it was around
>> 50%-70%).
>
> Internally, fgetc/fputc are still using the buffers behind the FILE
> structures, so the only overhead I can imagine is due to the repeated
> function calls. The previous tail -f code used getline/fputs. We could
> fix the NUL byte issue with fwrite instead of fputs, but I'd like to
> make sure that it actually makes any noticeable difference before
> trying this.

So I think you are correct in that this is actually horribly slow. I
think tail should probably be managing its own buffer. I might take a
look at what other tail implementations do and play around with this.
For now, I think getline/fwrite is the only thing to do since fgets
doesn't return the string length, and fputs will stop at the first
NUL.



Re: [hackers] [dwm] applied Ivan Delalande's NET_SUPPORTING_WM_CHECK patch for gtk3 compatibility || Anselm R Garbe

2016-12-05 Thread Hiltjo Posthuma
Hey Anselm,

I think its better to use `git am` next time to apply the original patches.
This way the original author, commit message/reason/explanation is archived
aswell.

-- 
Kind regards,
Hiltjo



Re: [hackers] [dwm] [PATCH] per client resizehints

2016-12-05 Thread Anselm R Garbe
Hi Markus,

On 27 October 2016 at 14:34, Markus Teich  wrote:
> here you go. Per client resize hints. Since the client struct is always
> initialized with zeroes to preserve behaviour either the meaning has to be
> reversed ("ignorehints"?) or a default rule with class, instance and title
> set to NULL has to be added.

Why adding instance/class exceptions for resizehints? Do you have an
example where this should be taken into account?

-Anselm



Re: [hackers] [dwm] [PATCH] don't purge tagset of alternative view on _NET_ACTIVE_WINDOW event

2016-12-05 Thread Anselm R Garbe
On 27 October 2016 at 15:36, Markus Teich  wrote:
> Here is the version which sets the urgency hint on receiving 
> _NET_ACTIVE_WINDOW
> messages. There is no real "extra code", but a small refactoring was needed to
> stay sane: clearurgent() was renamed to seturgent() which takes the value to 
> set
> the urgency hint to as an extra parameter.
>
> Also after the patch the window does not get popped to the top of the master
> area anymore, since I thought that was in the same line of intrusiveness.

Thanks, applied.

-Anselm



[hackers] [dwm] applied Markus' tagset purge of alternative view on _NET_ACTIVE_WINDOW event || Anselm R Garbe

2016-12-05 Thread git
commit bb3bd6fec37174e8d4bb9457ca815c00609e5157
Author: Anselm R Garbe 
AuthorDate: Mon Dec 5 10:16:46 2016 +0100
Commit: Anselm R Garbe 
CommitDate: Mon Dec 5 10:16:46 2016 +0100

applied Markus' tagset purge of alternative view on _NET_ACTIVE_WINDOW event

diff --git a/dwm.c b/dwm.c
index ca6f679..d27cb67 100644
--- a/dwm.c
+++ b/dwm.c
@@ -153,7 +153,6 @@ static void buttonpress(XEvent *e);
 static void checkotherwm(void);
 static void cleanup(void);
 static void cleanupmon(Monitor *mon);
-static void clearurgent(Client *c);
 static void clientmessage(XEvent *e);
 static void configure(Client *c);
 static void configurenotify(XEvent *e);
@@ -204,6 +203,7 @@ static void setfullscreen(Client *c, int fullscreen);
 static void setlayout(const Arg *arg);
 static void setmfact(const Arg *arg);
 static void setup(void);
+static void seturgent(Client *c, int urg);
 static void showhide(Client *c);
 static void sigchld(int unused);
 static void spawn(const Arg *arg);
@@ -509,19 +509,6 @@ cleanupmon(Monitor *mon)
 }
 
 void
-clearurgent(Client *c)
-{
-   XWMHints *wmh;
-
-   c->isurgent = 0;
-   if (!(wmh = XGetWMHints(dpy, c->win)))
-   return;
-   wmh->flags &= ~XUrgencyHint;
-   XSetWMHints(dpy, c->win, wmh);
-   XFree(wmh);
-}
-
-void
 clientmessage(XEvent *e)
 {
XClientMessageEvent *cme = >xclient;
@@ -534,11 +521,8 @@ clientmessage(XEvent *e)
setfullscreen(c, (cme->data.l[0] == 1 /* 
_NET_WM_STATE_ADD*/
  || (cme->data.l[0] == 2 /* 
_NET_WM_STATE_TOGGLE */ && !c->isfullscreen)));
} else if (cme->message_type == netatom[NetActiveWindow]) {
-   if (!ISVISIBLE(c)) {
-   c->mon->seltags ^= 1;
-   c->mon->tagset[c->mon->seltags] = c->tags;
-   }
-   pop(c);
+   if (c != selmon->sel && !c->isurgent)
+   seturgent(c, 1);
}
 }
 
@@ -806,7 +790,7 @@ focus(Client *c)
if (c->mon != selmon)
selmon = c->mon;
if (c->isurgent)
-   clearurgent(c);
+   seturgent(c, 0);
detachstack(c);
attachstack(c);
grabbuttons(c, 1);
@@ -1616,6 +1600,20 @@ setup(void)
focus(NULL);
 }
 
+
+void
+seturgent(Client *c, int urg)
+{
+   XWMHints *wmh;
+
+   c->isurgent = urg;
+   if (!(wmh = XGetWMHints(dpy, c->win)))
+   return;
+   wmh->flags = urg ? (wmh->flags | XUrgencyHint) : (wmh->flags & 
~XUrgencyHint);
+   XSetWMHints(dpy, c->win, wmh);
+   XFree(wmh);
+}
+
 void
 showhide(Client *c)
 {



Re: [hackers] [sbase] [PATCH 00/10] IO improvements and some bug fixes

2016-12-05 Thread Martin Kühne
On Mon, Dec 5, 2016 at 10:03 AM, Michael Forney  wrote:
> This would eliminate the extra copies, but we still have the issue of
> doing fread repeated reads until the passed in buffer is completely
> filled before we are able to write anything. Run something like make
> 2>&1 | cat, and you will see the output only appear in large chunks.
>

I don't know what design decisions might have lead to the current situation.

> I guess my main point with this patch set is, we shouldn't be using
> the terrible stdio API and suffering from its shortcomings when a
> plain read and write work just as well if not better...
>

For educational purposes, stdio is probably the way to go.
Proceed, though, +1.

cheers!
mar77i



[hackers] [dwm] applied Markus' decouple color-scheme patch || Anselm R Garbe

2016-12-05 Thread git
commit 975c8983762246b50026d43079c60a78b341f81c
Author: Anselm R Garbe 
AuthorDate: Mon Dec 5 10:01:33 2016 +0100
Commit: Anselm R Garbe 
CommitDate: Mon Dec 5 10:01:33 2016 +0100

applied Markus' decouple color-scheme patch

diff --git a/config.def.h b/config.def.h
index fd77a07..ba9a240 100644
--- a/config.def.h
+++ b/config.def.h
@@ -12,7 +12,7 @@ static const char col_gray2[]   = "#44";
 static const char col_gray3[]   = "#bb";
 static const char col_gray4[]   = "#ee";
 static const char col_cyan[]= "#005577";
-static const char *colors[SchemeLast][3]  = {
+static const char *colors[][3]  = {
/*   fg bg border   */
[SchemeNorm] = { col_gray3, col_gray1, col_gray2 },
[SchemeSel] =  { col_gray4, col_cyan,  col_cyan  },
diff --git a/dwm.c b/dwm.c
index dbff59b..3d6cc28 100644
--- a/dwm.c
+++ b/dwm.c
@@ -60,7 +60,7 @@
 
 /* enums */
 enum { CurNormal, CurResize, CurMove, CurLast }; /* cursor */
-enum { SchemeNorm, SchemeSel, SchemeLast }; /* color schemes */
+enum { SchemeNorm, SchemeSel }; /* color schemes */
 enum { NetSupported, NetWMName, NetWMState,
NetWMFullscreen, NetActiveWindow, NetWMWindowType,
NetWMWindowTypeDialog, NetClientList, NetLast }; /* EWMH atoms */
@@ -263,7 +263,7 @@ static void (*handler[LASTEvent]) (XEvent *) = {
 static Atom wmatom[WMLast], netatom[NetLast];
 static int running = 1;
 static Cur *cursor[CurLast];
-static Scm scheme[SchemeLast];
+static Scm *scheme;
 static Display *dpy;
 static Drw *drw;
 static Monitor *mons, *selmon;
@@ -483,7 +483,7 @@ cleanup(void)
cleanupmon(mons);
for (i = 0; i < CurLast; i++)
drw_cur_free(drw, cursor[i]);
-   for (i = 0; i < SchemeLast; i++)
+   for (i = 0; i < LENGTH(colors); i++)
free(scheme[i]);
drw_free(drw);
XSync(dpy, False);
@@ -1549,6 +1549,7 @@ setmfact(const Arg *arg)
 void
 setup(void)
 {
+   int i;
XSetWindowAttributes wa;
 
/* clean up any zombies immediately */
@@ -1583,8 +1584,9 @@ setup(void)
cursor[CurResize] = drw_cur_create(drw, XC_sizing);
cursor[CurMove] = drw_cur_create(drw, XC_fleur);
/* init appearance */
-   scheme[SchemeNorm] = drw_scm_create(drw, colors[SchemeNorm], 3);
-   scheme[SchemeSel] = drw_scm_create(drw, colors[SchemeSel], 3);
+   scheme = ecalloc(LENGTH(colors), sizeof(Scm));
+   for (i = 0; i < LENGTH(colors); i++)
+   scheme[i] = drw_scm_create(drw, colors[i], 3);
/* init bars */
updatebars();
updatestatus();



Re: [hackers] [dwm][PATCH] clarify tile layout description in man page

2016-12-05 Thread Anselm R Garbe
Hi Ian,

On 1 December 2016 at 04:20, Ian Remmler  wrote:
> ---
>  dwm.1 | 9 +
>  1 file changed, 5 insertions(+), 4 deletions(-)
>
> diff --git a/dwm.1 b/dwm.1
> index 60ca1d6..e3b2c38 100644
> --- a/dwm.1
> +++ b/dwm.1
> @@ -10,8 +10,9 @@ and floating layouts. Either layout can be applied 
> dynamically, optimising the
>  environment for the application in use and the task performed.
>  .P
>  In tiled layouts windows are managed in a master and stacking area. The 
> master
> -area contains the window which currently needs most attention, whereas the
> -stacking area contains all other windows. In monocle layout all windows are
> +area on the left contains one window by default, and the stacking area on the
> +right contains all other windows. The number of master area windows can be
> +adjusted from zero to an arbitrary number. In monocle layout all windows are
>  maximised to the screen size. In floating layout windows can be resized and
>  moved freely. Dialog windows are always managed floating, regardless of the
>  layout applied.
> @@ -98,10 +99,10 @@ Focus next window.
>  Focus previous window.
>  .TP
>  .B Mod1\-i
> -Increase clients in master area.
> +Increase number of windows in master area.
>  .TP
>  .B Mod1\-d
> -Decrease clients in master area.
> +Decrease number of windows in master area.
>  .TP
>  .B Mod1\-l
>  Increase master area size.

Thanks, applied.

-Anselm



[hackers] [dwm] applied Markus' clarify status text padding patch || Anselm R Garbe

2016-12-05 Thread git
commit a137a86a234476bc3c7128fecbf845e6fc1de995
Author: Anselm R Garbe 
AuthorDate: Mon Dec 5 09:54:20 2016 +0100
Commit: Anselm R Garbe 
CommitDate: Mon Dec 5 09:54:20 2016 +0100

applied Markus' clarify status text padding patch

diff --git a/dwm.c b/dwm.c
index 421bf27..dbff59b 100644
--- a/dwm.c
+++ b/dwm.c
@@ -717,8 +717,8 @@ drawbar(Monitor *m)
/* draw status first so it can be overdrawn by tags later */
if (m == selmon) { /* status is only drawn on selected monitor */
drw_setscheme(drw, scheme[SchemeNorm]);
-   sw = TEXTW(stext) - lrpad / 2; /* no right padding so status 
text hugs the corner */
-   drw_text(drw, m->ww - sw, 0, sw, bh, lrpad / 2 - 2, stext, 0);
+   sw = TEXTW(stext) - lrpad + 2; /* 2px right padding */
+   drw_text(drw, m->ww - sw, 0, sw, bh, 0, stext, 0);
}
 
for (c = m->clients; c; c = c->next) {



[hackers] [dwm] applied Ivan Delalande's NET_SUPPORTING_WM_CHECK patch for gtk3 compatibility || Anselm R Garbe

2016-12-05 Thread git
commit e63bf229485a576d68975dd4eb00c210394133ae
Author: Anselm R Garbe 
AuthorDate: Mon Dec 5 10:09:49 2016 +0100
Commit: Anselm R Garbe 
CommitDate: Mon Dec 5 10:09:49 2016 +0100

applied Ivan Delalande's NET_SUPPORTING_WM_CHECK patch for gtk3 
compatibility

diff --git a/dwm.c b/dwm.c
index 3d6cc28..ca6f679 100644
--- a/dwm.c
+++ b/dwm.c
@@ -61,7 +61,7 @@
 /* enums */
 enum { CurNormal, CurResize, CurMove, CurLast }; /* cursor */
 enum { SchemeNorm, SchemeSel }; /* color schemes */
-enum { NetSupported, NetWMName, NetWMState,
+enum { NetSupported, NetWMName, NetWMState, NetWMCheck,
NetWMFullscreen, NetActiveWindow, NetWMWindowType,
NetWMWindowTypeDialog, NetClientList, NetLast }; /* EWMH atoms */
 enum { WMProtocols, WMDelete, WMState, WMTakeFocus, WMLast }; /* default atoms 
*/
@@ -267,7 +267,7 @@ static Scm *scheme;
 static Display *dpy;
 static Drw *drw;
 static Monitor *mons, *selmon;
-static Window root;
+static Window root, wmcheckwin;
 
 /* configuration, allows nested code to access above variables */
 #include "config.h"
@@ -485,6 +485,7 @@ cleanup(void)
drw_cur_free(drw, cursor[i]);
for (i = 0; i < LENGTH(colors); i++)
free(scheme[i]);
+   XDestroyWindow(dpy, wmcheckwin);
drw_free(drw);
XSync(dpy, False);
XSetInputFocus(dpy, PointerRoot, RevertToPointerRoot, CurrentTime);
@@ -1551,6 +1552,7 @@ setup(void)
 {
int i;
XSetWindowAttributes wa;
+   Atom utf8string;
 
/* clean up any zombies immediately */
sigchld(0);
@@ -1567,6 +1569,7 @@ setup(void)
bh = drw->fonts->h + 2;
updategeom();
/* init atoms */
+   utf8string = XInternAtom(dpy, "UTF8_STRING", False);
wmatom[WMProtocols] = XInternAtom(dpy, "WM_PROTOCOLS", False);
wmatom[WMDelete] = XInternAtom(dpy, "WM_DELETE_WINDOW", False);
wmatom[WMState] = XInternAtom(dpy, "WM_STATE", False);
@@ -1575,6 +1578,7 @@ setup(void)
netatom[NetSupported] = XInternAtom(dpy, "_NET_SUPPORTED", False);
netatom[NetWMName] = XInternAtom(dpy, "_NET_WM_NAME", False);
netatom[NetWMState] = XInternAtom(dpy, "_NET_WM_STATE", False);
+   netatom[NetWMCheck] = XInternAtom(dpy, "_NET_SUPPORTING_WM_CHECK", 
False);
netatom[NetWMFullscreen] = XInternAtom(dpy, "_NET_WM_STATE_FULLSCREEN", 
False);
netatom[NetWMWindowType] = XInternAtom(dpy, "_NET_WM_WINDOW_TYPE", 
False);
netatom[NetWMWindowTypeDialog] = XInternAtom(dpy, 
"_NET_WM_WINDOW_TYPE_DIALOG", False);
@@ -1590,6 +1594,14 @@ setup(void)
/* init bars */
updatebars();
updatestatus();
+   /* supporting window for NetWMCheck */
+   wmcheckwin = XCreateSimpleWindow(dpy, root, 0, 0, 1, 1, 0, 0, 0);
+   XChangeProperty(dpy, wmcheckwin, netatom[NetWMCheck], XA_WINDOW, 32,
+   PropModeReplace, (unsigned char *) , 1);
+   XChangeProperty(dpy, wmcheckwin, netatom[NetWMName], utf8string, 8,
+   PropModeReplace, (unsigned char *) "dwm", 4);
+   XChangeProperty(dpy, root, netatom[NetWMCheck], XA_WINDOW, 32,
+   PropModeReplace, (unsigned char *) , 1);
/* EWMH support per view */
XChangeProperty(dpy, root, netatom[NetSupported], XA_ATOM, 32,
PropModeReplace, (unsigned char *) netatom, NetLast);



[hackers] [dwm] applied Ian Remmler's man page adjustment suggestions || Anselm R Garbe

2016-12-05 Thread git
commit 5376947571040a4654384ea8889a54cc2313cca7
Author: Anselm R Garbe 
AuthorDate: Mon Dec 5 10:05:00 2016 +0100
Commit: Anselm R Garbe 
CommitDate: Mon Dec 5 10:05:00 2016 +0100

applied Ian Remmler's man page adjustment suggestions

diff --git a/dwm.1 b/dwm.1
index 60ca1d6..e3b2c38 100644
--- a/dwm.1
+++ b/dwm.1
@@ -10,8 +10,9 @@ and floating layouts. Either layout can be applied 
dynamically, optimising the
 environment for the application in use and the task performed.
 .P
 In tiled layouts windows are managed in a master and stacking area. The master
-area contains the window which currently needs most attention, whereas the
-stacking area contains all other windows. In monocle layout all windows are
+area on the left contains one window by default, and the stacking area on the
+right contains all other windows. The number of master area windows can be
+adjusted from zero to an arbitrary number. In monocle layout all windows are
 maximised to the screen size. In floating layout windows can be resized and
 moved freely. Dialog windows are always managed floating, regardless of the
 layout applied.
@@ -98,10 +99,10 @@ Focus next window.
 Focus previous window.
 .TP
 .B Mod1\-i
-Increase clients in master area.
+Increase number of windows in master area.
 .TP
 .B Mod1\-d
-Decrease clients in master area.
+Decrease number of windows in master area.
 .TP
 .B Mod1\-l
 Increase master area size.



Re: [hackers] [sbase] [PATCH 00/10] IO improvements and some bug fixes

2016-12-05 Thread Michael Forney
On Mon, Dec 5, 2016 at 12:57 AM, Martin Kühne  wrote:
> Sorry if this is completely off the hook now, but if FILE's buffering
> is an issue here, can't we just setbuf(NULL)?

This would eliminate the extra copies, but we still have the issue of
doing fread repeated reads until the passed in buffer is completely
filled before we are able to write anything. Run something like make
2>&1 | cat, and you will see the output only appear in large chunks.

I guess my main point with this patch set is, we shouldn't be using
the terrible stdio API and suffering from its shortcomings when a
plain read and write work just as well if not better...



Re: [hackers] [sbase] [PATCH 00/10] IO improvements and some bug fixes

2016-12-05 Thread Martin Kühne
Sorry if this is completely off the hook now, but if FILE's buffering
is an issue here, can't we just setbuf(NULL)?

cheers!
mar77i