(command.CommandList children: [ (C {<Id.Lit_Colon ':'>} { (braced_var_sub token: <Id.VSub_Name AWK> suffix_op: (suffix_op.Unary tok:<Id.VTest_Hyphen -> arg_word:{<awk>}) ) } ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:DATA) op: assign_op.Equal rhs: { (braced_var_sub token: <Id.VSub_Number 1> suffix_op: (suffix_op.Unary tok:<Id.VTest_Hyphen -> arg_word:{<Caps>}) ) } spids: [116] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:data) op: assign_op.Equal rhs: {<Id.KW_Data data> ($ Id.VSub_Dollar '$$')} spids: [124] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:pass1) op: assign_op.Equal rhs: {<pass1_> ($ Id.VSub_Dollar '$$')} spids: [128] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:pass2) op: assign_op.Equal rhs: {<pass2_> ($ Id.VSub_Dollar '$$')} spids: [132] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:pass3) op: assign_op.Equal rhs: {<pass3_> ($ Id.VSub_Dollar '$$')} spids: [136] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:pass4) op: assign_op.Equal rhs: {<pass4_> ($ Id.VSub_Dollar '$$')} spids: [140] ) ] ) (C {<trap>} {(SQ <'rm -f $data pass[1234]_$$'>)} {<0>} {<1>} {<2>} {<5>} {<15>}) (command.If arms: [ (if_arm cond: (condition.Shell commands: [ (command.Simple words: [{<sort>} {<-k>} {<6>} {($ Id.VSub_DollarName '$DATA')}] redirects: [ (redir op: <Id.Redir_Great '>'> loc: (redir_loc.Fd fd:1) arg: {($ Id.VSub_DollarName '$data')} ) (redir op: <Id.Redir_Great '2>'> loc: (redir_loc.Fd fd:2) arg: {<'/dev/null'>} ) ] do_fork: T ) ] ) action: [ (command.Pipeline children: [ (command.Simple words: [{<sed>} {<-e>} {(SQ <'s/[\t][\t]*/\t/g'>)}] redirects: [ (redir op: <Id.Redir_Less '<'> loc: (redir_loc.Fd fd:0) arg: {($ Id.VSub_DollarName '$DATA')} ) ] do_fork: T ) (command.Simple words: [{<sort>} {<-n>} {<-k>} {<6>}] redirects: [ (redir op: <Id.Redir_Great '>'> loc: (redir_loc.Fd fd:1) arg: {($ Id.VSub_DollarName '$data')} ) ] do_fork: T ) ] negated: F ) ] spids: [167 183] ) (if_arm cond: (condition.Shell commands: [ (command.Simple words: [{<sort>} {<-n>} {<Id.Lit_Other '+'> <5>} {($ Id.VSub_DollarName '$DATA')}] redirects: [ (redir op: <Id.Redir_Great '>'> loc: (redir_loc.Fd fd:1) arg: {($ Id.VSub_DollarName '$data')} ) (redir op: <Id.Redir_Great '2>'> loc: (redir_loc.Fd fd:2) arg: {<'/dev/null'>} ) ] do_fork: T ) ] ) action: [ (command.Pipeline children: [ (command.Simple words: [{<sed>} {<-e>} {(SQ <'s/[\t][\t]*/\t/g'>)}] redirects: [ (redir op: <Id.Redir_Less '<'> loc: (redir_loc.Fd fd:0) arg: {($ Id.VSub_DollarName '$DATA')} ) ] do_fork: T ) (command.Simple words: [{<sort>} {<-n>} {<Id.Lit_Other '+'> <5>}] redirects: [ (redir op: <Id.Redir_Great '>'> loc: (redir_loc.Fd fd:1) arg: {($ Id.VSub_DollarName '$data')} ) ] do_fork: T ) ] negated: F ) ] spids: [214 231] ) ] else_action: [ (command.Simple words: [{<echo>} {(DQ <'Your sort utility is broken. Please install one that works.'>)}] redirects: [(redir op:<Id.Redir_GreatAnd '>&'> loc:(redir_loc.Fd fd:1) arg:{<2>})] do_fork: T ) (command.ControlFlow token:<Id.ControlFlow_Exit exit> arg_word:{<1>}) ] ) (command.Simple words: [{<cat>}] redirects: [ (redir op: <Id.Redir_DGreat '>>'> loc: (redir_loc.Fd fd:1) arg: {($ Id.VSub_DollarName '$data')} ) (redir op: <Id.Redir_DLess '<<'> loc: (redir_loc.Fd fd:0) arg: (redir_param.HereDoc here_begin: {<EOF>} here_end_span_id: 295 stdin_parts: [ <'key_resize\tkr1\tstr\tR1\tKEY_RESIZE\t+\t-----\tTerminal resize event\n'> <'key_event\tkv1\tstr\tV1\tKEY_EVENT\t+\t-----\tWe were interrupted by an event\n'> ] ) ) ] do_fork: T ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:THIS) op: assign_op.Equal rhs: {<'./'> (command_sub left_token: <Id.Left_Backtick '`'> child: (C {<basename>} {($ Id.VSub_Number '$0')}) ) } spids: [297] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:PARM) op: assign_op.Equal rhs: {<'./'> (command_sub left_token: <Id.Left_Backtick '`'> child: (C {<basename>} {($ Id.VSub_DollarName '$DATA')}) ) } spids: [307] ) ] ) (command.Simple words: [{<cat>}] redirects: [ (redir op: <Id.Redir_DLess '<<'> loc: (redir_loc.Fd fd:0) arg: (redir_param.HereDoc here_begin: {<EOF>} here_end_span_id: 331 stdin_parts: [ <'/*\n'> <' * These definitions were generated by '> ($ Id.VSub_DollarName '$THIS') <' '> ($ Id.VSub_DollarName '$PARM') <'\n'> <' */\n'> ] ) ) ] do_fork: T ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:maxkey) op: assign_op.Equal rhs: {<345>} spids: [336] ) ] ) (command.ForEach iter_names: [pass] iterable: (for_iter.Words words:[{<1>} {<2>} {<3>} {<4>}]) body: (command.DoGroup children: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:output) op: assign_op.Equal rhs: {<pass> (${ Id.VSub_Name pass) <Id.Lit_Underscore _> ($ Id.VSub_Dollar '$$')} spids: [357] ) ] ) (command.Simple words: [ { (braced_var_sub token: <Id.VSub_Name AWK> suffix_op: (suffix_op.Unary tok:<Id.VTest_Hyphen -> arg_word:{<awk>}) ) } { (SQ <'\n'> <'function print_cols(text,cols) {\n'> <'\tprintf "%s", text\n'> <'\tlen = length(text);\n'> <'\twhile (len < cols) {\n'> <'\t\tprintf "\t"\n'> <'\t\tlen += 8;\n'> <'\t}\n'> <'}\n'> <'function decode(keycode) {\n'> <'\tresult = 0;\n'> <'\tif (substr(keycode, 1, 2) == "0x") {\n'> <'\t\tdigits="0123456789abcdef";\n'> <'\t} else if (substr(keycode, 1, 1) == "0") {\n'> <'\t\tdigits="01234567";\n'> <'\t} else {\n'> <'\t\tdigits="0123456789";\n'> <'\t}\n'> <'\twhile (length(keycode) != 0) {\n'> <'\t\tdigit=substr(keycode, 1, 1);\n'> <'\t\tkeycode=substr(keycode, 2);\n'> <'\t\tresult = result * length(digits) + index(digits, digit) - 1;\n'> <'\t}\n'> <'\treturn result;\n'> <'}\n'> <'\n'> <'BEGIN\t{\n'> <'\tmaxkey='> ) ($ Id.VSub_DollarName '$maxkey') (SQ <';\n'> <'\tpass='>) ($ Id.VSub_DollarName '$pass') (SQ <';\n'> <'\tkey_max=1;\n'> <'\tbits=1;\n'> <'\twhile (key_max < maxkey) {\n'> <'\t\tbits = bits + 1;\n'> <'\t\tkey_max = (key_max * 2) + 1;\n'> <'\t}\n'> <'\toctal_fmt = sprintf ("%%0%do", (bits + 2) / 3 + 1);\n'> <'}\n'> <'\n'> <'/^$/\t\t{next;}\n'> <'/^#/\t\t{next;}\n'> <'/^capalias/\t{next;}\n'> <'/^infoalias/\t{next;}\n'> <'\n'> <'$5 != "-" && $6 != "-" {\n'> <'\t\tif ($6 == "+") {\n'> <'\t\t\tif (pass == 1 || pass == 2)\n'> <'\t\t\t\tnext;\n'> <'\t\t\tthiskey=maxkey + 1;\n'> <'\t\t} else {\n'> <'\t\t\tif (pass == 3)\n'> <'\t\t\t\tnext;\n'> <'\t\t\tthiskey=decode($6);\n'> <'\t\t}\n'> <'\t\tif (thiskey > maxkey)\n'> <'\t\t\tmaxkey = thiskey;\n'> <'\t\tif (pass == 2 || pass == 3) {\n'> <'\t\t\tshowkey=sprintf(octal_fmt, thiskey);\n'> <'\t\t\tif ($5 == "KEY_F(0)" ) {\n'> <'\t\t\t\tprintf "#define "\n'> <'\t\t\t\tprint_cols("KEY_F0", 16);\n'> <'\t\t\t\tprint_cols(showkey, 16);\n'> <'\t\t\t\tprint "/* Function keys. Space for 64 */";\n'> <'\t\t\t\tprintf "#define "\n'> <'\t\t\t\tprint_cols("KEY_F(n)", 16);\n'> <'\t\t\t\tprint_cols("(KEY_F0+(n))", 16);\n'> <'\t\t\t\tprint "/* Value of function key n */"\n'> <'\t\t\t} else {\n'> <'\t\t\t\tprintf "#define "\n'> <'\t\t\t\tprint_cols($5, 16);\n'> <'\t\t\t\tprint_cols(showkey, 16);\n'> <'\t\t\t\tprintf "/*"\n'> <'\t\t\t\tfor (i = 8; i <= NF; i++)\n'> <'\t\t\t\t\tprintf " %s", $i\n'> <'\t\t\t\tprint " */"\n'> <'\t\t\t}\n'> <'\t\t}\n'> <'\t}\n'> <'END\t{\n'> <'\t\tif (pass == 1) {\n'> <'\t\t\tprint maxkey;\n'> <'\t\t} else if (pass == 4) {\n'> <'\t\t\tprint "";\n'> <'\t\t\tprintf "#define ";\n'> <'\t\t\tprint_cols("KEY_MAX", 16);\n'> <'\t\t\tresult = sprintf (octal_fmt, key_max);\n'> <'\t\t\tprint_cols(result, 16);\n'> <'\t\t\tprintf "/* Maximum key value is ";\n'> <'\t\t\tprintf octal_fmt, maxkey;\n'> <'\t\t\tprint " */";\n'> <'\t\t}\n'> <'\t}\n'> ) } ] redirects: [ (redir op: <Id.Redir_Great '>'> loc: (redir_loc.Fd fd:1) arg: {($ Id.VSub_DollarName '$output')} ) (redir op: <Id.Redir_Less '<'> loc: (redir_loc.Fd fd:0) arg: {($ Id.VSub_DollarName '$data')} ) ] do_fork: T ) (command.If arms: [ (if_arm cond: (condition.Shell commands: [ (command.Sentence child: (C {<test>} {($ Id.VSub_DollarName '$pass')} {<Id.Lit_Equals '='>} {<1>}) terminator: <Id.Op_Semi _> ) ] ) action: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:maxkey) op: assign_op.Equal rhs: { (command_sub left_token: <Id.Left_Backtick '`'> child: (C {<cat>} {($ Id.VSub_DollarName '$pass1')}) ) } spids: [495] ) ] ) ] spids: [480 492] ) ] ) ] ) ) (C {<cat>} {($ Id.VSub_DollarName '$pass2')}) (C {<cat>} {($ Id.VSub_DollarName '$pass3')}) (C {<cat>} {($ Id.VSub_DollarName '$pass4')}) ] )