summaryrefslogtreecommitdiffstats
path: root/txr.1
Commit message (Collapse)AuthorAgeFilesLines
* New: standard stream redirection for subprocesses.Kaz Kylheku2016-05-071-0/+74
| | | | | | | | | | | | | | | | | | | When subprocesses are created using open-command, open-process, run or sh, any streams not bound by those functions are obtained from *stdin*, *stdout* or *stderr*, as appropriate. Thus manipulating these variables has the effect of redirecting not only local output within the program but over coprocesses as well. * stream.c (struct save_fds): New type. (FDS_IN, FDS_OUT, FDS_ERR): New macros. (fds_init, fds_subst, fds_swizzle, fds_restore): New static functions. (open_command, open_process, run): "Swizzle" and restore the standard file descriptors. * txr.1: Updated documentation of affected function.
* New --reexec option.Kaz Kylheku2016-05-051-0/+28
| | | | | | | | | | | | | | | | | This helps with setuid hash bang scripting on Mac OS, and other plaforms where the interpreter executed out of a hash bang script runs with orinary privilege, even if marked setuid. * sysif.c (exec_wrap): Static function turns extern. * sysif.h (exec-wrap): Declared. * txr.1: Documented --reexec. Added notes about setuid under Hash Bang Support. * txr.c (help): List --reexec option. (txr_main): Implement --reexec option.
* Somew new path access testing functions.Kaz Kylheku2016-05-041-27/+79
| | | | | | | | | | | | | | * lisplib.c (path_test_set_entries): New elements in the list for path-readable-to-me-p, path-read-writable-to-me-p, and path-strictly-private-to-me-p. * share/txr/stdlib/path-test.pl (sys:path-access): Test bitwise combinations of permissions, so read+write can be tested in one call. (path-readable-to-me-p, path-read-writable-to-me-p, path-strictly-private-to-me-p): New functions. * txr.1: Documented.
* Implement setgid script support.Kaz Kylheku2016-05-021-6/+39
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | TXR now notices that it's running setgid, and implements setgid logic for scripts. * sysif.c (orig_egid, real_gid, is_setgid): New static variables. (repress_privilege): Treat real and effective group ID similarly to user ID. Save them in global variables, and set the is_setgid flag. (drop_privilege): Drop setgid privilege similarly to setuid. Operate selectively: if neither setuid nor setgid is in effect, do nothing, but if just one is in effect, don't do anything for the other. (simulate_setuid): Function renamed to simulate_setuid_setgid. A small change is made here: if the fstat fails, just drop privilege, don't abort. Implement setgid operation independently of setuid. The is_setgid and is_setuid flags are manipulated here now to get the drop_privileges function to selectively drop setuid if we are running a script which is only segid, or drop setgid if we are running a setuid only script. * sysif.h (simulate_setuid): Declaration name change to simulate_setuid_setgid. * txr.c (txr_main): Follow rename of simulate_setuid. * txr.1: SETUID OPERATION section changed to SETUID/SETGID operation, and setgid description worked into the text.
* Fix somewhat broken setuid privilege dropping.Kaz Kylheku2016-05-011-43/+62
| | | | | | | | | | | | | | | | | | | | | | * sysif.c (repress_privilege): Eliminate redundant getuid call. (drop_privilege): On some platforms, setuid(getuid()) will not drop setuid non-root privilege. This is fixed by using setresuid, if we have it, which we do on Linux. On platforms where we don't have setresuid, we try setuid(getuid()). Then after that if we are able to change our effective user ID to the one we dropped, we conclude that it didn't work and abort. (simulate_setuid): Call drop_privilege instead of repeating the naive privilege-dropping logic. Check the result of seteuid; if it fails, then drop privilege! Otherwise a txr that is setuid bob will continue running as bob, if it fails to enact setuid on a script owned by alice. * txr.1: Rewrite SETUID OPERATION section in an attempt to clarify the wording, fix formatting issues, and describe the current implemenation of privilege dropping.
* Adding getresuid, getresuid, getresgid and setresgid.Kaz Kylheku2016-05-011-0/+36
| | | | | | | | | | | * configure: Test for these functions. * sysif.c (getresuid_wrap, getresgid_wrap, setresuid_wrap, setresgid_wrap): New static function. (sysif_init): Registered getresuid, setresgid, setresuid and setresgid intrinsics. * txr.1: Documented all four functions.
* Adding setgroups function.Kaz Kylheku2016-05-011-12/+32
| | | | | | | | | | | * configure: Test for setgroups. New HAVE_SETGROUPS preprocessor symbol for config/config.h. * sysif.c (setgroups_wrap): New static function. (sysif_init): Register intrinsic setgroups function. * txr.1: Documented setgroups. Rearranged sections so getgroups and setgroups descriptions are consecutive.
* Use random padding in PRNG rather than 0xAA.Kaz Kylheku2016-04-281-0/+25
| | | | | | | | | | | | | | | | | | | | | | | | The purpose is to eliminate any biases in the PRNG arising out of the regularity of that pattern, so that the behavior of successive values is good from the beginning. This doesn't solve the problem that a short warm-up period leads to a poor distribution of initial values relative to the seed space. In other words, that similar seeds lead to initially similar sequences. * rand.c (rand_tab): New static array. (make_random_state): Set uninitialized parts of state from the corresponding elements in rand_tab, rather than to the 0xAAAAAAAA values. (rand_compat_fixup): In 139 compatibility mode, clobber rand_tab with 0xAA bytes. * tests/013/maze.expected: Updated. * txr.1: Added some PRNG implementation notes, and also compatibility notes.
* Clean-up rand code; implement configurable warmup.Kaz Kylheku2016-04-281-4/+56
| | | | | | | | | | | | | | | | | | | | | * lib.c (copy): Pass new second argument to make_random_state. * rand.c (random_warmup): New macro. (random_warmup_s): New symbol variable. (make_random_state): New warmup argument. Code restructured to avoid copy flag. Fill code and initialization of r->cur made common. (rand_compat_fixup): Pass second argument to make_random_state. (rand_init): Pass second argument to make_random_state. Initialize random_warmup_s with interned symbol. Register *random-warmup* special variable. Fix registration of make-random-state to two-argument function type. * rand.h (make_random_state): Declaration updated. * txr.1: Document *random-warmup* variable and warup argument of make-random-state.
* Simple indirection on pattern functions: @(call).Kaz Kylheku2016-04-271-0/+90
| | | | | | | | | | * eval.h (call_s): Declared. * match.c (h_call, v_call): New static function. (dir_tables_init): Register v_call in v_directive_table under call symbol. Likewise h_call in h_directive_table. * txr.1: Documented.
* Adding fixnum-min and fixnum-max variables.Kaz Kylheku2016-04-271-0/+15
| | | | | | | * arith.c (arith_init): Registered fixnum-min and fixnum-max variables. * txr.1: Documented.
* Check .metn similarly to .codn and fix.Kaz Kylheku2016-04-261-27/+28
| | | | | | * checkman.txr: Check .metn using logic shared with .codn. * txr.1: Numerous errors fixed.
* Change .meta to single-argument.Kaz Kylheku2016-04-261-8/+8
| | | | | | | | * checkman.txr: Check .meta similarly to .code. * txr.1: Change .meta macro to take only one argument, so that text with spaces must be quoted. Errors found and fixed.
* Check that arg 2 of .codn starts with punctuation.Kaz Kylheku2016-04-261-5/+5
| | | | | | | | * checkman.txr: Constraint on first character of second argument coded as a require constraint, enforced with assert. * txr.1: Newly discovered errors fixed.
* Change .codn and .code to fixed arity.Kaz Kylheku2016-04-261-427/+455
| | | | | | | | | | | | | | | | | | | In the manual, the .code and .codn macros are no longer variadic. They take one an two arguments, respectively. Multiple arguments have to be quoted now. This makes it easier to detect errors in usage, using support in checkman.txr. Numerous errors were found, in fact. * checkman.txr (check-code): New pattern function for doing some checks on .code, codn, cod2 and cod3 macro usage. * txr.1: code and codn macro are no longer variadic. All variadic uses fixes with quotes. Numerous errors discovered and corrected.
* Fix errors found by new checkman.txr.Kaz Kylheku2016-04-261-21/+21
| | | | | | * txr.1: Fix incorrect function and variable description headings with spurious commas and inappropriate plurals. Fix missing .mets in syntax blocks.
* Version 139.txr-139Kaz Kylheku2016-04-221-2/+2
| | | | | | | | | | * RELNOTES: Updated. * configure, txr.1: Bumped version and date. * share/txr/stdlib/ver.tl: Likewise. * txr.vim, tl.vim: Regenerated.
* Spring cleaning: find wrong wrong troff macros.Kaz Kylheku2016-04-221-60/+61
| | | | | | * txr.1: Hunted down and fixed incorrect .code, .codn, .meta and .metn invocations. Added missing .desc macros after .coNP Variables ...
* Support list of paths in ftw.Kaz Kylheku2016-04-221-0/+47
| | | | | | | * ftw.c (ftw_wrap): Handle case when dirpath is a list, by recursion. * txr.1: Documented.
* Integrating fnmatch.Kaz Kylheku2016-04-201-0/+54
| | | | | | | | | | | | * configure: new test for fnmatch, introducing HAVE_FNMATCH configure variable into config/config.h. * sysif.c (fnmatch_wrap): New function. (sysif_init): Register intrinsic variables fnm-pathname, fnm-noescape, fnm-period, fnm-leading-dir, fnm-casefold and fnm-extmatch. Register intrinsic function fnmatch. * txr.1: Documented.
* read-until-match can optionally keep matched text.Kaz Kylheku2016-04-201-12/+24
| | | | | | | | | | | | | | | | | | | | * regex.c (read_until_match): New argument, include_match. Three times repeated termination code refactored into block reached by forward goto. (regex_init): Registration of read-until-match updated. * regex.h (read_until_match): Declaration updated. * stream.c (struct record_adapter_base): New member, include_match. (record_adapter_get_line): Pass match to read_until_match as new argument. (record_adapater): New argument, include_match. (stream_init): Update registration of record-adapter. * stream.h (record_adapter): Declaration updated. * txr.1: Updated.
* Allow unlimited character pushback in unget-char.Kaz Kylheku2016-04-191-1/+16
| | | | | | | | | | | | | | | | Fixing read_until_match will require this feature. * socket.c (dgram_get_char): Treat unget_c as a cons-based stack; pop a character from it if available. (dgram_unget_char): Push the character onto unget_c rather than storing the characer into unget_c. * stream.c (stdio_get_char, stdio_unget_char): Closely analogous changes to the ones in dgram_get_char and dgram_unget_char, respectively. * txr.1: Documentation improved and updated.
* Fix inconsistency of Lisp var visibility in TXR.Kaz Kylheku2016-04-171-12/+35
| | | | | | | | | | | | | | | | | | | Numerous places in match.c are using assoc(sym, bindings) logic to access a variable, which doesn't see the Lisp globals, as we would like. For example, if foo is defined using (defvar foo), @(set foo "A") doesn't work. This is subject to the compatibility option. * match.c (tx_lookup_var): New static function. (dest_set, h_var, h_coll, h_parallel, h_fun, v_next, v_parallel, v_gather, v_collect, v_flatten, v_cat, v_output, v_filter, v_fun, match_filter): Use tx_lookup_var instead of assoc for all lookups that see the full variable scope. Only variable lists known to be locally consed up are scanned with just assoc. * txr.1: Documented new rules and added compatibility notes.
* Version 138.txr-138Kaz Kylheku2016-04-161-2/+2
| | | | | | | | | | * RELNOTES: Updated. * configure, txr.1: Bumped version and date. * share/txr/stdlib/ver.tl: Likewise. * txr.vim, tl.vim: Regenerated.
* Improve sock-peer documentation.Kaz Kylheku2016-04-161-19/+20
| | | | | | * txr.1: Remove factually incorrect statements that only sockets connected with sock-connect or sock-accept have a peer address. Broadly revise wording.
* Doc for sys:abscond* references nonexistent sym.Kaz Kylheku2016-04-161-1/+1
| | | | | * txr.1: Incorrect reference to sys:return* should of course be to sys:abscond*.
* Notes on glob and exceptions.Kaz Kylheku2016-04-151-0/+19
| | | | | | * txr.1: Document that glob's error-func callback can be terminated by a non-local exit, but may not capture continuations across glob.
* Glob-related variables wrongly documented as special.Kaz Kylheku2016-04-151-1/+1
| | | | | * txr.1: glob-err, glob-mark and others are global lexical variables, not special.
* Adding ftw function.Kaz Kylheku2016-04-151-0/+194
| | | | | | | | | | | | | | * Makefile (ftw.o): Add to OBJS-y conditionally. * configure (have_ftw): New variable. New configure test for nftw. (gen_config_make): Set up have_ftw make variable. * ftw.c, ftw.h: New files. * lib.c (init): Call ftw_init, if compiled in. * txr.1: Documented.
* Macros obtain* and obtain*-block.Kaz Kylheku2016-04-151-0/+76
| | | | | | | | | | * lisplib.c (yield_set_entries): Add obtain* and obtain*-block to autoload list. * share/txr/stdlib/yield.tl (obtain*, obtain*-block): New macros. * txr.1: Documented.
* Fix proper-listp to proper-list-p.Kaz Kylheku2016-04-141-6/+17
| | | | | | | | | | | | | | | | | | | | This is really a gratuitous incompatibility with Common Lisp and other dialects. Let's fix it internally also, but keep the proper-listp function binding for backwards compatibility. * eval.c (dot_to_apply, me_op): Update proper_listp call to proper_list_p. (eval_init): Register proper-list-p to the same C function as proper-listp, and that C function is now called proper_list_p. * lib.c (proper_listp): Renamed to proper_list_p. * lib.h (proper_listp): Declaration updated. * parser.y (define_transform): Update proper_listp call. * txr.1: Replace all occurrences of proper-listp with proper-list-p. Add note explaining the rename situation.
* Remove @(do) from Lisp examples.Kaz Kylheku2016-04-141-17/+15
| | | | * txr.1: example for delay and gen doesn't need @(do).
* Fix incorrect example under umeth.Kaz Kylheku2016-04-141-2/+2
| | | | | * txr.1: Functions bound to variables must be invoked using DWIM brackets or call function.
* New open-socket-pair function.Kaz Kylheku2016-04-141-0/+27
| | | | | | | | | | | * lisplib.c (sock_set_entries): Add open-socket-pair to autoload list. * socket.c (sock_mark_connected, socketpair_wrap): New static functions. (sock_load_init): Register open-socket-pair intrinsic. * txr.1: Documented.
* Adding fmt function.Kaz Kylheku2016-04-141-0/+17
| | | | | | | | * stream.c (fmt): New function. * stream.h (fmt): Declared. * txr.1: Documented.
* Improved window-map doc.Kaz Kylheku2016-04-131-6/+6
| | | | * txr.1: Better wording introducing the semantics.
* Fix wrong documentation for window-map.Kaz Kylheku2016-04-131-7/+5
| | | | | * txr.1: window-map doesn't require the function to return sequences, and doesn't append.
* Formatting in defstruct documentation.Kaz Kylheku2016-04-121-10/+1
| | | | | | * txr.1: remove spurious blank lines before .meIP blocks. After the indented section end, return to the correct indentation with .IP rather than .PP.
* Better handling of dot position function calls.Kaz Kylheku2016-04-111-19/+60
| | | | | | | | | | | | | | | | | | | | | | | | | | The expander now actually produces apply forms for dot position function call and dwim forms. This allows symbol macros to work naturally. * eval.c (sys_apply_s): New symbol variable. (imp_list_to_list, dot_to_apply): New static functions. (expand_forms, expand_forms_lisp1): We now throw an error if a non-nil atom terminates a form, Except in compatibility mode with TXR 137 or less, whereby we emulate the old behavior of not expanding this atom. (do_expand): Perform the dot_to_apply transformation on the arguments of the dwim form. Perform the dot_to_apply transformation on an entire function call form. (eval_init): Initialize sys_apply_s and register sys:apply function (using the same function object that is registered under apply). * txr.1: Documented that both DWIM forms and regular function call forms work as if by a transformation to apply form, removing verbiage which separately described the DWIM handling. Documented that symbol macros work properly in dot position.
* Fix more macro name misspellings in manual.Dave Love2016-04-101-10/+10
| | | | | * txr.1: A few occurrences of .codn misspelled .cond are are fixed and one .cod fixed to .code.
* Allow symbol macro in function call dot position.Kaz Kylheku2016-04-071-0/+14
| | | | | | | | | | * eval.c (expand_forms): If the forms list is an atom, then don't just return it. Try to expand it as a macro. If the macro produces a compound form, diagnose with an exception, otherwise return the expansion. * txr.1: Document the treatment of symbol macros in function call dot position.
* Document improper lists as macro call forms.Kaz Kylheku2016-04-071-0/+36
| | | | | | | | * txr.1: New section: Improper Lists as Macro Calls. This is necessary because the section on Dot Position in Function Calls doesn't cover macros. Macros are simpler, because it's just destructuring of syntax.
* Example formatting under Dot Position in Function Calls.Kaz Kylheku2016-04-071-2/+2
| | | | * txr.1: Just some whitespace for alignment of comments.
* Dot position in function calls described in terms of apply.Kaz Kylheku2016-04-071-21/+29
| | | | | | | | * txr.1: Reduce and simplify the description text under the Dot Position in Function Calls section, giving the semantics via equivalence to apply. The handling of values which are atoms or improper lists is described under apply in a more effective way.
* Mistake in apply example.Kaz Kylheku2016-04-071-1/+1
| | | | * txr.1: Example produces (1 2 3 4), not (1 2 3).
* Fix inappropriate references to tree-bind.Kaz Kylheku2016-04-051-3/+3
| | | | | | * txr.1: Documentation for the tc macro falsely claims that it is based on tree-bind, in the description and example expansion.
* Cramped parenthesis under suspend.Kaz Kylheku2016-04-051-2/+2
| | | | | * txr.1: Fix strange formatting mistake, causing parenthesis to follow a meta symbol with no whitespace.
* Incorrect obtain-block heading.Kaz Kylheku2016-04-051-1/+1
| | | | * txr.1: obtain-block introduced as the obtain-from macro.
* Bugfix: support abstract UNIX socket addresses on Linux.Kaz Kylheku2016-03-311-4/+34
| | | | | | | | | | | | | Making it work as already documented. * socket.c (MIN): New macro. (sockaddr_pack): Use utf8_dup_to_buf to convert Unix socket path to a buffer of UTF-8 bytes, possibly with one or more embedded null bytes. Copy as much of this as fits into the sun_path member of struct sockaddr_un. * txr.1: Improve documentation about the abstract names on Linux.
* Define a sock-peer syntactic place.Kaz Kylheku2016-03-311-6/+43
| | | | | | | * share/txr/stdlib/socket.tl (sock-peer): Syntactic place defined, allowing (set (sock-peer sock) addr). * txr.1: Documented sock-peer as accessor and sock-set-peer.