+void discard_input(int sig, int code, struct sigcontext *scp)
+{
+ putc('\n', stdout);
+ longjmp(jb, 1);
+}
+
+char *mr_gets(char *prompt, char *buf, size_t len)
+{
+ char *in;
+#ifdef USE_READLINE
+ if(isatty(0)) {
+ in=readline(prompt);
+
+ if (!in) return NULL;
+ if (*in) {
+ add_history(in);
+ strncpy(buf, in, len-1);
+ buf[len]=0;
+ }
+
+ return buf;
+ }
+#endif
+ printf("%s", prompt);
+ fflush(stdout);
+ in=fgets(buf, len, stdin);
+ if(!in) return in;
+ if(strchr(buf,'\n')) *(strchr(buf,'\n'))=0;
+ return buf;
+}
+