fix "variable 'foo' set but not used" warnings

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
diff --git a/archival/libarchive/bz/compress.c b/archival/libarchive/bz/compress.c
index 6f1c70a..f936717 100644
--- a/archival/libarchive/bz/compress.c
+++ b/archival/libarchive/bz/compress.c
@@ -251,7 +251,7 @@
 {
 	int32_t v, t, i, j, gs, ge, totc, bt, bc, iter;
 	int32_t nSelectors, alphaSize, minLen, maxLen, selCtr;
-	int32_t nGroups, nBytes;
+	int32_t nGroups;
 
 	/*
 	 * uint8_t len[BZ_N_GROUPS][BZ_MAX_ALPHA_SIZE];
@@ -512,7 +512,6 @@
 			}
 		}
 
-		nBytes = s->numZ;
 		bsW(s, 16, inUse16);
 
 		inUse16 <<= (sizeof(int)*8 - 16); /* move 15th bit into sign bit */
@@ -528,7 +527,6 @@
 	}
 
 	/*--- Now the selectors. ---*/
-	nBytes = s->numZ;
 	bsW(s, 3, nGroups);
 	bsW(s, 15, nSelectors);
 	for (i = 0; i < nSelectors; i++) {
@@ -538,8 +536,6 @@
 	}
 
 	/*--- Now the coding tables. ---*/
-	nBytes = s->numZ;
-
 	for (t = 0; t < nGroups; t++) {
 		int32_t curr = s->len[t][0];
 		bsW(s, 5, curr);
@@ -551,7 +547,6 @@
 	}
 
 	/*--- And finally, the block data proper ---*/
