Beispiel #1
0
void		print_dir(t_file *dir, int file)
{
	t_stat	*st;
	t_file	*tmp;

	tmp = dir;
	st = (t_stat *)malloc(sizeof(t_stat));
	g_rec = 1;
	lstat(dir->path, st);
	if (g_flags[FLAG_L] == 1 && file == 0)
		ls_l(dir, 0, st);
	else
	{
		while (dir != NULL)
		{
			if (opt_a(dir))
				col_print(dir, file, st);
			dir = dir->next;
		}
	}
	if (tmp->err || !st->st_mode & S_IXUSR)
	{
		ft_putstr("ls: ");
		ft_putstr(get_name(tmp->path));
		ft_putendl(": Permission denied");
	}
	free(st);
}
Beispiel #2
0
void printEventFlags(FILE *outFile, int flags)
{
  char buf[80];

  buf[0] = 0;
  if (flags & mh_mEventFlags_Return)
    strcat( buf, "Return/");
  if(flags & mh_mEventFlags_Ack)
    strcat( buf, "Ack/");
  if(flags & mh_mEventFlags_Bell)
    strcat( buf, "Bell/");
  if(flags & mh_mEventFlags_Force)
    strcat( buf, "Force/");
  if(flags & mh_mEventFlags_InfoWindow)
    strcat( buf, "InfoWind/");
  if(flags & mh_mEventFlags_Returned)
    strcat( buf, "Returned/");
  if(flags & mh_mEventFlags_NoObject)
    strcat( buf, "NoObject/");
  /* Remove last / */
  if ( strlen(buf) > 0)
    buf[strlen(buf)-1] = 0;
  else
    strcpy( buf, "-");

  col_print(outFile, "%s", buf);
}
Beispiel #3
0
void
printMsgInfo (
  mh_sMsgInfo *mp,
  FILE *outFile
)
{
  char time_str[40];
  pwr_tTime event_time;
  
  col_print(outFile, "%d", mp->Id.Nix);
  
  event_time = net_NetTimeToTime(&(mp->Id.BirthTime));        
  time_AtoAscii(&event_time, time_eFormat_ComprDateAndTime, time_str, sizeof(time_str));
  col_print(outFile, "%s", time_str);
  
  col_print(outFile, "%d",mp->Id.Idx);
  /*
  sp->Object
  sp->SupObject
  */
  printEventFlags(outFile, mp->EventFlags);

  event_time = net_NetTimeToTime(&(mp->EventTime));      
  time_AtoAscii( &event_time, time_eFormat_ComprDateAndTime, time_str, sizeof(time_str));
  col_print(outFile, "%s", time_str);
  
  // col_print(outFile, "%s",mp->EventName_V3);
  
  convertEventType(mp->EventType, time_str);
  col_print(outFile, "%s", time_str);
  
  convertEventPrio(mp->EventPrio, time_str);
  col_print(outFile, "%s",time_str);
}
Beispiel #4
0
void
printBlock (
  sEvent *sp,
  FILE *outFile
)
{
  char time_str[40];
  pwr_tTime event_time;

  new_row( outFile);
  printMsgInfo(&(sp->Mess.block.Info), outFile);
  //EventText
  //Status
  //TargetIdx
  //DetectTime
  //AValue
  //CtrlLimit
  //Hysteres
  //Unit
  //DValue
  //High
  col_print(outFile, "\"\"");
  col_print(outFile, "%s", sp->Mess.block.EventName);
  col_print(outFile, "%u", sp->Mess.block.TargetId.Idx);

  event_time = net_NetTimeToTime( &(sp->Mess.block.DetectTime));        
  time_AtoAscii(&event_time, time_eFormat_ComprDateAndTime, time_str, sizeof(time_str));
  col_print(outFile, "%s", time_str);
    
  col_print(outFile,"");
  col_print(outFile,"");
  col_print(outFile,"");
  col_print(outFile,"");
  col_print(outFile,"");
  col_print(outFile,"");
}
Beispiel #5
0
int main(int argc, char* argv[]) {
  col* c = col_new();
  col* sol;

  col_random(c);
  
  //sol = col_g1search(300000, c);
  sol = col_gnsearch(300000, c);
  //sol = col_sq1search(300000, c);

  col_print_info(sol);
  col_print(sol);
  //col_print_fail(sol);
  
  return 0;
}
Beispiel #6
0
void
printRet (
  sEvent *sp,
  FILE *outFile
)
{
  char time_str[40];
  new_row( outFile);
  printMsgInfo(&(sp->Mess.ret.Info), outFile);
  pwr_tTime event_time;
  
  //EventText
  //Status
  //TargetIdx
  //DetectTime
  //AValue
  //CtrlLimit
  //Hysteres
  //Unit
  //DValue
  //High
  col_print(outFile, "\"%s\"", sp->Mess.ret.EventText);
  col_print(outFile, "%s", sp->Mess.ret.EventName);
  col_print(outFile, "%u", sp->Mess.ret.TargetId.Idx);

  event_time = net_NetTimeToTime(&(sp->Mess.ret.DetectTime));    
  time_AtoAscii( &event_time, time_eFormat_ComprDateAndTime, time_str, sizeof(time_str));
  col_print(outFile, "%s", time_str);

  switch (sp->Mess.ret.SupInfo.SupType) {
    case mh_eSupType_Analog:
      col_print(outFile, "%.2f", sp->Mess.ret.SupInfo.mh_uSupInfo_u.A.ActualValue);
      col_print(outFile, "%.2f", sp->Mess.ret.SupInfo.mh_uSupInfo_u.A.CtrlLimit);
      col_print(outFile, "%.2f", sp->Mess.ret.SupInfo.mh_uSupInfo_u.A.Hysteres);
      col_print(outFile, "%s",   sp->Mess.ret.SupInfo.mh_uSupInfo_u.A.Unit);
      col_print(outFile,"");
      col_print(outFile, "%u", sp->Mess.ret.SupInfo.mh_uSupInfo_u.A.High);
      break;
    case mh_eSupType_Digital:
      col_print(outFile,"");
      col_print(outFile,"");
      col_print(outFile,"");
      col_print(outFile,"");
      col_print(outFile, "%u", sp->Mess.ret.SupInfo.mh_uSupInfo_u.D.ActualValue);
      col_print(outFile, "%u", sp->Mess.ret.SupInfo.mh_uSupInfo_u.D.High);
      break;  
    case mh_eSupType__:  
    case mh_eSupType_None:
    case mh_eSupType_Link:
    case mh_eSupType_:
      break;  
  
  }

}
Beispiel #7
0
void
printMess (
  sEvent *sp,
  FILE *outFile
)
{
  new_row( outFile);
  printMsgInfo(&(sp->Mess.message.Info), outFile);


  //EventText
  //Status
  //TargetIdx
  //DetectTime
  //AValue
  //CtrlLimit
  //Hysteres
  //Unit
  //DValue
  //High
  col_print(outFile, "\"%s\"", sp->Mess.message.EventText);
  col_print(outFile, "%s", sp->Mess.message.EventName);
  col_print(outFile,"");
  col_print(outFile,"");
  switch (sp->Mess.message.SupInfo.SupType) {
    case mh_eSupType_Analog:
      col_print(outFile, "%.2f", sp->Mess.message.SupInfo.mh_uSupInfo_u.A.ActualValue);
      col_print(outFile, "%.2f", sp->Mess.message.SupInfo.mh_uSupInfo_u.A.CtrlLimit);
      col_print(outFile, "%.2f", sp->Mess.message.SupInfo.mh_uSupInfo_u.A.Hysteres);
      col_print(outFile, "%s",   sp->Mess.message.SupInfo.mh_uSupInfo_u.A.Unit);
      col_print(outFile,"");
      col_print(outFile, "%u", sp->Mess.message.SupInfo.mh_uSupInfo_u.A.High);
      break;
    case mh_eSupType_Digital:
      col_print(outFile,"");
      col_print(outFile,"");
      col_print(outFile,"");
      col_print(outFile,"");
      col_print(outFile, "%u", sp->Mess.message.SupInfo.mh_uSupInfo_u.D.ActualValue);
      col_print(outFile, "%u", sp->Mess.message.SupInfo.mh_uSupInfo_u.D.High);
      break;
    case mh_eSupType__:  
    case mh_eSupType_None:
    case mh_eSupType_Link:
    case mh_eSupType_:
      break;  
  }
}
Beispiel #8
0
void WriteColumnNames(FILE *outFile)
{
  col_print(outFile, "Nid");
  col_print(outFile, "BirthTime");
  col_print(outFile, "Idx");
  col_print(outFile, "EventFlags");
  col_print(outFile, "EventTime");
  col_print(outFile, "EventType");
  col_print(outFile, "Prio");
  col_print(outFile, "EventText");
  col_print(outFile, "EventName");
  col_print(outFile, "TargetIdx");
  col_print(outFile, "DetectTime");
  col_print(outFile, "AValue");
  col_print(outFile, "CtrlLimit");
  col_print(outFile, "Hysteres");
  col_print(outFile, "Unit");
  col_print(outFile, "DValue");
  col_print(outFile, "High");
}