projects
/
fw
/
altos
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge branch 'master' of ssh://git.gag.com/scm/git/fw/altos
[fw/altos]
/
ao-tools
/
ao-rawload
/
ao-rawload.c
diff --git
a/ao-tools/ao-rawload/ao-rawload.c
b/ao-tools/ao-rawload/ao-rawload.c
index 5f7708fd2f8c93ac4b1d8da40fefc0baaa71b2ca..1f1537b9f12d59eb49f6de87c7e96ed39e7e1e1f 100644
(file)
--- a/
ao-tools/ao-rawload/ao-rawload.c
+++ b/
ao-tools/ao-rawload/ao-rawload.c
@@
-16,8
+16,21
@@
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
*/
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
*/
+#include <unistd.h>
+#include <getopt.h>
#include "ccdbg.h"
#include "ccdbg.h"
+static const struct option options[] = {
+ { .name = "tty", .has_arg = 1, .val = 'T' },
+ { 0, 0, 0, 0},
+};
+
+static void usage(char *program)
+{
+ fprintf(stderr, "usage: %s [--tty <tty-name>] file.ihx\n", program);
+ exit(1);
+}
+
int
main (int argc, char **argv)
{
int
main (int argc, char **argv)
{
@@
-26,10
+39,22
@@
main (int argc, char **argv)
uint16_t pc;
struct hex_file *hex;
struct hex_image *image;
uint16_t pc;
struct hex_file *hex;
struct hex_image *image;
- char *filename;
- FILE *file;
+ char *filename;
+ FILE *file;
+ char *tty = NULL;
+ int c;
- filename = argv[1];
+ while ((c = getopt_long(argc, argv, "T:", options, NULL)) != -1) {
+ switch (c) {
+ case 'T':
+ tty = optarg;
+ break;
+ default:
+ usage(argv[0]);
+ break;
+ }
+ }
+ filename = argv[optind];
if (filename == NULL) {
fprintf(stderr, "usage: %s <filename.ihx>\n", argv[0]);
exit(1);
if (filename == NULL) {
fprintf(stderr, "usage: %s <filename.ihx>\n", argv[0]);
exit(1);
@@
-50,7
+75,7
@@
main (int argc, char **argv)
}
ccdbg_hex_file_free(hex);
}
ccdbg_hex_file_free(hex);
- dbg = ccdbg_open();
+ dbg = ccdbg_open(
tty
);
if (!dbg)
exit (1);
if (!dbg)
exit (1);