[Tux4kids-commits] r52 - in tuxmath/trunk: . src

dbruce at alioth.debian.org dbruce at alioth.debian.org
Thu Mar 8 21:19:41 CET 2007


Author: dbruce
Date: 2006-10-17 15:01:07 +0000 (Tue, 17 Oct 2006)
New Revision: 52

Modified:
   tuxmath/trunk/Makefile.am
   tuxmath/trunk/src/fileops.c
Log:
fixed syntax error in Makefile.am


Modified: tuxmath/trunk/Makefile.am
===================================================================
--- tuxmath/trunk/Makefile.am	2006-10-14 02:03:56 UTC (rev 51)
+++ tuxmath/trunk/Makefile.am	2006-10-17 15:01:07 UTC (rev 52)
@@ -37,14 +37,14 @@
 	@$(NORMAL_INSTALL)
 	if test -d $(srcdir)/$(PACKAGE_DATA_DIR); then \
 	  $(mkinstalldirs) $(DESTDIR)/$(pkgdatadir); \
-	  cd $(srcdir)/$(PACKAGE_DATA_DIR) ; tar cf -  --exclude "Makefile.in" --exclude "*.in" --exclude "*~" --exclude \ "Makefile" --exclude "Makefile.am" --exclude CVS --exclude .xvpics --exclude "1[1-9].ogg"  --exclude "2?.ogg" * \
-          --exclude "*.svn*" | ( cd $(DESTDIR)/$(pkgdatadir) ; tar xf -) ; cd .. ; \
+	  cd $(srcdir)/$(PACKAGE_DATA_DIR) ; tar cf -  --exclude "Makefile.in" --exclude "*.in" --exclude "*~" --exclude \ "Makefile" --exclude "Makefile.am" --exclude CVS --exclude .xvpics --exclude "1[1-9].ogg"  --exclude "2?.ogg" --exclude "*.svn*" * \
+           | ( cd $(DESTDIR)/$(pkgdatadir) ; tar xf -) ; cd .. ; \
 	fi
 
 install-nsi-local: all
 	$(INSTALL) -d $(top_srcdir)/$(NSI_INSTALL_DIR)/$(PACKAGE_DATA_DIR);
-	(cd $(top_srcdir)/$(PACKAGE_DATA_DIR) ; tar cf -  --exclude "Makefile.in" --exclude "*.in" --exclude "*~" --exclude \ "Makefile" --exclude "Makefile.am" --exclude CVS --exclude .xvpics --exclude "1[1-9].ogg"  --exclude "2?.ogg" * ) \
-        --exclude "*.svn*" | ( cd $(top_srcdir)/$(NSI_INSTALL_DIR)/$(PACKAGE_DATA_DIR) ; tar xf -) ; cd .. ; \
+	(cd $(top_srcdir)/$(PACKAGE_DATA_DIR) ; tar cf -  --exclude "Makefile.in" --exclude "*.in" --exclude "*~" --exclude \ "Makefile" --exclude "Makefile.am" --exclude CVS --exclude .xvpics --exclude "1[1-9].ogg"  --exclude "2?.ogg" --exclude "*.svn*" * ) \
+         | ( cd $(top_srcdir)/$(NSI_INSTALL_DIR)/$(PACKAGE_DATA_DIR) ; tar xf -) ; cd .. ; \
 	cp $(NSI_DLL_DIR)/*.dll $(top_srcdir)/$(NSI_INSTALL_DIR)
 
 install-nsi-am: install-nsi-local

Modified: tuxmath/trunk/src/fileops.c
===================================================================
--- tuxmath/trunk/src/fileops.c	2006-10-14 02:03:56 UTC (rev 51)
+++ tuxmath/trunk/src/fileops.c	2006-10-17 15:01:07 UTC (rev 52)
@@ -424,7 +424,6 @@
   char buf[PATH_MAX];
   char *parameter, *param_begin, *param_end, *value, *value_end;
 
-  parameter = malloc(sizeof(char) * PATH_MAX);
 
   #ifdef TUXMATH_DEBUG
   printf("\nEntering read_config_file()\n");
@@ -486,10 +485,14 @@
     }
 
     /* copy chars from start of non-whitespace up to '=': */
-//    parameter = strndup(param_begin, (param_end - param_begin));
+    //parameter = strndup(param_begin, (param_end - param_begin));
 
+    /* Next three lines do same as strndup(), which may not be available: */
+    parameter = malloc((sizeof(char) * (param_end - param_begin)) + 1);
     strncpy(parameter, param_begin, (param_end - param_begin));
-    /* Now get value string: */
+    parameter[param_end - param_begin] = '\0';
+ 
+   /* Now get value string: */
     /* set value to first '=' in line: */
     value = strchr(buf, '=');
 
@@ -523,11 +526,12 @@
     /* terminate string here: */
     *value_end = 0;
 
+    #define TUXMATH_DEBUG
     #ifdef TUXMATH_DEBUG
     printf("parameter = '%s'\t, length = %d\n", parameter, strlen(parameter));
     printf("value = '%s'\t, length = %d\t, atoi() = %d\n", value, strlen(value), atoi(value));
     #endif
-
+    #undef TUXMATH_DEBUG
     /* Now ready to handle each name/value pair! */
 
     /* Set general game_options struct (see tuxmath.h): */ 
@@ -986,9 +990,9 @@
       printf("parameter not recognized: %s\n", parameter);
       #endif    
     }
+    free(parameter);
+  }
 
-  }
-  free(parameter);
   #ifdef TUXMATH_DEBUG
   printf("\nAfter file read in:\n");
   print_game_options(stdout, 0);




More information about the Tux4kids-commits mailing list