Hi,

Here is a patch, which modifies the code for the menu of jhalfs,
and avoids warnings when compiling.

Tested (no big changes, and actually cleaner code, I think).

Regards,
Pierre

Index: jhalfs-trunk/menu/conf.c
===================================================================
--- jhalfs-trunk.orig/menu/conf.c	2012-02-09 11:41:15.038137507 +0100
+++ jhalfs-trunk/menu/conf.c	2012-02-09 16:59:46.927062468 +0100
@@ -179,7 +179,7 @@
 				help = nohelp_text;
 				if (menu->sym->help)
 					help = menu->sym->help;
-				printf("\n%s\n", menu->sym->help);
+				printf("\n%s\n", help);
 				def = NULL;
 				break;
 			}
@@ -195,7 +195,6 @@
 static int conf_sym(struct menu *menu)
 {
 	struct symbol *sym = menu->sym;
-	int type;
 	tristate oldval, newval;
 	const char *help;
 
@@ -203,7 +202,7 @@
 		printf("%*s%s ", indent - 1, "", menu->prompt->text);
 		if (sym->name)
 			printf("(%s) ", sym->name);
-		type = sym_get_type(sym);
+		(void)sym_get_type(sym);
 		putchar('[');
 		oldval = sym_get_tristate_value(sym);
 		switch (oldval) {
@@ -270,11 +269,10 @@
 {
 	struct symbol *sym, *def_sym;
 	struct menu *child;
-	int type;
 	bool is_new;
 
 	sym = menu->sym;
-	type = sym_get_type(sym);
+	(void)sym_get_type(sym);
 	is_new = !sym_has_value(sym);
 	if (sym_is_changable(sym)) {
 		conf_sym(menu);
Index: jhalfs-trunk/menu/lex.zconf.c_shipped
===================================================================
--- jhalfs-trunk.orig/menu/lex.zconf.c_shipped	2012-02-09 11:41:15.038137507 +0100
+++ jhalfs-trunk/menu/lex.zconf.c_shipped	2012-02-09 16:57:10.783054911 +0100
@@ -3,6 +3,10 @@
 
 #define  YY_INT_ALIGNED short int
 
+/* Define this so that no warnings are issued during
+   compilation of jhalfs */
+#define YY_NO_INPUT 1
+
 /* A lexical scanner generated by flex */
 
 #define FLEX_SCANNER
Index: jhalfs-trunk/menu/lxdialog/dialog.h
===================================================================
--- jhalfs-trunk.orig/menu/lxdialog/dialog.h	2012-02-09 11:41:15.030137505 +0100
+++ jhalfs-trunk/menu/lxdialog/dialog.h	2012-02-09 16:52:28.695041259 +0100
@@ -174,7 +174,7 @@
 int dialog_checklist (const char *title, const char *prompt, int height,
 		int width, int list_height, int item_no,
 		struct dialog_list_item ** items, int flag);
-extern unsigned char dialog_input_result[];
+extern char dialog_input_result[];
 int dialog_inputbox (const char *title, const char *prompt, int height,
 		int width, const char *init);
 
Index: jhalfs-trunk/menu/lxdialog/inputbox.c
===================================================================
--- jhalfs-trunk.orig/menu/lxdialog/inputbox.c	2012-02-09 11:41:15.030137505 +0100
+++ jhalfs-trunk/menu/lxdialog/inputbox.c	2012-02-09 16:53:17.631043628 +0100
@@ -21,7 +21,7 @@
 
 #include "dialog.h"
 
-unsigned char dialog_input_result[MAX_LEN + 1];
+char dialog_input_result[MAX_LEN + 1];
 
 /*
  *  Print the termination buttons
@@ -48,7 +48,7 @@
 {
     int i, x, y, box_y, box_x, box_width;
     int input_x = 0, scroll = 0, key = 0, button = -1;
-    unsigned char *instr = dialog_input_result;
+    char *instr = dialog_input_result;
     WINDOW *dialog;
 
     /* center dialog box on screen */
Index: jhalfs-trunk/menu/lxdialog/textbox.c
===================================================================
--- jhalfs-trunk.orig/menu/lxdialog/textbox.c	2012-02-09 11:41:15.030137505 +0100
+++ jhalfs-trunk/menu/lxdialog/textbox.c	2012-02-09 16:55:03.543048753 +0100
@@ -39,11 +39,8 @@
 {
     int i, x, y, cur_x, cur_y, fpos, key = 0;
     int passed_end;
-    char search_term[MAX_LEN + 1];
     WINDOW *dialog, *text;
 
-    search_term[0] = '\0';	/* no search term entered yet */
-
     /* Open input file for reading */
     if ((fd = open (file, O_RDONLY)) == -1) {
 	endwin ();
@@ -459,7 +456,6 @@
 static void
 print_line (WINDOW * win, int row, int width)
 {
-    int y, x;
     char *line;
 
     line = get_line ();
@@ -468,11 +464,12 @@
     waddch (win, ' ');
     waddnstr (win, line, MIN (strlen (line), width - 2));
 
-    getyx (win, y, x);
     /* Clear 'residue' of previous line */
 #if OLD_NCURSES
     {
+        int y, x;
 	int i;
+        getyx (win, y, x);
 	for (i = 0; i < width - x; i++)
 	    waddch (win, ' ');
     }
-- 
http://linuxfromscratch.org/mailman/listinfo/alfs-discuss
FAQ: http://www.linuxfromscratch.org/faq/
Unsubscribe: See the above information page

Reply via email to