├── MODULE_LICENSE_BSD_LIKE ├── OWNERS ├── METADATA ├── src ├── check.t ├── mksh.ico ├── jehanne.c ├── strlcpy.c ├── var_spec.h ├── rlimits.opt ├── emacsfn.h ├── FAQ2HTML.sh ├── exprtok.h ├── sh_flags.gen ├── rlimits.gen ├── lalloc.c ├── sh_flags.opt ├── mirhash.h ├── lksh.1 ├── os2.c ├── dot.mkshrc ├── tree.c ├── syn.c └── mksh.faq ├── mkshrc_vendor ├── mkshrc ├── Android.patch.txt ├── NOTICE └── Android.bp /MODULE_LICENSE_BSD_LIKE: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /OWNERS: -------------------------------------------------------------------------------- 1 | include platform/system/core:/janitors/OWNERS 2 | -------------------------------------------------------------------------------- /METADATA: -------------------------------------------------------------------------------- 1 | third_party { 2 | license_type: NOTICE 3 | } 4 | -------------------------------------------------------------------------------- /src/check.t: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ArrowOS/android_external_mksh/arrow-13.1/src/check.t -------------------------------------------------------------------------------- /src/mksh.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ArrowOS/android_external_mksh/arrow-13.1/src/mksh.ico -------------------------------------------------------------------------------- /mkshrc_vendor: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2010, 2012, 2013, 2014 2 | # Thorsten Glaser 3 | # This file is provided under the same terms as mksh. 4 | #- 5 | # Minimal /system/etc/mkshrc for Android 6 | # 7 | # Support: https://launchpad.net/mksh 8 | 9 | set +o nohup 10 | 11 | if (( USER_ID )); then PS1='$'; else PS1='#'; fi 12 | PS4='[$EPOCHREALTIME] '; PS1='${| 13 | local e=$? 14 | 15 | (( e )) && REPLY+="$e|" 16 | 17 | return $e 18 | }$HOSTNAME:${PWD:-?} '"$PS1 " 19 | -------------------------------------------------------------------------------- /mkshrc: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2010, 2012, 2013, 2014 2 | # Thorsten Glaser 3 | # This file is provided under the same terms as mksh. 4 | #- 5 | # Minimal /system/etc/mkshrc for Android 6 | # 7 | # Support: https://launchpad.net/mksh 8 | 9 | set +o nohup 10 | 11 | if (( USER_ID )); then PS1='$'; else PS1='#'; fi 12 | PS4='[$EPOCHREALTIME] '; PS1='${| 13 | local e=$? 14 | 15 | (( e )) && REPLY+="$e|" 16 | 17 | return $e 18 | }$HOSTNAME:${PWD:-?} '"$PS1 " 19 | 20 | export TERM=xterm-256color 21 | -------------------------------------------------------------------------------- /src/jehanne.c: -------------------------------------------------------------------------------- 1 | /*- 2 | * Copyright (c) 2017 3 | * Giacomo Tesio 4 | * 5 | * Provided that these terms and disclaimer and all copyright notices 6 | * are retained or reproduced in an accompanying document, permission 7 | * is granted to deal in this work without restriction, including un- 8 | * limited rights to use, publicly perform, distribute, sell, modify, 9 | * merge, give away, or sublicence. 10 | * 11 | * This work is provided "AS IS" and WITHOUT WARRANTY of any kind, to 12 | * the utmost extent permitted by applicable law, neither express nor 13 | * implied; without malicious intent or gross negligence. In no event 14 | * may a licensor, author or contributor be held liable for indirect, 15 | * direct, other damage, loss, or other issues arising in any way out 16 | * of dealing in the work, even if advised of the possibility of such 17 | * damage or existence of a defect, except proven that it results out 18 | * of said person's immediate fault when using the work as intended. 19 | *- 20 | * Initialisation code for the Jehanne operating system (a Plan 9 de- 21 | * rivative, using GCC) 22 | */ 23 | 24 | static const char __rcsid[] __attribute__((__used__)) = 25 | "$MirOS: src/bin/mksh/jehanne.c,v 1.1 2017/12/22 16:30:00 tg Exp $"; 26 | 27 | #include 28 | #include 29 | #include 30 | 31 | void 32 | __application_newlib_init(int argc, char *argv[]) 33 | { 34 | rfork(RFFDG | RFREND | RFNOTEG); 35 | libposix_emulate_SIGCHLD(); 36 | } 37 | -------------------------------------------------------------------------------- /Android.patch.txt: -------------------------------------------------------------------------------- 1 | Only in src: FAQ.htm 2 | diff -u mksh-R59b/funcs.c src/funcs.c 3 | --- mksh-R59b/funcs.c 2020-05-16 15:38:48.000000000 -0700 4 | +++ src/funcs.c 2020-05-20 17:14:19.588510856 -0700 5 | @@ -104,7 +104,9 @@ 6 | {Tsgbreak, c_brkcont}, 7 | {T__builtin, c_builtin}, 8 | {Tbuiltin, c_builtin}, 9 | +#if !defined(__ANDROID__) 10 | {Tbcat, c_cat}, 11 | +#endif 12 | {Tcd, c_cd}, 13 | /* dash compatibility hack */ 14 | {"chdir", c_cd}, 15 | @@ -125,7 +127,9 @@ 16 | {"pwd", c_pwd}, 17 | {Tread, c_read}, 18 | {Tdsgreadonly, c_typeset}, 19 | +#if !defined(__ANDROID__) 20 | {"!realpath", c_realpath}, 21 | +#endif 22 | {"~rename", c_rename}, 23 | {"*=return", c_exitreturn}, 24 | {Tsghset, c_set}, 25 | @@ -159,8 +163,10 @@ 26 | {"~printf", c_printf}, 27 | #endif 28 | #if HAVE_SELECT 29 | +#if !defined(__ANDROID__) 30 | {"sleep", c_sleep}, 31 | #endif 32 | +#endif 33 | #ifdef __MirBSD__ 34 | /* alias to "true" for historical reasons */ 35 | {"domainname", c_true}, 36 | diff -u mksh-R59b/main.c src/main.c 37 | --- mksh-R59b/main.c 2020-05-16 15:51:51.000000000 -0700 38 | +++ src/main.c 2020-05-20 17:14:19.588510856 -0700 39 | @@ -414,6 +414,12 @@ 40 | /* import environment */ 41 | init_environ(); 42 | 43 | + /* override default PATH regardless of environment */ 44 | +#ifdef MKSH_DEFPATH_OVERRIDE 45 | + vp = global(TPATH); 46 | + setstr(vp, MKSH_DEFPATH_OVERRIDE, KSH_RETURN_ERROR); 47 | +#endif 48 | + 49 | /* for security */ 50 | typeset(TinitIFS, 0, 0, 0, 0); 51 | 52 | Only in src: main.c.orig 53 | Only in src: Rebuild.sh 54 | Only in src: rlimits.gen 55 | Only in src: sh_flags.gen 56 | Only in src: signames.inc 57 | Only in src: test.sh 58 | -------------------------------------------------------------------------------- /src/strlcpy.c: -------------------------------------------------------------------------------- 1 | /*- 2 | * Copyright (c) 2006, 2008, 2009, 2013 3 | * mirabilos 4 | * Copyright (c) 1998 Todd C. Miller 5 | * 6 | * Permission to use, copy, modify, and distribute this software for any 7 | * purpose with or without fee is hereby granted, provided that the above 8 | * copyright notice and this permission notice appear in all copies. 9 | * 10 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 11 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 12 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 13 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 14 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 15 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 16 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 17 | */ 18 | 19 | #include "sh.h" 20 | 21 | __RCSID("$MirOS: src/bin/mksh/strlcpy.c,v 1.10 2015/11/29 17:05:02 tg Exp $"); 22 | 23 | /* 24 | * Copy src to string dst of size siz. At most siz-1 characters 25 | * will be copied. Always NUL terminates (unless siz == 0). 26 | * Returns strlen(src); if retval >= siz, truncation occurred. 27 | */ 28 | #undef strlcpy 29 | size_t 30 | strlcpy(char *dst, const char *src, size_t siz) 31 | { 32 | const char *s = src; 33 | 34 | if (siz == 0) 35 | goto traverse_src; 36 | 37 | /* copy as many chars as will fit */ 38 | while (--siz && (*dst++ = *s++)) 39 | ; 40 | 41 | /* not enough room in dst */ 42 | if (siz == 0) { 43 | /* safe to NUL-terminate dst since we copied <= siz-1 chars */ 44 | *dst = '\0'; 45 | traverse_src: 46 | /* traverse rest of src */ 47 | while (*s++) 48 | ; 49 | } 50 | 51 | /* count does not include NUL */ 52 | return ((size_t)(s - src - 1)); 53 | } 54 | -------------------------------------------------------------------------------- /src/var_spec.h: -------------------------------------------------------------------------------- 1 | /*- 2 | * Copyright (c) 2009, 2011, 2012, 2016, 2018 3 | * mirabilos 4 | * 5 | * Provided that these terms and disclaimer and all copyright notices 6 | * are retained or reproduced in an accompanying document, permission 7 | * is granted to deal in this work without restriction, including un- 8 | * limited rights to use, publicly perform, distribute, sell, modify, 9 | * merge, give away, or sublicence. 10 | * 11 | * This work is provided "AS IS" and WITHOUT WARRANTY of any kind, to 12 | * the utmost extent permitted by applicable law, neither express nor 13 | * implied; without malicious intent or gross negligence. In no event 14 | * may a licensor, author or contributor be held liable for indirect, 15 | * direct, other damage, loss, or other issues arising in any way out 16 | * of dealing in the work, even if advised of the possibility of such 17 | * damage or existence of a defect, except proven that it results out 18 | * of said person's immediate fault when using the work as intended. 19 | */ 20 | 21 | #if defined(VARSPEC_DEFNS) 22 | __RCSID("$MirOS: src/bin/mksh/var_spec.h,v 1.11 2018/01/13 21:38:10 tg Exp $"); 23 | #define FN(name) /* nothing */ 24 | #elif defined(VARSPEC_ENUMS) 25 | #define FN(name) V_##name, 26 | #define F0(name) V_##name = 0, 27 | #elif defined(VARSPEC_ITEMS) 28 | #define F0(name) /* nothing */ 29 | #define FN(name) #name, 30 | #endif 31 | 32 | #ifndef F0 33 | #define F0 FN 34 | #endif 35 | 36 | /* NOTE: F0 are skipped for the ITEMS array, only FN generate names */ 37 | 38 | /* 0 is always V_NONE */ 39 | F0(NONE) 40 | 41 | /* 1 and up are special variables */ 42 | FN(BASHPID) 43 | #ifdef __OS2__ 44 | FN(BEGINLIBPATH) 45 | #endif 46 | FN(COLUMNS) 47 | #ifdef __OS2__ 48 | FN(ENDLIBPATH) 49 | #endif 50 | FN(EPOCHREALTIME) 51 | #if HAVE_PERSISTENT_HISTORY 52 | FN(HISTFILE) 53 | #endif 54 | FN(HISTSIZE) 55 | FN(IFS) 56 | #ifdef MKSH_EARLY_LOCALE_TRACKING 57 | FN(LANG) 58 | FN(LC_ALL) 59 | FN(LC_CTYPE) 60 | #endif 61 | #ifdef __OS2__ 62 | FN(LIBPATHSTRICT) 63 | #endif 64 | FN(LINENO) 65 | FN(LINES) 66 | FN(OPTIND) 67 | FN(PATH) 68 | FN(RANDOM) 69 | FN(SECONDS) 70 | #ifndef MKSH_NO_CMDLINE_EDITING 71 | FN(TERM) 72 | #endif 73 | FN(TMOUT) 74 | FN(TMPDIR) 75 | 76 | #undef FN 77 | #undef F0 78 | #undef VARSPEC_DEFNS 79 | #undef VARSPEC_ENUMS 80 | #undef VARSPEC_ITEMS 81 | -------------------------------------------------------------------------------- /src/rlimits.opt: -------------------------------------------------------------------------------- 1 | /*- 2 | * Copyright (c) 2013, 2015 3 | * mirabilos 4 | * 5 | * Provided that these terms and disclaimer and all copyright notices 6 | * are retained or reproduced in an accompanying document, permission 7 | * is granted to deal in this work without restriction, including un- 8 | * limited rights to use, publicly perform, distribute, sell, modify, 9 | * merge, give away, or sublicence. 10 | * 11 | * This work is provided "AS IS" and WITHOUT WARRANTY of any kind, to 12 | * the utmost extent permitted by applicable law, neither express nor 13 | * implied; without malicious intent or gross negligence. In no event 14 | * may a licensor, author or contributor be held liable for indirect, 15 | * direct, other damage, loss, or other issues arising in any way out 16 | * of dealing in the work, even if advised of the possibility of such 17 | * damage or existence of a defect, except proven that it results out 18 | * of said person's immediate fault when using the work as intended. 19 | */ 20 | 21 | @RLIMITS_DEFNS 22 | __RCSID("$MirOS: src/bin/mksh/rlimits.opt,v 1.4 2019/04/24 20:56:31 tg Exp $"); 23 | @RLIMITS_ITEMS 24 | #define FN(lname,lid,lfac,lopt) (const struct limits *)(&rlimits_ ## lid), 25 | @@ 26 | 27 | /* generic options for the ulimit builtin */ 28 | 29 | t|RLIMIT_CPU 36 | FN("time(cpu-seconds)", RLIMIT_CPU, 1 37 | 38 | >f|RLIMIT_FSIZE 39 | FN("file(blocks)", RLIMIT_FSIZE, 512 40 | 41 | >c|RLIMIT_CORE 42 | FN("coredump(blocks)", RLIMIT_CORE, 512 43 | 44 | >d|RLIMIT_DATA 45 | FN("data(KiB)", RLIMIT_DATA, 1024 46 | 47 | >s|RLIMIT_STACK 48 | FN("stack(KiB)", RLIMIT_STACK, 1024 49 | 50 | >l|RLIMIT_MEMLOCK 51 | FN("lockedmem(KiB)", RLIMIT_MEMLOCK, 1024 52 | 53 | >n|RLIMIT_NOFILE 54 | FN("nofiles(descriptors)", RLIMIT_NOFILE, 1 55 | 56 | >p|RLIMIT_NPROC 57 | FN("processes", RLIMIT_NPROC, 1 58 | 59 | >w|RLIMIT_SWAP 60 | FN("swap(KiB)", RLIMIT_SWAP, 1024 61 | 62 | >T|RLIMIT_TIME 63 | FN("humantime(seconds)", RLIMIT_TIME, 1 64 | 65 | >V|RLIMIT_NOVMON 66 | FN("vnodemonitors", RLIMIT_NOVMON, 1 67 | 68 | >i|RLIMIT_SIGPENDING 69 | FN("sigpending", RLIMIT_SIGPENDING, 1 70 | 71 | >q|RLIMIT_MSGQUEUE 72 | FN("msgqueue(bytes)", RLIMIT_MSGQUEUE, 1 73 | 74 | >M|RLIMIT_AIO_MEM 75 | FN("AIOlockedmem(KiB)", RLIMIT_AIO_MEM, 1024 76 | 77 | >O|RLIMIT_AIO_OPS 78 | FN("AIOoperations", RLIMIT_AIO_OPS, 1 79 | 80 | >C|RLIMIT_TCACHE 81 | FN("cachedthreads", RLIMIT_TCACHE, 1 82 | 83 | >B|RLIMIT_SBSIZE 84 | FN("sockbufsiz(KiB)", RLIMIT_SBSIZE, 1024 85 | 86 | >P|RLIMIT_PTHREAD 87 | FN("threadsperprocess", RLIMIT_PTHREAD, 1 88 | 89 | >r|RLIMIT_THREADS 90 | FN("threadsperprocess", RLIMIT_THREADS, 1 91 | 92 | >e|RLIMIT_NICE 93 | FN("maxnice", RLIMIT_NICE, 1 94 | 95 | >r|RLIMIT_RTPRIO 96 | FN("maxrtprio", RLIMIT_RTPRIO, 1 97 | 98 | >m|ULIMIT_M_IS_RSS 99 | FN("resident-set(KiB)", RLIMIT_RSS, 1024 100 | >m|ULIMIT_M_IS_VMEM 101 | FN("memory(KiB)", RLIMIT_VMEM, 1024 102 | 103 | >v|ULIMIT_V_IS_VMEM 104 | FN("virtual-memory(KiB)", RLIMIT_VMEM, 1024 105 | >v|ULIMIT_V_IS_AS 106 | FN("address-space(KiB)", RLIMIT_AS, 1024 107 | 108 | >x|RLIMIT_LOCKS 109 | FN("filelocks", RLIMIT_LOCKS, 1 110 | 111 | |RLIMITS_OPTCS 112 | -------------------------------------------------------------------------------- /NOTICE: -------------------------------------------------------------------------------- 1 | The MirBSD Korn Shell (mksh) is 2 | Copyright (c) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 3 | 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 4 | 2020 5 | mirabilos 6 | Copyright (c) 2015, 2017, 2020 7 | KO Myung-Hun 8 | Copyright (c) 2015 9 | Daniel Richard G. 10 | Copyright (c) 2017 11 | Giacomo Tesio 12 | All rights reserved. 13 | 14 | The mksh logo is 15 | Copyright (c) 2008, 2009 16 | Lukas U. 17 | Copyright (c) 2008, 2009 18 | mirabilos 19 | 20 | 21 | Provided that these terms and disclaimer and all copyright notices 22 | are retained or reproduced in an accompanying document, permission 23 | is granted to deal in this work without restriction, including un- 24 | limited rights to use, publicly perform, distribute, sell, modify, 25 | merge, give away, or sublicence. 26 | 27 | This work is provided "AS IS" and WITHOUT WARRANTY of any kind, to 28 | the utmost extent permitted by applicable law, neither express nor 29 | implied; without malicious intent or gross negligence. In no event 30 | may a licensor, author or contributor be held liable for indirect, 31 | direct, other damage, loss, or other issues arising in any way out 32 | of dealing in the work, even if advised of the possibility of such 33 | damage or existence of a defect, except proven that it results out 34 | of said person's immediate fault when using the work as intended. 35 | 36 | 37 | Copyright © 1991–2020 Unicode, Inc. All rights reserved. 38 | Distributed under the Terms of Use in https://www.unicode.org/copyright.html. 39 | 40 | Permission is hereby granted, free of charge, to any person obtaining 41 | a copy of the Unicode data files and any associated documentation 42 | (the "Data Files") or Unicode software and any associated documentation 43 | (the "Software") to deal in the Data Files or Software 44 | without restriction, including without limitation the rights to use, 45 | copy, modify, merge, publish, distribute, and/or sell copies of 46 | the Data Files or Software, and to permit persons to whom the Data Files 47 | or Software are furnished to do so, provided that either 48 | (a) this copyright and permission notice appear with all copies 49 | of the Data Files or Software, or 50 | (b) this copyright and permission notice appear in associated 51 | Documentation. 52 | 53 | THE DATA FILES AND SOFTWARE ARE PROVIDED "AS IS", WITHOUT WARRANTY OF 54 | ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE 55 | WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 56 | NONINFRINGEMENT OF THIRD PARTY RIGHTS. 57 | IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS INCLUDED IN THIS 58 | NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL 59 | DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, 60 | DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER 61 | TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR 62 | PERFORMANCE OF THE DATA FILES OR SOFTWARE. 63 | 64 | Except as contained in this notice, the name of a copyright holder 65 | shall not be used in advertising or otherwise to promote the sale, 66 | use or other dealings in these Data Files or Software without prior 67 | written authorization of the copyright holder. 68 | -------------------------------------------------------------------------------- /src/emacsfn.h: -------------------------------------------------------------------------------- 1 | /*- 2 | * Copyright (c) 2009, 2010, 2015, 2016, 2020 3 | * mirabilos 4 | * 5 | * Provided that these terms and disclaimer and all copyright notices 6 | * are retained or reproduced in an accompanying document, permission 7 | * is granted to deal in this work without restriction, including un- 8 | * limited rights to use, publicly perform, distribute, sell, modify, 9 | * merge, give away, or sublicence. 10 | * 11 | * This work is provided "AS IS" and WITHOUT WARRANTY of any kind, to 12 | * the utmost extent permitted by applicable law, neither express nor 13 | * implied; without malicious intent or gross negligence. In no event 14 | * may a licensor, author or contributor be held liable for indirect, 15 | * direct, other damage, loss, or other issues arising in any way out 16 | * of dealing in the work, even if advised of the possibility of such 17 | * damage or existence of a defect, except proven that it results out 18 | * of said person's immediate fault when using the work as intended. 19 | */ 20 | 21 | #if defined(EMACSFN_DEFNS) 22 | __RCSID("$MirOS: src/bin/mksh/emacsfn.h,v 1.11 2020/04/13 20:46:39 tg Exp $"); 23 | #define FN(cname,sname,flags) static int x_##cname(int); 24 | #elif defined(EMACSFN_ENUMS) 25 | #define FN(cname,sname,flags) XFUNC_##cname, 26 | #define F0(cname,sname,flags) XFUNC_##cname = 0, 27 | #elif defined(EMACSFN_ITEMS) 28 | #define FN(cname,sname,flags) { x_##cname, sname, flags }, 29 | #endif 30 | 31 | #ifndef F0 32 | #define F0 FN 33 | #endif 34 | 35 | F0(abort, "abort", 0) 36 | FN(beg_hist, "beginning-of-history", 0) 37 | FN(cls, "clear-screen", 0) 38 | FN(comment, "comment", 0) 39 | FN(comp_comm, "complete-command", 0) 40 | FN(comp_file, "complete-file", 0) 41 | FN(comp_list, "complete-list", 0) 42 | FN(complete, "complete", 0) 43 | FN(del_back, "delete-char-backward", XF_ARG) 44 | FN(del_bword, "delete-word-backward", XF_ARG) 45 | FN(del_char, "delete-char-forward", XF_ARG) 46 | FN(del_fword, "delete-word-forward", XF_ARG) 47 | FN(del_line, "kill-line", 0) 48 | FN(draw_line, "redraw", 0) 49 | #ifndef MKSH_SMALL 50 | FN(edit_line, "edit-line", XF_ARG) 51 | #endif 52 | FN(end_hist, "end-of-history", 0) 53 | FN(end_of_text, "eot", 0) 54 | FN(enumerate, "list", 0) 55 | FN(eot_del, "eot-or-delete", XF_ARG) 56 | FN(error, "error", 0) 57 | #ifndef MKSH_SMALL 58 | FN(eval_region, "evaluate-region", 0) 59 | #endif 60 | FN(expand, "expand-file", 0) 61 | #ifndef MKSH_SMALL 62 | FN(fold_capitalise, "capitalize-word", XF_ARG) 63 | FN(fold_lower, "downcase-word", XF_ARG) 64 | FN(fold_upper, "upcase-word", XF_ARG) 65 | #endif 66 | FN(goto_hist, "goto-history", XF_ARG) 67 | #ifndef MKSH_SMALL 68 | FN(ins_string, "macro-string", XF_NOBIND) 69 | #endif 70 | FN(insert, "auto-insert", XF_ARG) 71 | FN(kill, "kill-to-eol", XF_ARG) 72 | FN(kill_region, "kill-region", 0) 73 | FN(list_comm, "list-command", 0) 74 | FN(list_file, "list-file", 0) 75 | FN(literal, "quote", 0) 76 | FN(meta1, "prefix-1", XF_PREFIX) 77 | FN(meta2, "prefix-2", XF_PREFIX) 78 | FN(meta3, "prefix-3", XF_PREFIX) 79 | FN(meta_yank, "yank-pop", 0) 80 | FN(mv_back, "backward-char", XF_ARG) 81 | FN(mv_beg, "beginning-of-line", 0) 82 | FN(mv_bword, "backward-word", XF_ARG) 83 | FN(mv_end, "end-of-line", 0) 84 | FN(mv_forw, "forward-char", XF_ARG) 85 | FN(mv_fword, "forward-word", XF_ARG) 86 | FN(newline, "newline", 0) 87 | FN(next_com, "down-history", XF_ARG) 88 | FN(nl_next_com, "newline-and-next", 0) 89 | FN(noop, "no-op", 0) 90 | FN(prev_com, "up-history", XF_ARG) 91 | FN(prev_histword, "prev-hist-word", XF_ARG) 92 | #ifndef MKSH_SMALL 93 | FN(quote_region, "quote-region", 0) 94 | #endif 95 | FN(search_char_back, "search-character-backward", XF_ARG) 96 | FN(search_char_forw, "search-character-forward", XF_ARG) 97 | FN(search_hist, "search-history", 0) 98 | #ifndef MKSH_SMALL 99 | FN(search_hist_dn, "search-history-down", 0) 100 | FN(search_hist_up, "search-history-up", 0) 101 | #endif 102 | FN(set_arg, "set-arg", XF_NOBIND) 103 | FN(set_mark, "set-mark-command", 0) 104 | FN(transpose, "transpose-chars", 0) 105 | FN(version, "version", 0) 106 | #ifndef MKSH_SMALL 107 | FN(vt_hack, "vt100-hack", XF_ARG) 108 | #endif 109 | FN(xchg_point_mark, "exchange-point-and-mark", 0) 110 | FN(yank, "yank", 0) 111 | 112 | #undef FN 113 | #undef F0 114 | #undef EMACSFN_DEFNS 115 | #undef EMACSFN_ENUMS 116 | #undef EMACSFN_ITEMS 117 | -------------------------------------------------------------------------------- /src/FAQ2HTML.sh: -------------------------------------------------------------------------------- 1 | #!/bin/mksh 2 | rcsid='$MirOS: src/bin/mksh/FAQ2HTML.sh,v 1.1 2020/02/03 22:23:33 tg Exp $' 3 | #- 4 | # Copyright © 2020 5 | # mirabilos 6 | # 7 | # Provided that these terms and disclaimer and all copyright notices 8 | # are retained or reproduced in an accompanying document, permission 9 | # is granted to deal in this work without restriction, including un‐ 10 | # limited rights to use, publicly perform, distribute, sell, modify, 11 | # merge, give away, or sublicence. 12 | # 13 | # This work is provided “AS IS” and WITHOUT WARRANTY of any kind, to 14 | # the utmost extent permitted by applicable law, neither express nor 15 | # implied; without malicious intent or gross negligence. In no event 16 | # may a licensor, author or contributor be held liable for indirect, 17 | # direct, other damage, loss, or other issues arising in any way out 18 | # of dealing in the work, even if advised of the possibility of such 19 | # damage or existence of a defect, except proven that it results out 20 | # of said person’s immediate fault when using the work as intended. 21 | #- 22 | 23 | set -e 24 | LC_ALL=C; LANGUAGE=C 25 | export LC_ALL; unset LANGUAGE 26 | nl=' 27 | ' 28 | srcdir=$(dirname "$0") 29 | 30 | p=--posix 31 | sed $p -e q /dev/null 2>&1 || p= 32 | 33 | v=$1 34 | if test -z "$v"; then 35 | v=$(sed $p -n '/^#define MKSH_VERSION "\(.*\)"$/s//\1/p' "$srcdir"/sh.h) 36 | fi 37 | src_id=$(sed $p -n '/^RCSID: /s///p' "$srcdir"/mksh.faq) 38 | # sanity check 39 | case $src_id in 40 | (*"$nl"*) 41 | echo >&2 "E: more than one RCSID in mksh.faq?" 42 | exit 1 ;; 43 | esac 44 | 45 | sed $p \ 46 | -e '/^RCSID: \$/s/^.*$/----/' \ 47 | -e 's!@@RELPATH@@!http://www.mirbsd.org/!g' \ 48 | -e 's^  ' \ 49 | "$srcdir"/mksh.faq | tr '\n' '' | sed $p \ 50 | -e 'sg' \ 51 | -e 's----g' \ 52 | -e 's\([^]*\)\1g' \ 53 | -e 's\([^]*\)\1g' \ 54 | -e 's\([^]*\)*ToC: \([^]*\)Title: \([^]*\)\([^]*\)\{0,1\}

\3


g' \ 55 | -e 's[^]*

g' \ 56 | -e 's^
*' \ 57 | -e 's$' \ 58 | -e 's<><>g' \ 59 | -e 'sg' | tr '' '\n' >FAQ.tmp 60 | 61 | exec >FAQ.htm~ 62 | cat < 65 | 66 | 67 | mksh $v FAQ (local copy) 68 | 69 | 70 | 111 | 112 |

Note: Links marked like this 113 | one to the mksh IRC channel connect to external resources.

114 |

Notice: the website will have the latest version of the 116 | mksh FAQ online.

117 |

Table of Contents

118 |