(CommandList children: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:agendafile) op: Equal rhs: {(DQ ($ VSub_Name '$HOME') (/.agenda))} spids: [8] ) ] spids: [8] ) (FuncDef name: isDayName body: (BraceGroup children: [ (Case to_match: { (CommandSubPart command_list: (CommandList children: [ (Pipeline children: [ (C {(echo)} {($ VSub_Number '$1')}) (C {(tr)} {(SQ <'[[:upper:]]'>)} {(SQ <'[[:lower:]]'>)}) ] negated: False ) ] ) left_token: <Left_CommandSub '$('> spids: [29 45] ) } arms: [ (case_arm pat_list: [ {(sun) (Lit_Other '*')} {(mon) (Lit_Other '*')} {(tue) (Lit_Other '*')} {(wed) (Lit_Other '*')} {(thu) (Lit_Other '*')} {(fri) (Lit_Other '*')} {(sat) (Lit_Other '*')} ] action: [ (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:retval) op:Equal rhs:{(0)} spids:[72])] spids: [72] ) ] spids: [50 70 75 -1] ) (case_arm pat_list: [{(Lit_Other '*')}] action: [ (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:retval) op:Equal rhs:{(1)} spids:[82])] spids: [82] ) ] spids: [78 80 85 -1] ) ] spids: [27 47 88] ) (ControlFlow token: <ControlFlow_Return return> arg_word: {($ VSub_Name '$retval')} ) ] spids: [19] ) spids: [15 18] ) (FuncDef name: isMonthName body: (BraceGroup children: [ (Case to_match: { (CommandSubPart command_list: (CommandList children: [ (Pipeline children: [ (C {(echo)} {($ VSub_Number '$1')}) (C {(tr)} {(SQ <'[[:upper:]]'>)} {(SQ <'[[:lower:]]'>)}) ] negated: False ) ] ) left_token: <Left_CommandSub '$('> spids: [107 123] ) } arms: [ (case_arm pat_list: [ {(jan) (Lit_Other '*')} {(feb) (Lit_Other '*')} {(mar) (Lit_Other '*')} {(apr) (Lit_Other '*')} {(may) (Lit_Other '*')} {(jun) (Lit_Other '*')} ] action: [(ControlFlow token:<ControlFlow_Return return> arg_word:{(0)})] spids: [129 146 152 -1] ) (case_arm pat_list: [ {(jul) (Lit_Other '*')} {(aug) (Lit_Other '*')} {(sep) (Lit_Other '*')} {(oct) (Lit_Other '*')} {(nov) (Lit_Other '*')} {(dec) (Lit_Other '*')} ] action: [(ControlFlow token:<ControlFlow_Return return> arg_word:{(0)})] spids: [155 172 178 -1] ) (case_arm pat_list: [{(Lit_Other '*')}] action: [(ControlFlow token:<ControlFlow_Return return> arg_word:{(1)})] spids: [181 183 189 -1] ) ] spids: [105 125 192] ) ] spids: [102] ) spids: [98 101] ) (FuncDef name: normalize body: (BraceGroup children: [ (Pipeline children: [ (C {(/bin/echo)} {(-n)} {($ VSub_Number '$1')}) (C {(cut)} {(-c1)}) (C {(tr)} {(SQ <'[[:lower:]]'>)} {(SQ <'[[:upper:]]'>)}) ] negated: False ) (Pipeline children: [ (C {(echo)} {($ VSub_Number '$1')}) (C {(cut)} {(-c2-3)}) (C {(tr)} {(SQ <'[[:upper:]]'>)} {(SQ <'[[:lower:]]'>)}) ] negated: False ) ] spids: [201] ) spids: [197 200] ) (If arms: [ (if_arm cond: [ (Sentence child: (C {(Lit_Other '[')} {(KW_Bang '!')} {(-w)} {($ VSub_Name '$HOME')} {(Lit_Other ']')}) terminator: <Op_Semi ';'> ) ] action: [ (SimpleCommand words: [ {(echo)} { (DQ ($ VSub_Number '$0') (': cannot write in your home directory (') ($ VSub_Name '$HOME') (')') ) } ] redirects: [(Redir op_id:Redir_GreatAnd fd:-1 arg_word:{(2)} spids:[284])] ) (C {(exit)} {(1)}) ] spids: [-1 272] ) ] spids: [-1 292] ) (C {(echo)} {(DQ ('Agenda: The Unix Reminder Service'))}) (C {(/bin/echo)} {(-n)} {(DQ ('Date of event (day mon, day month year, or dayname): '))}) (C {(read)} {(word1)} {(word2)} {(word3)} {(junk)}) (If arms: [ (if_arm cond: [(Sentence child:(C {(isDayName)} {($ VSub_Name '$word1')}) terminator:<Op_Semi ';'>)] action: [ (If arms: [ (if_arm cond: [ (Sentence child: (C {(Lit_Other '[')} {(KW_Bang '!')} {(-z)} {(DQ ($ VSub_Name '$word2'))} {(Lit_Other ']')} ) terminator: <Op_Semi ';'> ) ] action: [ (SimpleCommand words: [ {(echo)} {(DQ ('Bad dayname format: just specify the day name by itself.'))} ] redirects: [(Redir op_id:Redir_GreatAnd fd:-1 arg_word:{(2)} spids:[356])] ) (C {(exit)} {(1)}) ] spids: [-1 347] ) ] spids: [-1 365] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:date) op: Equal rhs: { (DQ (CommandSubPart command_list: (CommandList children: [(C {(normalize)} {($ VSub_Name '$word1')})] ) left_token: <Left_CommandSub '$('> spids: [370 374] ) ) } spids: [368] ) ] spids: [368] ) ] spids: [-1 328] ) ] else_action: [ (If arms: [ (if_arm cond: [ (Sentence child: (C {(Lit_Other '[')} {(-z)} {(DQ ($ VSub_Name '$word2'))} {(Lit_Other ']')}) terminator: <Op_Semi ';'> ) ] action: [ (SimpleCommand words: [{(echo)} {(DQ ('Bad dayname format: unknown day name specified'))}] redirects: [(Redir op_id:Redir_GreatAnd fd:-1 arg_word:{(2)} spids:[405])] ) (C {(exit)} {(1)}) ] spids: [-1 396] ) ] spids: [-1 414] ) (If arms: [ (if_arm cond: [ (Sentence child: (C {(Lit_Other '[')} {(KW_Bang '!')} {(-z)} { (DQ (CommandSubPart command_list: (CommandList children: [ (Pipeline children: [ (C {(echo)} {($ VSub_Name '$word1')}) (C {(sed)} {(SQ <'s/[[:digit:]]//g'>)}) ] negated: False ) ] ) left_token: <Left_CommandSub '$('> spids: [427 437] ) ) } {(Lit_Other ']')} ) terminator: <Op_Semi ';'> ) ] action: [ (SimpleCommand words: [{(echo)} {(DQ ('Bad date format: please specify day first, by day number'))}] redirects: [(Redir op_id:Redir_GreatAnd fd:-1 arg_word:{(2)} spids:[453])] ) (C {(exit)} {(1)}) ] spids: [-1 444] ) ] spids: [-1 462] ) (If arms: [ (if_arm cond: [ (Sentence child: (C {(Lit_Other '[')} {(DQ ($ VSub_Name '$word1'))} {(-lt)} {(1)} {(-o)} {(DQ ($ VSub_Name '$word1'))} {(-gt)} {(31)} {(Lit_Other ']')} ) terminator: <Op_Semi ';'> ) ] action: [ (SimpleCommand words: [{(echo)} {(DQ ('Bad date format: day number can only be in range 1-31'))}] redirects: [(Redir op_id:Redir_GreatAnd fd:-1 arg_word:{(2)} spids:[501])] ) (C {(exit)} {(1)}) ] spids: [-1 492] ) ] spids: [-1 510] ) (If arms: [ (if_arm cond: [ (Sentence child: (Pipeline children: [(C {(isMonthName)} {(DQ ($ VSub_Name '$word2'))})] negated: True ) terminator: <Op_Semi ';'> ) ] action: [ (SimpleCommand words: [{(echo)} {(DQ ('Bad date format: unknown month name specified.'))}] redirects: [(Redir op_id:Redir_GreatAnd fd:-1 arg_word:{(2)} spids:[535])] ) (C {(exit)} {(1)}) ] spids: [-1 526] ) ] spids: [-1 544] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:word2) op: Equal rhs: { (DQ (CommandSubPart command_list: (CommandList children: [(C {(normalize)} {($ VSub_Name '$word2')})] ) left_token: <Left_CommandSub '$('> spids: [550 554] ) ) } spids: [548] ) ] spids: [548] ) (If arms: [ (if_arm cond: [ (Sentence child: (C {(Lit_Other '[')} {(-z)} {(DQ ($ VSub_Name '$word3'))} {(Lit_Other ']')}) terminator: <Op_Semi ';'> ) ] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:date) op: Equal rhs: {(DQ ($ VSub_Name '$word1') ($ VSub_Name '$word2'))} spids: [576] ) ] spids: [576] ) ] spids: [-1 573] ) ] else_action: [ (If arms: [ (if_arm cond: [ (Sentence child: (C {(Lit_Other '[')} {(KW_Bang '!')} {(-z)} { (DQ (CommandSubPart command_list: (CommandList children: [ (Pipeline children: [ (C {(echo)} {($ VSub_Name '$word3')}) (C {(sed)} {(SQ <'s/[[:digit:]]//g'>)}) ] negated: False ) ] ) left_token: <Left_CommandSub '$('> spids: [595 605] ) ) } {(Lit_Other ']')} ) terminator: <Op_Semi ';'> ) ] action: [ (SimpleCommand words: [{(echo)} {(DQ ('Bad date format: third field should be year.'))}] redirects: [(Redir op_id:Redir_GreatAnd fd:-1 arg_word:{(2)} spids:[621])] ) (C {(exit)} {(1)}) ] spids: [-1 612] ) (if_arm cond: [ (Sentence child: (C {(Lit_Other '[')} {($ VSub_Name '$word3')} {(-lt)} {(2000)} {(-o)} {($ VSub_Name '$word3')} {(-gt)} {(2500)} {(Lit_Other ']')} ) terminator: <Op_Semi ';'> ) ] action: [ (SimpleCommand words: [{(echo)} {(DQ ('Bad date format: year value should be 2000-2500'))}] redirects: [(Redir op_id:Redir_GreatAnd fd:-1 arg_word:{(2)} spids:[661])] ) (C {(exit)} {(1)}) ] spids: [630 652] ) ] spids: [-1 670] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:date) op: Equal rhs: {(DQ ($ VSub_Name '$word1') ($ VSub_Name '$word2') ($ VSub_Name '$word3'))} spids: [673] ) ] spids: [673] ) ] spids: [583 681] ) ] spids: [378 683] ) (C {(/bin/echo)} {(-n)} {(DQ ('One-line description: '))}) (C {(read)} {(description)}) (SimpleCommand words: [ {(echo)} { (DQ (CommandSubPart command_list: (CommandList children: [ (Pipeline children: [(C {(echo)} {($ VSub_Name '$date')}) (C {(sed)} {(SQ <'s/ //g'>)})] negated: False ) ] ) left_token: <Left_CommandSub '$('> spids: [707 717] ) ('|') ($ VSub_Name '$description') ) } ] redirects: [(Redir op_id:Redir_DGreat fd:-1 arg_word:{($ VSub_Name '$agendafile')} spids:[722])] ) (C {(exit)} {(0)}) ] )