Browse Source

Fix many warnings.

git-svn-id: https://klish.googlecode.com/svn/trunk@287 0eaa4687-2ee9-07dd-09d9-bcdd2d2dd5fb
Serj Kalichev 13 years ago
parent
commit
1a9cf520ef

+ 30 - 0
LICENCE

@@ -107,6 +107,36 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
 
 <HR>
 <HR>
 
 
+\section _Serj_Kalichev Serj Kalichev
+The klish is the clish fork.
+
+Copyright ¿ 2010 Serj Kalichev.
+All Rights Reserved.
+
+Redistribution and use in source and binary forms, with or without modification,
+are permitted provided that the following conditions are met:
+
+1. Redistributions of source code must retain the above copyright notice,
+   this list of conditions and the following disclaimer.
+
+2. Redistributions in binary form must reproduce the above copyright notice,
+   this list of conditions and the following disclaimer in the documentation
+   and/or other materials provided with the distribution.
+
+3. The name of the author may not be used to endorse or promote products derived
+   from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
 \section _tinyxml Yves Berquin
 \section _tinyxml Yves Berquin
 As of release 0.6 the tinyxml library is included (unchanged) as part of the
 As of release 0.6 the tinyxml library is included (unchanged) as part of the
 distribution.
 distribution.

+ 2 - 2
Makefile.am

@@ -8,8 +8,8 @@ if DEBUG
   DEBUG_CFLAGS = -DDEBUG
   DEBUG_CFLAGS = -DDEBUG
 endif
 endif
 
 
-AM_CFLAGS               = -pedantic -Werror -Wall $(DEBUG_CFLAGS)
-AM_CXXFLAGS             = -Werror -Wall $(DEBUG_CFLAGS)
+AM_CFLAGS               = -pedantic -Wall $(DEBUG_CFLAGS)
+AM_CXXFLAGS             = -Wall $(DEBUG_CFLAGS)
 #AM_CFLAGS               = -ansi -pedantic -Werror -Wall -D_POSIX_C_SOURCE=199309 -DVERSION=$(VERSION) $(DEBUG_CFLAGS)
 #AM_CFLAGS               = -ansi -pedantic -Werror -Wall -D_POSIX_C_SOURCE=199309 -DVERSION=$(VERSION) $(DEBUG_CFLAGS)
 
 
 bin_PROGRAMS            =
 bin_PROGRAMS            =

+ 2 - 2
Makefile.in

@@ -678,8 +678,8 @@ AUTOMAKE_OPTIONS = foreign nostdinc
 AM_CPPFLAGS = -I. -I$(top_srcdir)
 AM_CPPFLAGS = -I. -I$(top_srcdir)
 AM_LD = $(CXX)
 AM_LD = $(CXX)
 @DEBUG_TRUE@DEBUG_CFLAGS = -DDEBUG
 @DEBUG_TRUE@DEBUG_CFLAGS = -DDEBUG
-AM_CFLAGS = -pedantic -Werror -Wall $(DEBUG_CFLAGS)
-AM_CXXFLAGS = -Werror -Wall $(DEBUG_CFLAGS)
+AM_CFLAGS = -pedantic -Wall $(DEBUG_CFLAGS)
+AM_CXXFLAGS = -Wall $(DEBUG_CFLAGS)
 lib_LTLIBRARIES = libclish.la liblub.la $(am__append_3) libtinyrl.la \
 lib_LTLIBRARIES = libclish.la liblub.la $(am__append_3) libtinyrl.la \
 	libtinyxml.la libkonf.la
 	libtinyxml.la libkonf.la
 lib_LIBRARIES = 
 lib_LIBRARIES = 

+ 1 - 1
clish/clish_config_callback.c

@@ -17,6 +17,7 @@
 #include "konf/net.h"
 #include "konf/net.h"
 #include "konf/buf.h"
 #include "konf/buf.h"
 #include "konf/query.h"
 #include "konf/query.h"
+#include "lub/string.h"
 #include "clish/variable.h"
 #include "clish/variable.h"
 
 
 static int send_request(konf_client_t * client, char *command);
 static int send_request(konf_client_t * client, char *command);
