这篇教程C++ FATAL_ERROR函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中FATAL_ERROR函数的典型用法代码示例。如果您正苦于以下问题:C++ FATAL_ERROR函数的具体用法?C++ FATAL_ERROR怎么用?C++ FATAL_ERROR使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了FATAL_ERROR函数的27个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: WSAStartupbool NetSystem::Init(){ WSAData wsa_data; int error = WSAStartup(MAKEWORD(2, 2), &wsa_data); if (error == 0) { NetMessageDefinition pingDef; pingDef.m_callback = PingCallback; pingDef.m_name = "ping"; pingDef.m_options |= eNMO_Connectionless; NetMessage::RegisterMessageDefinition(0, pingDef); NetMessageDefinition pongDef; pongDef.m_callback = PongCallback; pongDef.m_name = "pong"; pongDef.m_options |= eNMO_Connectionless; NetMessage::RegisterMessageDefinition(1, pongDef); NetMessageDefinition heartbeatDef; heartbeatDef.m_callback = HeartbeatCallback; heartbeatDef.m_name = "heartbeat"; NetMessage::RegisterMessageDefinition(2, heartbeatDef); NetMessageDefinition ackDef; ackDef.m_callback = AckCallback; ackDef.m_name = "ack"; NetMessage::RegisterMessageDefinition(3, ackDef); NetMessageDefinition joinRequest; joinRequest.m_callback = JoinRequestCallback; joinRequest.m_name = "joinrequest"; joinRequest.m_options |= eNMO_Reliable; joinRequest.m_options |= eNMO_Connectionless; NetMessage::RegisterMessageDefinition(4, joinRequest); NetMessageDefinition joinAccept; joinAccept.m_callback = JoinAcceptCallback; joinAccept.m_name = "joinaccept"; joinAccept.m_options |= eNMO_Reliable; NetMessage::RegisterMessageDefinition(5, joinAccept); NetMessageDefinition joinDeny; joinDeny.m_callback = JoinDenyCallback; joinDeny.m_name = "joindeny"; joinDeny.m_options |= eNMO_Connectionless; NetMessage::RegisterMessageDefinition(6, joinDeny); NetMessageDefinition leave; leave.m_callback = LeaveCallback; leave.m_name = "leave"; NetMessage::RegisterMessageDefinition(7, leave); NetMessageDefinition startTest; startTest.m_callback = StartTestCallback; startTest.m_name = "starttest"; startTest.m_options |= eNMO_Reliable; NetMessage::RegisterMessageDefinition(8, startTest); NetMessageDefinition inOrderTest; inOrderTest.m_callback = InOrderTestCallback; inOrderTest.m_name = "inordertest"; inOrderTest.m_options |= eNMO_Reliable; inOrderTest.m_options |= eNMO_InOrder; NetMessage::RegisterMessageDefinition(9, inOrderTest); NetMessageDefinition forceTest; forceTest.m_callback = ForceTestCallback; forceTest.m_name = "forcetest"; forceTest.m_options |= eNMO_Reliable; NetMessage::RegisterMessageDefinition(10, forceTest); return true; } else { FATAL_ERROR("Could not setup WSA System"); } //Create netmessage definitions here}
开发者ID:2bitdreamer,项目名称:SD6_Engine,代码行数:79,
示例2: numericGetLongValue /** * @brief For Numeric TypeInstances, get this TypeInstance's value as an * int64_t. * @warning supportsNumericInterface() must be true and isNull() must be * false for this method to be usable. * * @return The value as an int64_t. **/ virtual std::int64_t numericGetLongValue() const { FATAL_ERROR("Used a Numeric interface method on a non-numeric TypeInstance."); }
开发者ID:saketj,项目名称:quickstep-storage-explorer,代码行数:11,
示例3: numericGetDoubleValue /** * @brief For Numeric TypeInstances, get this TypeInstance's value as a C++ * double. * @warning supportsNumericInterface() must be true and isNull() must be * false for this method to be usable. * * @return The value as a double. **/ virtual double numericGetDoubleValue() const { FATAL_ERROR("Used a Numeric interface method on a non-numeric TypeInstance."); }
开发者ID:saketj,项目名称:quickstep-storage-explorer,代码行数:11,
示例4: pm_execute/*** pm_execute* @params* int should_wait - Indicates if this execute should be inline or asynchronous* const char* command - The command to run* const char* cd - Run in this directory unless it's a NULL pointer* int nice - Special nice level* const char** env - Environment variables to run in the shell* @output pid_t pid - output pid of the new process**/pid_t pm_execute( int should_wait, const char* command, const char *cd, int nice, const char** env, int *child_stdin, const char* p_stdout, const char *p_stderr) { // Setup execution char **command_argv = {0}; int command_argc = 0; int running_script = 0; int countdown = 200; // If there is nothing here, don't run anything :) if (strlen(command) == 0) return -1; char* chomped_string = str_chomp(command); char* safe_chomped_string = str_safe_quote(chomped_string); if (expand_command((const char*)safe_chomped_string, &command_argc, &command_argv, &running_script, env)) ; command_argv[command_argc] = 0; // Now actually RUN it! pid_t pid; #if USE_PIPES int child_fd[2]; if ( pipe(child_fd) < 0 ) {// Create a pipe to the child (do we need this? I doubt it) perror("pipe failed"); } // Setup the stdin so the parent can communicate! (*child_stdin) = child_fd[0];#endif // Let's name it so we can get to it later int child_dev_null; #if DEBUG if ((child_dev_null = open("debug.log", O_WRONLY|O_CREAT|O_TRUNC,S_IRUSR|S_IWUSR|S_IRGRP|S_IROTH)) < 0) { syslog(LOG_ERR, "babysitter (fatal): Could not open debug.log: errno: %d/n", errno); };#else if ((child_dev_null = open("/dev/null", O_RDWR)) < 0) { syslog(LOG_ERR, "babysitter (fatal): Could not open /dev/null: errno: %d/n", errno); };#endif // Setup fork pm_setup_fork(); if (should_wait) pid = vfork(); else pid = fork(); switch (pid) { case -1: return -1; case 0: { // Child process pm_setup_child(); if (cd != NULL && cd[0] != '/0') safe_chdir(cd); else safe_chdir("/tmp"); int child_stdout, child_stderr; // Set everything to dev/null first child_stdout = child_stderr = child_dev_null; // If we've passed in a stdout filename, then open it if(p_stdout) if ((child_stdout = open(p_stdout, O_WRONLY|O_CREAT|O_TRUNC,S_IRUSR|S_IWUSR|S_IRGRP|S_IROTH)) < 0) { perror("child stdout"); child_stdout = child_dev_null; } // If we've been passed a stderr filename, then open that if(p_stderr) if ((child_stderr = open(p_stderr, O_WRONLY|O_CREAT|O_TRUNC,S_IRUSR|S_IWUSR|S_IRGRP|S_IROTH)) < 0) { perror("child stderr"); child_stderr = child_dev_null; } // Parent doesn't write anything to the child, so just close this right away // REDIRECT TO DEV/NULL // Replace the stdout/stderr with the child_write fd#if USE_PIPES if (dup2(child_fd[0], STDIN_FILENO) < 0) FATAL_ERROR("could not dup STDIN_FILENO", -1); close(child_fd[1]); // We are using a different stdout#endif#if DEBUG//.........这里部分代码省略.........
开发者ID:alepharchives,项目名称:babysitter,代码行数:101,
示例5: FATAL_ERRORstd::string PlayerSAO::getStaticData(){ FATAL_ERROR("Deprecated function (?)"); return "";}
开发者ID:gongfuPanada,项目名称:minetest,代码行数:5,
示例6: FATAL_ERROROCLAcceleratorMatrixCOO<ValueType>::OCLAcceleratorMatrixCOO() { // no default constructors FATAL_ERROR(__FILE__, __LINE__);}
开发者ID:LeiDai,项目名称:agros2d,代码行数:6,
示例7: pivoid SampleLoopTask::Task(){ int cnt = 0; int region; int attempt = 0; static int dout = 1; static double error = 0; int last_status = 0; double pos_prev = 0; double pCmd_prev = 0; double vCmd_prev = 0; int obj_ang_index = 0; // to keep continuous angle value when acrossing pi(or -pi). uint64_t cycle, cycle_prev; // for acceleration calculation double u = 0; double alpha = 0; double DuDeta1Bar =0; double DuDeta2 =0; double DalphaDeta1Bar =0; double DalphaDeta2 =0; double eta1Bar = 0; double z = 0; // to use eta2D in calculation of shD double eta2_prev = 0; double eta2D = 0; double eta2D_prev = 0; double elapsedSec = 0; //test double feedforwardVal = 0; uint64_t cycle1, cycle2; while(!lost){ TimerWait(); ncycles = ClockCycles(); sec=(double)(ncycles - ncycles_prev)/cps; ncycles_prev = ncycles; TimingProcess(); // Read Inputs HW->ProcessInput(); // all digital & analog, encoders reading. // Get status of camera last_status = HW->ReadDigitalBit(IoHardware::FRAME_STATUS); // Send out pulse to trigger camera HW->WriteDigitalBit(IoHardware::CAMERA_TRIGGER, 1); HW->WriteDigitalBit(IoHardware::CAMERA_TRIGGER, 0); // test //cycle1 = ClockCycles(); if(camera) {// && !lost){ // Wait for camera to process data, with timeout counter while(HW->ReadDigitalBit(IoHardware::FRAME_STATUS) == last_status){ if(++attempt == (int)(6.0e5/SAMPLE_RATE)) { // 5.0e5 must be found out by experiments to give the smallest time to determine an error status HW->SetAnalogOut(IoHardware::AMP_SIGNAL, 0.0); HW->WriteDigitalBit(IoHardware::MOTOR_ENABLE, MOTOR_OFF); HW->motorStatus = MOTOR_OFF; lost = 1; FATAL_ERROR("Frame not received -"); //strcpy(err_msg, "Frame not received -"); // // not work this way. } } attempt = 0; vnum[0] = -99; int n = VNET->Recv(); region = (int)vnum[0]; switch(region){ case 0: //ROI_0: obj.x0 = vnum[1]; //mm obj.y0 = vnum[2]; //mm break; case 1: //ROI_1: obj.x1 = vnum[1]; //mm obj.y1 = vnum[2]; //mm break; default: HW->SetAnalogOut(IoHardware::AMP_SIGNAL, 0.0); HW->WriteDigitalBit(IoHardware::MOTOR_ENABLE, MOTOR_OFF); HW->motorStatus = MOTOR_OFF; printf("roi-vnum[0]:%d/n", region); FATAL_ERROR("Object lost -"); lost = 1; } obj.x = (obj.x0 + obj.x1)/2/1000; // convert to m obj.y = (obj.y0 + obj.y1)/2/1000; double obj_raw_angle = atan2(obj.y1-obj.y0, obj.x1-obj.x0); // within -pi to pi//.........这里部分代码省略.........
开发者ID:JoshMarino,项目名称:lims-hsv-system,代码行数:101,
示例8: load_confvoid load_conf(void){ FILE *fc; char line[128]; char *p, *q, **tmp; int lineno = 0; struct conf_entry *curr_section = NULL; void *value = NULL; /* initialize the structures */ init_structures(); DEBUG_MSG("load_conf"); /* the user has specified an alternative config file */ if (GBL_CONF->file) { DEBUG_MSG("load_conf: alternative config: %s", GBL_CONF->file); fc = fopen(GBL_CONF->file, FOPEN_READ_TEXT); ON_ERROR(fc, NULL, "Cannot open %s", GBL_CONF->file); } else { /* errors are handled by the function */ fc = open_data("etc", ETTER_CONF, FOPEN_READ_TEXT); ON_ERROR(fc, NULL, "Cannot open %s", ETTER_CONF); } /* read the file */ while (fgets(line, 128, fc) != 0) { /* update the line count */ lineno++; /* trim out the comments */ if ((p = strchr(line, '#'))) *p = '/0'; /* trim out the new line */ if ((p = strchr(line, '/n'))) *p = '/0'; q = line; /* trim the initial spaces */ while (q < line + sizeof(line) && *q == ' ') q++; /* skip empty lines */ if (line[0] == '/0' || *q == '/0') continue; /* here starts a new section [...] */ if (*q == '[') { /* remove the square brackets */ if ((p = strchr(line, ']'))) *p = '/0'; else FATAL_ERROR("Missing ] in %s line %d", ETTER_CONF, lineno); p = q + 1; DEBUG_MSG("load_conf: SECTION: %s", p); /* get the pointer to the right structure */ if ( (curr_section = search_section(p)) == NULL) FATAL_ERROR("Invalid section in %s line %d", ETTER_CONF, lineno); /* read the next line */ continue; } /* variable outside a section */ if (curr_section == NULL) FATAL_ERROR("Entry outside a section in %s line %d", ETTER_CONF, lineno); /* sanity check */ if (!strchr(q, '=')) FATAL_ERROR("Parse error %s line %d", ETTER_CONF, lineno); p = q; /* split the entry name from the value */ do { if (*p == ' ' || *p == '=') { *p = '/0'; break; } } while (p++ < line + sizeof(line) ); /* move p to the value */ p++; do { if (*p != ' ' && *p != '=') break; } while (p++ < line + sizeof(line) ); /* * if it is the "dissector" section, * do it in a different way */ if (curr_section == (struct conf_entry *)&dissectors) {//.........这里部分代码省略.........
开发者ID:secpersu,项目名称:dsploit,代码行数:101,
示例9: ParseFilestatic bool ParseFile(FILE *pFile) { uint8_t size; if(pFile == NULL) { FATAL_ERROR(); return false; } fread(&size, sizeof(char), 1, pFile); fread(room.title, sizeof(char), size, pFile); room.title[size] = '/0'; fread(&size, sizeof(char), 1, pFile); if(size == 0) { room.itemRequirements = 0; } else { fread(&room.itemRequirements, sizeof(char), size, pFile); } while(!FindInInventory(room.itemRequirements) || room.itemRequirements) { fread(&size, sizeof(char), 1, pFile); fseek(pFile, size, SEEK_CUR); fread(&size, sizeof(char), 1, pFile); fread(&room.itemsContained, sizeof(char), size, pFile); fseek(pFile, 4, SEEK_CUR); fread(&size, sizeof(char), 1, pFile); if(size == 0) { room.itemRequirements = 0; } else { fread(&room.itemRequirements, sizeof(char), size, pFile); } } fread(&size, sizeof(char), 1, pFile); fread(room.description, sizeof(char), size, pFile); room.description[size] = '/0'; fread(&size, sizeof(char), 1, pFile); if(size != 0) { fread(&room.itemsContained, sizeof(char), size, pFile); AddToInventory(room.itemsContained); } else { room.itemsContained = 0; } fread(&room.north, sizeof(uint8_t), 1, pFile); fread(&room.east, sizeof(uint8_t), 1, pFile); fread(&room.south, sizeof(uint8_t), 1, pFile); fread(&room.west, sizeof(uint8_t), 1, pFile); room.roomExits = 0; if(room.north) { room.roomExits |= GAME_ROOM_EXIT_NORTH_EXISTS; } if(room.east) { room.roomExits |= GAME_ROOM_EXIT_NORTH_EXISTS; } if(room.south) { room.roomExits |= GAME_ROOM_EXIT_SOUTH_EXISTS; } if(room.west) { room.roomExits |= GAME_ROOM_EXIT_WEST_EXISTS; } fclose(pFile); return true;}
开发者ID:InvaderZim19,项目名称:rpg-arduino-adv,代码行数:68,
示例10: MorseCheckEvents/** * This function calls ButtonsCheckEvents() once per call and returns which, if any, * of the Morse code events listed in the enum above have been encountered. It checks for BTN4 * events in its input and should be called at 100Hz so that the timing works. The * length that BTN4 needs to be held down for a dot is >= 0.25s and < 0.50s with a dash being a button * down event for >= 0.5s. The button uptime various between dots/dashes (>= .5s), letters * (>= 1s), and words (>= 2s). * * @note This function assumes that the buttons are all unpressed at startup, so that the first * event it will see is a BUTTON_EVENT_*DOWN. * * So pressing the button for 0.1s, releasing it for 0.1s, pressing it for 0.3s, and then waiting * will decode the string '.-' (A). It will trigger the following order of events: * 9 MORSE_EVENT_NONEs, 1 MORSE_EVENT_DOT, 39 MORSE_EVENT_NONEs, a MORSE_EVENT_DASH, 69 * MORSE_EVENT_NONEs, a MORSE_EVENT_END_CHAR, and then MORSE_EVENT_INTER_WORDs. * * @return The MorseEvent that occurred. */MorseEvent MorseCheckEvents(void) { switch (myState) { case(WAITING): {// if in the state of waiting if (ButtonsCheckEvents() == BUTTON_EVENT_4DOWN) { myState = DOT; myCount = 0; } return MORSE_EVENT_NONE; break; } case(DOT): { // in the state of dot myCount += 1; if (myCount >= MORSE_EVENT_LENGTH_DOWN_DOT) { myState = DASH; } if (ButtonsCheckEvents() == BUTTON_EVENT_4UP) { // Chenge into Inter letter myState = INTER_LETTER; myCount = 0; return MORSE_EVENT_DOT; } return MORSE_EVENT_NONE; break; } case(DASH): { //in Dash state if (ButtonsCheckEvents() == BUTTON_EVENT_4UP) { // change my state to Inter letter myState = INTER_LETTER; myCount = 0; return MORSE_EVENT_DASH; } return MORSE_EVENT_NONE; break; } case(INTER_LETTER): { //In the inter letter state myCount += 1; if (myCount > MORSE_EVENT_LENGTH_UP_INTER_WORD) { //if inter letter time out, we go to myState = WAITING; return MORSE_EVENT_INTER_WORD; } else if (ButtonsCheckEvents() == BUTTON_EVENT_4DOWN) { // if (myCount > MORSE_EVENT_LENGTH_UP_INTER_LETTER) { myCount = 0; myState = DOT; // return inter ltter event return MORSE_EVENT_INTER_LETTER; } myCount = 0; myState = DOT; } return MORSE_EVENT_NONE; break; } default: { //In the deflaut state FATAL_ERROR(); break; } }}
开发者ID:UCSC-WilliamLu,项目名称:CMPE013,代码行数:90,
示例11: mainint main(void){ // Watchdog Timer Enabled/disabled by user software // (LPRC can be disabled by clearing SWDTEN bit in RCON registe // Configure Oscillator to operate the device at 40Mhz // Fosc= Fin*M/(N1*N2), Fcy=Fosc/2 // Fosc= 8M*40/(2*2)=80Mhz for 8M input clock PLLFBD = 38; // M=40 CLKDIVbits.PLLPOST = 0; // N1=2 CLKDIVbits.PLLPRE = 0; // N2=2 OSCTUN = 0; // Tune FRC oscillator, if FRC is used RCONbits.SWDTEN = 0; /* Disable Watch Dog Timer*/ // Clock switch to incorporate PLL __builtin_write_OSCCONH(0x03); // Initiate Clock Switch to Primary // Oscillator with PLL (NOSC=0b011) __builtin_write_OSCCONL(0x01); // Start clock switching while (OSCCONbits.COSC != 0b011); // Wait for Clock switch to occur while (OSCCONbits.LOCK != 1) { }; /* Wait for PLL to lock*/// bufferPointer = NULL; Uart2Init(InterruptRoutine); if (!CB_Init(&circBuf, cbData, CB_SIZE)) FATAL_ERROR(); // Generate a fake input to record to the circular buffer // give beginning and end special characters unsigned char goodData[512]; int i; for (i=0; i<512; i++) { goodData[i] = (char)i; } goodSum = checksum(goodData, 512); Uart2PrintStr("Begin./n"); file = NewSDInit("newfile.txt"); int SDConnected = 0; while(1) {// if (bufferPointer != NULL) { TODO implement this?// CB_WriteMany(&circBuf, bufferPointer, UART2_BUFFER_SIZE, 1); // the 1 is arbitrary// bufferPointer = NULL;// } if (SD_IN) { // if the board was just plugged in try to reinitialize if(!SDConnected) { MEDIA_INFORMATION * Minfo; do { Minfo = MDD_MediaInitialize(); } while(Minfo->errorCode == MEDIA_CANNOT_INITIALIZE); SDConnected = 1; } // When we are connected and initialized, poll the buffer, if there // is data, write it. unsigned char outData[SD_SECTOR_SIZE]; if (CB_PeekMany(&circBuf, outData, SD_SECTOR_SIZE)){ if(NewSDWriteSector(file, outData)){ // Remove the data we just written. if(checksum(outData, 512) != goodSum) { FATAL_ERROR(); } CB_Remove(&circBuf, SD_SECTOR_SIZE); } } } else { SDConnected = 0; } }}
开发者ID:FrauBluher,项目名称:SLUGS-Logger,代码行数:75,
示例12: concatenate/* * concatenate two (or more) files into one single file */void concatenate(int argc, char **argv){ int zerr; gzFile fd; struct log_global_header hdr, tmp; memset(&hdr, 0, sizeof(struct log_global_header)); /* open the output file for writing */ fd = gzopen(GBL_LOGFILE, "wb"); ON_ERROR(fd, NULL, "%s", gzerror(fd, &zerr)); /* * use GBL_LOG_FD here so the get_header function * will use this file */ GBL_LOG_FD = gzopen(argv[argc], "rb"); ON_ERROR(GBL_LOG_FD, NULL, "%s", gzerror(GBL_LOG_FD, &zerr)); /* get the file header */ if (get_header(&hdr) != E_SUCCESS) FATAL_ERROR("Invalid log file (%s)", argv[argc]); /* write the header */ put_header(fd, &hdr); printf("Concatenating file [%s]", argv[argc]); /* copy the first file into the output */ dump_file(fd, &hdr); /* move the pointer to the next file */ argc++; /* cicle thru the file list */ while(argv[argc] != NULL) { GBL_LOG_FD = gzopen(argv[argc], "rb"); ON_ERROR(GBL_LOG_FD, NULL, "%s", gzerror(GBL_LOG_FD, &zerr)); /* get the file header */ if (get_header(&tmp) != E_SUCCESS) FATAL_ERROR("Invalid log file (%s)", argv[argc]); /* check if the files are compatible */ if (hdr.type != tmp.type) FATAL_ERROR("Cannot concatenate different type of file"); printf("Concatenating file [%s]", argv[argc]); /* concatenate this file */ dump_file(fd, &tmp); gzclose(GBL_LOG_FD); argc++; } gzclose(fd); printf("/nAll files concatenated into: %s/n/n", GBL_LOGFILE); exit(0);}
开发者ID:LocutusOfBorg,项目名称:ettercap,代码行数:66,
示例13: initializePathsvoid initializePaths(){#if RUN_IN_PLACE char buf[BUFSIZ]; infostream << "Using relative paths (RUN_IN_PLACE)" << std::endl; bool success = getCurrentExecPath(buf, sizeof(buf)) || getExecPathFromProcfs(buf, sizeof(buf)); if (success) { pathRemoveFile(buf, DIR_DELIM_CHAR); std::string execpath(buf); path_share = execpath + DIR_DELIM ".."; path_user = execpath + DIR_DELIM ".."; if (detectMSVCBuildDir(execpath)) { path_share += DIR_DELIM ".."; path_user += DIR_DELIM ".."; } } else { errorstream << "Failed to get paths by executable location, " "trying cwd" << std::endl; if (!getCurrentWorkingDir(buf, sizeof(buf))) FATAL_ERROR("Ran out of methods to get paths"); size_t cwdlen = strlen(buf); if (cwdlen >= 1 && buf[cwdlen - 1] == DIR_DELIM_CHAR) { cwdlen--; buf[cwdlen] = '/0'; } if (cwdlen >= 4 && !strcmp(buf + cwdlen - 4, DIR_DELIM "bin")) pathRemoveFile(buf, DIR_DELIM_CHAR); std::string execpath(buf); path_share = execpath; path_user = execpath; } path_cache = path_user + DIR_DELIM + "cache";#else infostream << "Using system-wide paths (NOT RUN_IN_PLACE)" << std::endl; if (!setSystemPaths()) errorstream << "Failed to get one or more system-wide path" << std::endl; // Initialize path_cache // First try $XDG_CACHE_HOME/PROJECT_NAME const char *cache_dir = getenv("XDG_CACHE_HOME"); const char *home_dir = getenv("HOME"); if (cache_dir) { path_cache = std::string(cache_dir) + DIR_DELIM + PROJECT_NAME; } else if (home_dir) { // Then try $HOME/.cache/PROJECT_NAME path_cache = std::string(home_dir) + DIR_DELIM + ".cache" + DIR_DELIM + PROJECT_NAME; } else { // If neither works, use $PATH_USER/cache path_cache = path_user + DIR_DELIM + "cache"; } // Migrate cache folder to new location if possible migrateCachePath();#endif infostream << "Detected share path: " << path_share << std::endl; infostream << "Detected user path: " << path_user << std::endl; infostream << "Detected cache path: " << path_cache << std::endl;#if USE_GETTEXT bool found_localedir = false;# ifdef STATIC_LOCALEDIR if (STATIC_LOCALEDIR[0] && fs::PathExists(STATIC_LOCALEDIR)) { found_localedir = true; path_locale = STATIC_LOCALEDIR; infostream << "Using locale directory " << STATIC_LOCALEDIR << std::endl; } else { path_locale = getDataPath("locale"); if (fs::PathExists(path_locale)) { found_localedir = true; infostream << "Using in-place locale directory " << path_locale << " even though a static one was provided " << "(RUN_IN_PLACE or CUSTOM_LOCALEDIR)." << std::endl; } }# else path_locale = getDataPath("locale"); if (fs::PathExists(path_locale)) { found_localedir = true; }# endif if (!found_localedir) { warningstream << "Couldn't find a locale directory!" << std::endl; }#endif // USE_GETTEXT}
开发者ID:HybridDog,项目名称:minetest,代码行数:99,
示例14: parse_optionsvoid parse_options(int argc, char **argv){ int c; static struct option long_options[] = { { "help", no_argument, NULL, 'h' }, { "version", no_argument, NULL, 'v' }, { "iface", required_argument, NULL, 'i' }, { "iflist", no_argument, NULL, 'I' }, { "netmask", required_argument, NULL, 'n' }, { "write", required_argument, NULL, 'w' }, { "read", required_argument, NULL, 'r' }, { "pcapfilter", required_argument, NULL, 'f' }, { "reversed", no_argument, NULL, 'R' }, { "proto", required_argument, NULL, 't' }, { "plugin", required_argument, NULL, 'P' }, { "filter", required_argument, NULL, 'F' }, { "superquiet", no_argument, NULL, 'Q' }, { "quiet", no_argument, NULL, 'q' }, { "script", required_argument, NULL, 's' }, { "silent", no_argument, NULL, 'z' }, { "unoffensive", no_argument, NULL, 'u' }, { "load-hosts", required_argument, NULL, 'j' }, { "save-hosts", required_argument, NULL, 'k' }, { "wep-key", required_argument, NULL, 'W' }, { "config", required_argument, NULL, 'a' }, { "dns", no_argument, NULL, 'd' }, { "regex", required_argument, NULL, 'e' }, { "visual", required_argument, NULL, 'V' }, { "ext-headers", no_argument, NULL, 'E' }, { "log", required_argument, NULL, 'L' }, { "log-info", required_argument, NULL, 'l' }, { "log-msg", required_argument, NULL, 'm' }, { "compress", no_argument, NULL, 'c' }, { "text", no_argument, NULL, 'T' }, { "curses", no_argument, NULL, 'C' }, { "gtk", no_argument, NULL, 'G' }, { "daemon", no_argument, NULL, 'D' }, { "mitm", required_argument, NULL, 'M' }, { "only-mitm", no_argument, NULL, 'o' }, { "bridge", required_argument, NULL, 'B' }, { "promisc", no_argument, NULL, 'p' }, { 0 , 0 , 0 , 0} };#ifdef HAVE_GTK if (strcmp(argv[0], "ettercap-gtk") == 0) select_gtk_interface();#endif#ifdef HAVE_NCURSES if (strcmp(argv[0], "ettercap-curses") == 0) select_curses_interface();#endif if (strcmp(argv[0], "ettercap-text") == 0) select_text_interface(); for (c = 0; c < argc; c++) DEBUG_MSG("parse_options -- [%d] [%s]", c, argv[c]); /* OPTIONS INITIALIZATION */ GBL_PCAP->promisc = 1; GBL_FORMAT = &ascii_format;/* OPTIONS INITIALIZED */ optind = 0; while ((c = getopt_long (argc, argv, "a:B:CchDdEe:F:f:GhIi:j:k:L:l:M:m:n:oP:pQqiRr:s:Tt:UuV:vW:w:z", long_options, (int *)0)) != EOF) { switch (c) { case 'M': GBL_OPTIONS->mitm = 1; if (mitm_set(optarg) != ESUCCESS) FATAL_ERROR("MITM method '%s' not supported.../n", optarg); break; case 'o': GBL_OPTIONS->only_mitm = 1; //select_text_interface(); break; case 'B': GBL_OPTIONS->iface_bridge = strdup(optarg); set_bridge_sniff(); break; //.........这里部分代码省略.........
开发者ID:bonsaiviking,项目名称:ettercap,代码行数:101,
示例15: assertvoid OCLAcceleratorMatrixCOO<ValueType>::CopyTo(BaseMatrix<ValueType> *dst) const { OCLAcceleratorMatrixCOO<ValueType> *ocl_cast_mat; HostMatrix<ValueType> *host_cast_mat; // copy only in the same format assert(this->get_mat_format() == dst->get_mat_format()); // OCL to OCL copy if ((ocl_cast_mat = dynamic_cast<OCLAcceleratorMatrixCOO<ValueType>*> (dst)) != NULL) { ocl_cast_mat->set_backend(this->local_backend_); if (this->get_nnz() == 0) ocl_cast_mat->AllocateCOO(dst->get_nnz(), dst->get_nrow(), dst->get_ncol() ); assert((this->get_nnz() == dst->get_nnz()) && (this->get_nrow() == dst->get_nrow()) && (this->get_ncol() == dst->get_ncol()) ); if (this->get_nnz() > 0) { // Copy object from device to device memory (internal copy) ocl_dev2dev<int>(this->get_nnz(), // size this->mat_.row, // src ocl_cast_mat->mat_.row, // dst OCL_HANDLE(this->local_backend_.OCL_handle)->OCL_cmdQueue ); // Copy object from device to device memory (internal copy) ocl_dev2dev<int>(this->get_nnz(), // size this->mat_.col, // src ocl_cast_mat->mat_.col, // dst OCL_HANDLE(this->local_backend_.OCL_handle)->OCL_cmdQueue ); // Copy object from device to device memory (internal copy) ocl_dev2dev<ValueType>(this->get_nnz(), // size this->mat_.val, // src ocl_cast_mat->mat_.val, // dst OCL_HANDLE(this->local_backend_.OCL_handle)->OCL_cmdQueue ); } } else { //OCL to CPU if ((host_cast_mat = dynamic_cast<HostMatrix<ValueType>*> (dst)) != NULL) { this->CopyToHost(host_cast_mat); } else { LOG_INFO("Error unsupported OCL matrix type"); this->info(); dst->info(); FATAL_ERROR(__FILE__, __LINE__); } }}
开发者ID:LeiDai,项目名称:agros2d,代码行数:62,
示例16: mainint main(int argc, char *argv[]){ int ret; /* etterlog copyright */ globals_alloc(); fprintf(stdout, "/n" EC_COLOR_BOLD "%s %s" EC_COLOR_END " copyright %s %s/n/n", GBL_PROGRAM, EC_VERSION, EC_COPYRIGHT, EC_AUTHORS); /* allocate the global target */ SAFE_CALLOC(GBL_TARGET, 1, sizeof(struct target_env)); /* initialize to all target */ GBL_TARGET->all_mac = 1; GBL_TARGET->all_ip = 1; GBL_TARGET->all_port = 1; /* getopt related parsing... */ parse_options(argc, argv); /* get the global header */ ret = get_header(&GBL->hdr); if (ret == -EINVALID) FATAL_ERROR("Invalid log file"); fprintf(stderr, "Log file version : %s/n", GBL->hdr.version); /* display the date. ec_ctime() has no newline at end. */ fprintf(stderr, "Timestamp : %s [%lu]/n", ec_ctime(&GBL->hdr.tv), GBL->hdr.tv.tv_usec); fprintf(stderr, "Type : %s/n/n", (GBL->hdr.type == LOG_PACKET) ? "LOG_PACKET" : "LOG_INFO" ); /* analyze the logfile */ if (GBL->analyze) analyze(); /* rewind the log file and skip the global header */ gzrewind(GBL_LOG_FD); get_header(&GBL->hdr); /* create the connection table (respecting the filters) */ if (GBL->connections) conn_table_create(); /* display the connection table */ if (GBL->connections && !GBL->decode) conn_table_display(); /* extract files from the connections */ if (GBL->decode) conn_decode(); /* not interested in the content... only analysis */ if (GBL->analyze || GBL->connections) return 0; /* display the content of the logfile */ display(); globals_free(); return 0;}
开发者ID:0x0mar,项目名称:ettercap,代码行数:62,
示例17: read_directory_filestatic voidread_directory_file (void){ char *strp; FILE *fp; char buf[512]; /* FIXME: use a symbol */ static char *path = NULL; if (path == NULL) path = xmalloc (PATH_MAX); time (&time_now); if (listed_incremental_option[0] != '/'#if DOSWIN /* The case of DOSWIN absolute file name with a drive letter. */ && !(listed_incremental_option[0] && listed_incremental_option[1] == ':')#endif ) { char *current_directory = xgetcwd (); if (!current_directory) FATAL_ERROR ((0, 0, _("Could not get current directory"))); listed_incremental_option = concat_with_slash (current_directory, listed_incremental_option); } fp = fopen (listed_incremental_option, "r"); if (fp == 0 && errno != ENOENT) { ERROR ((0, errno, _("Cannot open %s"), listed_incremental_option)); return; } if (!fp) return; fgets (buf, sizeof (buf), fp); /* FIXME: Using newer_ctime_option as a first time flag looks fairly dubious to me! So, using -N with incremental might be buggy just because of the next few lines. I saw a few unexplained, almost harsh advices from FSF people about *not* using -N with incremental dumps, and here might lie (part of) the reason. */ if (!newer_ctime_option) { time_option_threshold = atol (buf); newer_ctime_option = true; } while (fgets (buf, sizeof (buf), fp)) { dev_t device_number; ino_t inode_number; strp = &buf[strlen (buf)]; if (strp[-1] == '/n') strp[-1] = '/0'; /* FIXME: For files ending with an incomplete line, maybe a NUL might be missing, here... */ strp = buf; device_number = atol (strp); while (ISDIGIT (*strp)) strp++; inode_number = atol (strp); while (ISSPACE (*strp)) strp++; while (ISDIGIT (*strp)) strp++; strp++; unquote_string (strp); note_directory (strp, device_number, inode_number, NULL); } if (fclose (fp) == EOF) ERROR ((0, errno, "%s", listed_incremental_option));}
开发者ID:pinard,项目名称:paxutils,代码行数:74,
示例18: parse_options//.........这里部分代码省略......... GBL.only_source = 1; break; case 'd': GBL.only_dest = 1; break; case 'k': GBL.color = 1; break; case 'r': GBL.reverse = 1; break; case 't': GBL_TARGET->proto = strdup(optarg); break; case 'n': GBL.no_headers = 1; break; case 'm': GBL.showmac = 1; break; case 'i': GBL.showclient = 1; break; case 'I': if (inet_aton(optarg, &ip) == 0) { FATAL_ERROR("Invalid client ip address"); return; } ip_addr_init(&GBL.client, AF_INET, (u_char *)&ip); break; case 'l': GBL.only_local = 1; break; case 'L': GBL.only_remote = 1; break; case 'u': GBL.user = strdup(optarg); break; case 'p': GBL.passwords = 1; break; case 'e': set_display_regex(optarg); break; case 'o': GBL_LOGFILE = strdup(optarg); break; case 'C': GBL.concat = 1; break;
开发者ID:Alex-Nabu,项目名称:ettercap,代码行数:67,
示例19: FATAL_ERRORvoid PlayerSAO::getStaticData(std::string *result) const{ FATAL_ERROR("Deprecated function");}
开发者ID:MultiCraftProject,项目名称:MultiCraft,代码行数:4,
示例20: FATAL_ERROR/** * * @author Petr Djakow */void Utils::reuseSocketAddr(int sockfd){ int opt = 1; if(setsockopt(sockfd, SOL_SOCKET, SO_REUSEADDR, &opt, sizeof(opt)) == -1) FATAL_ERROR(("Could not reuse socket addr"));}
开发者ID:azevedo-252,项目名称:msc-thesis,代码行数:10,
示例21: stdin_read_completestatic void stdin_read_complete(GObject *src, GAsyncResult *res, gpointer data){ char *s, *ep; GError *err = NULL; gsize len; s = g_data_input_stream_read_line_finish(G_DATA_INPUT_STREAM(src), res, &len, &err); if (!s) { if (err) { FATAL_ERROR("Reading from stdin: %s/n", err->message); g_error_free(err); return; } switch (state) { case STATE_WAITING_FOR_BUS_N_DEV: FATAL_ERROR("EOF while waiting for bus and device num/n"); break; case STATE_WAITING_FOR_POL_KIT: ERROR("Cancelled while waiting for authorization/n"); break; case STATE_WAITING_FOR_STDIN_EOF: cleanup(); break; } return; } switch (state) { case STATE_WAITING_FOR_BUS_N_DEV: busnum = strtol(s, &ep, 10); if (!isspace(*ep)) { FATAL_ERROR("Invalid busnum / devnum: %s/n", s); break; } devnum = strtol(ep, &ep, 10); if (*ep != '/0') { FATAL_ERROR("Invalid busnum / devnum: %s/n", s); break; } /* * The set_facl() call is a no-op for root, so no need to ask PolKit * and then if ok call set_facl(), when called by a root process. */ if (getuid() != 0) { polkit_cancellable = g_cancellable_new(); polkit_authority_check_authorization( authority, subject, "org.spice-space.lowlevelusbaccess", NULL, POLKIT_CHECK_AUTHORIZATION_FLAGS_ALLOW_USER_INTERACTION, polkit_cancellable, (GAsyncReadyCallback)check_authorization_cb, NULL); state = STATE_WAITING_FOR_POL_KIT; } else { fprintf(stdout, "SUCCESS/n"); fflush(stdout); state = STATE_WAITING_FOR_STDIN_EOF; } g_data_input_stream_read_line_async(stdin_stream, G_PRIORITY_DEFAULT, NULL, stdin_read_complete, NULL); break; default: FATAL_ERROR("Unexpected extra input in state %u: %s/n", state, s); } g_free(s);}
开发者ID:fgouget,项目名称:spice-gtk,代码行数:68,
示例22: info_attach_exclistvoidinfo_attach_exclist (struct tar_stat_info *dir){ struct excfile *file; struct exclist *head = NULL, *tail = NULL, *ent; struct vcs_ignore_file *vcsfile; if (dir->exclude_list) return; for (file = excfile_head; file; file = file->next) { if (faccessat (dir ? dir->fd : chdir_fd, file->name, F_OK, 0) == 0) { FILE *fp; struct exclude *ex = NULL; int fd = subfile_open (dir, file->name, O_RDONLY); if (fd == -1) { open_error (file->name); continue; } fp = fdopen (fd, "r"); if (!fp) { ERROR ((0, errno, _("%s: fdopen failed"), file->name)); close (fd); continue; } if (!ex) ex = new_exclude (); vcsfile = get_vcs_ignore_file (file->name); if (vcsfile->initfn) vcsfile->data = vcsfile->initfn (vcsfile->data); if (add_exclude_fp (vcsfile->addfn, ex, fp, EXCLUDE_WILDCARDS|EXCLUDE_ANCHORED, '/n', vcsfile->data)) { int e = errno; FATAL_ERROR ((0, e, "%s", quotearg_colon (file->name))); } fclose (fp); ent = xmalloc (sizeof (*ent)); ent->excluded = ex; ent->flags = file->flags == EXCL_DEFAULT ? file->flags : vcsfile->flags; ent->prev = tail; ent->next = NULL; if (tail) tail->next = ent; else head = ent; tail = ent; } } dir->exclude_list = head;}
开发者ID:mfragkoulis,项目名称:tar,代码行数:62,
示例23: LOG_INFOvoid LocalStencil<ValueType>::MoveToHost(void) { LOG_INFO("The function is not implemented (yet)!"); FATAL_ERROR(__FILE__, __LINE__);}
开发者ID:georgeliao,项目名称:paralution_VBCSR,代码行数:6,
示例24: numericGetFloatValue /** * @brief For Numeric TypeInstances, get this TypeInstance's value as a C++ * float. * @warning supportsNumericInterface() must be true and isNull() must be * false for this method to be usable. * * @return The value as a float. **/ virtual float numericGetFloatValue() const { FATAL_ERROR("Used a Numeric interface method on a non-numeric TypeInstance."); }
开发者ID:saketj,项目名称:quickstep-storage-explorer,代码行数:11,
示例25: initializePathsvoid initializePaths(){#if RUN_IN_PLACE /* Use relative paths if RUN_IN_PLACE */ infostream<<"Using relative paths (RUN_IN_PLACE)"<<std::endl; /* Windows */ #if defined(_WIN32) const DWORD buflen = 1000; char buf[buflen]; DWORD len; // Find path of executable and set path_share relative to it len = GetModuleFileName(GetModuleHandle(NULL), buf, buflen); assert(len < buflen); pathRemoveFile(buf, '//'); if(detectMSVCBuildDir(buf)){ infostream<<"MSVC build directory detected"<<std::endl; path_share = std::string(buf) + "//..//.."; path_user = std::string(buf) + "//..//.."; } else{ path_share = std::string(buf) + "//.."; path_user = std::string(buf) + "//.."; } /* Linux */ #elif defined(linux) char buf[BUFSIZ]; memset(buf, 0, BUFSIZ); // Get path to executable FATAL_ERROR_IF(readlink("/proc/self/exe", buf, BUFSIZ-1) == -1, "Failed to get cwd"); pathRemoveFile(buf, '/'); path_share = std::string(buf) + "/.."; path_user = std::string(buf) + "/.."; /* OS X */ #elif defined(__APPLE__) CFBundleRef main_bundle = CFBundleGetMainBundle(); CFURLRef resources_url = CFBundleCopyResourcesDirectoryURL(main_bundle); char path[PATH_MAX]; if (CFURLGetFileSystemRepresentation(resources_url, TRUE, (UInt8 *)path, PATH_MAX)) { path_share = std::string(path); path_user = std::string(path) + "/../User"; } else { dstream << "WARNING: Could not determine bundle resource path" << std::endl; } CFRelease(resources_url); /* FreeBSD */ #elif defined(__FreeBSD__) int mib[4]; char buf[BUFSIZ]; size_t len = sizeof(buf); mib[0] = CTL_KERN; mib[1] = KERN_PROC; mib[2] = KERN_PROC_PATHNAME; mib[3] = -1; FATAL_ERROR_IF(sysctl(mib, 4, buf, &len, NULL, 0) == -1, ""); pathRemoveFile(buf, '/'); path_share = std::string(buf) + "/.."; path_user = std::string(buf) + "/.."; #else //TODO: Get path of executable. This assumes working directory is bin/ dstream<<"WARNING: Relative path not properly supported on this platform" <<std::endl; /* scriptapi no longer allows paths that start with "..", so assuming that the current working directory is bin/, strip off the last component. */ char *cwd = getcwd(NULL, 0); pathRemoveFile(cwd, '/'); path_share = std::string(cwd); path_user = std::string(cwd); #endif#else // RUN_IN_PLACE//.........这里部分代码省略.........
开发者ID:racam,项目名称:minetest,代码行数:101,
示例26: asciiStringNullTerminated /** * @brief Actually determine whether the string represented by this * particular type instance has a terminating NULL-character. * @note If asciiStringGuaranteedNullTerminated() is false, then this method * actually scans the string for a NULL-terminator. * @warning supportsAsciiStringInterface() must be true and isNull() must be * false for this method to be usable. * * @return Whether the underlying string is has a NULL-terminator. **/ virtual bool asciiStringNullTerminated() const { FATAL_ERROR("Used an AsciiString interface method on a non-AsciiString TypeInstance."); }
开发者ID:saketj,项目名称:quickstep-storage-explorer,代码行数:13,
示例27: sys_child_open_for_compress/* Set ARCHIVE for writing, then compressing an archive. */voidsys_child_open_for_compress (void){ FATAL_ERROR ((0, 0, _("Cannot use compressed or remote archives")));}
开发者ID:stfp,项目名称:tar-dedup,代码行数:6,
注:本文中的FATAL_ERROR函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ FATAL_ERROR_IF函数代码示例 C++ FATALERROR函数代码示例 |