summaryrefslogtreecommitdiffstats
path: root/configure
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2015-09-01 22:27:09 -0700
committerKaz Kylheku <kaz@kylheku.com>2015-09-01 22:27:09 -0700
commit88698e57f6a41adefd0a75bf8674c2ee065d1acd (patch)
tree149eeb1ff3663a851491cc6e146db128a7a6af88 /configure
parentd1805abb3e8fe34728de9de637247eb2f8917cd2 (diff)
downloadtxr-88698e57f6a41adefd0a75bf8674c2ee065d1acd.tar.gz
txr-88698e57f6a41adefd0a75bf8674c2ee065d1acd.tar.bz2
txr-88698e57f6a41adefd0a75bf8674c2ee065d1acd.zip
Unix password database access.
* configure: Detect getpwuid, getpwuid_r and others. * sysif.c (passwd_s, name_s, gecos_s, dir_s, shell_s): New symbol variables. (setpwent_wrap, endpwent_wrap, fill_passwd, make_pwstruct, getpwent_wrap, getpwuid_wrap, getpwnam_wrap): New static functions. (sysif_init): Initialize new symbol variables. Create passwd structure type. Register setpwent, endpwent, getpwent, getpwuid and getpwnam intrinsics. * txr.1: Documented passwd structure and functions.
Diffstat (limited to 'configure')
-rwxr-xr-xconfigure53
1 files changed, 53 insertions, 0 deletions
diff --git a/configure b/configure
index d2ade8cc..c6452488 100755
--- a/configure
+++ b/configure
@@ -121,6 +121,7 @@ have_windres=
have_posix_sigs=
need_darwin_c_source=
have_git=
+have_pwuid=
have_alloca=
conf_dir=config
config_h=$conf_dir/config.h
@@ -2049,6 +2050,58 @@ else
printf "no\n"
fi
+printf "Checking for old school getpwent, getpwuid and getpwnam ... "
+
+cat > conftest.c <<!
+#include <sys/types.h>
+#include <pwd.h>
+
+int main(void)
+{
+ struct passwd *p = getpwent();
+ struct passwd *q = getpwnam("root");
+ struct passwd *r = getpwuid(0);
+ setpwent();
+ endpwent();
+ return 0;
+}
+!
+
+if conftest ; then
+ printf "yes\n"
+ printf "#define HAVE_PWUID 1\n" >> $config_h
+ have_pwuid=y
+else
+ printf "no\n"
+fi
+
+if [ "$have_pwuid" ]; then
+ printf "Checking for getpwent_r, getpwuid_r, and getpwnam_r ... "
+
+ cat > conftest.c <<!
+#include <sys/types.h>
+#include <pwd.h>
+
+int main(void)
+{
+ struct passwd pw;
+ struct passwd *p;
+ char buf[1024];
+ int r0 = getpwent_r(&pw, buf, sizeof buf, &p);
+ int r1 = getpwuid_r(0, &pw, buf, sizeof buf, &p);
+ int r2 = getpwnam_r("root", &pw, buf, sizeof buf, &p);
+ return 0;
+}
+!
+
+ if conftest ; then
+ printf "yes\n"
+ printf "#define HAVE_PWUID_R 1\n" >> $config_h
+ else
+ printf "no\n"
+ fi
+fi
+
printf "Checking for alloca ... "
for try_header in alloca.h malloc.h ; do