-	nBytes = s->numZ;
 	selCtr = 0;
 	gs = 0;
 	while (1) {
diff --git a/e2fsprogs/fsck.c b/e2fsprogs/fsck.c
index b4257a2..fcbdb59 100644
--- a/e2fsprogs/fsck.c
+++ b/e2fsprogs/fsck.c
@@ -317,7 +317,6 @@
 {
 	FILE *fstab;
 	struct mntent mte;
-	struct fs_info *fs;
 
 	fstab = setmntent(filename, "r");
 	if (!fstab) {
@@ -330,7 +329,7 @@
 		//bb_info_msg("CREATE[%s][%s][%s][%s][%d]", mte.mnt_fsname, mte.mnt_dir,
 		//	mte.mnt_type, mte.mnt_opts,
 		//	mte.mnt_passno);
-		fs = create_fs_device(mte.mnt_fsname, mte.mnt_dir,
+		create_fs_device(mte.mnt_fsname, mte.mnt_dir,
 			mte.mnt_type, mte.mnt_opts,
 			mte.mnt_passno);
 	}
diff --git a/editors/vi.c b/editors/vi.c
index fd8bd0f..638b3b7 100644
--- a/editors/vi.c
+++ b/editors/vi.c
@@ -536,7 +536,6 @@
 #define cur_line edit_file__cur_line
 #endif
 	int c;
-	int size;
 #if ENABLE_FEATURE_VI_USE_SIGNALS
 	int sig;
 #endif
@@ -545,7 +544,6 @@
 	rawmode();
 	rows = 24;
 	columns = 80;
-	size = 0;
 	IF_FEATURE_VI_ASK_TERMINAL(G.get_rowcol_error =) query_screen_dimensions();
 #if ENABLE_FEATURE_VI_ASK_TERMINAL
 	if (G.get_rowcol_error /* TODO? && no input on stdin */) {
diff --git a/libbb/dump.c b/libbb/dump.c
index 1b1d03a..919fe13 100644
--- a/libbb/dump.c
+++ b/libbb/dump.c
@@ -99,7 +99,7 @@
 static NOINLINE void rewrite(priv_dumper_t *dumper, FS *fs)
 {
 	enum { NOTOKAY, USEBCNT, USEPREC } sokay;
-	PR *pr, **nextpr = NULL;
+	PR *pr;
 	FU *fu;
 	char *p1, *p2, *p3;
 	char savech, *fmtp;
@@ -111,15 +111,12 @@
 		 * break each format unit into print units; each
 		 * conversion character gets its own.
 		 */
-		for (nconv = 0, fmtp = fu->fmt; *fmtp; nextpr = &pr->nextpr) {
+		for (nconv = 0, fmtp = fu->fmt; *fmtp; ) {
 			/* NOSTRICT */
 			/* DBU:[dvae@cray.com] zalloc so that forward ptrs start out NULL*/
 			pr = xzalloc(sizeof(PR));
 			if (!fu->nextpr)
 				fu->nextpr = pr;
-			/* ignore nextpr -- its unused inside the loop and is
-			 * uninitialized 1st time through.
-			 */
 
 			/* skip preceding text and up to the next % sign */
 			for (p1 = fmtp; *p1 && *p1 != '%'; ++p1)
diff --git a/miscutils/last_fancy.c b/miscutils/last_fancy.c
index 7e61b76..dc09b65 100644
--- a/miscutils/last_fancy.c
+++ b/miscutils/last_fancy.c
@@ -161,11 +161,10 @@
 	time_t boot_time;
 	time_t down_time;
 	int file;
-	unsigned opt;
 	smallint going_down;
 	smallint boot_down;
 
-	opt = getopt32(argv, "Wf:" /* "H" */, &filename);
+	/*opt =*/ getopt32(argv, "Wf:" /* "H" */, &filename);
 #ifdef BUT_UTIL_LINUX_LAST_HAS_NO_SUCH_OPT
 	if (opt & LAST_OPT_H) {
 		/* Print header line */
diff --git a/networking/ftpgetput.c b/networking/ftpgetput.c
index 66316e2..f63df55 100644
--- a/networking/ftpgetput.c
+++ b/networking/ftpgetput.c
@@ -60,7 +60,7 @@
 	FILE *control_stream;
 	int verbose_flag;
 	int do_continue;
-	char buf[1]; /* actually [BUFSZ] */
+	char buf[4]; /* actually [BUFSZ] */
 } FIX_ALIASING;
 #define G (*(struct globals*)&bb_common_bufsiz1)
 enum { BUFSZ = COMMON_BUFSIZE - offsetof(struct globals, buf) };
@@ -105,7 +105,7 @@
 	}
 
 	do {
-		strcpy(buf, "EOF");
+		strcpy(buf, "EOF"); /* for ftp_die */
 		if (fgets(buf, BUFSZ - 2, control_stream) == NULL) {
 			ftp_die(NULL);
 		}
@@ -316,7 +316,6 @@
 int ftpgetput_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
 int ftpgetput_main(int argc UNUSED_PARAM, char **argv)
 {
-	unsigned opt;
 	const char *port = "ftp";
 	/* socket to ftp server */
 
@@ -345,7 +344,7 @@
 	applet_long_options = ftpgetput_longopts;
 #endif
 	opt_complementary = "-2:vv:cc"; /* must have 2 to 3 params; -v and -c count */
-	opt = getopt32(argv, "cvu:p:P:", &user, &password, &port,
+	getopt32(argv, "cvu:p:P:", &user, &password, &port,
 					&verbose_flag, &do_continue);
 	argv += optind;
 
diff --git a/procps/powertop.c b/procps/powertop.c
index bfe5a95..008cdfc 100644
--- a/procps/powertop.c
+++ b/procps/powertop.c
@@ -393,11 +393,9 @@
 	char buf[128];
 	char line[15 + 3 + 128];
 	int n;
-	ullong totalticks;
 	FILE *fp;
 
 	buf[0] = '\0';
-	totalticks = 0;
 
 	n = 0;
 	fp = NULL;
diff --git a/runit/sv.c b/runit/sv.c
index 322688a..5b01c87 100644
--- a/runit/sv.c
+++ b/runit/sv.c
@@ -437,7 +437,6 @@
 int sv_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
 int sv_main(int argc UNUSED_PARAM, char **argv)
 {
-	unsigned opt;
 	char *x;
 	char *action;
 	const char *varservice = CONFIG_SV_DEFAULT_SERVICE_DIR;
@@ -458,7 +457,7 @@
 	if (x) waitsec = xatou(x);
 
 	opt_complementary = "w+:vv"; /* -w N, -v is a counter */
-	opt = getopt32(argv, "w:v", &waitsec, &verbose);
+	getopt32(argv, "w:v", &waitsec, &verbose);
 	argv += optind;
 	action = *argv++;
 	if (!action || !*argv) bb_show_usage();
diff --git a/shell/hush.c b/shell/hush.c
index 4c348ec..9cc86fa 100644
--- a/shell/hush.c
+++ b/shell/hush.c
@@ -4517,11 +4517,11 @@
 			break;
 #if ENABLE_HUSH_TICK
 		case '`': {
-			unsigned pos;
+			USE_FOR_NOMMU(unsigned pos;)
 
 			o_addchr(&dest, SPECIAL_VAR_SYMBOL);
 			o_addchr(&dest, '`');
-			pos = dest.length;
+			USE_FOR_NOMMU(pos = dest.length;)
 			if (!add_till_backquote(&dest, input, /*in_dquote:*/ 0))
 				goto parse_error;
 # if !BB_MMU