(CommandList
  children: [
    (C {(echo)} {(DQ ('Content-type: text/html'))})
    (C {(echo)} {(DQ )})
    (C {(echo)} {(DQ ('<html><title>Apache Password Manager Utility</title><body>'))})
    (Assignment
      keyword: Assign_None
      pairs: [
        (assign_pair
          lhs: (LhsName name:basedir)
          op: Equal
          rhs: 
            {
              (CommandSubPart
                command_list: (CommandList children:[(C {(pwd)})])
                left_token: <Left_CommandSub '$('>
                spids: [36 38]
              )
            }
          spids: [35]
        )
      ]
      spids: [35]
    )
    (Assignment
      keyword: Assign_None
      pairs: [
        (assign_pair
          lhs: (LhsName name:myname)
          op: Equal
          rhs: 
            {
              (DQ 
                (CommandSubPart
                  command_list: (CommandList children:[(C {(basename)} {($ VSub_Number '$0')})])
                  left_token: <Left_CommandSub '$('>
                  spids: [42 46]
                )
              )
            }
          spids: [40]
        )
      ]
      spids: [40]
    )
    (Assignment
      keyword: Assign_None
      pairs: [
        (assign_pair
          lhs: (LhsName name:footer)
          op: Equal
          rhs: {(DQ ($ VSub_Name '$basedir') (/apm-footer.html))}
          spids: [49]
        )
      ]
      spids: [49]
    )
    (Assignment
      keyword: Assign_None
      pairs: [
        (assign_pair
          lhs: (LhsName name:htaccess)
          op: Equal
          rhs: {(DQ ($ VSub_Name '$basedir') (/.htaccess))}
          spids: [55]
        )
      ]
      spids: [55]
    )
    (Assignment
      keyword: Assign_None
      pairs: [
        (assign_pair
          lhs: (LhsName name:htpasswd)
          op: Equal
          rhs: 
            {
              (DQ 
                (CommandSubPart
                  command_list: (CommandList children:[(C {(which)} {(htpasswd)})])
                  left_token: <Left_Backtick '`'>
                  spids: [64 68]
                ) (' -b')
              )
            }
          spids: [62]
        )
      ]
      spids: [62]
    )
    (If
      arms: [
        (if_arm
          cond: [
            (Sentence
              child: 
                (C {(Lit_Other '[')} {(KW_Bang '!')} {(-r)} {(DQ ($ VSub_Name '$htaccess'))} 
                  {(Lit_Other ']')}
                )
              terminator: <Op_Semi ';'>
            )
          ]
          action: [
            (C {(echo)} {(DQ ('Error: cannot read ') ($ VSub_Name '$htaccess') (' file.'))})
            (C {(exit)} {(1)})
          ]
          spids: [16777215 112]
        )
      ]
      spids: [16777215 128]
    )
    (Assignment
      keyword: Assign_None
      pairs: [
        (assign_pair
          lhs: (LhsName name:passwdfile)
          op: Equal
          rhs: 
            {
              (DQ 
                (CommandSubPart
                  command_list: 
                    (CommandList
                      children: [
                        (Pipeline
                          children: [
                            (C {(grep)} {(DQ (AuthUserFile))} {($ VSub_Name '$htaccess')})
                            (C {(cut)} {(-d) (EscapedLiteralPart token:<Lit_EscapedChar '\\ '>)} {(-f2)})
                          ]
                          negated: False
                        )
                      ]
                    )
                  left_token: <Left_CommandSub '$('>
                  spids: [133 150]
                )
              )
            }
          spids: [131]
        )
      ]
      spids: [131]
    )
    (If
      arms: [
        (if_arm
          cond: [
            (Sentence
              child: 
                (C {(Lit_Other '[')} {(KW_Bang '!')} {(-r)} {($ VSub_Name '$passwdfile')} 
                  {(Lit_Other ']')}
                )
              terminator: <Op_Semi ';'>
            )
          ]
          action: [
            (C {(echo)} {(DQ ("Error: can't read password file: can't make updates."))})
            (C {(exit)} {(1)})
          ]
          spids: [16777215 167]
        )
        (if_arm
          cond: [
            (Sentence
              child: 
                (C {(Lit_Other '[')} {(KW_Bang '!')} {(-w)} {($ VSub_Name '$passwdfile')} 
                  {(Lit_Other ']')}
                )
              terminator: <Op_Semi ';'>
            )
          ]
          action: [
            (C {(echo)} {(DQ ("Error: can't write to password file: can't update."))})
            (C {(exit)} {(1)})
          ]
          spids: [181 195]
        )
      ]
      spids: [16777215 209]
    )
    (C {(echo)} 
      {
        (DQ 
          (
"<center><h1 style='background:#ccf;border-radius:3px;border:1px solid #99c;padding:3px;'>"
          )
        )
      }
    )
    (C {(echo)} {(DQ ('Apache Password Manager</h1>'))})
    (Assignment
      keyword: Assign_None
      pairs: [
        (assign_pair
          lhs: (LhsName name:action)
          op: Equal
          rhs: 
            {
              (DQ 
                (CommandSubPart
                  command_list: 
                    (CommandList
                      children: [
                        (Pipeline
                          children: [(C {(echo)} {($ VSub_Name '$QUERY_STRING')}) (C {(cut)} {(-c3)})]
                          negated: False
                        )
                      ]
                    )
                  left_token: <Left_CommandSub '$('>
                  spids: [227 237]
                )
              )
            }
          spids: [225]
        )
      ]
      spids: [225]
    )
    (Assignment
      keyword: Assign_None
      pairs: [
        (assign_pair
          lhs: (LhsName name:user)
          op: Equal
          rhs: 
            {
              (DQ 
                (CommandSubPart
                  command_list: 
                    (CommandList
                      children: [
                        (Pipeline
                          children: [
                            (C {(echo)} {($ VSub_Name '$QUERY_STRING')})
                            (C {(cut)} {(-d) (EscapedLiteralPart token:<Lit_EscapedChar '\\&'>)} {(-f2)})
                            (C {(cut)} {(-d) (Lit_Other '=')} {(-f2)})
                            (C {(tr)} {(SQ <'[:upper:]'>)} {(SQ <'[:lower:]'>)})
                          ]
                          negated: False
                        )
                      ]
                    )
                  left_token: <Left_CommandSub '$('>
                  spids: [242 270]
                )
              )
            }
          spids: [240]
        )
      ]
      spids: [240]
    )
    (Case
      to_match: {(DQ ($ VSub_Name '$action'))}
      arms: [
        (case_arm
          pat_list: [{(A)}]
          action: [
            (C {(echo)} {(DQ ('<h3>Adding New User <u>') ($ VSub_Name '$user') ('</u></h3>'))})
            (If
              arms: [
                (if_arm
                  cond: [
                    (Sentence
                      child: 
                        (C {(Lit_Other '[')} {(KW_Bang '!')} {(-z)} 
                          {
                            (DQ 
                              (CommandSubPart
                                command_list: 
                                  (CommandList
                                    children: [
                                      (C {(grep)} {(-E)} {(DQ ('^') (${ VSub_Name user) (':'))} 
                                        {($ VSub_Name '$passwdfile')}
                                      )
                                    ]
                                  )
                                left_token: <Left_CommandSub '$('>
                                spids: [305 319]
                              )
                            )
                          } {(Lit_Other ']')}
                        )
                      terminator: <Op_Semi ';'>
                    )
                  ]
                  action: [
                    (C {(echo)} 
                      {
                        (DQ ('Error: user <b>') ($ VSub_Name '$user') 
                          ('</b> already appears in the file.')
                        )
                      }
                    )
                  ]
                  spids: [16777215 326]
                )
              ]
              else_action: [
                (Assignment
                  keyword: Assign_None
                  pairs: [
                    (assign_pair
                      lhs: (LhsName name:pass)
                      op: Equal
                      rhs: 
                        {
                          (DQ 
                            (CommandSubPart
                              command_list: 
                                (CommandList
                                  children: [
                                    (Pipeline
                                      children: [
                                        (C {(echo)} {($ VSub_Name '$QUERY_STRING')})
                                        (C {(cut)} 
                                          {(-d) (EscapedLiteralPart token:<Lit_EscapedChar '\\&'>)} {(-f3)}
                                        )
                                        (C {(cut)} {(-d) (Lit_Other '=')} {(-f2)})
                                      ]
                                      negated: False
                                    )
                                  ]
                                )
                              left_token: <Left_CommandSub '$('>
                              spids: [343 361]
                            )
                          )
                        }
                      spids: [341]
                    )
                  ]
                  spids: [341]
                )
                (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 '$pass')})
                                              (C {(tr)} {(-d)} {(SQ <'[[:upper:][:lower:][:digit:]]'>)})
                                            ]
                                            negated: False
                                          )
                                        ]
                                      )
                                    left_token: <Left_CommandSub '$('>
                                    spids: [374 386]
                                  )
                                )
                              } {(Lit_Other ']')}
                            )
                          terminator: <Op_Semi ';'>
                        )
                      ]
                      action: [
                        (C {(echo)} 
                          {
                            (DQ ('Error: passwords can only contain a-z A-Z 0-9 (') 
                              ($ VSub_Name '$pass') (')')
                            )
                          }
                        )
                      ]
                      spids: [16777215 393]
                    )
                  ]
                  else_action: [
                    (C {($ VSub_Name '$htpasswd')} {($ VSub_Name '$passwdfile')} 
                      {(DQ ($ VSub_Name '$user'))} {(DQ ($ VSub_Name '$pass'))}
                    )
                    (C {(echo)} {(DQ ('Added!<br>'))})
                  ]
                  spids: [405 428]
                )
              ]
              spids: [338 431]
            )
          ]
          spids: [283 285 434 16777215]
        )
        (case_arm
          pat_list: [{(U)}]
          action: [
            (C {(echo)} 
              {(DQ ('<h3>Updating Password for user <u>') ($ VSub_Name '$user') ('</u></h3>'))}
            )
            (If
              arms: [
                (if_arm
                  cond: [
                    (Sentence
                      child: 
                        (C {(Lit_Other '[')} {(-z)} 
                          {
                            (DQ 
                              (CommandSubPart
                                command_list: 
                                  (CommandList
                                    children: [
                                      (C {(grep)} {(-E)} {(DQ ('^') (${ VSub_Name user) (':'))} 
                                        {($ VSub_Name '$passwdfile')}
                                      )
                                    ]
                                  )
                                left_token: <Left_CommandSub '$('>
                                spids: [457 471]
                              )
                            )
                          } {(Lit_Other ']')}
                        )
                      terminator: <Op_Semi ';'>
                    )
                  ]
                  action: [
                    (C {(echo)} 
                      {
                        (DQ ('Error: user <b>') ($ VSub_Name '$user') 
                          ("</b> isn't in the password file?")
                        )
                      }
                    )
                    (C {(echo)} 
                      {
                        (DQ ('searched for &quot;^') (${ VSub_Name user) (':&quot; in ') 
                          ($ VSub_Name '$passwdfile')
                        )
                      }
                    )
                  ]
                  spids: [16777215 478]
                )
              ]
              else_action: [
                (Assignment
                  keyword: Assign_None
                  pairs: [
                    (assign_pair
                      lhs: (LhsName name:pass)
                      op: Equal
                      rhs: 
                        {
                          (DQ 
                            (CommandSubPart
                              command_list: 
                                (CommandList
                                  children: [
                                    (Pipeline
                                      children: [
                                        (C {(echo)} {($ VSub_Name '$QUERY_STRING')})
                                        (C {(cut)} 
                                          {(-d) (EscapedLiteralPart token:<Lit_EscapedChar '\\&'>)} {(-f3)}
                                        )
                                        (C {(cut)} {(-d) (Lit_Other '=')} {(-f2)})
                                      ]
                                      negated: False
                                    )
                                  ]
                                )
                              left_token: <Left_CommandSub '$('>
                              spids: [507 525]
                            )
                          )
                        }
                      spids: [505]
                    )
                  ]
                  spids: [505]
                )
                (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 '$pass')})
                                              (C {(tr)} {(-d)} {(SQ <'[[:upper:][:lower:][:digit:]]'>)})
                                            ]
                                            negated: False
                                          )
                                        ]
                                      )
                                    left_token: <Left_CommandSub '$('>
                                    spids: [538 550]
                                  )
                                )
                              } {(Lit_Other ']')}
                            )
                          terminator: <Op_Semi ';'>
                        )
                      ]
                      action: [
                        (C {(echo)} 
                          {
                            (DQ ('Error: passwords can only contain a-z A-Z 0-9 (') 
                              ($ VSub_Name '$pass') (')')
                            )
                          }
                        )
                      ]
                      spids: [16777215 557]
                    )
                  ]
                  else_action: [
                    (Pipeline
                      children: [
                        (C {(grep)} {(-vE)} {(DQ ('^') (${ VSub_Name user) (':'))} 
                          {($ VSub_Name '$passwdfile')}
                        )
                        (SimpleCommand
                          words: [{(tee)} {($ VSub_Name '$passwdfile')}]
                          redirects: [
                            (Redir
                              op_id: Redir_Great
                              fd: 16777215
                              arg_word: {(/dev/null)}
                              spids: [592]
                            )
                          ]
                        )
                      ]
                      negated: False
                    )
                    (C {($ VSub_Name '$htpasswd')} {($ VSub_Name '$passwdfile')} 
                      {(DQ ($ VSub_Name '$user'))} {(DQ ($ VSub_Name '$pass'))}
                    )
                    (C {(echo)} {(DQ ('Updated!<br>'))})
                  ]
                  spids: [569 617]
                )
              ]
              spids: [502 620]
            )
          ]
          spids: [437 439 623 16777215]
        )
        (case_arm
          pat_list: [{(D)}]
          action: [
            (C {(echo)} {(DQ ('<h3>Deleting User <u>') ($ VSub_Name '$user') ('</u></h3>'))})
            (If
              arms: [
                (if_arm
                  cond: [
                    (Sentence
                      child: 
                        (C {(Lit_Other '[')} {(-z)} 
                          {
                            (DQ 
                              (CommandSubPart
                                command_list: 
                                  (CommandList
                                    children: [
                                      (C {(grep)} {(-E)} {(DQ ('^') (${ VSub_Name user) (':'))} 
                                        {($ VSub_Name '$passwdfile')}
                                      )
                                    ]
                                  )
                                left_token: <Left_CommandSub '$('>
                                spids: [646 660]
                              )
                            )
                          } {(Lit_Other ']')}
                        )
                      terminator: <Op_Semi ';'>
                    )
                  ]
                  action: [
                    (C {(echo)} 
                      {
                        (DQ ('Error: user <b>') ($ VSub_Name '$user') 
                          ("</b> isn't in the password file?")
                        )
                      }
                    )
                  ]
                  spids: [16777215 667]
                )
                (if_arm
                  cond: [
                    (Sentence
                      child: 
                        (C {(Lit_Other '[')} {(DQ ($ VSub_Name '$user'))} {(Lit_Other '=')} {(DQ (admin))} 
                          {(Lit_Other ']')}
                        )
                      terminator: <Op_Semi ';'>
                    )
                  ]
                  action: [(C {(echo)} {(DQ ("Error: you can't delete the 'admin' account."))})]
                  spids: [679 697]
                )
              ]
              else_action: [
                (Pipeline
                  children: [
                    (C {(grep)} {(-vE)} {(DQ ('^') (${ VSub_Name user) (':'))} 
                      {($ VSub_Name '$passwdfile')}
                    )
                    (SimpleCommand
                      words: [{(tee)} {($ VSub_Name '$passwdfile')}]
                      redirects: [
                        (Redir
                          op_id: Redir_Great
                          fd: 16777215
                          arg_word: {(/dev/null)}
                          spids: [730]
                        )
                      ]
                    )
                  ]
                  negated: False
                )
                (C {(echo)} {(DQ ('Deleted!<br>'))})
              ]
              spids: [707 741]
            )
          ]
          spids: [626 628 744 16777215]
        )
      ]
      spids: [274 280 746]
    )
    (C {(echo)} {(DQ ("<br><br><table border='1' cellspacing='0' width='80%' cellpadding='3'>"))})
    (C {(echo)} {(DQ ("<tr bgcolor='#cccccc'><th colspan='3'>List "))})
    (C {(echo)} {(DQ ('of all current users</td></tr>'))})
    (Sentence
      child: 
        (Assignment
          keyword: Assign_None
          pairs: [
            (assign_pair
              lhs: (LhsName name:oldIFS)
              op: Equal
              rhs: {($ VSub_Name '$IFS')}
              spids: [771]
            )
          ]
          spids: [771]
        )
      terminator: <Op_Semi ';'>
    )
    (Assignment
      keyword: Assign_None
      pairs: [(assign_pair lhs:(LhsName name:IFS) op:Equal rhs:{(DQ (':'))} spids:[776])]
      spids: [776]
    )
    (While
      cond: [(Sentence child:(C {(read)} {(acct)} {(pw)}) terminator:<Op_Semi ';'>)]
      body: 
        (DoGroup
          children: [
            (C {(echo)} 
              {
                (DQ ('<tr><th>') ($ VSub_Name '$acct') ('</th><td align=center><a href=') 
                  (EscapedLiteralPart token:<Lit_EscapedChar '\\"'>) ($ VSub_Name '$myname') ('?a=D&u=') ($ VSub_Name '$acct') 
                  (EscapedLiteralPart token:<Lit_EscapedChar '\\"'>) ('>')
                )
              }
            )
            (C {(echo)} {(DQ ('[delete]</a></td></tr>'))})
          ]
          spids: [794 818]
        )
      redirects: [
        (Redir
          op_id: Redir_Less
          fd: 16777215
          arg_word: {($ VSub_Name '$passwdfile')}
          spids: [820]
        )
      ]
    )
    (C {(echo)} {(DQ ('</table>'))})
    (Assignment
      keyword: Assign_None
      pairs: [(assign_pair lhs:(LhsName name:IFS) op:Equal rhs:{($ VSub_Name '$oldIFS')} spids:[830])]
      spids: [830]
    )
    (Assignment
      keyword: Assign_None
      pairs: [
        (assign_pair
          lhs: (LhsName name:optionstring)
          op: Equal
          rhs: 
            {
              (DQ 
                (CommandSubPart
                  command_list: 
                    (CommandList
                      children: [
                        (Pipeline
                          children: [
                            (C {(cut)} {(-d) (Lit_Other ':')} {(-f1)} {($ VSub_Name '$passwdfile')})
                            (C {(sed)} {(SQ <'s/^/<option>/'>)})
                            (C {(tr)} {(SQ <'\\n'>)} {(SQ <' '>)})
                          ]
                          negated: False
                        )
                      ]
                    )
                  left_token: <Left_CommandSub '$('>
                  spids: [842 869]
                )
              )
            }
          spids: [840]
        )
      ]
      spids: [840]
    )
    (If
      arms: [
        (if_arm
          cond: [
            (Sentence
              child: 
                (C {(Lit_Other '[')} {(KW_Bang '!')} {(-r)} {($ VSub_Name '$footer')} {(Lit_Other ']')})
              terminator: <Op_Semi ';'>
            )
          ]
          action: [(C {(echo)} {(DQ ("Warning: can't read ") ($ VSub_Name '$footer'))})]
          spids: [16777215 887]
        )
      ]
      else_action: [
        (SimpleCommand
          words: [
            {(sed)}
            {(-e)}
            {(DQ (s/--myname--/) ($ VSub_Name '$myname') (/g))}
            {(-e)}
            {(DQ (s/--options--/) ($ VSub_Name '$optionstring') (/g))}
          ]
          redirects: [
            (Redir
              op_id: Redir_Less
              fd: 16777215
              arg_word: {($ VSub_Name '$footer')}
              spids: [921]
            )
          ]
        )
      ]
      spids: [897 925]
    )
    (C {(exit)} {(0)})
  ]
)