ChangeLog, unix.c, util.c:
unix.c (PRS), util.c (ask_yn): Add #ifdef's to make e2fsprogs easier
to port to non-Unix platforms.
diff --git a/e2fsck/ChangeLog b/e2fsck/ChangeLog
index a75e47d..52a93ad 100644
--- a/e2fsck/ChangeLog
+++ b/e2fsck/ChangeLog
@@ -1,4 +1,9 @@
-1999-09-07 <tytso@rsts-11.mit.edu>
+1999-09-24 <tytso@valinux.com>
+
+ * unix.c (PRS), util.c (ask_yn): Add #ifdef's to make
+ e2fsprogs easier to port to non-Unix platforms.
+
+1999-09-07 <tytso@valinux.com>
* pass3.c (adjust_inode_count): Fix bug where we didn't keep the
internal and external inode counts in sync when we
diff --git a/e2fsck/unix.c b/e2fsck/unix.c
index ba1aa6b..150bd51 100644
--- a/e2fsck/unix.c
+++ b/e2fsck/unix.c
@@ -16,9 +16,10 @@
#include <string.h>
#include <fcntl.h>
#include <ctype.h>
-#include <termios.h>
#include <time.h>
+#ifdef HAVE_SIGNAL_H
#include <signal.h>
+#endif
#ifdef HAVE_GETOPT_H
#include <getopt.h>
#endif
@@ -37,8 +38,6 @@
#include "problem.h"
#include "../version.h"
-extern int isatty(int);
-
/* Command line options */
static int blocksize = 0;
static int swapfs = 0;
@@ -338,6 +337,7 @@
close(fd);
}
+#ifdef HAVE_SIGNAL_H
static e2fsck_t global_signal_ctx;
static void signal_progress_on(int sig)
@@ -361,6 +361,7 @@
e2fsck_clear_progbar(ctx);
ctx->progress = 0;
}
+#endif
static errcode_t PRS(int argc, char *argv[], e2fsck_t *ret_ctx)
{
@@ -372,7 +373,9 @@
char *oldpath = getenv("PATH");
e2fsck_t ctx;
errcode_t retval;
+#ifdef HAVE_SIGNAL_H
struct sigaction sa;
+#endif
retval = e2fsck_allocate_context(&ctx);
if (retval)
@@ -530,6 +533,7 @@
exit(FSCK_ERROR);
}
}
+#ifdef HAVE_SIGNAL_H
/*
* Set up signal action
*/
@@ -542,6 +546,7 @@
sigaction(SIGUSR1, &sa, 0);
sa.sa_handler = signal_progress_off;
sigaction(SIGUSR2, &sa, 0);
+#endif
return 0;
}
diff --git a/e2fsck/util.c b/e2fsck/util.c
index d48c769..a124a0f 100644
--- a/e2fsck/util.c
+++ b/e2fsck/util.c
@@ -13,7 +13,17 @@
#include <unistd.h>
#include <string.h>
#include <ctype.h>
+
+#ifdef HAVE_CONIO_H
+#undef HAVE_TERMIOS_H
+#include <conio.h>
+#define getchar() getch()
+#else
+#ifdef HAVE_TERMIOS_H
#include <termios.h>
+#endif
+#endif
+
#ifdef HAVE_MALLOC_H
#include <malloc.h>
#endif
@@ -54,15 +64,18 @@
int ask_yn(const char * string, int def)
{
int c;
- struct termios termios, tmp;
const char *defstr;
+#ifdef HAVE_TERMIOS_H
+ struct termios termios, tmp;
+
tcgetattr (0, &termios);
tmp = termios;
tmp.c_lflag &= ~(ICANON | ECHO);
tmp.c_cc[VMIN] = 1;
tmp.c_cc[VTIME] = 0;
tcsetattr (0, TCSANOW, &tmp);
+#endif
if (def == 1)
defstr = "<y>";
@@ -91,7 +104,9 @@
printf ("yes\n\n");
else
printf ("no\n\n");
+#ifdef HAVE_TERMIOS_H
tcsetattr (0, TCSANOW, &termios);
+#endif
return def;
}