Changeset View
Changeset View
Standalone View
Standalone View
head/usr.sbin/pkg/config.c
Show All 34 Lines | |||||
#include <sys/utsname.h> | #include <sys/utsname.h> | ||||
#include <sys/sbuf.h> | #include <sys/sbuf.h> | ||||
#include <sys/sysctl.h> | #include <sys/sysctl.h> | ||||
#include <dirent.h> | #include <dirent.h> | ||||
#include <ucl.h> | #include <ucl.h> | ||||
#include <err.h> | #include <err.h> | ||||
#include <errno.h> | #include <errno.h> | ||||
#include <paths.h> | |||||
#include <stdbool.h> | #include <stdbool.h> | ||||
#include <unistd.h> | #include <unistd.h> | ||||
#include "config.h" | #include "config.h" | ||||
#define roundup2(x, y) (((x)+((y)-1))&(~((y)-1))) /* if y is powers of two */ | #define roundup2(x, y) (((x)+((y)-1))&(~((y)-1))) /* if y is powers of two */ | ||||
struct config_value { | struct config_value { | ||||
▲ Show 20 Lines • Show All 398 Lines • ▼ Show 20 Lines | if (val != NULL) { | ||||
default: | default: | ||||
c[i].val = val; | c[i].val = val; | ||||
break; | break; | ||||
} | } | ||||
} | } | ||||
} | } | ||||
/* Read LOCALBASE/etc/pkg.conf first. */ | /* Read LOCALBASE/etc/pkg.conf first. */ | ||||
localbase = getenv("LOCALBASE") ? getenv("LOCALBASE") : _LOCALBASE; | localbase = getenv("LOCALBASE") ? getenv("LOCALBASE") : _PATH_LOCALBASE; | ||||
snprintf(confpath, sizeof(confpath), "%s/etc/pkg.conf", | snprintf(confpath, sizeof(confpath), "%s/etc/pkg.conf", | ||||
localbase); | localbase); | ||||
if (access(confpath, F_OK) == 0 && read_conf_file(confpath, | if (access(confpath, F_OK) == 0 && read_conf_file(confpath, | ||||
CONFFILE_PKG)) | CONFFILE_PKG)) | ||||
goto finalize; | goto finalize; | ||||
/* Then read in all repos from REPOS_DIR list of directories. */ | /* Then read in all repos from REPOS_DIR list of directories. */ | ||||
▲ Show 20 Lines • Show All 71 Lines • Show Last 20 Lines |