summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2016-06-27 11:28:59 -0700
committerKaz Kylheku <kaz@kylheku.com>2016-06-27 11:33:35 -0700
commit6d390f413981c29c15e6ce8a6faf59cae77246f9 (patch)
tree422b037d0c9028232308fdf3c336158465f65507
parent9a9fe075f5c1f79dde574bae585431b717a83e18 (diff)
downloadtxr-6d390f413981c29c15e6ce8a6faf59cae77246f9.tar.gz
txr-6d390f413981c29c15e6ce8a6faf59cae77246f9.tar.bz2
txr-6d390f413981c29c15e6ce8a6faf59cae77246f9.zip
Preparations for bundling Cygwin library.
* LICENSE-CYG: New file. * METALICENSE: Include a note about the use of Cygwin in accordance with LGPL. * txr.c (license): Use glob to iterate over all files in the txr share directory which match the LICENSE* pattern.
-rw-r--r--LICENSE-CYG4
-rw-r--r--METALICENSE4
-rw-r--r--txr.c36
3 files changed, 33 insertions, 11 deletions
diff --git a/LICENSE-CYG b/LICENSE-CYG
new file mode 100644
index 00000000..e7b37cd4
--- /dev/null
+++ b/LICENSE-CYG
@@ -0,0 +1,4 @@
+This build of TXR is linked against the Cygwin library, which is
+Copyright (C) 1995-2016 Red Hat Inc. and is distributed and used
+with TXR in accordance with the Lesser GNU Public License (LGPL),
+Version 3 <https://cygwin.com/COPYING.LIB>.
diff --git a/METALICENSE b/METALICENSE
index a504cd3c..493a680e 100644
--- a/METALICENSE
+++ b/METALICENSE
@@ -48,3 +48,7 @@ legally questionable, so the MPI library must be regarded as being copyrighted
by Michael J. Fromberger. The above text can be reasonably understood to
constitute a license which is compatible with the TXR LICENSE file
in the sense that it is at least as permissive.
+
+TXR is ported to Windows with the help of the Cygwin library. For user
+conveninence, a packaged version of TXR includes the CYGWIN.DLL, in accordance
+with the terms of Cywgin's license, the GNU Lesser Public License, Version 3.
diff --git a/txr.c b/txr.c
index ad6f834d..0be29644 100644
--- a/txr.c
+++ b/txr.c
@@ -53,6 +53,9 @@
#include "regex.h"
#include "arith.h"
#include "sysif.h"
+#if HAVE_GLOB
+#include "glob.h"
+#endif
#include "txr.h"
const wchli_t *version = wli(TXR_VER);
@@ -337,25 +340,36 @@ static int license(void)
{
int retval = EXIT_SUCCESS;
- uw_catch_begin(cons(error_s, nil), esym, eobj);
+ uw_catch_begin(cons(error_s, nil), esym, eargs);
{
- val path = sysroot(lit("share/txr/LICENSE"));
- val lic = open_file(path, lit("r"));
- val line;
-
- put_char(chr('\n'), std_output);
+ val iter;
+#if HAVE_GLOB
+ val glob_pattern = sysroot(lit("share/txr/LICENSE*"));
+ val path_list = glob_wrap(glob_pattern, zero, nil);
+#else
+ val glob_pattern = sysroot(lit("share/txr/LICENSE"));
+ val path_list = cons(glob_pattern, nil);
+#endif
- while ((line = get_line(lic)))
- put_line(line, std_output);
+ if (!path_list)
+ uw_throwf(error_s, lit("Error: pattern ~a didn't match any files."),
+ glob_pattern, nao);
put_char(chr('\n'), std_output);
- close_stream(lic, nil);
+ for (iter = path_list; iter; iter = cdr(iter)) {
+ val lic = open_file(car(iter), lit("r"));
+
+ put_lines(lazy_stream_cons(lic), std_output);
+ put_char(chr('\n'), std_output);
+ }
}
- uw_catch (esym, eobj) {
- format(std_output, lit("~a:\nThis TXR installation might be unlicensed.\n"), eobj, nao);
+ uw_catch (esym, eargs) {
+ format(std_output,
+ lit("~a\nThis TXR installation might be unlicensed.\n"),
+ car(eargs), nao);
retval = EXIT_FAILURE;
}