diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2014-07-07 20:29:43 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2014-07-07 20:29:43 -0700 |
commit | 71cc1d5902abb8cc005114f28a5cea8d766a4b05 (patch) | |
tree | 49242d1f03974045036d21772dae553738301e18 | |
parent | 46b7f60f9fa32fd2a8c2162cf108dc89d3d95196 (diff) | |
download | txr-71cc1d5902abb8cc005114f28a5cea8d766a4b05.tar.gz txr-71cc1d5902abb8cc005114f28a5cea8d766a4b05.tar.bz2 txr-71cc1d5902abb8cc005114f28a5cea8d766a4b05.zip |
* Makefile: install the LICENSE and METALICENSE files into the data
directory.
* txr.c (help): Help text updated to document --license option.
(license): New function.
(txr_main): Implement --license option.
* unwind.h (uw_catch): Add cast to suppress warning about unused symbol.
* txr.1: Document --license option.
-rw-r--r-- | ChangeLog | 13 | ||||
-rw-r--r-- | Makefile | 2 | ||||
-rw-r--r-- | txr.1 | 5 | ||||
-rw-r--r-- | txr.c | 39 | ||||
-rw-r--r-- | unwind.h | 1 |
5 files changed, 60 insertions, 0 deletions
@@ -1,5 +1,18 @@ 2014-07-07 Kaz Kylheku <kaz@kylheku.com> + * Makefile: install the LICENSE and METALICENSE files into the data + directory. + + * txr.c (help): Help text updated to document --license option. + (license): New function. + (txr_main): Implement --license option. + + * unwind.h (uw_catch): Add cast to suppress warning about unused symbol. + + * txr.1: Document --license option. + +2014-07-07 Kaz Kylheku <kaz@kylheku.com> + * lib.c (replace_list, sel): fix use of unused variable. 2014-07-07 Kaz Kylheku <kaz@kylheku.com> @@ -167,6 +167,8 @@ PREINSTALL := : install: $(PROG) $(PREINSTALL) $(call INSTALL,0755,txr$(EXE),$(DESTDIR)$(bindir)) + $(call INSTALL,0444,$(top_srcdir)/LICENSE,$(DESTDIR)$(datadir)) + $(call INSTALL,0444,$(top_srcdir)/METALICENSE,$(DESTDIR)$(datadir)) $(call INSTALL,0444,$(top_srcdir)/txr.1,$(DESTDIR)$(mandir)/man1) $(call INSTALL,0444,$(top_srcdir)/share/txr/stdlib/*.txr,$(DESTDIR)$(datadir)/stdlib) @@ -194,6 +194,11 @@ once. .IP --help Prints usage summary on standard output, and terminates successfully. +.IP --license +Prints the software license. This depends on the software being +installed such that the LICENSE file is in the data directory. +Use of txr implies agreement with the liability disclaimer in the license. + .IP --version Prints program version standard output, and terminates successfully. @@ -121,6 +121,9 @@ static void help(void) " to the utility.\n" "--help You already know!\n" "--version Display program version\n" +"--license Display software license\n" +" Use of txr implies agreement with the disclaimer\n" +" section at the bottom of the license.\n" "--lisp-bindings Synonym for -l\n" "--debugger Synonym for -d\n" "\n" @@ -240,6 +243,39 @@ static void sysroot_init(void) toint(lit(TXR_VER), nil)); } +static int license(void) +{ + int retval = EXIT_SUCCESS; + + uw_catch_begin(cons(error_s, nil), esym, eobj); + + { + val path = sysroot(lit("share/txr/LICENSE")); + val lic = open_file(path, lit("r")); + val line; + + put_char(chr('\n'), std_output); + + while ((line = get_line(lic))) + put_line(line, std_output); + + put_char(chr('\n'), std_output); + + close_stream(lic, nil); + } + + uw_catch (esym, eobj) { + format(std_output, lit("~a:\nThis TXR installation might be unlicensed.\n"), eobj, nao); + retval = EXIT_FAILURE; + } + + uw_unwind { } + + uw_catch_end; + + return retval; +} + int txr_main(int argc, char **argv); int main(int argc, char **argv) @@ -331,6 +367,9 @@ int txr_main(int argc, char **argv) return 0; } + if (equal(arg, lit("--license"))) + return license(); + if (memqual(arg, list(lit("-a"), lit("-c"), lit("-f"), lit("-e"), lit("-p"), nao))) { @@ -173,6 +173,7 @@ noreturn val type_mismatch(val, ...); case 2: \ EXCVAR = uw_catch.ca.exception; \ SYMVAR = uw_catch.ca.sym; \ + (void) SYMVAR; \ /* prevent looping */ \ uw_catch.ca.matches = nil; |