int GetVersion(int arg) { struct vmeio_version_s ver; if (cvora_get_version(vmeio[lun],&ver)) { printf("Driver: %s - %d\n",TimeToStr(ver.driver), ver.driver); printf("Library: %s - %d\n",TimeToStr(ver.library), ver.library); } else printf("GetVersion:Error\n"); arg++; return arg; }
void __fastcall TForm1::BeaconProximity(System::TObject* const Sender, const _di_IBeacon ABeacon, TBeaconProximity Proximity) { String LProximityText; TListViewItem *LNewitem; Integer I; switch (Proximity) { case TBeaconProximity::Inmediate: LProximityText = "Inmediate"; case TBeaconProximity::Near: LProximityText = "Near2"; case TBeaconProximity::Far: LProximityText = "Far"; case TBeaconProximity::Away: LProximityText = "Away"; }; LNewitem = LvProximity->Items->Add(); LNewitem->Text = GUIDToString(ABeacon->GUID); LNewitem->Detail = " Ma:" + IntToStr(ABeacon->Major) + " Mi:" + IntToStr(ABeacon->Minor) + " Dist:" + FloatToStr(ABeacon->Distance) + "Proximity: " + LProximityText + " time " + TimeToStr(Now()); for( I = 0; I < FList.Length; I++) { if ( FList[I].FName == (GUIDToString(ABeacon->GUID) + ";" + IntToStr(ABeacon->Major)+ ";" + IntToStr(ABeacon->Minor))) { switch (Proximity) { case TBeaconProximity::Inmediate: FList[I].FOriginalColor = TAlphaColorRec::Green; break; case TBeaconProximity::Near: FList[I].FOriginalColor = TAlphaColorRec::Yellow; break; case TBeaconProximity::Far: FList[I].FOriginalColor = TAlphaColorRec::Red; break; case TBeaconProximity::Away: FList[I].FOriginalColor = TAlphaColorRec::Black; break; }; break; }; }; };
void CFolderListCtrl::AddFileItem(const _tfinddata_t &fd, int nLargeIconInd, int nSmallIconInd, CString &strExt) { CString sFileName; int nItemPos; if( m_sFolderPath.GetLength() && ( m_sFolderPath[m_sFolderPath.GetLength()-1] == _T('\\') || m_sFolderPath[m_sFolderPath.GetLength()-1] == _T('/') ) ) sFileName = m_sFolderPath+ fd.name; else sFileName = m_sFolderPath + ( _T("\\") ) + fd.name; CFLCItemData * pData; pData = new CFLCItemData( sFileName, strExt ); pData->m_nSize = fd.size; pData->m_tModified = fd.time_write; pData->m_nLargeIconInd = nLargeIconInd; pData->m_nSmallIconInd = nSmallIconInd; nItemPos = InsertItem( m_nItemCount, fd.name, FLC_IMAGE_EMPTY ); SetItemData( nItemPos, DWORD_PTR(pData) ); SetItemText( nItemPos, 1, SizeToStr( pData->m_nSize ) ); SetItemText( nItemPos, 2, TimeToStr( pData->m_tModified ) ); SetValidItemImage( nItemPos ); m_nItemCount++; if (m_strSelectedPath.CompareNoCase(sFileName)==0) { SetItemState(nItemPos, LVIS_SELECTED, LVIS_SELECTED); } }
void TJvNTEventLogMainForm::ReadEvents(void) { TListItem *pItem; ListView1->Items->BeginUpdate(); Screen->Cursor = crHourGlass; __try { ListView1->Items->Clear(); JvNTEventLog1->First(); while( !JvNTEventLog1->Eof() ) { pItem = ListView1->Items->Add(); pItem->Caption = JvNTEventLog1->EventRecord->EventType; pItem->SubItems->Add(DateToStr(JvNTEventLog1->EventRecord->DateTime)); pItem->SubItems->Add(TimeToStr(JvNTEventLog1->EventRecord->DateTime)); pItem->SubItems->Add(JvNTEventLog1->EventRecord->Source); pItem->SubItems->Add(IntToStr(JvNTEventLog1->EventRecord->Category)); pItem->SubItems->Add(IntToStr(JvNTEventLog1->EventRecord->ID & 0x0FFFFFFF)); pItem->SubItems->Add(JvNTEventLog1->EventRecord->UserName); pItem->SubItems->Add(JvNTEventLog1->EventRecord->Computer); JvNTEventLog1->Next(); } } __finally { ListView1->Items->EndUpdate(); Screen->Cursor = crDefault; } }
int main(int argc,char *argv[]) { char *ep; if (argc > 1) printf("%s\n",TimeToStr(strtoul(argv[1],&ep,0))); else printf("%s <UTC>\n"); exit(0); }
//--------------------------------------------------------------------------- __fastcall TForm1::TForm1(TComponent* Owner) : TForm(Owner) { AnsiString time1 = TimeToStr(Time()); unsigned char currentTime[20]; strcpy(currentTime, time1.c_str()); Label7->SetTextBuf(currentTime); for(int i = 0; i < sizeof(currentTime); i++){ pdata.startupTime[i] = currentTime[i]; } }
//--------------------------------------------------------------------------- void __fastcall TMainForm::TimerTaskTimer(TObject *Sender){ StatusBar->Panels->operator [](0)->Text =DateTimeToStr(Now()); if (DateTimePicker->Checked){ //自动关机设置 TDateTime time =DateTimePicker->Time; if (TimeToStr(time) ==TimeToStr(Now())){ ShutDown(true); //关终端机 system("shutdown -s -t 30"); //30秒后关电脑,直接运行系统命令算了 } } echoLoopTimes ++; if (echoLoopTimes >20){ //每16秒变换一次错误提示 echoLoopTimes =0; ShowErrMessage(); indexErrMsg ++; } if (! dateFileBakup){ //备份文件的程序执行一次 dateFileBakup =true; controller->BackupDateFile(controller->config->BinFileDir); //bin文件 controller->BackupDateFile(controller->config->HexFileDir); //hex文件 } }
/* ** Configure wake up for RTC alarm interrupt */ void configWakeRTC(void) { unsigned int currTime = 0; unsigned int alarmTime = 0x00002000; /* 20 Seconds for RTC Wake */ unsigned int alarmDate = 0; unsigned char time[9]= {0}; unsigned char date[9]= {0}; /* Force RTC into 24hr format */ RTCHourModeSet(RTC_INST_BASE, RTC_24HOUR_MODE); /* get current time */ currTime = RTCTimeGet(RTC_INST_BASE); /* get current date */ alarmDate = RTCCalendarGet(RTC_INST_BASE); TimeToStr(currTime, time); DateToStr(alarmDate, date); ConsoleUtilsPrintf("\n\r Current Time & Date: %s, %s", time, date); /* Add alarm time to current time */ alarmTime = addTime(alarmTime, currTime, &alarmDate); /* Set alarm Time */ RTCAlarmTimeSet(RTC_INST_BASE, alarmTime); /* Set alarm Date */ RTCAlarmCalendarSet(RTC_INST_BASE, alarmDate); TimeToStr(alarmTime, time); DateToStr(alarmDate, date); ConsoleUtilsPrintf("\n\r RTC Alarm Wake Time & Date: %s, %s", time, date); /* Run the RTC. The seconds tick from now on.*/ RTCRun(RTC_INST_BASE); }
void __fastcall TdmRemote::PlaylistRefreshStatsExecute(TObject *) { int SongS = 0; int PosMS = 0; client->getTimes(SongS, PosMS); if ((SongS) && (!frmPlaylist->Dragging)) frmPlaylist->pbSongPos->Position = (frmPlaylist->pbSongPos->Max * PosMS) / (SongS * 1000); if (frmPlaylist->lstSongs->Items->Count > 1) frmPlaylist->pbListPos->Position = (frmPlaylist->pbListPos->Max * CurrentIndex) / (frmPlaylist->lstSongs->Items->Count - 1); else frmPlaylist->pbListPos->Position = 0; // time frmPlaylist->sbPlaylist->Panels->Items[1]->Text = TimeToStr(Time()); // current song length frmPlaylist->sbPlaylist->Panels->Items[3]->Text = TimeToStr((float) SongS / SecsPerDay); }
/* ** Displays the Time and Date on the UART console */ void RtcTimeCalDisplay(void) { unsigned int time = 0; unsigned int cal = 0; unsigned char strTime[9] = {'\0'}; unsigned char strDate[9] = {'\0'}; time = RTCTimeGet(SOC_RTC_0_REGS); cal = RTCCalendarGet(SOC_RTC_0_REGS); TimeToStr(time, strTime); DateToStr(cal, strDate); ConsoleUtilsPrintf("\rCurrent Time And Date: %s, %s, ", strTime, strDate); switch(cal & MASK_DOTW) { case 0x00: ConsoleUtilsPrintf("Sun"); break; case 0x01: ConsoleUtilsPrintf("Mon"); break; case 0x02: ConsoleUtilsPrintf("Tue"); break; case 0x03: ConsoleUtilsPrintf("Wed"); break; case 0x04: ConsoleUtilsPrintf("Thu"); break; case 0x05: ConsoleUtilsPrintf("Fri"); break; case 0x06: ConsoleUtilsPrintf("Sat"); default: break; } }
void DumpObjFiles (FILE* F, unsigned long Offset) /* Dump the source files */ { ObjHeader H; Collection StrPool = AUTO_COLLECTION_INITIALIZER; unsigned Count; unsigned I; /* Seek to the header position and read the header */ FileSetPos (F, Offset); ReadObjHeader (F, &H); /* Seek to the start of the string pool and read it */ FileSetPos (F, Offset + H.StrPoolOffs); ReadStrPool (F, &StrPool); /* Seek to the start of the source files */ FileSetPos (F, Offset + H.FileOffs); /* Output a header */ printf (" Files:\n"); /* Read the number of files and print it */ Count = ReadVar (F); printf (" Count:%27u\n", Count); /* Read and print all files */ for (I = 0; I < Count; ++I) { /* Read the data for one file */ const char* Name = GetString (&StrPool, ReadVar (F)); unsigned long MTime = Read32 (F); unsigned long Size = ReadVar (F); unsigned Len = strlen (Name); /* Print the header */ printf (" Index:%27u\n", I); /* Print the data */ printf (" Name:%*s\"%s\"\n", (int)(24-Len), "", Name); printf (" Size:%26lu\n", Size); printf (" Modification time:%13lu (%s)\n", MTime, TimeToStr (MTime)); } /* Destroy the string pool */ DestroyStrPool (&StrPool); }
///----------------------------------------------------------------------------- void WriteLogFile(AnsiString Msg){ char* time_ptr; AnsiString cur_time; cur_time = TimeToStr(Time()); if((time_ptr = strchr(cur_time.c_str(),':')) != NULL){ *time_ptr = '.'; time_ptr++; if((time_ptr = strchr(cur_time.c_str(),':')) != 0x00){ *time_ptr = '.'; } } cur_time += " "; cur_time += Msg; LogList->Add(cur_time); MainForm->MainLogMemo->Lines->Add(cur_time); return; }
///----------------------------------------------------------------------------- void SaveLogFile(AnsiString Patch){ char* time_ptr; AnsiString LogPatch; AnsiString cur_time; AnsiString cur_date; cur_date += DateToStr(Date()); cur_date += " "; cur_time = TimeToStr(Time()); if((time_ptr = strchr(cur_time.c_str(),':')) != NULL){ *time_ptr = '.'; time_ptr++; if((time_ptr = strchr(cur_time.c_str(),':')) != 0x00){ *time_ptr = '.'; } } cur_time += " "; LogPatch = Patch; LogPatch += "Hammer Log File At "; LogPatch += cur_date; LogPatch += cur_time; LogPatch += ".log"; LogList->SaveToFile(LogPatch); return; }
void __fastcall TForm1::BeaconExit(System::TObject* const Sender, const _di_IBeacon ABeacon, const TBeaconList CurrentBeaconList) { TListViewItem *LItem; LItem = LvExitedBeacon->Items->Add(); LItem->Text = GUIDToString(ABeacon->GUID); LItem->Detail = "Major: " + IntToStr(ABeacon->Major) + " Minor: " + IntToStr(ABeacon->Minor) + " time :" + TimeToStr(Now()) ; TMonitor::Enter(FLock); try { FCurrentBeaconList = CurrentBeaconList; } __finally { TMonitor::Exit(FLock); }; }
//--------------------------------------------------------------------------- // Guarda en el fichero ema.cfg la configuracion presente en la ventana de configuracion. //--------------------------------------------------------------------------- void __fastcall TFConfigMeteo::BAjustes_MeteoClick(TObject *Sender) { if(Application->MessageBox("¿Desea guardar ajustes?", "ATENCION", MB_OKCANCEL ) == IDCANCEL ) { return; } strcpy(&ConfMeteo[0], "cfg:"); strncpy(&ConfMeteo[5], EKPluvio->Text.c_str(),3); strncpy(&ConfMeteo[9], ELimiteNubes->Text.c_str(),3); strncpy(&ConfMeteo[13], EOffset_Bar->Text.c_str(),3); strncpy(&ConfMeteo[17], EAltura_Bar->Text.c_str(),3); strncpy(&ConfMeteo[21], Ezener1->Text.c_str(),3); strncpy(&ConfMeteo[25], Ezener2->Text.c_str(),3); strncpy(&ConfMeteo[29], Ezener3->Text.c_str(),3); strncpy(&ConfMeteo[33], Ezener4->Text.c_str(),3); strncpy(&ConfMeteo[37], Ezener5->Text.c_str(),3); strncpy(&ConfMeteo[41], Ezener6->Text.c_str(),3); // strncpy(&ConfMeteo[45], EMinFichero->Text.c_str(),1); strncpy(&ConfMeteo[49], EOffset_IR->Text.c_str(),3); strncpy(&ConfMeteo[53], EOffset_UV->Text.c_str(),3); strncpy(&ConfMeteo[58], EKAnem_mec->Text.c_str(),3); strncpy(&ConfMeteo[62], EK1Anem_term->Text.c_str(),4); strncpy(&ConfMeteo[67], EK2Anem_term->Text.c_str(),4); strcpy(&ConfMeteo[80], TimeToStr(Time()).c_str()); strcpy(&ConfMeteo[90], DateToStr(Date()).c_str()); strcpy(&ConfMeteo[110], EDirectorio->Text.c_str() ); strcpy(&ConfMeteo[210], Ejpg->Text.c_str() ); strcpy(temp, dir_trab); strcat(temp, "ema.cfg"); if((conf_ema = fopen(temp, "wt")) != NULL) { fwrite(ConfMeteo, sizeof(ConfMeteo), 1, conf_ema); fclose(conf_ema); } //Refresca la matriz de configuracion con los nuevos datos confEMA.kpluvio = atoi(EKPluvio->Text.c_str()); confEMA.alerta_nube = atoi(ELimiteNubes->Text.c_str()); confEMA.bar_ofset = atoi(EOffset_Bar->Text.c_str()); confEMA.bar_altura = atoi(EAltura_Bar->Text.c_str()); for (int sens = 0; sens<6; sens++) // se actualiza Referencia { // Referencia[sens] = Ref[sens]; confEMA.RefZener[sens] = Ref[sens]; } confEMA.luzIR_ofset = atoi(EOffset_IR->Text.c_str()); confEMA.luzUV_ofset = atoi(EOffset_UV->Text.c_str()); confEMA.kmecanico = atoi(EKAnem_mec->Text.c_str()); confEMA.k1termico = atoi(EK1Anem_term->Text.c_str()); confEMA.k2termico = atoi(EK2Anem_term->Text.c_str()); strcpy(confEMA.direc_datos, EDirectorio->Text.c_str()); strcpy(confEMA.direc_jpg, Ejpg->Text.c_str()); }
void DumpObjOptions (FILE* F, unsigned long Offset) /* Dump the file options */ { ObjHeader H; Collection StrPool = AUTO_COLLECTION_INITIALIZER; unsigned Count; unsigned I; /* Seek to the header position and read the header */ FileSetPos (F, Offset); ReadObjHeader (F, &H); /* Seek to the start of the string pool and read it */ FileSetPos (F, Offset + H.StrPoolOffs); ReadStrPool (F, &StrPool); /* Seek to the start of the options */ FileSetPos (F, Offset + H.OptionOffs); /* Output a header */ printf (" Options:\n"); /* Read the number of options and print it */ Count = ReadVar (F); printf (" Count:%27u\n", Count); /* Read and print all options */ for (I = 0; I < Count; ++I) { const char* ArgStr; unsigned ArgLen; /* Read the type of the option and the value */ unsigned char Type = Read8 (F); unsigned long Val = ReadVar (F); /* Get the type of the argument */ unsigned char ArgType = Type & OPT_ARGMASK; /* Determine which option follows */ const char* TypeDesc; switch (Type) { case OPT_COMMENT: TypeDesc = "OPT_COMMENT"; break; case OPT_AUTHOR: TypeDesc = "OPT_AUTHOR"; break; case OPT_TRANSLATOR:TypeDesc = "OPT_TRANSLATOR"; break; case OPT_COMPILER: TypeDesc = "OPT_COMPILER"; break; case OPT_OS: TypeDesc = "OPT_OS"; break; case OPT_DATETIME: TypeDesc = "OPT_DATETIME"; break; default: TypeDesc = "OPT_UNKNOWN"; break; } /* Print the header */ printf (" Index:%27u\n", I); /* Print the data */ printf (" Type:%22s0x%02X (%s)\n", "", Type, TypeDesc); switch (ArgType) { case OPT_ARGSTR: ArgStr = GetString (&StrPool, Val); ArgLen = strlen (ArgStr); printf (" Data:%*s\"%s\"\n", (int)(24-ArgLen), "", ArgStr); break; case OPT_ARGNUM: printf (" Data:%26lu", Val); if (Type == OPT_DATETIME) { /* Print the time as a string */ printf (" (%s)", TimeToStr (Val)); } printf ("\n"); break; default: /* Unknown argument type. This means that we cannot determine * the option length, so we cannot proceed. */ Error ("Unknown option type: 0x%02X", Type); break; } } /* Destroy the string pool */ DestroyStrPool (&StrPool); }
int main(int argc,char **argv) { edg_wll_Context ctx; edg_wll_QueryRec **conditions = NULL; time_t valid = 0; char *errt, *errd; void *fields = NULL; int sock = -1, flags = 0; char *fake_addr = NULL; // sleep(20); me = argv[0]; if (edg_wll_InitContext(&ctx) != 0) { fprintf(stderr, "Couldn't create L&B context.\n"); exit(1); } if ( argc < 2 ) { usage(NULL); goto cleanup; } if ( (argc < 2) || !strcmp(argv[1], "help") || !strcmp(argv[1], "--help") || !strcmp(argv[1], "-h") || !strcmp(argv[1], "-?")) { usage(NULL); goto cleanup; } else if ( !strcmp(argv[1], "new") ) { int c; edg_wlc_JobId jid; edg_wll_NotifId id_out; int attr = 0, i = 0, excl = 0; edg_wll_GssCred mycred; edg_wll_GssStatus gss_code; static struct option long_options[] = { {"state", required_argument, 0, 'S'}, {"jdl", no_argument, 0, 'J'}, {"bootstrap", no_argument, 0, 'B'}, {"terminal", no_argument, 0, 'T'}, {"history", no_argument, 0, 'H'}, {"anonymize", no_argument, 0, 'N'}, {"type", no_argument, 0, 'E'}, {0, 0, 0, 0}}; int option_index = 0; char *single, *statelist, *notif_server, *typelist, *type, *typestor; edg_wll_JobStatCode single_code; enum edg_wll_StatJobtype typecode; int statno, stdelims, sti; unsigned int notif_server_port; #define MAX_NEW_CONDS 7 conditions = (edg_wll_QueryRec **)calloc(MAX_NEW_CONDS + 1,sizeof(edg_wll_QueryRec *)); conditions[0] = (edg_wll_QueryRec *)calloc(2,sizeof(edg_wll_QueryRec)); while ((c = getopt_long(argc-1,argv+1,"j:o:v:n:s:a:t:f:cOS:JBTHNE:",long_options,&option_index)) > 0) { switch (c) { case 'j': conditions[i] = (edg_wll_QueryRec *)calloc(2,sizeof(edg_wll_QueryRec)); conditions[i][0].attr = EDG_WLL_QUERY_ATTR_JOBID; conditions[i][0].op = EDG_WLL_QUERY_OP_EQUAL; if (edg_wlc_JobIdParse(optarg, &jid) ) { fprintf(stderr,"Job ID parameter not set propperly!\n"); usage("new"); goto cleanup; } conditions[i][0].value.j = jid; i++; edg_wll_GetParam(ctx, EDG_WLL_PARAM_NOTIF_SERVER, ¬if_server); if (!notif_server) { glite_jobid_getServerParts(jid, ¬if_server, ¬if_server_port); edg_wll_SetParam(ctx, EDG_WLL_PARAM_NOTIF_SERVER, notif_server); edg_wll_SetParamInt(ctx, EDG_WLL_PARAM_NOTIF_SERVER_PORT, notif_server_port); } free(notif_server); break; case 'o': if (excl) { usage("new"); return EX_USAGE; } else excl = 1; conditions[i] = (edg_wll_QueryRec *)calloc(2,sizeof(edg_wll_QueryRec)); conditions[i][0].attr = EDG_WLL_QUERY_ATTR_OWNER; conditions[i][0].op = EDG_WLL_QUERY_OP_EQUAL; conditions[i][0].value.c = optarg; i++; break; case 'v': conditions[i] = (edg_wll_QueryRec *)calloc(2,sizeof(edg_wll_QueryRec)); conditions[i][0].attr = EDG_WLL_QUERY_ATTR_JDL_ATTR; conditions[i][0].op = EDG_WLL_QUERY_OP_EQUAL; conditions[i][0].value.c = optarg; asprintf(&(conditions[i][0].attr_id.tag), "VirtualOrganisation"); i++; break; case 'n': conditions[i] = (edg_wll_QueryRec *)calloc(2,sizeof(edg_wll_QueryRec)); conditions[i][0].attr = EDG_WLL_QUERY_ATTR_NETWORK_SERVER; conditions[i][0].op = EDG_WLL_QUERY_OP_EQUAL; conditions[i][0].value.c = optarg; i++; break; case 's': if (fake_addr) { usage("new"); return EX_USAGE; } sock = atoi(optarg); break; case 'a': if (sock >= 0) { usage("new"); return EX_USAGE; } fake_addr = optarg; break; case 't': valid = time(NULL) + atol(optarg); break; case 'f': flags |= atoi(optarg); break; case 'J': flags |= EDG_WLL_STAT_CLASSADS; break; case 'B': flags |= EDG_WLL_NOTIF_BOOTSTRAP; break; case 'T': flags |= EDG_WLL_NOTIF_TERMINAL_STATES; break; case 'H': flags |= EDG_WLL_NOTIF_TERMINAL_STATES | EDG_WLL_NOTIF_HISTORY; break; case 'N': flags |= EDG_WLL_NOTIF_ANONYMIZE; break; case 'c': conditions[i] = (edg_wll_QueryRec *)calloc(2,sizeof(edg_wll_QueryRec)); conditions[i][0].attr = EDG_WLL_QUERY_ATTR_STATUS; conditions[i][0].op = EDG_WLL_QUERY_OP_CHANGED; i++; break; case 'O': if (excl) { usage("new"); return EX_USAGE; } else excl = 1; if ( !edg_wll_gss_acquire_cred(NULL, NULL, GSS_C_INITIATE, &mycred, &gss_code) ) { conditions[i] = (edg_wll_QueryRec *)calloc(2,sizeof(edg_wll_QueryRec)); conditions[i][0].attr = EDG_WLL_QUERY_ATTR_OWNER; conditions[i][0].op = EDG_WLL_QUERY_OP_EQUAL; conditions[i][0].value.c = strdup(mycred->name); edg_wll_gss_release_cred(&mycred, NULL); i++; } else { fprintf(stderr,"No credentials found! Exiting. \n"); goto cleanup; } break; case 'S': statelist = optarg; statno = 0; stdelims = 0; for (sti = 0; sti < strlen(statelist); sti++) if (statelist[sti] == ',') stdelims++; conditions[i] = (edg_wll_QueryRec *)calloc(stdelims+2,sizeof(edg_wll_QueryRec)); while((single = strtok(statelist, ","))) { single_code = edg_wll_StringToStat(single); if (single_code != -1) { conditions[i][statno].attr = EDG_WLL_QUERY_ATTR_STATUS; conditions[i][statno].op = EDG_WLL_QUERY_OP_EQUAL; conditions[i][statno].value.i = single_code; statelist = NULL; statno++; } else { fprintf(stderr,"'%s' is not a valid state name! Exitting.\n", single); goto cleanup; } } i++; break; case 'E': typelist = optarg; statno = 0; for( type = strtok_r(typelist, ",", &typestor); type ; type = strtok_r(NULL, ",", &typestor)) statno++; conditions[i] = (edg_wll_QueryRec *)calloc(statno+1,sizeof(edg_wll_QueryRec)); statno = 0; for( type = strtok_r(typelist, ",", &typestor); type ; type = strtok_r(NULL, ",", &typestor)) { typecode=edg_wll_JobtypeStrToCode(type); if (((int)typecode)<0) { fprintf(stderr,"'%s' is not a valid job type! Exitting.\n", type); goto cleanup; } else { conditions[i][statno].attr = EDG_WLL_QUERY_ATTR_JOB_TYPE; conditions[i][statno].op = EDG_WLL_QUERY_OP_EQUAL; conditions[i][statno].value.i = typecode; statelist = NULL; statno++; } } i++; break; default: usage("new"); return EX_USAGE; } if (i > MAX_NEW_CONDS) { usage("new"); return EX_USAGE; } } if ( !edg_wll_NotifNew(ctx, (edg_wll_QueryRec const* const*)conditions, flags, sock, fake_addr, &id_out, &valid)) fprintf(stdout,"notification ID: %s\nvalid: %s (%ld)\n", edg_wll_NotifIdUnparse(id_out), TimeToStr(valid), valid); edg_wll_NotifIdFree(id_out); if (attr == EDG_WLL_QUERY_ATTR_JOBID) edg_wlc_JobIdFree(jid); if (edg_wll_Error(ctx,&errt,&errd)) { fprintf(stderr, "%s: %s (%s)\n", me, errt, errd); return EX_IOERR; } } else if ( !strcmp(argv[1], "bind") ) { edg_wll_NotifId nid; int c; while ((c = getopt(argc-1,argv+1,"s:a:t:")) > 0) switch (c) { case 's': if (fake_addr) { usage("bind"); return EX_USAGE; } sock = atoi(optarg); break; case 'a': if (sock >= 0) { usage("bind"); return EX_USAGE; } fake_addr = optarg; break; case 't': valid = time(NULL) + atol(optarg); break; default: usage("bind"); return EX_USAGE; } if ( (optind+1 == argc) || edg_wll_NotifIdParse(argv[optind+1], &nid) ) { fprintf(stderr,"Notification ID parameter not set propperly!\n\n"); usage("bind"); return EX_USAGE; } if ( !edg_wll_NotifBind(ctx, nid, sock, fake_addr, &valid) ) printf("valid until: %s (%ld)\n", TimeToStr(valid), valid); edg_wll_NotifIdFree(nid); if (edg_wll_Error(ctx,&errt,&errd)) { fprintf(stderr, "%s: %s (%s)\n", me, errt, errd); return EX_IOERR; } } else if ( !strcmp(argv[1], "receive") ) { edg_wll_JobStat stat; edg_wll_NotifId nid = NULL; int c; char *field_arg = "owner",*err; time_t client_tout = time(NULL) + 600; int refresh = 0; struct timeval tout; time_t opt_valid = 0,do_refresh = client_tout,now; while ((c = getopt(argc-1,argv+1,"s:a:i:f:t:r")) > 0) switch (c) { case 's': if (fake_addr || refresh || opt_valid) { usage("receive"); return EX_USAGE; } sock = atoi(optarg); break; case 'a': if (sock >= 0) { usage("receive"); return EX_USAGE; } fake_addr = optarg; break; case 'i': client_tout = time(NULL) + atoi(optarg); break; case 'f': field_arg = optarg; break; case 't': if (sock >= 0) { usage("receive"); return EX_USAGE; } opt_valid = atol(optarg); break; case 'r': if (sock >= 0) { usage("receive"); return EX_USAGE; } refresh = 1; break; default: usage("receive"); return EX_USAGE; } if (opt_valid == 0) opt_valid = 3600; if ((err = glite_lb_parse_stat_fields(field_arg,&fields))) { fprintf(stderr,"%s: invalid argument\n",err); return EX_USAGE; } memset(&stat,0,sizeof stat); if (sock == -1) { int param = optind+1; if (param == argc) { fprintf(stderr, "Notification ID parameter not set propperly!\n\n"); usage("receive"); return EX_USAGE; } valid = time(NULL) + opt_valid; while (param < argc) { if (edg_wll_NotifIdParse(argv[param], &nid)) { fprintf(stderr, "Notification ID parameter not set propperly!\n\n"); usage("receive"); return EX_USAGE; } if (edg_wll_NotifBind(ctx, nid, -1, fake_addr, &valid) ) goto receive_err; fprintf(stderr,"notification is valid until: %s (%ld)\n", TimeToStr(valid), valid); param++; } now = time(NULL); do_refresh = now + (valid - now)/2; if (refresh) fprintf(stderr,"next refresh %s (%ld)\n", TimeToStr(do_refresh),do_refresh); } do { edg_wll_NotifId recv_nid = NULL; int err; tout.tv_sec = (refresh && client_tout >= do_refresh ? do_refresh : client_tout) - time(NULL); if (tout.tv_sec < 0) tout.tv_sec = 0; tout.tv_usec = 0; if ( (err = edg_wll_NotifReceive(ctx, sock, &tout, &stat, &recv_nid)) ) { edg_wll_NotifIdFree(recv_nid); recv_nid = NULL; if (err != ETIMEDOUT) goto receive_err; } else { glite_lb_print_stat_fields(fields,&stat); edg_wll_FreeStatus(&stat); stat.state = EDG_WLL_JOB_UNDEF; } if ((now = time(NULL)) >= client_tout) goto cleanup; if (refresh && now >= do_refresh) { valid = now + opt_valid; if (!edg_wll_NotifRefresh(ctx,nid,&valid)) { do_refresh = now + (valid - now)/2; fprintf(stderr,"notification is valid until: %s (%ld)\n",TimeToStr(valid), valid); fprintf(stderr,"next refresh %s (%ld)\n", TimeToStr(do_refresh),do_refresh); } else { char *et,*ed; edg_wll_Error(ctx,&et,&ed); do_refresh = now + (valid - now)/2; fprintf(stderr,"warning: edg_wll_NotifRefresh failed (%s, %s)\n" "next refresh %s (%ld)\n", et,ed,TimeToStr(do_refresh),do_refresh); } } /* original example */ #if 0 printf("\nnotification ID: %s\n", edg_wll_NotifIdUnparse(recv_nid)); if (stat.state != EDG_WLL_JOB_UNDEF) { char *jobid_s; jobid_s = edg_wlc_JobIdUnparse(stat.jobId); printf("Jobid:\t%s\nStatus:\t%s\n", jobid_s, edg_wll_StatToString(stat.state)); edg_wll_FreeStatus(&stat); free(jobid_s); stat.state = EDG_WLL_JOB_UNDEF; } #endif if (recv_nid) { edg_wll_NotifIdFree(recv_nid); recv_nid = NULL; } } while (1); // till timeout.... return 0; receive_err: if (stat.state != EDG_WLL_JOB_UNDEF) edg_wll_FreeStatus(&stat); if (nid) edg_wll_NotifIdFree(nid); edg_wll_NotifCloseFd(ctx); edg_wll_NotifClosePool(ctx); if (edg_wll_Error(ctx,&errt,&errd)) fprintf(stderr, "%s: %s (%s)\n", me, errt, errd); return EX_IOERR; } else if ( !strcmp(argv[1], "change") ) { edg_wlc_JobId jid; edg_wll_NotifId nid; if ( (argc < 3) || edg_wll_NotifIdParse(argv[2], &nid) ) { printf("Notification ID parameter not set propperly!\n"); usage("bind"); return 1; } if ( (argc < 4) || edg_wlc_JobIdParse(argv[3], &jid) ) { fprintf(stderr,"Job ID parameter not set propperly!\n"); usage("change"); goto cleanup; } conditions = (edg_wll_QueryRec **)calloc(2,sizeof(edg_wll_QueryRec *)); conditions[0] = (edg_wll_QueryRec *)calloc(2,sizeof(edg_wll_QueryRec)); conditions[0][0].attr = EDG_WLL_QUERY_ATTR_JOBID; conditions[0][0].op = EDG_WLL_QUERY_OP_EQUAL; conditions[0][0].value.j = jid; conditions[1] = NULL; /*conditions[1] = (edg_wll_QueryRec *)calloc(3, sizeof(edg_wll_QueryRec)); conditions[1][0].attr = EDG_WLL_QUERY_ATTR_STATUS; conditions[1][0].op = EDG_WLL_QUERY_OP_EQUAL; conditions[1][0].value.i = EDG_WLL_JOB_DONE; conditions[1][1].attr = EDG_WLL_QUERY_ATTR_STATUS; conditions[1][1].op = EDG_WLL_QUERY_OP_EQUAL; conditions[1][1].value.i = EDG_WLL_JOB_RUNNING;*/ edg_wll_NotifChange(ctx, nid, (edg_wll_QueryRec const * const *) conditions, EDG_WLL_NOTIF_REPLACE); edg_wlc_JobIdFree(jid); edg_wll_NotifIdFree(nid); } else if ( !strcmp(argv[1], "refresh") ) { edg_wll_NotifId nid; int c; while ((c = getopt(argc-1,argv+1,"t:")) > 0) switch (c) { case 't': valid = time(NULL) + atol(optarg); break; default: usage("refresh"); return EX_USAGE; } if ( (optind+1 == argc) || edg_wll_NotifIdParse(argv[optind+1], &nid) ) { fprintf(stderr,"Notification ID parameter not set propperly!\n\n"); usage("refresh"); return EX_USAGE; } if ( !edg_wll_NotifRefresh(ctx, nid, &valid) ) printf("valid until: %s (%ld)\n", TimeToStr(valid), valid); edg_wll_NotifIdFree(nid); } else if ( !strcmp(argv[1], "drop") ) { edg_wll_NotifId nid; if ( (argc < 3) || edg_wll_NotifIdParse(argv[2], &nid) ) { fprintf(stderr,"Notification ID parameter not set propperly!\n"); usage("drop"); return EX_USAGE; } edg_wll_NotifDrop(ctx, nid); edg_wll_NotifIdFree(nid); } else { usage(NULL); return EX_USAGE; } cleanup: if ( conditions ) { /* for ( i = 0; conditions[i][0].attr; i++ ) free(conditions[1]); */ free(conditions); } int retval; if (retval = edg_wll_Error(ctx,&errt,&errd)) fprintf(stderr, "%s: %s (%s)\n", me, errt, errd); edg_wll_NotifCloseFd(ctx); edg_wll_FreeContext(ctx); edg_wll_poolFree(); return retval; }
BOOL CDlgExportHistory::ExportHistory(LPCSTR pszFile, fs::list <fsDLHistoryRecord*> &vpHist, BOOL bAppend) { HANDLE hFile = CreateFile (pszFile, GENERIC_READ | GENERIC_WRITE, 0, NULL, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); if (hFile == INVALID_HANDLE_VALUE) return FALSE; CString str; if (bAppend && GetLastError () == ERROR_ALREADY_EXISTS) { DWORD dwSize = GetFileSize (hFile, NULL); if (dwSize > 10000) { SetFilePointer (hFile, dwSize - 10000, NULL, FILE_BEGIN); dwSize = 10000; } DWORD dw; LPSTR psz = new char [dwSize+1]; ReadFile (hFile, psz, dwSize, &dw, NULL); psz [dwSize] = 0; int nLen = lstrlen (psz); if (nLen != (int) dwSize) { CloseHandle (hFile); return FALSE; } LPSTR psz2 = psz + nLen - 7; while (psz2 != psz) { if (_memicmp (psz2, "</body>", 7) == 0) { *psz2 = 0; break; } *psz2--; } if (psz2 == psz) { CloseHandle (hFile); return FALSE; } SetFilePointer (hFile, (psz2 - psz) - nLen, NULL, FILE_END); SetEndOfFile (hFile); delete [] psz; } else { SetEndOfFile (hFile); str = "<html>\n"; str += "<style type=\"text/css\">\n"; str += "<!--\n"; str += "H3 { font-size: 19px; font-family: Tahoma; color: #cc0000;}\n"; str += "TR { font-size: 12px; font-family: Tahoma; color: #000033}\n"; str += "TD { font-size: 12px; font-family: Tahoma; color: #000033}\n"; str += "A,A:visited,A:active { text-decoration: none; }\n"; str += "A:hover { text-decoration: underline; }\n"; str += "-->\n"; str += "</style>\n"; str += "<body>\n"; str += "<h3>"; str += LS (L_FDMHIST); str += "</h3>\n"; } for (int i = 0; i < vpHist.size (); i++) { fsDLHistoryRecord* rec = vpHist [i]; str += "<table width=\"75%\" border=\"1\">\n"; str += "<tr><td width=\"180\">"; str += LS (L_URLOFDOWNLOAD); str += ":</td>"; str += "<td><a href=\""; str += rec->strURL; str += "\"> "; str += rec->strURL; str += "</a></td></tr>\n"; if (rec->dateDownloaded.dwHighDateTime) { str += "<tr><td>"; str += LS (L_DLDEDTOFILE); str += ":</td><td>"; str += rec->strSavedTo; str += "</td></tr>\n"; str += "<tr><td>"; str += LS (L_SIZEOFFILE); str += ":</td><td>"; str += BytesToString (rec->uFileSize); str += "</td></tr>\n"; str += "<tr><td>"; str += LS (L_DLDWASCOMPLETED); str += ":</td><td>"; str += TimeToStr (rec->dateDownloaded); str += "</td></tr>\n"; } else { str += "<tr><td>"; str += LS (L_DLDWASDELETED); str += ":</td><td>"; str += TimeToStr (rec->dateRecordAdded); str += "</td></tr>\n"; } if (rec->strComment != "") { CString str2 = rec->strComment; str2.Replace ("\n", "<br>"); str += "<tr><td>"; str += LS (L_DESC); str += ":</td><td>"; str += str2; str += "</td></tr>\n"; } str += "</table><br>\n"; } str += "</body></html>"; DWORD dw; WriteFile (hFile, str, str.GetLength (), &dw, NULL); CloseHandle (hFile); return TRUE; }
void __fastcall TForm1::ExitRegion(System::TObject* const Sender, const GUID &UUID, int AMajor, int AMinor) { TListViewItem *LItem; LItem = LvExitedRegion->Items->Add(); LItem->Text = GUIDToString(UUID); LItem->Detail = "Major: " + IntToStr(AMajor) + " Minor: " + IntToStr(AMinor) + " time :" + TimeToStr(Now()); };
/* ** Configure wake up for RTC Only */ void configRTCOnly(void) { unsigned int currTime = 0; unsigned int alarm1Date = 0; unsigned int alarm1Time = 0x00002200; /* 22 Seconds for RTC Wake */ unsigned int alarm2Date = 0; unsigned int alarm2Time = 0x00000200; /* 2 Seconds for RTC only */ unsigned char time[9]= {0}; unsigned char date[9]= {0}; /* Force RTC into 24hr format */ RTCHourModeSet(RTC_INST_BASE, RTC_24HOUR_MODE); /* get current time */ currTime = RTCTimeGet(RTC_INST_BASE); /* get current date */ alarm1Date = RTCCalendarGet(RTC_INST_BASE); alarm2Date = alarm1Date; TimeToStr(currTime, time); DateToStr(alarm1Date, date); ConsoleUtilsPrintf("\n\r Current Time & Date: %s, %s", time, date); /* Add alarm time to current time */ alarm2Time = addTime(alarm2Time, currTime, &alarm2Date); /* Set alarm Time */ RTCAlarm2TimeSet(RTC_INST_BASE, alarm2Time); /* Set alarm Date */ RTCAlarm2CalendarSet(RTC_INST_BASE, alarm2Date); TimeToStr(alarm2Time, time); DateToStr(alarm2Date, date); ConsoleUtilsPrintf("\n\r RTC Only Mode Sleep Time & Date: %s, %s", time, date); /* Add alarm time to current time */ alarm1Time = addTime(alarm1Time, currTime, &alarm1Date); /* Set alarm Time */ RTCAlarmTimeSet(RTC_INST_BASE, alarm1Time); /* Set alarm Date */ RTCAlarmCalendarSet(RTC_INST_BASE, alarm1Date); TimeToStr(alarm1Time, time); DateToStr(alarm1Date, date); ConsoleUtilsPrintf("\n\r RTC Alarm Wake Time & Date: %s, %s", time, date); /* Set the polarity of RTC External Wake pin0 to Low */ RTCConfigPmicExtWakePolarity(RTC_INST_BASE, 0, RTC_EXT_WAKEUP_POL_ACTIVE_LOW); /* Enable Wake through External Wake pin0 */ RTCConfigPmicExtWake(RTC_INST_BASE, 0, RTC_EXT_WAKEUP_ENABLE); /* Disable the debounce on RTC External Wake pin0 */ RTCConfigPmicExtWakeDebounce(RTC_INST_BASE, 0, RTC_PMIC_EXT_WAKEUP_DB_EN_DISABLE); /* Clear the external wake status of Wake pin0 */ RTCPmicExtWakeStatusClear(RTC_INST_BASE, 0); /* Enable RTC_PMIC */ RTCConfigPmicPowerEnable(RTC_INST_BASE, RTC_PMIC_PWR_ENABLE); /* Run the RTC. The seconds tick from now on.*/ RTCRun(RTC_INST_BASE); }
int GetVersion(struct cmd_desc *cmddint, struct atom *atoms) { unsigned int arg; SLbHandle hnd = NULL; SLbErr err; SLbVersion ver; struct timespec t; int i; char c, *cp; unsigned int sv; arg = cmddint->pa + 1; if (atoms == (struct atom *) VERBOSE_HELP) { printf("GetVersion: //Show hardware and software versions\n"); return arg; } err = SLbGetStubVersion(&sv); t.tv_sec = sv; t.tv_nsec = 0; printf("StubLibVersion:%s\n",TimeToStr(&t)); if (COMPILE_TIME != 0) { t.tv_sec = COMPILE_TIME; t.tv_nsec = 0; printf("TestPrgVersion:%s\n",TimeToStr(&t)); } hnd = handles[curoph]; err = SLbGetVersion(hnd,module,&ver); if (err) { fprintf(stderr,"GetVersion:%s\n",SLbErrToStr(hnd,err)); printf("GetVersion:Probably error due to handle not opened, or no library\n"); return arg; } t.tv_sec = ver.LibraryVersion; t.tv_nsec = 0; printf("DllLibCompiled:%s\n",TimeToStr(&t)); t.tv_sec = ver.DriverVersion; t.tv_nsec = 0; printf("DriverCompiled:%s\n",TimeToStr(&t)); for (i=0; i<strlen(ver.ModVersion); i++) { c = ver.ModVersion[i]; if ( ((c >= 'A') && (c <= 'Z')) || ((c >= '0') && (c <= '9')) ) continue; ver.ModVersion[i] = 0; break; } printf("ModHwrVersion :%s Module:%d\n",ver.ModVersion,module); err = SLbGetDllVersion(hnd,&cp); if (err) { fprintf(stderr,"GetDllVersion :%s\n",SLbErrToStr(hnd,err)); printf("GetVersion:Can't get DLL library version\n"); return arg; } printf("DllLibVersion :%s\n",cp); return arg; }
const std::string ModuleSpanningTree::MapOperInfo(TreeServer* Current) { time_t secs_up = ServerInstance->Time() - Current->age; return " [Up: " + TimeToStr(secs_up) + (Current->rtt == 0 ? "]" : " Lag: " + ConvToStr(Current->rtt) + "ms]"); }
int msgFileAlreadyExists(const TCHAR* lpFileName, const ArchiveItem* pItem) { WIN32_FIND_DATA fdata; memset(&fdata, 0, sizeof(WIN32_FIND_DATA)); GetFileInfo(lpFileName, &fdata); if ( (fdata.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) == FILE_ATTRIBUTE_DIRECTORY ) return PROCESS_OVERWRITE; FarDialog D(-1, -1, 72, 13); D.SetDialogFlags(FDLG_WARNING); D.DoubleBox(3, 1, 68, 11, _T("Warning")); //0 D.Text(5, 2, 66, _T("File already exists")); //1 D.SetFlags(DIF_CENTERTEXT); D.Text(5, 3, 66, lpFileName); //2 D.SetFlags(DIF_CENTERTEXT); D.Separator(4); //3 string strTemp; string strSize; string strTime; TimeToStr(pItem->ftLastWriteTime, strTime); strSize.Format(_T("%I64u"), pItem->nFileSize); strTemp.Format(_T("%-17s %25.25s %s"), _T("&New"), strSize.GetString(), strTime.GetString()); D.Text(5, 5, strTemp); //4 TimeToStr(fdata.ftLastWriteTime, strTime); strSize.Format(_T("%I64u"), ((unsigned __int64)fdata.nFileSizeHigh << 32)+(unsigned __int64)fdata.nFileSizeLow); strTemp.Format(_T("%-17s %25.25s %s"), _T("E&xisting"), strSize.GetString(), strTime.GetString()); D.Text(5, 6, strTemp); //5 D.Separator(7); //6 D.CheckBox(5, 8, false, _T("&Remember choice")); //7 D.Separator(9); //8 D.Button(0, 10, _T("&Overwrite")); D.SetFlags(DIF_CENTERGROUP); D.DefaultButton(); D.Button(0, 10, _T("&Skip")); D.SetFlags(DIF_CENTERGROUP); D.Button(0, 10, _T("&Cancel")); D.SetFlags(DIF_CENTERGROUP); int nResult = D.Run(); if ( nResult != -1 ) { bool bAll = D.GetResultCheck(7); int nIndex = D.FirstButton(); if ( nResult == nIndex+0 ) return bAll?PROCESS_OVERWRITE_ALL:PROCESS_OVERWRITE; if ( nResult == nIndex+1 ) return bAll?PROCESS_SKIP_ALL:PROCESS_SKIP; if ( nResult == nIndex+2 ) return PROCESS_CANCEL; } return PROCESS_CANCEL; }
/* * call-seq: time_to_str(secondes) -> string * * Format a given duration in human-readable manner. * * Debian::AptPkg.time_to_str(3601) # => '1h 0min 1s' * **/ static VALUE time_to_str(VALUE self, VALUE secondes) { return rb_str_new2(TimeToStr(NUM2INT(secondes)).c_str()); }
static void printconds(edg_wll_QueryRec **cond) { int i, j; int any = 0; char *s; if ( !cond ) { printf("empty\n"); return ; } for ( i = 0; cond[i]; i++ ) { if ( cond[i][0].attr ) { any = 1; if ( i ) printf(" AND ("); else printf("("); } for ( j = 0; cond[i][j].attr; j++ ) { if ( j ) printf(" OR "); printf("%s", edg_wll_QueryAttrNames[cond[i][j].attr]); switch ( cond[i][j].op ) { case EDG_WLL_QUERY_OP_EQUAL: printf("="); break; case EDG_WLL_QUERY_OP_UNEQUAL: printf("<>"); break; case EDG_WLL_QUERY_OP_LESS: printf("<"); break; case EDG_WLL_QUERY_OP_GREATER: printf(">"); break; case EDG_WLL_QUERY_OP_WITHIN: printf("@"); break; case EDG_WLL_QUERY_OP_CHANGED: printf("->"); break; } switch ( cond[i][j].attr ) { case EDG_WLL_QUERY_ATTR_JOBID: case EDG_WLL_QUERY_ATTR_PARENT: s = edg_wlc_JobIdUnparse(cond[i][j].value.j); printf("%s", s); free(s); break; case EDG_WLL_QUERY_ATTR_OWNER: case EDG_WLL_QUERY_ATTR_LOCATION: case EDG_WLL_QUERY_ATTR_DESTINATION: case EDG_WLL_QUERY_ATTR_HOST: case EDG_WLL_QUERY_ATTR_INSTANCE: case EDG_WLL_QUERY_ATTR_USERTAG: case EDG_WLL_QUERY_ATTR_JDL_ATTR: printf("%s", cond[i][j].value.c); break; case EDG_WLL_QUERY_ATTR_STATUS: case EDG_WLL_QUERY_ATTR_DONECODE: case EDG_WLL_QUERY_ATTR_EXITCODE: case EDG_WLL_QUERY_ATTR_RESUBMITTED: case EDG_WLL_QUERY_ATTR_SOURCE: if ( cond[i][j].op == EDG_WLL_QUERY_OP_WITHIN ) printf("[%d,%d]", cond[i][j].value.i, cond[i][j].value2.i); else printf("%d", cond[i][j].value.i); break; case EDG_WLL_QUERY_ATTR_TIME: if ( cond[i][j].op == EDG_WLL_QUERY_OP_WITHIN ) { printf("[%s,", TimeToStr(cond[i][j].value.t.tv_sec)); printf("%s] & state = %d", TimeToStr(cond[i][j].value2.t.tv_sec), cond[i][j].attr_id.state); } else printf("%s & state = %d", TimeToStr(cond[i][j].value.t.tv_sec), cond[i][j].attr_id.state); break; default: break; } } if ( j ) printf(")"); } if ( any ) printf("\n"); }