chiark
/
gitweb
/
~mdw
/
jog
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
0ebccf0
)
Parse tracing options on the command-line.
author
mdw
<mdw>
Wed, 30 Jan 2002 09:27:55 +0000
(09:27 +0000)
committer
mdw
<mdw>
Wed, 30 Jan 2002 09:27:55 +0000
(09:27 +0000)
main.c
patch
|
blob
|
blame
|
history
diff --git
a/main.c
b/main.c
index 6855a869b34d34b8c2770df38fcacf9ce6d02e17..b30b7ec28bf5ddde6db07628a86a33530da818cd 100644
(file)
--- a/
main.c
+++ b/
main.c
@@
-1,6
+1,6
@@
/* -*-c-*-
*
/* -*-c-*-
*
- * $Id: main.c,v 1.
1 2002/01/25 19:34:4
5 mdw Exp $
+ * $Id: main.c,v 1.
2 2002/01/30 09:27:5
5 mdw Exp $
*
* Main program
*
*
* Main program
*
@@
-29,6
+29,9
@@
/*----- Revision history --------------------------------------------------*
*
* $Log: main.c,v $
/*----- Revision history --------------------------------------------------*
*
* $Log: main.c,v $
+ * Revision 1.2 2002/01/30 09:27:55 mdw
+ * Parse tracing options on the command-line.
+ *
* Revision 1.1 2002/01/25 19:34:45 mdw
* Initial revision
*
* Revision 1.1 2002/01/25 19:34:45 mdw
* Initial revision
*
@@
-52,6
+55,7
@@
#include <mLib/trace.h>
#include "err.h"
#include <mLib/trace.h>
#include "err.h"
+#include "jog.h"
#include "rxglue.h"
#include "txport.h"
#include "tx-serial-unix.h"
#include "rxglue.h"
#include "txport.h"
#include "tx-serial-unix.h"
@@
-76,7
+80,9
@@
static void sigtidy(int sig)
static void usage(FILE *fp)
{
static void usage(FILE *fp)
{
- pquis(fp, "Usage: $ [-t TRANSPORT] [-f FILE] [-c CONFIG] SCRIPT [ARG]\n");
+ pquis(fp, "\
+Usage: $ [-t TRANSPORT] [-f FILE] [-c CONFIG] SCRIPT ARG...\n\
+");
}
static void version(FILE *fp)
}
static void version(FILE *fp)
@@
-120,7
+126,7
@@
int main(int argc, char *argv[])
err_init();
rx_init();
err_init();
rx_init();
- trace_on(stderr, 0u);
+ T( trace_on(stderr, 0u); )
if ((txname = getenv("JOGTX")) != 0)
;
else
if ((txname = getenv("JOGTX")) != 0)
;
else
@@
-149,12
+155,27
@@
int main(int argc, char *argv[])
{ "txfile", OPTF_ARGREQ, 0, 'f' },
{ "file", OPTF_ARGREQ, 0, 'f' },
{ "txfile", OPTF_ARGREQ, 0, 'f' },
{ "file", OPTF_ARGREQ, 0, 'f' },
+ /* --- Debugging stuff --- */
+
+#ifndef NTRACE
+ { "trace", OPTF_ARGREQ, 0, 'T' },
+#endif
+
/* --- End marker --- */
{ 0, 0, 0, 0 }
};
/* --- End marker --- */
{ 0, 0, 0, 0 }
};
- i = mdwopt(argc, argv, "hvut:c:f:", opt, 0, 0, 0);
+#ifndef NTRACE
+ static const trace_opt tropt[] = {
+ { 'x', T_TX, "transport layer" },
+ { 's', T_TXSYS, "low-level transport" },
+ { 'A', T_ALL, "all of the above" },
+ { 0, 0, 0 }
+ };
+#endif
+
+ i = mdwopt(argc, argv, "hvu" "t:c:f:" T("T:"), opt, 0, 0, 0);
if (i < 0)
break;
if (i < 0)
break;
@@
-184,6
+205,14
@@
int main(int argc, char *argv[])
txfile = optarg;
break;
txfile = optarg;
break;
+ /* --- Tracing --- */
+
+#ifndef NTRACE
+ case 'T':
+ trace_level(traceopt(tropt, optarg, tracing(), 0));
+ break;
+#endif
+
/* --- Errors --- */
default:
/* --- Errors --- */
default:
@@
-192,7
+221,7
@@
int main(int argc, char *argv[])
}
}
}
}
- if ((f & f_bogus) ||
(optind != argc - 1 && optind != argc - 2)
) {
+ if ((f & f_bogus) ||
optind > argc - 1
) {
usage(stderr);
exit(EXIT_FAILURE);
}
usage(stderr);
exit(EXIT_FAILURE);
}