summaryrefslogtreecommitdiff
path: root/dmake/dbug/dbug/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'dmake/dbug/dbug/main.c')
-rwxr-xr-xdmake/dbug/dbug/main.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/dmake/dbug/dbug/main.c b/dmake/dbug/dbug/main.c
new file mode 100755
index 000000000000..d7c4267d4767
--- /dev/null
+++ b/dmake/dbug/dbug/main.c
@@ -0,0 +1,27 @@
+#include <stdio.h>
+/* User programs should use <local/dbug.h> */
+#include "dbug.h"
+
+int main (argc, argv)
+ int argc;
+ char *argv[];
+{
+ register int result, ix;
+ extern int factorial (), atoi ();
+
+ DBUG_ENTER ("main");
+ DBUG_PROCESS (argv[0]);
+ for (ix = 1; ix < argc && argv[ix][0] == '-'; ix++) {
+ switch (argv[ix][1]) {
+ case '#':
+ DBUG_PUSH (&(argv[ix][2]));
+ break;
+ }
+ }
+ for (; ix < argc; ix++) {
+ DBUG_PRINT ("args", ("argv[%d] = %s", ix, argv[ix]));
+ result = factorial (atoi (argv[ix]));
+ printf ("%d\n", result);
+ }
+ DBUG_RETURN (0);
+}