def main(dbg=None, sys_argv=list(sys.argv)):
global __title__<EOL>orig_sys_argv = list(sys_argv)<EOL>opts, dbg_opts, sys_argv  = process_options(__title__, __version__,<EOL>sys_argv)<EOL>dbg_opts['<STR_LIT>'] = sys_argv<EOL>dbg_opts['<STR_LIT>']     = Mbullwinkle.BWInterface()<EOL>dbg_opts['<STR_LIT>']     = '<STR_LIT>'<EOL>if dbg is None:<EOL><INDENT>dbg = Mdebugger.Trepan(dbg_opts)<EOL>dbg.core.add_ignore(main)<EOL>pass<EOL><DEDENT>_postprocess_options(dbg, opts)<EOL>if len(sys_argv) == <NUM_LIT:0>:<EOL><INDENT>mainpyfile = None<EOL><DEDENT>else:<EOL><INDENT>mainpyfile = sys_argv[<NUM_LIT:0>]  <EOL>if not os.path.isfile(mainpyfile):<EOL><INDENT>mainpyfile=Mclifns.whence_file(mainpyfile)<EOL>is_readable = Mfile.readable(mainpyfile)<EOL>if is_readable is None:<EOL><INDENT>print("<STR_LIT>"<EOL>% (__title__, mainpyfile,))<EOL>sys.exit(<NUM_LIT:1>)<EOL><DEDENT>elif not is_readable:<EOL><INDENT>print("<STR_LIT>"<EOL>% (__title__, mainpyfile,))<EOL>sys.exit(<NUM_LIT:1>)<EOL>return<EOL><DEDENT><DEDENT>mainpyfile_noopt = Mfile.file_pyc2py(mainpyfile)<EOL>if mainpyfile != mainpyfile_nooptand Mfile.readable(mainpyfile_noopt):<EOL><INDENT>print("<STR_LIT>"<EOL>% __title__)<EOL>print("<STR_LIT>" % (<EOL>__title__, mainpyfile_noopt,))<EOL>mainpyfile = mainpyfile_noopt<EOL>pass<EOL><DEDENT>sys.path[<NUM_LIT:0>] = dbg.main_dirname = os.path.dirname(mainpyfile)<EOL><DEDENT>dbg.sig_received = False<EOL>while True:<EOL><INDENT>try:<EOL><INDENT>if dbg.program_sys_argv and mainpyfile:<EOL><INDENT>normal_termination = dbg.run_script(mainpyfile)<EOL>if not normal_termination: break<EOL><DEDENT>else:<EOL><INDENT>dbg.core.execution_status = '<STR_LIT>'<EOL>dbg.core.processor.process_commands()<EOL>pass<EOL><DEDENT>dbg.core.execution_status = '<STR_LIT>'<EOL>dbg.intf[-<NUM_LIT:1>].msg("<STR_LIT>")<EOL>dbg.core.processor.process_commands()<EOL><DEDENT>except Mexcept.DebuggerQuit:<EOL><INDENT>break<EOL><DEDENT>except Mexcept.DebuggerRestart:<EOL><INDENT>dbg.core.execution_status = '<STR_LIT>'<EOL>if dbg.program_sys_argv:<EOL><INDENT>sys.argv = list(dbg.program_sys_argv)<EOL>part1 = ('<STR_LIT>' %<EOL>dbg.core.filename(mainpyfile))<EOL>args  = '<STR_LIT:U+0020>'.join(dbg.program_sys_argv[<NUM_LIT:1>:])<EOL>dbg.intf[-<NUM_LIT:1>].msg(Mmisc.wrapped_lines(part1, args,<EOL>dbg.settings['<STR_LIT:width>']))<EOL><DEDENT>else: break<EOL><DEDENT>except SystemExit:<EOL><INDENT>break<EOL><DEDENT>pass<EOL><DEDENT>sys.argv = orig_sys_argv<EOL>return<EOL>
Routine which gets run if we were invoked directly