2 Copyright © 2006-2007, The AROS Development Team. All rights reserved.
6 #include <aros/debug.h>
10 #include <proto/dos.h>
11 #include <proto/arossupport.h>
12 #include <proto/exec.h>
28 Locale_Deinitialize();
32 static void prettyprint(CONST_STRPTR str
, LONG minlen
)
35 LONG len
= strlen(str
);
37 RawPutChars(str
, len
);
39 for (i
= len
; i
< minlen
; i
++)
46 // eye-catching function name because this is what we'd see in the debugger
47 static void SNOOPY_breakpoint(void)
49 // interrupting makes only sense on "hosted" where we have a debugger
50 #if (AROS_FLAVOUR & AROS_FLAVOUR_EMULATION)
51 #if defined(__i386__) || defined(__x86_64__)
53 #elif defined(__powerpc__)
56 // TODO: other platforms
57 kprintf("[SNOOP] interrupt not supported on this platform\n");
63 void main_output(CONST_STRPTR action
, CONST_STRPTR target
, CONST_STRPTR option
, LONG result
, BOOL canInterrupt
)
65 struct Task
*thistask
= SysBase
->ThisTask
;
66 STRPTR name
= thistask
->tc_Node
.ln_Name
;
68 if (setup
.onlyShowFails
&& result
) return;
71 if ( ! stricmp(name
, "wanderer:wanderer")) return;
72 if ( ! stricmp(name
, "new shell")) return;
73 if ( ! stricmp(name
, "newshell")) return;
74 if ( ! stricmp(name
, "boot shell")) return;
75 if ( ! stricmp(name
, "background cli")) return;
78 if (setup
.match
&& ! MatchPatternNoCase(setup
.parsedpattern
, name
))
80 // pattern doesn't fit
84 // FIXME: Can Forbid/Permit cause locks?
87 RawPutChars("SNOOP ", 7);
89 prettyprint(name
, setup
.nameLen
);
94 if (thistask
->tc_Node
.ln_Type
== NT_PROCESS
&& ((struct Process
*)thistask
)->pr_CLI
)
96 clinum
= ((struct Process
*)thistask
)->pr_TaskNum
;
99 kprintf(" [%d]", clinum
);
102 prettyprint(action
, setup
.actionLen
);
103 prettyprint(target
, setup
.targetLen
);
104 prettyprint(option
, setup
.optionLen
);
105 prettyprint(result
? MSG(MSG_OK
) : MSG(MSG_FAIL
), 0);
109 // We're calling the breakpoint function from the output function
110 // so that we don't have to check the setup parameters again.
111 // canInterrupt is for cases where a patch prints multiple lines.
112 if (canInterrupt
&& setup
.breakPoint
) SNOOPY_breakpoint();
116 void main_parsepattern(void)
120 if (!setup
.pattern
) return;
121 if (setup
.pattern
[0] == '\0') return;
123 Forbid(); // avoid that parsed pattern is used while we change it
124 setup
.parsedpattern
[0] = '\0';
125 if (ParsePatternNoCase(setup
.pattern
, setup
.parsedpattern
, PARSEDPATTERNLEN
) != -1)
133 void clean_exit(char *s
)