ao-tools: Add lots of compiler warning flags to ao-tools build
[fw/altos] / ao-tools / ao-dbg / ao-dbg-main.c
index 21b83a3dbc2b6c01327f05fe1e72ae59111b400a..8c87903510b5a325297afca854a1944a4cccbdaf 100644 (file)
  * 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>
@@ -62,7 +66,6 @@ main(int argc, char **argv)
 {
        int flags, opt;
        char *endptr;
 {
        int flags, opt;
        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) {
@@ -165,22 +168,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();
-                       sigvec(SIGINT, &ovec, NULL);
+                       signal(SIGINT, SIG_DFL);
                        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);
@@ -204,13 +201,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;
 
@@ -221,7 +221,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