aruu

[MIRROR] Actual replacement for Busybox | suckless
git clone https://git.daat.foo/aruu.git
Log | Files | Refs | README | LICENSE

apathmax.c (383B)


      1 /* see LICENSE file for copyright and license details */
      2 #include <errno.h>
      3 #include <stdio.h>
      4 #include <stdlib.h>
      5 #include <unistd.h>
      6 
      7 #include "../util.h"
      8 
      9 void
     10 apathmax(char **p, long *size)
     11 {
     12   errno = 0;
     13 
     14   if ((*size = pathconf("/", _PC_PATH_MAX)) == -1) {
     15     if (errno == 0) {
     16       *size = BUFSIZ;
     17     } else {
     18       eprintf("pathconf:");
     19     }
     20   }
     21   *p = emalloc(*size);
     22 }