projects
/
fw
/
altos
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Version 1.9.10
[fw/altos]
/
ao-tools
/
ao-dbg
/
ao-dbg-main.c
diff --git
a/ao-tools/ao-dbg/ao-dbg-main.c
b/ao-tools/ao-dbg/ao-dbg-main.c
index f1e2c11199122a5ca4b1ca5b19a5c59fb7f839b7..772701a94315543260b101747021a63ea213930e 100644
(file)
--- a/
ao-tools/ao-dbg/ao-dbg-main.c
+++ b/
ao-tools/ao-dbg/ao-dbg-main.c
@@
-16,6
+16,10
@@
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
*/
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
*/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
#include "ao-dbg.h"
#include <unistd.h>
#include <sys/types.h>
#include "ao-dbg.h"
#include <unistd.h>
#include <sys/types.h>
@@
-34,6
+38,7
@@
struct ccdbg *s51_dbg;
int s51_interrupted = 0;
int s51_monitor = 0;
char *s51_tty = NULL;
int s51_interrupted = 0;
int s51_monitor = 0;
char *s51_tty = NULL;
+char *s51_device = NULL;
static FILE *s51_input;
static FILE *s51_output;
static FILE *s51_input;
static FILE *s51_output;
@@
-45,22
+50,23
@@
usage(void)
exit(1);
}
exit(1);
}
-void s51_sigint()
+static void
+s51_sigint(int signum)
{
s51_interrupted = 1;
}
static const struct option options[] = {
{ .name = "tty", .has_arg = 1, .val = 'T' },
{
s51_interrupted = 1;
}
static const struct option options[] = {
{ .name = "tty", .has_arg = 1, .val = 'T' },
+ { .name = "device", .has_arg = 1, .val = 'D' },
{ 0, 0, 0, 0 },
};
int
main(int argc, char **argv)
{
{ 0, 0, 0, 0 },
};
int
main(int argc, char **argv)
{
- int
flags,
opt;
+ int opt;
char *endptr;
char *endptr;
- struct sigvec vec, ovec;
while ((opt = getopt_long(argc, argv, "PVvHhmt:X:c:r:Z:s:S:p:T:", options, NULL)) != -1) {
switch (opt) {
while ((opt = getopt_long(argc, argv, "PVvHhmt:X:c:r:Z:s:S:p:T:", options, NULL)) != -1) {
switch (opt) {
@@
-114,6
+120,9
@@
main(int argc, char **argv)
case 'T':
s51_tty = optarg;
break;
case 'T':
s51_tty = optarg;
break;
+ case 'D':
+ s51_device = optarg;
+ break;
}
}
if (s51_port) {
}
}
if (s51_port) {
@@
-160,22
+169,16
@@
main(int argc, char **argv)
perror("fdopen");
exit(1);
}
perror("fdopen");
exit(1);
}
- vec.sv_handler = SIG_IGN;
- vec.sv_mask = 0;
- vec.sv_flags = 0;
- sigvec(SIGINT, &vec, &ovec);
+ signal(SIGINT, SIG_IGN);
command_read();
command_read();
- sig
vec(SIGINT, &ovec, NUL
L);
+ sig
nal(SIGINT, SIG_DF
L);
fclose(s51_input);
fclose(s51_output);
}
} else {
s51_input = stdin;
s51_output = stdout;
fclose(s51_input);
fclose(s51_output);
}
} else {
s51_input = stdin;
s51_output = stdout;
- vec.sv_handler = s51_sigint;
- vec.sv_mask = 0;
- vec.sv_flags = 0;
- sigvec(SIGINT, &vec, &ovec);
+ signal(SIGINT, s51_sigint);
command_read();
}
exit(0);
command_read();
}
exit(0);
@@
-199,13
+202,16
@@
s51_putc(int c)
putc(c, s51_output);
}
putc(c, s51_output);
}
+#if HAVE_LIBREADLINE
#include <readline/readline.h>
#include <readline/history.h>
#include <readline/readline.h>
#include <readline/history.h>
+#endif
int
s51_read_line(char *line, int len)
{
int ret;
int
s51_read_line(char *line, int len)
{
int ret;
+#if HAVE_LIBREADLINE
if (s51_output == stdout && s51_input == stdin && s51_prompt) {
char *r;
if (s51_output == stdout && s51_input == stdin && s51_prompt) {
char *r;
@@
-216,7
+222,9
@@
s51_read_line(char *line, int len)
line[len-1] = '\0';
add_history(r);
return 1;
line[len-1] = '\0';
add_history(r);
return 1;
- } else {
+ } else
+#endif
+ {
if (s51_prompt)
s51_printf("%s", s51_prompt);
else
if (s51_prompt)
s51_printf("%s", s51_prompt);
else
@@
-235,7
+243,6
@@
s51_check_input(void)
{
struct pollfd input;
int r;
{
struct pollfd input;
int r;
- int c;
input.fd = fileno(s51_input);
input.events = POLLIN;
input.fd = fileno(s51_input);
input.events = POLLIN;