Fix various gcc -Wall complaints.

diff --git a/e2fsck/ChangeLog b/e2fsck/ChangeLog
index 747f1fc..e04c260 100644
--- a/e2fsck/ChangeLog
+++ b/e2fsck/ChangeLog
@@ -1,4 +1,8 @@
-2002-03-07    <tytso@snap.thunk.org>
+2002-03-07  Theodore Tso  <tytso@mit.edu>
+
+	* journal.c, pass5.c, revoke.c: Fix gcc -Wall complaints
+
+2002-03-07  Theodore Tso  <tytso@mit.edu>
 
 	* unix.c (main): Don't close the filesystem before calling
 		fatal_error(); this just causes a needless warning about a
@@ -8,7 +12,7 @@
 		in case the journal is too small, or the inode number in
 		the superblock doesn't appear to be random.
 
-2002-03-06    <tytso@mit.edu>
+2002-03-06  Theodore Tso  <tytso@mit.edu>
 
 	* problem.h, problem.c: PR_5_BLOCK_RANGE_UNUSED,
 		PR_5_BLOCK_RANGE_USED, PR_5_INODE_RANGE_UNUSED,
diff --git a/e2fsck/journal.c b/e2fsck/journal.c
index 6597d57..246af2b 100644
--- a/e2fsck/journal.c
+++ b/e2fsck/journal.c
@@ -184,7 +184,7 @@
 	struct buffer_head 	*bh;
 	struct inode		*j_inode = NULL;
 	struct kdev_s		*dev_fs = NULL, *dev_journal;
-	const char		*journal_name = 0;
+	char			*journal_name = 0;
 	journal_t		*journal = NULL;
 	errcode_t		retval;
 	io_manager		io_ptr;
@@ -792,7 +792,7 @@
  * This function will move the journal inode from a visible file in
  * the filesystem directory hierarchy to the reserved inode if necessary.
  */
