diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2015-09-17 22:23:53 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2015-09-17 22:23:53 -0700 |
commit | 86d3b7542e1dffa525f0d131d1ef26440055f39e (patch) | |
tree | 6b8ffa84dedef15ed83b15b872cf7b376ffb1cb3 /configure | |
parent | 7959a22f6f5434dcbc505c1a8f7b560c5b621077 (diff) | |
download | txr-86d3b7542e1dffa525f0d131d1ef26440055f39e.tar.gz txr-86d3b7542e1dffa525f0d131d1ef26440055f39e.tar.bz2 txr-86d3b7542e1dffa525f0d131d1ef26440055f39e.zip |
Add unix group database functions.
* configure (have_grgid): New variable.
New tests added for getgrent and the rest.
(HAVE_GRGID, HAVE_GRGID_R): New preprocessor symbols
conditionally deposited into config/config.h.
* sysif.c (group_s, mem_s): New global symbol variables.
(setgrent_wrap, endgrent_wrap, fill_group, make_grstruct,
get_grent_wrap, getgrgid_wrap, getgrnam_wrap): New static
functions.
(sysif_init): New global symbol variables initialized.
New group struct type instantiated.
Intrinsic functions setgrent, endgrent, getgrent,
getgrgid and getgrnam registered.
* txr.1: Documented group structure and functions.
Diffstat (limited to 'configure')
-rwxr-xr-x | configure | 52 |
1 files changed, 52 insertions, 0 deletions
@@ -122,6 +122,7 @@ have_posix_sigs= need_darwin_c_source= have_git= have_pwuid= +have_grgid= have_alloca= have_termios= have_winsize= @@ -2108,6 +2109,57 @@ int main(void) fi fi +printf "Checking for old school getgrent, getgrgid and getgrnam ... " + +cat > conftest.c <<! +#include <sys/types.h> +#include <grp.h> + +int main(void) +{ + struct group *g = getgrent(); + struct group *h = getgrnam("root"); + struct group *i = getgrgid(0); + setgrent(); + endgrent(); + return 0; +} +! + +if conftest ; then + printf "yes\n" + printf "#define HAVE_GRGID 1\n" >> $config_h + have_grgid=y +else + printf "no\n" +fi + +if [ "$have_grgid" ]; then + printf "Checking for getgrgid_r and getgrnam_r ... " + + cat > conftest.c <<! +#include <sys/types.h> +#include <grp.h> + +int main(void) +{ + struct group gr; + struct group *g; + char buf[1024]; + int r1 = getgrgid_r(0, &gr, buf, sizeof buf, &g); + int r2 = getgrnam_r("root", &gr, buf, sizeof buf, &g); + return 0; +} +! + + if conftest ; then + printf "yes\n" + printf "#define HAVE_GRGID_R 1\n" >> $config_h + else + printf "no\n" + fi +fi + printf "Checking for alloca ... " for try_header in alloca.h malloc.h ; do |