Esempio n. 1
0
pwr_tStatus
proc_Start (
  proc_sProcess *p
)
{
  pwr_tStatus sts;
  char *fmt;
  char nameb[40];
  char buf[512];
  int flags;
  $DESCRIPTOR(com,"");
  $DESCRIPTOR(name,"");

  cdh_ToUpper(nameb, p->name);
  name.dsc$w_length = strlen(nameb);
  name.dsc$a_pointer = nameb;

  if (p->flags.b.user)
    fmt = "@pwr_exe:pwrp_run %s \"%s\" %d %d \"%s\"";
  else
    fmt = "@pwr_exe:pwr_run %s \"%s\" %d %d \"%s\"";

  com.dsc$w_length = sprintf(buf, fmt, p->file, p->name, p->flags.b.debug, p->p_prio, p->arg);
  com.dsc$a_pointer = buf;
  flags = 1; /* Nowait */
  sts = lib$spawn(&com, NULL, NULL, &flags, &name, &p->pid);

  return sts;
}
Esempio n. 2
0
char *Ev::name_to_alias( char *name)
{
  char oname[120];
  static char alias[40];

  cdh_ToUpper( oname, name);

  for ( int i = 0; i < (int)(sizeof(alias_list)/sizeof(alias_list[0])); i++) {
    if ( alias_list[i].Alias[0] == 0)
      break;
    if ( strcmp( alias_list[i].Object, "") != 0 && 
	 strncmp( oname, alias_list[i].Object, strlen(alias_list[i].Object)) == 0) {
      strcpy( alias, alias_list[i].Alias);
      return alias;
    }	 
  }
  strcpy( alias, "");
  return alias;
}
Esempio n. 3
0
void Ev::create_aliaslist( void *up)
{
  char alias_array[2][80];
  int nr;
  int i, j;
  int alias_size;
  ev_sAlias dum;
  pwr_sClass_OpPlace *userp = (pwr_sClass_OpPlace *)up;
  int listsize = MIN( sizeof(userp->EventSelectList)/sizeof(userp->EventSelectList[0]),
		      sizeof(alias_list)/sizeof(alias_list[0]));
						    
  for ( i = 0, j = 0; i < listsize; i++) {
    strcpy( alias_list[i].Alias, "");
    strcpy( alias_list[i].Object, "");
  }
  for ( i = 0, j = 0; i < listsize; i++) {
    nr = dcli_parse( userp->EventSelectList[i], " 	", "",
	     (char *) alias_array, sizeof( alias_array)/sizeof( alias_array[0]), 
	     sizeof( alias_array[0]), 0);
    if ( nr < 2)
      continue;

    cdh_ToUpper( alias_list[j].Object, alias_array[0]);
    strncpy( alias_list[j].Alias, alias_array[1], sizeof(alias_list[j].Alias));
    alias_list[j].Alias[sizeof(alias_list[j].Alias)-1] = 0;
    j++;
  }
  alias_size = j;

  // Order
  for ( i = alias_size - 1; i > 0; i--) {
    for ( j = 0; j < i; j++) {
      if ( strcmp( alias_list[j].Object, alias_list[j+1].Object) <= 0) {
	memcpy( &dum, &alias_list[j+1], sizeof(dum));
	memcpy( &alias_list[j+1], &alias_list[j], sizeof(dum));
	memcpy( &alias_list[j], &dum, sizeof(dum));
      }
    }
  }
}