@@ -25,7 +26,6 @@ static int send_request(konf_client_t * client, char *command);
 bool_t clish_config_callback(const clish_shell_t * this,
 bool_t clish_config_callback(const clish_shell_t * this,
 	const clish_command_t * cmd, clish_pargv_t * pargv)
 	const clish_command_t * cmd, clish_pargv_t * pargv)
 {
 {
-	unsigned i;
 	char *command = NULL;
 	char *command = NULL;
 	konf_client_t *client;
 	konf_client_t *client;
 	konf_buf_t *buf = NULL;
 	konf_buf_t *buf = NULL;

+ 1 - 1
clish/clish_script_callback.c

@@ -16,6 +16,7 @@
 #include <sys/stat.h>
 #include <sys/stat.h>
 #include <fcntl.h>
 #include <fcntl.h>
 
 
+#include "lub/string.h"
 #include "konf/buf.h"
 #include "konf/buf.h"
 #include "private.h"
 #include "private.h"
 
 
@@ -75,7 +76,6 @@ bool_t clish_script_callback(clish_shell_t * this,
 
 
 		/* Child: write to FIFO */
 		/* Child: write to FIFO */
 		if (cpid == 0) {
 		if (cpid == 0) {
-			int retval;
 			wpipe = fopen(fifo_name, "w");
 			wpipe = fopen(fifo_name, "w");
 			if (!wpipe)
 			if (!wpipe)
 				_exit(-1);
 				_exit(-1);

+ 0 - 3
clish/command/command.c

@@ -56,8 +56,6 @@ clish_command_init(clish_command_t * this, const char *name, const char *text)
 /*--------------------------------------------------------- */
 /*--------------------------------------------------------- */
 static void clish_command_fini(clish_command_t * this)
 static void clish_command_fini(clish_command_t * this)
 {
 {
-	unsigned i;
-
 	lub_string_free(this->name);
 	lub_string_free(this->name);
 	this->name = NULL;
 	this->name = NULL;
 
 
@@ -179,7 +177,6 @@ void clish_command_help(const clish_command_t * this, const char * viewid,
 {
 {
 	const char *name = clish_command__get_name(this);
 	const char *name = clish_command__get_name(this);
 	unsigned index = lub_argv_wordcount(line);
 	unsigned index = lub_argv_wordcount(line);
-	const clish_param_t *param;
 	unsigned idx = lub_argv_wordcount(name);
 	unsigned idx = lub_argv_wordcount(name);
 	lub_argv_t *argv;
 	lub_argv_t *argv;
 	clish_pargv_t *last, *pargv;
 	clish_pargv_t *last, *pargv;

+ 3 - 2
clish/nspace/nspace.c

@@ -76,7 +76,6 @@ static clish_command_t *clish_nspace_find_create_command(clish_nspace_t * this,
 	clish_command_t *cmd;
 	clish_command_t *cmd;
 	char *name = NULL;
 	char *name = NULL;
 	clish_command_t *tmp = NULL;
 	clish_command_t *tmp = NULL;
-	lub_bintree_iterator_t iter;
 	const char *str = NULL;
 	const char *str = NULL;
 
 
 	assert(prefix);
 	assert(prefix);
@@ -92,7 +91,7 @@ static clish_command_t *clish_nspace_find_create_command(clish_nspace_t * this,
 	}
 	}
 
 
 	/* The command is cached already */
 	/* The command is cached already */
-	if (cmd = lub_bintree_find(&this->tree, name)) {
+	if ((cmd = lub_bintree_find(&this->tree, name))) {
 		free(name);
 		free(name);
 		return cmd;
 		return cmd;
 	}
 	}
@@ -352,6 +351,8 @@ clish_nspace__get_visibility(const clish_nspace_t * instance,
 	case CLISH_NSPACE_CHELP:
 	case CLISH_NSPACE_CHELP:
 		result = clish_nspace__get_context_help(instance);
 		result = clish_nspace__get_context_help(instance);
 		break;
 		break;
+	default:
+		break;
 	}
 	}
 
 
 	return result;
 	return result;

+ 0 - 2
clish/nspace/nspace_dump.c

@@ -7,8 +7,6 @@
 /*--------------------------------------------------------- */
 /*--------------------------------------------------------- */
 void clish_nspace_dump(const clish_nspace_t * this)
 void clish_nspace_dump(const clish_nspace_t * this)
 {
 {
-	unsigned i;
-
 	lub_dump_printf("nspace(%p)\n", this);
 	lub_dump_printf("nspace(%p)\n", this);
 
 
 	lub_dump_indent();
 	lub_dump_indent();

+ 0 - 2
clish/param/param.c

@@ -38,8 +38,6 @@ clish_param_init(clish_param_t * this,
 /*--------------------------------------------------------- */
 /*--------------------------------------------------------- */
 static void clish_param_fini(clish_param_t * this)
 static void clish_param_fini(clish_param_t * this)
 {
 {
-	unsigned i;
-
 	/* deallocate the memory for this instance */
 	/* deallocate the memory for this instance */
 	lub_string_free(this->defval);
 	lub_string_free(this->defval);
 	this->defval = NULL;
 	this->defval = NULL;

+ 4 - 4
clish/pargv/pargv.c

@@ -67,6 +67,7 @@ int clish_pargv_insert(clish_pargv_t * this,
 	return 0;
 	return 0;
 }
 }
 
 
+#if 0
 /*--------------------------------------------------------- */
 /*--------------------------------------------------------- */
 static void set_defaults(clish_pargv_t * this, const clish_command_t * cmd)
 static void set_defaults(clish_pargv_t * this, const clish_command_t * cmd)
 {
 {
@@ -92,6 +93,7 @@ static void set_defaults(clish_pargv_t * this, const clish_command_t * cmd)
 		}
 		}
 	}
 	}
 }
 }
+#endif
 
 
 /*--------------------------------------------------------- */
 /*--------------------------------------------------------- */
 clish_pargv_status_t
 clish_pargv_status_t
@@ -102,7 +104,6 @@ clish_pargv_parse(clish_pargv_t * this,
 	const lub_argv_t * argv,
 	const lub_argv_t * argv,
 	unsigned *idx, clish_pargv_t * last, unsigned need_index)
 	unsigned *idx, clish_pargv_t * last, unsigned need_index)
 {
 {
-	unsigned start = *idx;
 	unsigned argc = lub_argv__get_count(argv);
 	unsigned argc = lub_argv__get_count(argv);
 	unsigned index = 0;
 	unsigned index = 0;
 	unsigned nopt_index = 0;
 	unsigned nopt_index = 0;
@@ -151,7 +152,6 @@ clish_pargv_parse(clish_pargv_t * this,
 		if (last && (*idx == need_index) &&
 		if (last && (*idx == need_index) &&
 			(NULL == clish_pargv_find_arg(this, clish_param__get_name(param)))) {
 			(NULL == clish_pargv_find_arg(this, clish_param__get_name(param)))) {
 			if (is_switch) {
 			if (is_switch) {
-				clish_paramv_t *rec_paramv = clish_param__get_paramv(param);
 				unsigned rec_paramc = clish_param__get_param_count(param);
 				unsigned rec_paramc = clish_param__get_param_count(param);
 				for (i = 0; i < rec_paramc; i++) {
 				for (i = 0; i < rec_paramc; i++) {
 					cparam = clish_param__get_param(param, i);
 					cparam = clish_param__get_param(param, i);
@@ -212,10 +212,10 @@ clish_pargv_parse(clish_pargv_t * this,
 					    clish_param__get_param(param, i);
 					    clish_param__get_param(param, i);
 					if (!cparam)
 					if (!cparam)
 						break;
 						break;
-					if (validated =
+					if ((validated =
 					    arg ? clish_param_validate(cparam,
 					    arg ? clish_param_validate(cparam,
 								       arg) :
 								       arg) :
-					    NULL) {
+					    NULL)) {
 						rec_paramv =
 						rec_paramv =
 						    clish_param__get_paramv
 						    clish_param__get_paramv
 						    (cparam);
 						    (cparam);

+ 4 - 4
clish/ptype/ptype.c

@@ -284,7 +284,7 @@ static char *clish_ptype_validate_or_translate(const clish_ptype_t * this,
 	/*----------------------------------------- */
 	/*----------------------------------------- */
 	case CLISH_PTYPE_TOUPPER:
 	case CLISH_PTYPE_TOUPPER:
 		{
 		{
-			unsigned char *p = result;
+			char *p = result;
 			while (*p) {
 			while (*p) {
 				/*lint -e155 Ignoring { }'ed sequence within an expression, 0 assumed 
 				/*lint -e155 Ignoring { }'ed sequence within an expression, 0 assumed 
 				 * MACRO implementation uses braces to prevent multiple increments
 				 * MACRO implementation uses braces to prevent multiple increments
@@ -298,7 +298,7 @@ static char *clish_ptype_validate_or_translate(const clish_ptype_t * this,
 	/*----------------------------------------- */
 	/*----------------------------------------- */
 	case CLISH_PTYPE_TOLOWER:
 	case CLISH_PTYPE_TOLOWER:
 		{
 		{
-			unsigned char *p = result;
+			char *p = result;
 			while (*p) {
 			while (*p) {
 				*p = lub_ctype_tolower(*p);
 				*p = lub_ctype_tolower(*p);
 				p++;
 				p++;
@@ -393,9 +393,9 @@ static char *clish_ptype_validate_or_translate(const clish_ptype_t * this,
 			for (i = 0;
 			for (i = 0;
 			     i < lub_argv__get_count(this->u.select.items);
 			     i < lub_argv__get_count(this->u.select.items);
 			     i++) {
 			     i++) {
-				unsigned char *name =
+				char *name =
 				    clish_ptype_select__get_name(this, i);
 				    clish_ptype_select__get_name(this, i);
-				unsigned char *value =
+				char *value =
 				    clish_ptype_select__get_value(this, i);
 				    clish_ptype_select__get_value(this, i);
 				int tmp = lub_string_nocasecmp(result, name);
 				int tmp = lub_string_nocasecmp(result, name);
 				lub_string_free((BOOL_TRUE ==
 				lub_string_free((BOOL_TRUE ==

+ 2 - 7
clish/shell/shell_command_generator.c

@@ -22,10 +22,6 @@ const clish_command_t *clish_shell_find_next_completion(const clish_shell_t *
 							iter)
 							iter)
 {
 {
 	const clish_command_t *result, *cmd;
 	const clish_command_t *result, *cmd;
-	clish_nspace_t *nspace;
-	clish_view_t *view;
-	unsigned view_cnt = clish_view__get_nspace_count(this->view);
-	int i;
 
 
 	/* ask the local view for next command */
 	/* ask the local view for next command */
 	result = clish_view_find_next_completion(this->view,
 	result = clish_view_find_next_completion(this->view,
@@ -67,8 +63,7 @@ static char *clish_shell_param_generator(clish_shell_t * this,
 		if (0 == state) {
 		if (0 == state) {
 			lub_argv_t *argv;
 			lub_argv_t *argv;
 			clish_pargv_t *pargv;
 			clish_pargv_t *pargv;
-			unsigned i;
-			
+
 			if ((0 != index) && (text[0] != '\0')) {
 			if ((0 != index) && (text[0] != '\0')) {
 				/* if there is some text for the parameter then adjust the index */
 				/* if there is some text for the parameter then adjust the index */
 				index--;
 				index--;
@@ -105,7 +100,7 @@ static char *clish_shell_param_generator(clish_shell_t * this,
 				result = NULL;
 				result = NULL;
 			} else {
 			} else {
 				/* The common param. Let ptype do the work */
 				/* The common param. Let ptype do the work */
-				if (ptype = clish_param__get_ptype(param)) {
+				if ((ptype = clish_param__get_ptype(param))) {
 					result = clish_ptype_word_generator(ptype, text, 
 					result = clish_ptype_word_generator(ptype, text, 
 						this->context.completion_pindex++);
 						this->context.completion_pindex++);
 					if (!result)
 					if (!result)

+ 4 - 1
clish/shell/shell_delete.c

@@ -1,10 +1,13 @@
 /*
 /*
  * shell_delete.c
  * shell_delete.c
  */
  */
+
+#include <stdlib.h>
+#include <unistd.h>
+
 #include "private.h"
 #include "private.h"
 #include "lub/string.h"
 #include "lub/string.h"
 
 
-#include <stdlib.h>
 /*--------------------------------------------------------- */
 /*--------------------------------------------------------- */
 static void clish_shell_fini(clish_shell_t * this)
 static void clish_shell_fini(clish_shell_t * this)
 {
 {

+ 0 - 1
clish/shell/shell_execute.c

@@ -63,7 +63,6 @@ clish_source_internal(const clish_shell_t * shell,
 	bool_t result = BOOL_FALSE;
 	bool_t result = BOOL_FALSE;
 	const char *filename = lub_argv__get_arg(argv, 0);
 	const char *filename = lub_argv__get_arg(argv, 0);
 	struct stat fileStat;
 	struct stat fileStat;
-	FILE *file;
 
 
 	/* the exception proves the rule... */
 	/* the exception proves the rule... */
 	clish_shell_t *this = (clish_shell_t *) shell;
 	clish_shell_t *this = (clish_shell_t *) shell;

+ 1 - 1
clish/shell/shell_tinyrl.c

@@ -113,7 +113,7 @@ static clish_pargv_status_t clish_shell_tinyrl_expand(tinyrl_t * this)
  */
  */
 static tinyrl_match_e clish_shell_tinyrl_complete(tinyrl_t * this)
 static tinyrl_match_e clish_shell_tinyrl_complete(tinyrl_t * this)
 {
 {
-	context_t *context = tinyrl__get_context(this);
+//	context_t *context = tinyrl__get_context(this);
 	tinyrl_match_e status;
 	tinyrl_match_e status;
 
 
 	/* first of all perform any history expansion */
 	/* first of all perform any history expansion */

+ 0 - 4
clish/variable/variable_expand.c

@@ -58,10 +58,6 @@ static char *find_viewid_var(const char *viewid, const char *name)
 static char *find_context_var(const context_t * this, const char *name)
 static char *find_context_var(const context_t * this, const char *name)
 {
 {
 	char *result = NULL;
 	char *result = NULL;
-	regex_t regex;
-	int status;
-	char *pattern = NULL;
-	regmatch_t pmatches[2];
 
 
 	if (!this->cmd)
 	if (!this->cmd)
 		return NULL;
 		return NULL;

+ 0 - 2
clish/view/view.c

@@ -211,7 +211,6 @@ clish_command_t *clish_view_find_command(clish_view_t * this, const char *name,
 {
 {
 	clish_command_t *cmd, *result;
 	clish_command_t *cmd, *result;
 	clish_nspace_t *nspace;
 	clish_nspace_t *nspace;
-	clish_view_t *view;
 	unsigned cnt = clish_view__get_nspace_count(this);
 	unsigned cnt = clish_view__get_nspace_count(this);
 	int i;
 	int i;
 
 
@@ -274,7 +273,6 @@ const clish_command_t *clish_view_find_next_completion(clish_view_t * this,
 {
 {
 	const clish_command_t *result, *cmd;
 	const clish_command_t *result, *cmd;
 	clish_nspace_t *nspace;
 	clish_nspace_t *nspace;
-	clish_view_t *view;
 	unsigned cnt = clish_view__get_nspace_count(this);
 	unsigned cnt = clish_view__get_nspace_count(this);
 	int i;
 	int i;
 
 

+ 1 - 1
configure

@@ -15186,7 +15186,7 @@ fi
 
 
 done
 done
 
 
-    if test x$TCL_LIBS != x; then
+    if test "x$TCL_LIBS" != "x"; then
 
 
 $as_echo "#define HAVE_LIBTCL /**/" >>confdefs.h
 $as_echo "#define HAVE_LIBTCL /**/" >>confdefs.h
 
 

+ 1 - 1
configure.ac

@@ -167,7 +167,7 @@ if test -e $TCL_CONFIG; then
                       fi
                       fi
                      ])
                      ])
         )
         )
-    if test x$TCL_LIBS != x; then
+    if test "x$TCL_LIBS" != "x"; then
             AC_DEFINE([HAVE_LIBTCL], [], [Have TCL library])
             AC_DEFINE([HAVE_LIBTCL], [], [Have TCL library])
             AC_SUBST(TCL_CFLAGS)
             AC_SUBST(TCL_CFLAGS)
             AC_SUBST(TCL_LIBS)
             AC_SUBST(TCL_LIBS)