sbsv2/raptor/util/talon/talon.c
branchfix
changeset 283 a5284ec02d61
parent 282 99ac65572b14
child 285 1cdb9a551505
equal deleted inserted replaced
282:99ac65572b14 283:a5284ec02d61
   135 			do {
   135 			do {
   136 				envvarname[e++] = *att;
   136 				envvarname[e++] = *att;
   137 				att++;
   137 				att++;
   138 			} while ( e < (VARNAMEMAX-1) && (isalnum(*att) || *att == '_'));
   138 			} while ( e < (VARNAMEMAX-1) && (isalnum(*att) || *att == '_'));
   139 			envvarname[e] = '\0';
   139 			envvarname[e] = '\0';
   140 /* DEBUG(("envvarname: %s\n", envvarname)); */
   140 			/* DEBUG(("envvarname: %s\n", envvarname));*/ 
   141 			v = talon_getenv(envvarname);
   141 			v = talon_getenv(envvarname);
   142 			if (v)
   142 			if (v)
   143 			{
   143 			{
   144 				/* DEBUG(("     value: %s\n", v)); */
   144 				/* DEBUG(("     value: %s\n", v)); */
   145 				char *oldv=v;
   145 				char *oldv=v;
   342 	/* remove any leading white space on the recipe */
   342 	/* remove any leading white space on the recipe */
   343 	while (isspace(*recipe))
   343 	while (isspace(*recipe))
   344 		recipe++;
   344 		recipe++;
   345 
   345 
   346 
   346 
       
   347 
       
   348 
       
   349 	/* turn debugging on? */
       
   350 	char *debugstr=talon_getenv("TALON_DEBUG");
       
   351 
       
   352 	if (debugstr)
       
   353 	{
       
   354 		loglevel=LOGDEBUG;
       
   355 		free(debugstr); debugstr=NULL;
       
   356 	}
       
   357 
       
   358 	DEBUG(("talon: recipe: %s\n", recipe));
       
   359 
   347 	/* Make sure that the agent's hostname can be put into the host attribute */
   360 	/* Make sure that the agent's hostname can be put into the host attribute */
   348 	char hostname[HOSTNAME_MAX];
   361 	char hostname[HOSTNAME_MAX];
   349 
   362 	int hostresult=0;
   350 	if (0 != gethostname(hostname, HOSTNAME_MAX-1))
   363 
   351 	{
   364 	
       
   365 	hostresult = gethostname(hostname, HOSTNAME_MAX-1);
       
   366 	if (0 != hostresult)
       
   367 	{
       
   368 		DEBUG(("talon: failed to get hostname: %d\n", hostresult));
   352 		hostname[0] = '\0';
   369 		hostname[0] = '\0';
   353 	}
   370 	}
   354 
   371 
   355 	talon_setenv("HOSTNAME", hostname);
   372 	talon_setenv("HOSTNAME", hostname);
   356 
   373 	DEBUG(("talon: setenv: hostname: %s\n", hostname));
   357 
       
   358 	/* turn debugging on? */
       
   359 	char *debugstr=talon_getenv("TALON_DEBUG");
       
   360 
       
   361 	if (debugstr)
       
   362 	{
       
   363 		loglevel=LOGDEBUG;
       
   364 		free(debugstr); debugstr=NULL;
       
   365 	}
       
   366 
       
   367 	DEBUG(("talon: recipe: %s\n", recipe));
       
   368 
   374 
   369 	
   375 	
   370 	char varname[VARNAMEMAX];
   376 	char varname[VARNAMEMAX];
   371 	char varval[VARVALMAX];
   377 	char varval[VARVALMAX];
   372 	int dotagging = 0; 
   378 	int dotagging = 0;