cvs commit: ALFS/nALFS/src/handlers conditionals.c

kpfleming at linuxfromscratch.org kpfleming at linuxfromscratch.org
Fri Feb 6 20:24:22 PST 2004


kpfleming    04/02/06 21:24:22

  Modified:    nALFS/src/handlers conditionals.c
  Log:
  fix bug in do_shelltest when execute_command returns failure
  inplement syntax version 3.1 <if> with "test" attribute
  
  Revision  Changes    Path
  1.2       +26 -2     ALFS/nALFS/src/handlers/conditionals.c
  
  Index: conditionals.c
  ===================================================================
  RCS file: /home/cvsroot/ALFS/nALFS/src/handlers/conditionals.c,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- conditionals.c	6 Feb 2004 05:54:36 -0000	1.1
  +++ conditionals.c	7 Feb 2004 04:24:22 -0000	1.2
  @@ -73,7 +73,7 @@
   			*result = (status == 0) ? 1 : 0;
   			status = 0;
   		} else
  -			status -1;
  +			status = -1;
   	}
   
   	return status;
  @@ -85,7 +85,31 @@
   
   static int if_main_3_1(element_s *element)
   {
  -	return -1;
  +	char *shelltest;
  +	char *packagetest;
  +	int test_result = 1;
  +	handler_type_e result_handler_type = HTYPE_TRUE_RESULT;
  +	int status;
  +
  +	shelltest = attr_value("test", element);
  +	packagetest = attr_value("package", element);
  +	if (shelltest && packagetest) {
  +		Nprint_h_err("Cannot specify both \"test\" and \"package\".");
  +		return -1;
  +	}
  +	if (!shelltest && !packagetest) {
  +		Nprint_h_err("Must specify either \"test\" or \"package\".");
  +		return -1;
  +	}
  +	if (shelltest) {
  +		if ((status = do_shelltest(shelltest, &test_result)))
  +			return status;
  +	} else {
  +	}
  +	if (!test_result)
  +		result_handler_type = HTYPE_FALSE_RESULT;
  +
  +	return execute_children_filtered(element, result_handler_type);
   }
   #endif
   
  
  
  



More information about the alfs-log mailing list