-const static char * const journal_names[] = {
+static const char * const journal_names[] = {
 	".journal", "journal", ".journal.dat", "journal.dat", 0 };
 
 void e2fsck_move_ext3_journal(e2fsck_t ctx)
diff --git a/e2fsck/pass5.c b/e2fsck/pass5.c
index ef3e166..7fe7c6d 100644
--- a/e2fsck/pass5.c
+++ b/e2fsck/pass5.c
@@ -74,7 +74,7 @@
 
 #define NO_BLK ((blk_t) -1)
 
-static print_bitmap_problem(e2fsck_t ctx, int problem,
+static void print_bitmap_problem(e2fsck_t ctx, int problem,
 			    struct problem_context *pctx)
 {
 	switch (problem) {
diff --git a/e2fsck/revoke.c b/e2fsck/revoke.c
index 9866935..fd2b73e 100644
--- a/e2fsck/revoke.c
+++ b/e2fsck/revoke.c
@@ -122,7 +122,9 @@
 	struct list_head *hash_list;
 	struct jbd_revoke_record_s *record;
 
+#ifdef __KERNEL__
 repeat:
+#endif
 	record = kmem_cache_alloc(revoke_record_cache, GFP_NOFS);
 	if (!record)
 		goto oom;
diff --git a/lib/ext2fs/ChangeLog b/lib/ext2fs/ChangeLog
index 6e1f824..7bb2ce0 100644
--- a/lib/ext2fs/ChangeLog
+++ b/lib/ext2fs/ChangeLog
@@ -1,5 +1,10 @@
 2002-03-07  Theodore Tso  <tytso@mit.edu>
 
+	* ext2fs.h (ext2fs_inode_io_intern): Add missing function prototype.
+
+	* bmap.c, fileio.c, inode_io.c, tst_badblocks.c, 
+		tst_byteswap.c: Fix gcc -Wall complaints
+
 	* Makefile.in (check): Use LD_LIBRARY_PATH to run test programs.
 		(From Philipp Thomas <pthomas@suse.de>)
 
diff --git a/lib/ext2fs/bmap.c b/lib/ext2fs/bmap.c
index 25ba695..b8b5280 100644
--- a/lib/ext2fs/bmap.c
+++ b/lib/ext2fs/bmap.c
@@ -33,7 +33,7 @@
 
 #define inode_bmap(inode, nr) ((inode)->i_block[(nr)])
 
-static errcode_t _BMAP_INLINE_ block_ind_bmap(ext2_filsys fs, int flags, 
+static _BMAP_INLINE_ errcode_t block_ind_bmap(ext2_filsys fs, int flags, 
 					      blk_t ind, char *block_buf, 
 					      int *blocks_alloc,
 					      blk_t nr, blk_t *ret_blk)
@@ -83,7 +83,7 @@
 	return 0;
 }
 
-static errcode_t _BMAP_INLINE_ block_dind_bmap(ext2_filsys fs, int flags,
+static _BMAP_INLINE_ errcode_t block_dind_bmap(ext2_filsys fs, int flags,
 					       blk_t dind, char *block_buf, 
 					       int *blocks_alloc,
 					       blk_t nr, blk_t *ret_blk)
@@ -103,7 +103,7 @@
 	return retval;
 }
 
-static errcode_t _BMAP_INLINE_ block_tind_bmap(ext2_filsys fs, int flags,
+static _BMAP_INLINE_ errcode_t block_tind_bmap(ext2_filsys fs, int flags,
 					       blk_t tind, char *block_buf, 
 					       int *blocks_alloc,
 					       blk_t nr, blk_t *ret_blk)
diff --git a/lib/ext2fs/ext2fs.h b/lib/ext2fs/ext2fs.h
index e37b817..15d0b6f 100644
--- a/lib/ext2fs/ext2fs.h
+++ b/lib/ext2fs/ext2fs.h
@@ -723,6 +723,8 @@
 
 /* inode_io.c */
 extern io_manager inode_io_manager;
+extern errcode_t ext2fs_inode_io_intern(ext2_filsys fs, ext2_ino_t ino, 
+					char **name);
 	
 /* ismounted.c */
 extern errcode_t ext2fs_check_if_mounted(const char *file, int *mount_flags);
diff --git a/lib/ext2fs/fileio.c b/lib/ext2fs/fileio.c
index f0b216e..32f5b37 100644
--- a/lib/ext2fs/fileio.c
+++ b/lib/ext2fs/fileio.c
@@ -241,7 +241,7 @@
 	ext2_filsys	fs;
 	errcode_t	retval = 0;
 	unsigned int	start, c, count = 0;
-	char		*ptr = (char *) buf;
+	const char	*ptr = (const char *) buf;
 
 	EXT2_CHECK_MAGIC(file, EXT2_ET_MAGIC_EXT2_FILE);
 	fs = file->fs;
diff --git a/lib/ext2fs/inode_io.c b/lib/ext2fs/inode_io.c
index bb72403..cdd0f21 100644
--- a/lib/ext2fs/inode_io.c
+++ b/lib/ext2fs/inode_io.c
@@ -78,7 +78,7 @@
 				     (void **) &data)))
 		return retval;
 	data->magic = EXT2_ET_MAGIC_INODE_IO_CHANNEL;
-	sprintf(data->name, "%lu:%d", ino, ino_unique++);
+	sprintf(data->name, "%u:%d", ino, ino_unique++);
 	data->file = 0;
 	data->fs = fs;
 	data->ino = ino;
@@ -172,7 +172,6 @@
 static errcode_t inode_set_blksize(io_channel channel, int blksize)
 {
 	struct inode_private_data *data;
-	errcode_t		retval;
 
 	EXT2_CHECK_MAGIC(channel, EXT2_ET_MAGIC_IO_CHANNEL);
 	data = (struct inode_private_data *) channel->private_data;
@@ -187,10 +186,7 @@
 			       int count, void *buf)
 {
 	struct inode_private_data *data;
-	struct inode_cache *cache;
 	errcode_t	retval;
-	char		*cp;
-	int		i, j;
 
 	EXT2_CHECK_MAGIC(channel, EXT2_ET_MAGIC_IO_CHANNEL);
 	data = (struct inode_private_data *) channel->private_data;
@@ -210,10 +206,7 @@
 				int count, const void *buf)
 {
 	struct inode_private_data *data;
-	struct inode_cache *cache;
-	errcode_t	retval = 0, retval2;
-	const char	*cp;
-	int		writethrough;
+	errcode_t	retval;
 
 	EXT2_CHECK_MAGIC(channel, EXT2_ET_MAGIC_IO_CHANNEL);
 	data = (struct inode_private_data *) channel->private_data;
@@ -234,7 +227,6 @@
 {
 	struct inode_private_data *data;
 	errcode_t	retval = 0;
-	size_t		actual;
 
 	EXT2_CHECK_MAGIC(channel, EXT2_ET_MAGIC_IO_CHANNEL);
 	data = (struct inode_private_data *) channel->private_data;
@@ -253,7 +245,6 @@
 static errcode_t inode_flush(io_channel channel)
 {
 	struct inode_private_data *data;
-	errcode_t retval = 0;
 	
 	EXT2_CHECK_MAGIC(channel, EXT2_ET_MAGIC_IO_CHANNEL);
 	data = (struct inode_private_data *) channel->private_data;
diff --git a/lib/ext2fs/tst_badblocks.c b/lib/ext2fs/tst_badblocks.c
index c9389fa..cad6efd 100644
--- a/lib/ext2fs/tst_badblocks.c
+++ b/lib/ext2fs/tst_badblocks.c
@@ -160,11 +160,11 @@
 		printf("Block bitmap NOT matched.\n");
 		test_fail++;
 	}
-
+	return 0;
 }
 
 
-int main(int argc, char *argv)
+int main(int argc, char **argv)
 {
 	badblocks_list bb1, bb2, bb3, bb4;
 	int	equal;
diff --git a/lib/ext2fs/tst_byteswap.c b/lib/ext2fs/tst_byteswap.c
index e747c1e..d73fb41 100644
--- a/lib/ext2fs/tst_byteswap.c
+++ b/lib/ext2fs/tst_byteswap.c
@@ -44,7 +44,7 @@
 	0x00000000, 0x00000000
 	};
 
-int main(int argc, char *argv)
+int main(int argc, char **argv)
 {
 	int	i;
 	int	errors = 0;
diff --git a/lib/ss/ChangeLog b/lib/ss/ChangeLog
index 2e9ff3e..68b641c 100644
--- a/lib/ss/ChangeLog
+++ b/lib/ss/ChangeLog
@@ -1,3 +1,16 @@
+2002-03-07  Theodore Tso  <tytso@mit.edu>
+
+	* pager.c (ss_pager_create), list_rqs.c (ss_list_requests): Fix
+		function prototypes to avoid gcc -Wall complaints.
+
+	* listen.c (ss_listen): Make sure the signal handler for SIGCONT
+		is restored when we exit.  Also, make sure we don't
+		clubber any variables after setjmp/longjmp.  Also removed
+		some bogus, fairly dubious coude.
+
+	* ss.h, ss_internal.h, execute_cmd.c: Add function prototypes to
+		prevent gcc -Wall complaints.
+
 2002-02-12  Theodore Tso  <tytso@mit.edu>
 
 	* requests.c (DECLARE): Fix bug in non-STDC declaration --- we
diff --git a/lib/ss/execute_cmd.c b/lib/ss/execute_cmd.c
index fbae177..0f6a8c7 100644
--- a/lib/ss/execute_cmd.c
+++ b/lib/ss/execute_cmd.c
@@ -17,6 +17,11 @@
 #include "ss_internal.h"
 #include <stdio.h>
 
+static int check_request_table PROTOTYPE((ss_request_table *rqtbl, int argc,
+					  char *argv[], int sci_idx));
+static int really_execute_command PROTOTYPE((int sci_idx, int argc,
+					     char **argv[]));
+
 /*
  * get_request(tbl, idx)
  *
diff --git a/lib/ss/list_rqs.c b/lib/ss/list_rqs.c
index 1467132..8c4e846 100644
--- a/lib/ss/list_rqs.c
+++ b/lib/ss/list_rqs.c
@@ -29,7 +29,7 @@
 
 void ss_list_requests(argc, argv, sci_idx, info_ptr)
     int argc;
-    char **argv;
+    char const * const * argv;
     int sci_idx;
     pointer info_ptr;
 {
@@ -46,7 +46,7 @@
 #else
     int mask;
 #endif
-    sigret_t (*func)();
+    sigret_t (*func) PROTOTYPE((int));
 #ifndef NO_FORK
     int waitb;
 #endif
diff --git a/lib/ss/listen.c b/lib/ss/listen.c
index fbd563b..04b8302 100644
--- a/lib/ss/listen.c
+++ b/lib/ss/listen.c
@@ -34,6 +34,7 @@
 
 static ss_data *current_info;
 static jmp_buf listen_jmpb;
+static sigret_t (*sig_cont)(int);
 
 static sigret_t print_prompt(int sig)
 {
@@ -62,10 +63,8 @@
 {
     char *cp;
     ss_data *info;
-    sigret_t (*sig_int)(int), (*sig_cont)(int), (*old_sig_cont)(int);
+    sigret_t (*sig_int)(int), (*old_sig_cont)(int);
     char input[BUFSIZ];
-    char buffer[BUFSIZ];
-    char *end = buffer;
 #ifdef POSIX_SIGNALS
     sigset_t omask, igmask;
 #else
@@ -95,15 +94,17 @@
 #endif
     while(!info->abort) {
 	print_prompt(0);
-	*end = '\0';
 	old_sig_cont = sig_cont;
 	sig_cont = signal(SIGCONT, print_prompt);
 	if (sig_cont == print_prompt)
 	    sig_cont = old_sig_cont;
 	if (fgets(input, BUFSIZ, stdin) != input) {
 	    code = SS_ET_EOF;
+	    (void) signal(SIGCONT, sig_cont);
 	    goto egress;
 	}
+	input[BUFSIZ-1] = 0;
+	
 	cp = strchr(input, '\n');
 	if (cp) {
 	    *cp = '\0';
@@ -111,8 +112,6 @@
 		continue;
 	}
 	(void) signal(SIGCONT, sig_cont);
-	for (end = input; *end; end++)
-	    ;
 
 	code = ss_execute_line (sci_idx, input);
 	if (code == SS_ET_COMMAND_NOT_FOUND) {
diff --git a/lib/ss/pager.c b/lib/ss/pager.c
index f3640ce..979ae5d 100644
--- a/lib/ss/pager.c
+++ b/lib/ss/pager.c
@@ -31,7 +31,7 @@
 
 static char MORE[] = "more";
 extern char *_ss_pager_name;
-extern char *getenv();
+extern char *getenv PROTOTYPE((const char *));
 
 /*
  * this needs a *lot* of work....
@@ -42,7 +42,7 @@
  */
 
 #ifndef NO_FORK
-int ss_pager_create() 
+int ss_pager_create(NOARGS) 
 {
 	int filedes[2];
      
diff --git a/lib/ss/ss.h b/lib/ss/ss.h
index 4215dfd..7a7975c 100644
--- a/lib/ss/ss.h
+++ b/lib/ss/ss.h
@@ -74,6 +74,8 @@
 			  int sci_idx, void *infop);
 void ss_unimplemented(int argc, const char * const *argv,
 		      int sci_idx, void *infop);
+void ss_set_prompt(int sci_idx, char *new_prompt);
+char *ss_get_prompt(int sci_idx);
 #else
 char *ss_name();
 void ss_error ();
@@ -90,6 +92,8 @@
 void ss_subsystem_name();
 void ss_subsystem_version();
 void ss_unimplemented();
+void ss_set_prompt;
+char *ss_get_prompt;
 #endif
 extern ss_request_table ss_std_requests;
 #endif /* _ss_h */
diff --git a/lib/ss/ss_internal.h b/lib/ss/ss_internal.h
index 94c99f2..ab15586 100644
--- a/lib/ss/ss_internal.h
+++ b/lib/ss/ss_internal.h
@@ -105,12 +105,17 @@
 #define	ss_info(sci_idx)	(_ss_table[sci_idx])
 #define	ss_current_request(sci_idx,code_ptr)	\
      (*code_ptr=0,ss_info(sci_idx)->current_request)
+void ss_add_info_dir PROTOTYPE((int sci_idx, char *info_dir,
+				int *code_ptr));
 void ss_delete_info_dir PROTOTYPE((int sci_idx, char *info_dir,
 				   int *code_ptr));
 int ss_execute_line PROTOTYPE((int sci_idx, char *line_ptr));
 char **ss_parse PROTOTYPE((int sci_idx, char *line_ptr, int *argc_ptr));
 ss_abbrev_info *ss_abbrev_initialize PROTOTYPE((char *, int *));
 void ss_page_stdin(NOARGS);
+void ss_list_requests PROTOTYPE((int, char const * const *, int, pointer));
+int ss_execute_command PROTOTYPE((int sci_idx, char *argv[]));
+int ss_pager_create(NOARGS);
 
 extern ss_data **_ss_table;
 extern char *ss_et_msgs[];
diff --git a/misc/ChangeLog b/misc/ChangeLog
index 523f12b..7c5e596 100644
--- a/misc/ChangeLog
+++ b/misc/ChangeLog
@@ -1,5 +1,7 @@
 2002-03-07  Theodore Tso  <tytso@mit.edu>
 
+	* base_device.c (main): Fix gcc -Wall complaints in debug code.
+
 	* mke2fs.c (zap_sector): Don't erase BSD disklabels on Alpha.
 		(From Thorsten Kukuk <kukuk@suse.de>)
 
diff --git a/misc/base_device.c b/misc/base_device.c
index f58f2e8..80cd0fa 100644
--- a/misc/base_device.c
+++ b/misc/base_device.c
@@ -147,8 +147,7 @@
 }
 
 #ifdef DEBUG
-
-main(int argc, char** argv)
+int main(int argc, char** argv)
 {
 	const char *base;
 	char  buf[256], *cp;
@@ -167,5 +166,4 @@
 	}
 	exit(0);
 }
-
 #endif
diff --git a/resize/ChangeLog b/resize/ChangeLog
index 1a0093a..2df7fb2 100644
--- a/resize/ChangeLog
+++ b/resize/ChangeLog
@@ -1,5 +1,9 @@
 2002-03-07  Theodore Tso  <tytso@mit.edu>
 
+	* resize2fs.c (process_block, inode_scan_and_fix, 
+		check_and_change_inodes): Fix gcc -Wall complaints in
+		debug code.
+
 	* Makefile.in (check): Use LD_LIBRARY_PATH to run test programs.
 		(From Philipp Thomas <pthomas@suse.de>)
 
diff --git a/resize/resize2fs.c b/resize/resize2fs.c
index 9f5f170..830347c 100644
--- a/resize/resize2fs.c
+++ b/resize/resize2fs.c
@@ -35,7 +35,7 @@
 
 #include "resize2fs.h"
 
-#ifdef linux			/* Kludge for debugging */
+#ifdef __linux__			/* Kludge for debugging */
 #define RESIZE2FS_DEBUG
 #endif
 
@@ -881,7 +881,7 @@
 			pb->changed = 1;
 #ifdef RESIZE2FS_DEBUG
 			if (pb->rfs->flags & RESIZE_DEBUG_BMOVE)
-				printf(_("ino=%ld, blockcnt=%ld, %u->%u\n"), 
+				printf(_("ino=%u, blockcnt=%lld, %u->%u\n"), 
 				       pb->ino, blockcnt, block, new_block);
 #endif
 			block = new_block;
@@ -1037,7 +1037,7 @@
 		
 #ifdef RESIZE2FS_DEBUG
 		if (rfs->flags & RESIZE_DEBUG_INODEMAP)
-			printf(_("Inode moved %ld->%ld\n"), ino, new_inode);
+			printf(_("Inode moved %u->%u\n"), ino, new_inode);
 #endif
 		if (!rfs->imap) {
 			retval = ext2fs_create_extent_table(&rfs->imap, 0);
@@ -1100,7 +1100,7 @@
 		return 0;
 #ifdef RESIZE2FS_DEBUG
 	if (is->rfs->flags & RESIZE_DEBUG_INODEMAP)
-		printf(_("Inode translate (dir=%ld, name=%.*s, %u->%ld)\n"),
+		printf(_("Inode translate (dir=%u, name=%.*s, %u->%u)\n"),
 		       dir, dirent->name_len, dirent->name,
 		       dirent->inode, new_inode);
 #endif