示例#1
0
cmdLine *parseCmdLines(const char *strLine)
{
	char* line, *ampersand;
	cmdLine *head, *last;
	int idx = 0;
	
	if (isEmpty(strLine))
	  return NULL;
	
	line = strClone(strLine);
	if (line[strlen(line)-1] == '\n')
	  line[strlen(line)-1] = 0;
	
	ampersand = strchr( line,  '&');
	if (ampersand)
	  *(ampersand) = 0;
		
	if ( (last = head = _parseCmdLines(line)) )
	{	
	  while (last->next)
	    last = last->next;
	  last->blocking = ampersand? 0:1;
	}
	
	for (last = head; last; last = last->next)
		last->idx = idx++;
			
	FREE(line);
	return head;
}
示例#2
0
int replaceCmdArg(cmdLine *pCmdLine, int num, const char *newString)
{
  if (num >= pCmdLine->argCount)
    return 0;
  
  FREE(pCmdLine->arguments[num]);
  ((char**)pCmdLine->arguments)[num] = strClone(newString);
  return 1;
}
示例#3
0
static cmdLine *parseSingleCmdLine(const char *strLine)
{
    char *delimiter = " ";
    char *line, *result;
    
    if (isEmpty(strLine))
      return NULL;
    
    cmdLine* pCmdLine = (cmdLine*)malloc( sizeof(cmdLine) ) ;
    memset(pCmdLine, 0, sizeof(cmdLine));
    
    line = strClone(strLine);
         
    extractRedirections(line, pCmdLine);
    
    result = strtok( line, delimiter);    
    while( result && pCmdLine->argCount < MAX_ARGUMENTS-1) {
        ((char**)pCmdLine->arguments)[pCmdLine->argCount++] = strClone(result);
        result = strtok ( NULL, delimiter);
    }

    FREE(line);
    return pCmdLine;
}
示例#4
0
文件: Bone.cpp 项目: tgandrew/SKA
Bone::Bone(int _id, Skeleton* skeleton_description)
	: id(_id), 
	name(NULL), length(1.0f), direction(0.0f,0.0f,1.0f), axis(0.0f,0.0f,1.0f),
	children(NULL), num_children(0), max_children(10)
{
	name = strClone("UNNAMED");
	axis_order[0] = CT_TX;
	axis_order[1] = CT_TY;
	axis_order[2] = CT_TZ;
	channel_order[0] = CT_INVALID;
	channel_order[1] = CT_INVALID;
	channel_order[2] = CT_INVALID;
	channel_order[3] = CT_INVALID;
	channel_order[4] = CT_INVALID;
	channel_order[5] = CT_INVALID;
	children = new Bone*[max_children];
	skeleton = skeleton_description;
	bone_object = NULL; 
	base_box = NULL;
	tip_box = NULL;
	parent = NULL; 
	bone_data_initialized=false; 
}