head 1.5; access; symbols tnftp-20260211:1.5 tnftp-20230507:1.5 tnftp-20230409:1.5 tnftp-20210827:1.5 tnftp-20200705:1.5 NetBSD-libedit-20200704:1.1.1.5 NetBSD-20160131:1.1.1.4 NetBSD-20050531:1.1.1.3 TNF:1.1.1 NetBSD-20050105:1.1.1.2 NetBSD-20020605:1.1.1.1 NetBSD:1.1.1; locks; strict; comment @# @; 1.5 date 2020.07.04.13.43.21; author lukem; state Exp; branches; next 1.4; commitid 6eLNoxX04C5hBLeC; 1.4 date 2016.01.31.22.11.18; author lukem; state Exp; branches; next 1.3; commitid iXrokmCpYkt6m8Ty; 1.3 date 2016.01.31.22.06.02; author lukem; state Exp; branches; next 1.2; commitid I5Js8BOxdpqgk8Ty; 1.2 date 2005.01.05.04.27.36; author lukem; state dead; branches; next 1.1; 1.1 date 2001.01.16.03.59.26; author lukem; state Exp; branches 1.1.1.1; next ; 1.1.1.1 date 2001.01.16.03.59.26; author lukem; state Exp; branches; next 1.1.1.2; 1.1.1.2 date 2003.03.11.03.07.20; author lukem; state Exp; branches; next 1.1.1.3; 1.1.1.3 date 2005.05.31.01.53.58; author lukem; state Exp; branches; next 1.1.1.4; 1.1.1.4 date 2016.01.31.07.11.58; author lukem; state Exp; branches; next 1.1.1.5; commitid quzRcSo02dF3D3Ty; 1.1.1.5 date 2020.07.04.12.41.18; author lukem; state Exp; branches; next ; commitid aoB0YkxzjoYkjLeC; desc @@ 1.5 log @merge from NetBSD-20160131 to NetBSD-libedit-20200704 @ text @#!/bin/sh - # $NetBSD: makelist,v 1.4 2016/01/31 22:11:18 lukem Exp $ # NetBSD: makelist,v 1.29 2016/05/09 21:46:56 christos Exp # # Copyright (c) 1992, 1993 # The Regents of the University of California. All rights reserved. # # This code is derived from software contributed to Berkeley by # Christos Zoulas of Cornell University. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # 1. Redistributions of source code must retain the above copyright # notice, this list of conditions and the following disclaimer. # 2. Redistributions in binary form must reproduce the above copyright # notice, this list of conditions and the following disclaimer in the # documentation and/or other materials provided with the distribution. # 3. Neither the name of the University nor the names of its contributors # may be used to endorse or promote products derived from this software # without specific prior written permission. # # THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE # ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS # OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF # SUCH DAMAGE. # # @@(#)makelist 5.3 (Berkeley) 6/4/93 # makelist.sh: Automatically generate header files... : ${AWK:=awk} USAGE="Usage: $0 -h|-fc|-fh|-bh " if [ "x$1" = "x" ] then echo $USAGE 1>&2 exit 1 fi FLAG="$1" shift FILES="$@@" case $FLAG in -h) set - `echo $FILES | sed -e 's/\\./_/g'` hdr="_h_`basename $1`" cat $FILES | $AWK ' BEGIN { printf("/* Automatically generated file, do not edit */\n"); printf("#ifndef %s\n#define %s\n", "'$hdr'", "'$hdr'"); } /\(\):/ { pr = substr($2, 1, 2); if (pr == "vi" || pr == "em" || pr == "ed") { name = substr($2, 1, length($2) - 3); # # XXX: need a space between name and prototype so that -fc and -fh # parsing is much easier # printf("libedit_private el_action_t\t%s (EditLine *, wint_t);\n", name); } } END { printf("#endif /* %s */\n", "'$hdr'"); }' ;; # generate help.h from various .c files # -bh) cat $FILES | $AWK ' BEGIN { printf("/* Automatically generated file, do not edit */\n"); printf("static const struct el_bindings_t el_func_help[] = {\n"); low = "abcdefghijklmnopqrstuvwxyz_"; high = "ABCDEFGHIJKLMNOPQRSTUVWXYZ_"; for (i = 1; i <= length(low); i++) tr[substr(low, i, 1)] = substr(high, i, 1); } /\(\):/ { pr = substr($2, 1, 2); if (pr == "vi" || pr == "em" || pr == "ed") { name = substr($2, 1, length($2) - 3); uname = ""; fname = ""; for (i = 1; i <= length(name); i++) { s = substr(name, i, 1); uname = uname tr[s]; if (s == "_") s = "-"; fname = fname s; } printf(" { %-30.30s %-30.30s\n","L\"" fname "\",", uname ","); ok = 1; } } /^ \*/ { if (ok) { printf(" L\""); for (i = 2; i < NF; i++) printf("%s ", $i); printf("%s\" },\n", $i); ok = 0; } } END { printf("};\n"); }' ;; # generate fcns.h from various .h files # -fh) cat $FILES | $AWK '/el_action_t/ { print $3 }' | \ sort | tr '[:lower:]' '[:upper:]' | $AWK ' BEGIN { printf("/* Automatically generated file, do not edit */\n"); count = 0; } { printf("#define\t%-30.30s\t%3d\n", $1, count++); } END { printf("#define\t%-30.30s\t%3d\n", "EL_NUM_FCNS", count); }' ;; # generate func.h from various .h files # -fc) cat $FILES | $AWK '/el_action_t/ { print $3 }' | sort | $AWK ' BEGIN { printf("/* Automatically generated file, do not edit */\n"); printf("static const el_func_t el_func[] = {"); maxlen = 80; needn = 1; len = 0; } { clen = 25 + 2; len += clen; if (len >= maxlen) needn = 1; if (needn) { printf("\n "); needn = 0; len = 4 + clen; } s = $1 ","; printf("%-26.26s ", s); } END { printf("\n};\n"); }' ;; *) echo $USAGE 1>&2 exit 1 ;; esac @ 1.4 log @makelist: allow AWK to be supplied in env @ text @d2 2 a3 2 # $NetBSD$ # from: NetBSD: makelist,v 1.18 2012/03/21 05:34:54 matt Exp d40 1 a40 1 USAGE="Usage: $0 -n|-h|-e|-fc|-fh|-bc|-bh|-m " a54 11 # generate foo.h file from foo.c # -n) cat << _EOF #include "config.h" #undef WIDECHAR #define NARROWCHAR #include "${FILES}" _EOF ;; d71 2 a72 1 printf("protected el_action_t\t%s (EditLine *, Int);\n", name); d80 1 a80 1 # generate help.c from various .c files d82 1 a82 1 -bc) d86 1 a86 3 printf("#include \"config.h\"\n#include \"el.h\"\n"); printf("#include \"chartype.h\"\n"); printf("private const struct el_bindings_t el_func_help[] = {\n"); d106 1 a106 1 printf(" { %-30.30s %-30.30s\n","STR(\"" fname "\"),", uname ","); d112 1 a112 1 printf(" STR(\""); d115 1 a115 1 printf("%s\") },\n", $i); a120 2 printf("\nprotected const el_bindings_t* help__get(void)"); printf("{ return el_func_help; }\n"); a123 12 # generate help.h from various .c files # -bh) $AWK ' BEGIN { printf("/* Automatically generated file, do not edit */\n"); printf("#ifndef _h_help_c\n#define _h_help_c\n"); printf("protected const el_bindings_t *help__get(void);\n"); printf("#endif /* _h_help_c */\n"); }' /dev/null ;; a130 1 printf("#ifndef _h_fcns_c\n#define _h_fcns_c\n"); a137 4 printf("typedef el_action_t (*el_func_t)(EditLine *, Int);"); printf("\nprotected const el_func_t* func__get(void);\n"); printf("#endif /* _h_fcns_c */\n"); d141 1 a141 1 # generate fcns.c from various .h files d147 1 a147 2 printf("#include \"config.h\"\n#include \"el.h\"\n"); printf("private const el_func_t el_func[] = {"); a166 53 printf("\nprotected const el_func_t* func__get(void) { return el_func; }\n"); }' ;; # generate editline.c from various .c files # -e) echo "$FILES" | tr ' ' '\012' | $AWK ' BEGIN { printf("/* Automatically generated file, do not edit */\n"); printf("#define protected static\n"); printf("#define SCCSID\n"); } { printf("#include \"%s\"\n", $1); }' ;; # generate man page fragment from various .c files # -m) cat $FILES | $AWK ' BEGIN { printf(".\\\" Section automatically generated with makelist\n"); printf(".Bl -tag -width 4n\n"); } /\(\):/ { pr = substr($2, 1, 2); if (pr == "vi" || pr == "em" || pr == "ed") { name = substr($2, 1, length($2) - 3); fname = ""; for (i = 1; i <= length(name); i++) { s = substr(name, i, 1); if (s == "_") s = "-"; fname = fname s; } printf(".It Ic %s\n", fname); ok = 1; } } /^ \*/ { if (ok) { for (i = 2; i < NF; i++) printf("%s ", $i); printf("%s.\n", $i); ok = 0; } } END { printf(".El\n"); printf(".\\\" End of section automatically generated with makelist\n"); @ 1.3 log @restore config.h and makelist from upstream @ text @d2 2 a3 1 # NetBSD: makelist,v 1.18 2012/03/21 05:34:54 matt Exp d39 1 a39 1 AWK=awk @ 1.2 log @this has been replaced with makelist.in @ text @d2 1 a2 1 # $NetBSD: makelist,v 1.1 2001/01/16 03:59:26 lukem Exp $ d18 1 a18 5 # 3. All advertising materials mentioning features or use of this software # must display the following acknowledgement: # This product includes software developed by the University of # California, Berkeley and its contributors. # 4. Neither the name of the University nor the names of its contributors d38 2 a39 2 AWK=/usr/bin/awk USAGE="Usage: $0 -h|-e|-fc|-fh|-bc|-bh|-m " d56 9 d81 1 a81 1 printf("protected el_action_t\t%s (EditLine *, int);\n", name); d95 2 a96 1 printf("#include \"sys.h\"\n#include \"el.h\"\n"); d117 1 a117 1 printf(" { %-30.30s %-30.30s\n","\"" fname "\",", uname ","); d123 1 a123 1 printf(" \""); d126 1 a126 1 printf("%s\" },\n", $i); a130 1 printf(" { NULL, 0, NULL }\n"); d132 1 a132 1 printf("\nprotected const el_bindings_t* help__get()"); d153 1 a153 1 sort | tr '[a-z]' '[A-Z]' | $AWK ' d165 1 a165 1 printf("typedef el_action_t (*el_func_t)(EditLine *, int);"); d177 1 a177 1 printf("#include \"sys.h\"\n#include \"el.h\"\n"); d198 1 a198 1 printf("\nprotected const el_func_t* func__get() { return el_func; }\n"); @ 1.1 log @Initial revision @ text @d2 1 a2 1 # $NetBSD: makelist,v 1.7 2001/01/09 19:22:31 jdolecek Exp $ @ 1.1.1.1 log @libedit from NetBSD-current 20020605. (This is the vendor version that the tnftp libedit was derived from) @ text @@ 1.1.1.2 log @Update to libedit from NetBSD-current 20050105. Numerous changes, including: * Improve vi-mode. * Delete-previous-char and delete-next-char without an argument are not supposed to modify the yank buffer in emacs-mode. * Improve incremental searching. * Improve memory allocation & usage. * Move UCB-licensed code from 4-clause to 3-clause. * Make the tokenization functions publically available. * Various tty access bug-fixes. * Improve readline emulation. @ text @d2 1 a2 1 # $NetBSD: makelist,v 1.8 2003/03/10 21:21:10 christos Exp $ d42 1 a42 1 AWK=awk @ 1.1.1.3 log @Import libedit from NetBSD 20050531. Notable changes (that affect tnftp): * PR/29738: Rui Paulo: Incorrect tok_line and tok_str declarations. * Remove clause 3 from the UCB license. * PR/25694: Luke Mewburn: Don't abuse unconstify'ing a string and writing to it, because you'll core dump. Also remove extra const that gives pain to the irix compiler. * Make sure we flush after we prepare when we are unbuffered otherwise the prompt will not appear immediately. * Terminate the arglist with a NULL instead of 0. (Shuts up gcc4.x) @ text @d2 1 a2 2 # $NetBSD$ # from NetBSD: makelist,v 1.9 2005/05/16 13:14:43 lukem Exp d18 5 a22 1 # 3. Neither the name of the University nor the names of its contributors @ 1.1.1.4 log @Update libedit from NetBSD-current 20160131 * Notable API changes, even if not used by tnftp: - Make el_get varyadic, and implement EL_GETTC. - Add EL_GETFP, and EL_SETFP. - Add EL_REFRESH for the benefit of readline - Document and enable wide character support. - Provide an el_init_fd function. * Remove use of alloca. @ text @d2 2 a3 1 # NetBSD: makelist,v 1.18 2012/03/21 05:34:54 matt Exp d40 1 a40 1 USAGE="Usage: $0 -n|-h|-e|-fc|-fh|-bc|-bh|-m " a56 9 -n) cat << _EOF #include "config.h" #undef WIDECHAR #define NARROWCHAR #include "${FILES}" _EOF ;; d73 1 a73 1 printf("protected el_action_t\t%s (EditLine *, Int);\n", name); d87 1 a87 2 printf("#include \"config.h\"\n#include \"el.h\"\n"); printf("#include \"chartype.h\"\n"); d108 1 a108 1 printf(" { %-30.30s %-30.30s\n","STR(\"" fname "\"),", uname ","); d114 1 a114 1 printf(" STR(\""); d117 1 a117 1 printf("%s\") },\n", $i); d122 1 d124 1 a124 1 printf("\nprotected const el_bindings_t* help__get(void)"); d145 1 a145 1 sort | tr '[:lower:]' '[:upper:]' | $AWK ' d157 1 a157 1 printf("typedef el_action_t (*el_func_t)(EditLine *, Int);"); d169 1 a169 1 printf("#include \"config.h\"\n#include \"el.h\"\n"); d190 1 a190 1 printf("\nprotected const el_func_t* func__get(void) { return el_func; }\n"); @ 1.1.1.5 log @Update libedit from NetBSD-current 20200704 Notable changes since import on 20160131: * Fix uninitialized memory access in libedit history. PR/54399 * Fix out-of-bounds read in libedit c_delbefore. PR/54400 * Avoid segmentation fault in bad history file. PR/53597 * Fix crash in history saving. PR/52849 * Fix crash in c_gets(). * Fix crash in re_fastputc(). * Fix crash with backspacing on a long line. * Fix patbuf updating. * Save and restore errno in signal handler. * Fix cursor movement. PR/54654, PR/54329 * Fix cursor after resize. PR/52359 * Fix terminal restoration if piped. PR/50863 * Fix memory leaks. * Various UTF-8 fixes. * Implementation improvements. * Readline compatibility improvements (not used by ftp). * and chartype portability improvements. * Remove 4 clause BSD licenses. * Default editrc is $EDITRC, falling back to $HOME/.editrc. * Add literal escape sequence support, patterned after the tcsh ones. * Support pasting multiline buffers. * Fix errno / el_errno handling. * Improve directory completion in subdirs with only one match. * Add support for escaping special characters when doing filename completion. * Only quote the completion matches if we are doing filename completion. * Don't escape strings with user-supplied completion functions. * Grow the buffer for event search if there was not enough space. * Use strncpy() or strlcpy() instead of memcpy(). * (Many fixes were from Ingo Schwarze.) @ text @d2 1 a2 1 # NetBSD: makelist,v 1.29 2016/05/09 21:46:56 christos Exp d39 1 a39 1 USAGE="Usage: $0 -h|-fc|-fh|-bh " d54 11 d81 1 a81 2 printf("libedit_private el_action_t\t%s (EditLine *, wint_t);\n", name); d89 1 a89 1 # generate help.h from various .c files d91 1 a91 1 -bh) d95 3 a97 1 printf("static const struct el_bindings_t el_func_help[] = {\n"); d117 1 a117 1 printf(" { %-30.30s %-30.30s\n","L\"" fname "\",", uname ","); d123 1 a123 1 printf(" L\""); d126 1 a126 1 printf("%s\" },\n", $i); d132 2 d137 12 d156 1 d164 4 d171 1 a171 1 # generate func.h from various .h files d177 2 a178 1 printf("static const el_func_t el_func[] = {"); d198 53 @