aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org>2019-05-10 08:02:03 +0300
committerSergey Poznyakoff <gray@gnu.org>2019-05-10 08:02:03 +0300
commit9223032f5025f8bc4820dfdfb081be1c7fcd1c4e (patch)
treee1209bcc78f5a48673c36ea5ad4d820f4ab1bd98
parent462c760d4605787a6f5baecc87dfee5e8ee5238b (diff)
downloadsmap-9223032f5025f8bc4820dfdfb081be1c7fcd1c4e.tar.gz
smap-9223032f5025f8bc4820dfdfb081be1c7fcd1c4e.tar.bz2
Support for Guile 2.2
* NEWS: Update. * README: Update. * configure.ac: Drop support for Guile versions prior to 2.2 and Mailutils prior to 3.0 * modules/guile/getpw.scm: Use inet-ntop instead of the withdrawn inet-ntoa. * modules/guile/guile.c: Rewrite for Guile 2.2
-rw-r--r--NEWS9
-rw-r--r--README8
-rw-r--r--configure.ac10
-rw-r--r--modules/guile/getpw.scm4
-rw-r--r--modules/guile/guile.c89
5 files changed, 36 insertions, 84 deletions
diff --git a/NEWS b/NEWS
index efe0707..d8b87f3 100644
--- a/NEWS
+++ b/NEWS
@@ -1,11 +1,14 @@
-Smap NEWS -- history of user-visible changes. 2015-06-20
-Copyright (C) 2006-2010, 2014-1015 Sergey Poznyakoff
+Smap NEWS -- history of user-visible changes. 2019-05-10
See the end of file for copying conditions.
Please send Smap bug reports to <gray+smap@gnu.org.ua>
+
+Version 2.0.90 (git)
+
+* Support for Guile 2.2
Version 2.0, 2015-06-20
* new module: ldap
@@ -71,13 +74,13 @@ Version 1.0, 2010-06-19
* First release
=========================================================================
Copyright information:
-Copyright (C) 2006-2010, 2014-1015 Sergey Poznyakoff
+Copyright (C) 2006-2019 Sergey Poznyakoff
Permission is granted to anyone to make or distribute verbatim copies
of this document as received, in any medium, provided that the
copyright notice and this permission notice are preserved,
thus giving the recipient permission to redistribute in turn.
diff --git a/README b/README
index 170a593..5130d82 100644
--- a/README
+++ b/README
@@ -1,8 +1,8 @@
Smap README
-Copyright (C) 2006-2010, 2014 Sergey Poznyakoff
+See end of file for copying conditions.
* Introduction
==============
This file contains brief information about configuring, testing
and running Smap. It is *not* intended as a replacement
@@ -67,22 +67,22 @@ generic options. Smap-specific options are:
Compile with TCP wrappers (libwrap) support. This is the default.
** --with-mailutils
Compile with GNU Mailutils, build the `mailutils' module. By default,
this is enabled if configure determines that a sufficiently new
-version of GNU Mailutils (i.e. 2.0 or newer) is installed.
+version of GNU Mailutils (i.e. 3.0 or newer) is installed.
See http://www.gnu.org/software/mailutils for more information on GNU
Mailutils including file downloads.
** --with-guile
Compile with Guile support; build the `guile' module. By default,
this is enabled if configure determines that a sufficiently new
-version of Guile (i.e. 1.8 or newer) is installed.
+version of Guile (i.e. 2.2 or newer) is installed.
See http://www.gnu.org/software/guile for additional information on
Guile including file downloads.
** --with-guile-site-dir[=DIR]
Specify a directory to install guile modules to. Without argument --
@@ -106,13 +106,13 @@ description of its format.
If you are upgrading an old installation, your previous smapd.conf
will remain intact.
* Copyright information
-Copyright (C) 2006, 2007, 2008, 2009, 2010 Sergey Poznyakoff
+Copyright (C) 2006-2019 Sergey Poznyakoff
Permission is granted to anyone to make or distribute verbatim copies
of this document as received, in any medium, provided that the
copyright notice and this permission notice are preserved,
thus giving the recipient permission to redistribute in turn.
diff --git a/configure.ac b/configure.ac
index 8bec28d..46774b2 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,8 +1,8 @@
# This file is part of Smap. -*- autoconf -*-
-# Copyright (C) 2010, 2014-2016 Sergey Poznyakoff
+# Copyright (C) 2010, 2014-2019 Sergey Poznyakoff
#
# Smap is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3, or (at your option)
# any later version.
#
@@ -17,13 +17,15 @@
AC_PREREQ(2.63)
m4_define([SMAP_VERSION_MAJOR], 2)
m4_define([SMAP_VERSION_MINOR], 0)
m4_define([SMAP_VERSION_PATCH], 90)
AC_INIT([smap],
SMAP_VERSION_MAJOR.SMAP_VERSION_MINOR[]m4_ifdef([SMAP_VERSION_PATCH],.SMAP_VERSION_PATCH),
- [gray+smap@gnu.org.ua])
+ [gray+smap@gnu.org.ua],
+ [smap],
+ [http://smap.software.gnu.org.ua])
AC_CONFIG_SRCDIR([src/smapd.c])
AC_CONFIG_HEADERS([config.h])
AC_CONFIG_AUX_DIR([build-aux])
AC_CONFIG_MACRO_DIR([m4])
AM_INIT_AUTOMAKE([1.11 gnits tar-ustar std-options silent-rules subdir-objects])
@@ -98,24 +100,24 @@ AC_ARG_WITH([mailutils],
AC_HELP_STRING([--with-mailutils],
[use GNU Mailutils]),
[status_mailutils=${withval}],
[status_mailutils=maybe])
if test $status_mailutils != no; then
- AM_GNU_MAILUTILS(2.99.992, [all],
+ AM_GNU_MAILUTILS(3.0, [all],
[status_mailutils=yes],
[if test $status_mailutils = yes; then
AC_MSG_ERROR([GNU Mailutils not found])
fi
status_mailutils=no])
fi
AM_CONDITIONAL([MAILUTILS_COND],[test $status_mailutils = yes])
# Guile
-GINT_INIT([gint],[1.8 with-guile nodoc],
+GINT_INIT([gint],[2.2.0 with-guile nodoc],
[status_guile=yes],
[status_guile=no])
AM_CONDITIONAL([GUILE_COND],[test $status_guile = yes])
# Mysql
AC_ARG_WITH(mysql,
diff --git a/modules/guile/getpw.scm b/modules/guile/getpw.scm
index 168badb..2a8bc39 100644
--- a/modules/guile/getpw.scm
+++ b/modules/guile/getpw.scm
@@ -1,8 +1,8 @@
;;;; This file is part of Smap.
-;;;; Copyright (C) 2010, 2014 Sergey Poznyakoff
+;;;; Copyright (C) 2010, 2014, 2019 Sergey Poznyakoff
;;;;
;;;; Smap is free software; you can redistribute it and/or modify
;;;; it under the terms of the GNU General Public License as published by
;;;; the Free Software Foundation; either version 3, or (at your option)
;;;; any later version.
;;;;
@@ -84,13 +84,13 @@
;;; rest - connection information
(define-public (smap-query handle map arg . rest)
;; Log the connection
(let ((src (car rest)))
(format (current-error-port) "connect from ~A~%"
(if (= (sockaddr:fam src) AF_INET)
- (inet-ntoa (sockaddr:addr src))
+ (inet-ntop AF_INET (sockaddr:addr src))
"UNIX socket")))
;; Select appropriate handler and call it
(let ((elt (assoc map map-list)))
;; Whatever you write to the current output port, is buffered until
;; the newline character, then converted into a proper `sockmap'
;; protocol packet and sent back to the client as a reply.
diff --git a/modules/guile/guile.c b/modules/guile/guile.c
index ae63a51..2ce66c5 100644
--- a/modules/guile/guile.c
+++ b/modules/guile/guile.c
@@ -1,8 +1,8 @@
/* This file is part of Smap.
- Copyright (C) 2010, 2014, 2015 Sergey Poznyakoff
+ Copyright (C) 2010, 2014, 2015, 2019 Sergey Poznyakoff
Smap is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3, or (at your option)
any later version.
@@ -168,118 +168,65 @@ argv_to_scm(int argc, char **argv)
scm_last = new;
}
}
return scm_first;
}
-static scm_t_bits scm_tc16_smap_output_port;
+static scm_t_port_type *scm_smap_output_port_type;
struct _guile_smap_output_port {
smap_stream_t stream;
};
static SCM
_make_smap_output_port(smap_stream_t stream)
{
struct _guile_smap_output_port *dp;
- SCM port;
- scm_port *pt;
- dp = scm_gc_malloc(sizeof (struct _guile_smap_output_port),
- "smap-output_-port");
+ dp = scm_gc_typed_calloc (struct _guile_smap_output_port);
dp->stream = stream;
-
- port = scm_new_port_table_entry(scm_tc16_smap_output_port);
- pt = SCM_PTAB_ENTRY(port);
- pt->rw_random = 0;
- SCM_SET_CELL_TYPE(port,
- (scm_tc16_smap_output_port |
- SCM_OPN | SCM_WRTNG | SCM_BUF0));
- SCM_SETSTREAM(port, dp);
- return port;
+ return scm_c_make_port (scm_smap_output_port_type,
+ SCM_WRTNG | SCM_BUF0,
+ (scm_t_bits) dp);
}
#define SMAP_OUTPUT_PORT(x) ((struct _guile_smap_output_port *) SCM_STREAM (x))
-static SCM
-_smap_output_port_mark(SCM port)
-{
- return SCM_BOOL_F;
-}
-
static void
-_smap_output_port_flush(SCM port)
-{
- scm_port *pt = SCM_PTAB_ENTRY(port);
- struct _guile_smap_output_port *dp = SMAP_OUTPUT_PORT(port);
- if (dp && pt->write_pos > pt->write_buf)
- smap_stream_write(dp->stream, "\n", 1, NULL);
-}
-
-static int
_smap_output_port_close(SCM port)
{
struct _guile_smap_output_port *dp = SMAP_OUTPUT_PORT(port);
- if (dp) {
- _smap_output_port_flush(port);
- SCM_SETSTREAM(port, NULL);
- scm_gc_free(dp, sizeof(struct _guile_smap_output_port),
- "smap-output-port");
+ if (dp && dp->stream) {
+ smap_stream_flush(dp->stream);
}
- return 0;
}
-static scm_sizet
-_smap_output_port_free(SCM port)
-{
- _smap_output_port_close(port);
- return 0;
-}
-
-static int
-_smap_output_port_fill_input(SCM port)
-{
- return EOF;
-}
-
-static void
-_smap_output_port_write(SCM port, const void *data, size_t size)
+static size_t
+_smap_output_port_write(SCM port, SCM src, size_t start, size_t count)
{
struct _guile_smap_output_port *dp = SMAP_OUTPUT_PORT(port);
- smap_stream_write(dp->stream, data, size, NULL);
-}
-
-static scm_t_off
-_smap_output_port_seek (SCM port, scm_t_off offset, int whence)
-{
- return -1;
+ smap_stream_write(dp->stream, SCM_BYTEVECTOR_CONTENTS (src) + start, count, NULL);
+ return count;
}
static int
_smap_output_port_print(SCM exp, SCM port, scm_print_state *pstate)
{
scm_puts ("#<Smap output port>", port);
return 1;
}
static void
_init_smap_output_port()
{
- scm_tc16_smap_output_port = scm_make_port_type("smap-output-port",
- _smap_output_port_fill_input,
- _smap_output_port_write);
- scm_set_port_mark (scm_tc16_smap_output_port, _smap_output_port_mark);
- scm_set_port_free (scm_tc16_smap_output_port, _smap_output_port_free);
- scm_set_port_print (scm_tc16_smap_output_port,
- _smap_output_port_print);
- scm_set_port_flush (scm_tc16_smap_output_port,
- _smap_output_port_flush);
- scm_set_port_close (scm_tc16_smap_output_port,
- _smap_output_port_close);
- scm_set_port_seek (scm_tc16_smap_output_port,
- _smap_output_port_seek);
+ scm_smap_output_port_type = scm_make_port_type("smap-output-port",
+ NULL,
+ _smap_output_port_write);
+ scm_set_port_print(scm_smap_output_port_type, _smap_output_port_print);
+ scm_set_port_close(scm_smap_output_port_type, _smap_output_port_close);
+ scm_set_port_needs_close_on_gc(scm_smap_output_port_type, 1);
}
static void
_add_load_path(char *path)
{
SCM scm, path_scm;

Return to:

Send suggestions and report system problems to the System administrator.