X-Git-Url: https://ncurses.scripts.mit.edu/?p=ncurses.git;a=blobdiff_plain;f=include%2FMKkey_defs.sh;h=865a7b9c8b875649cd60141bfe34f6e6c1a4ff14;hp=f8b7d19cd6b5dd063a69751eca3503334e33835e;hb=2db461ea0b1b29c142e3000d830b520c946e385b;hpb=a20e6eb464be80b9cd8cae7ce925d27fe9c209ed diff --git a/include/MKkey_defs.sh b/include/MKkey_defs.sh index f8b7d19c..865a7b9c 100755 --- a/include/MKkey_defs.sh +++ b/include/MKkey_defs.sh @@ -1,7 +1,8 @@ #! /bin/sh -# $Id: MKkey_defs.sh,v 1.16 2017/08/12 12:22:06 tom Exp $ +# $Id: MKkey_defs.sh,v 1.19 2020/02/02 23:34:34 tom Exp $ ############################################################################## -# Copyright (c) 2001-2013,2017 Free Software Foundation, Inc. # +# Copyright 2019,2020 Thomas E. Dickey # +# Copyright 2001-2013,2017 Free Software Foundation, Inc. # # # # Permission is hereby granted, free of charge, to any person obtaining a # # copy of this software and associated documentation files (the "Software"), # @@ -35,25 +36,26 @@ # Extract function-key definitions from the Caps file # : ${AWK-awk} -DATA=${1-Caps} + +test $# = 0 && set Caps data=data$$ pass1=pass1_$$ pass2=pass2_$$ pass3=pass3_$$ pass4=pass4_$$ -trap 'rm -f $data pass[1234]_$$' 0 1 2 3 15 +trap 'rm -f $data pass[1234]_$$' EXIT INT QUIT TERM HUP # change repeated tabs (used for readability) to single tabs (needed to make # awk see the right field alignment of the corresponding columns): -if sort -k 6 $DATA >$data 2>/dev/null +if sort -k 6 "$@" >$data 2>/dev/null then # POSIX - sed -e 's/[ ][ ]*/ /g' < $DATA |sort -n -k 6 >$data -elif sort -n +5 $DATA >$data 2>/dev/null + sed -e 's/[ ][ ]*/ /g' "$@" |sort -n -k 6 >$data +elif sort -n +5 "$@" >$data 2>/dev/null then # SunOS (and SVr4, marked as obsolete but still recognized) - sed -e 's/[ ][ ]*/ /g' < $DATA |sort -n +5 >$data + sed -e 's/[ ][ ]*/ /g' "$@" |sort -n +5 >$data else echo "Your sort utility is broken. Please install one that works." >&2 exit 1 @@ -66,11 +68,10 @@ key_event kv1 str V1 KEY_EVENT + ----- We were interrupted by an event EOF THIS=./`basename $0` -PARM=./`basename $DATA` cat <