/***************************************************************************//* * @par Description: * This function is called by the main function and is used to open the input * file that was passed in from the command line arguements. It will then check * to see if the file opened correctly and safely exit if it did not open. After * confirming file is open it will then dynamically allocate memory in the form * of the structure Record that will hold the individual records while they are * checked. This function calls the checkRecord function and uses the array * "errors" to decide which output file the record will be output to. * * * @param[in] argv - a 2d array of characters containing the arguments. * ******************************************************************************/ void readRecords ( char *argv1[] ) { int endoffile; int count; int i = 0; int j = 0; int numberOfErrors = 0; bool errors[22] = {false}; Record *record = NULL; ifstream oldDataFile; ofstream goodData; ofstream badData; //Opening and checking file oldDataFile.open ( argv1[1], ios::out | ios::binary ); if ( oldDataFile.is_open() == false ) { cout << "Database To Be Tested Could Not Be Open" << endl; safeExit ( record ); } //Finding how many records are in the file oldDataFile.seekg ( 0, ios::end ); endoffile = int ( oldDataFile.tellg() ); oldDataFile.seekg ( 0, ios::beg ); count = endoffile / sizeof ( Record ); //Dynamically allocate memory for record record = new ( nothrow ) Record; if ( record == NULL ) safeExit ( record ); //Read in and check each record one by one. while ( oldDataFile.read ( ( char * ) & ( record[0] ), sizeof ( Record ) )) { //Read in Record //oldDataFile.read ( ( char * ) & ( record[0] ), sizeof ( Record ) ); //Check Record For errors checkRecord ( record, errors ); for ( j = 0; j < 22; j++ ) { if ( errors[j] == true ) { numberOfErrors += 1; } } //If there were errors output record to bad file, else to good file. if ( numberOfErrors > 0 ) saveBadRecord ( record, argv1, errors ); else saveGoodRecord ( record, argv1 ); for ( j = 0; j < 22; j++ ) errors[j] = false; numberOfErrors = 0; i++; } //deallocate memory and exit. safeExit ( record ); }
void *loadSymbol(const char *name, bool optional) { if(!name) { vglout.print("[VGL] ERROR: Invalid argument in loadSymbol()\n"); safeExit(1); } if(!strncmp(name, "gl", 2)) return loadGLSymbol(name, optional); #ifdef FAKEXCB else if(!strcmp(name, "XGetXCBConnection") || !strcmp(name, "XSetEventQueueOwner")) return loadXCBX11Symbol(name, optional); #endif else if(!strncmp(name, "X", 1)) return loadX11Symbol(name, optional); #ifdef FAKEXCB else if(!strncmp(name, "xcb_glx", 7)) return loadXCBGLXSymbol(name, optional); else if(!strncmp(name, "xcb_key", 7)) return loadXCBKeysymsSymbol(name, optional); else if(!strncmp(name, "xcb_", 4)) return loadXCBSymbol(name, optional); #endif else { vglout.print("[VGL] ERROR: don't know how to load symbol \"%s\"\n", name); return NULL; } }
int main(int argc, char *argv[]) { GError *error = NULL; GOptionContext *context; lua_State *L; int kalle; // init log system gp_log_init("glua.log"); // parse command line arguments context = g_option_context_new (DESCRIPTION); g_option_context_add_main_entries (context, entries, NULL); if (!g_option_context_parse (context, &argc, &argv, &error)) { g_print ("option parsing failed: %s\n", error->message); exit (1); } // print version information if (opt_version) { printf("Program version %s\nBuild ("__DATE__" "__TIME__")\n", VERSION); safeExit(); } // enable verbose mode if (opt_verbose) { gp_log_set_verbose(TRUE); } printf("Ett litet testprogram.\n"); L = luaL_newstate(); luaL_openlibs(L); (void) luaL_dofile(L, "test.lua"); UNUSED_PARAM(L); lua_close(L); safeExit(); }
/***************************************************************************//* * @par Description: * This function is called by the checkRecords function and is used to store * a record that has been showed to be error free into a binary file specified * by the user via command line arguement. It opens the output file and checks * for its validity. It then stores the array into the end of the file, closes * the file and then returns back into readRecords. * * @param[in] argv - a 2d array of characters containing the arguments. * @param[in] record - a structure that holds a record and its contents. * * ******************************************************************************/ void saveGoodRecord ( Record *record, char *argv1[] ) { //Open and Check file ofstream goodData; goodData.open ( argv1[2], ios::app | ios::out | ios::binary ); if ( goodData.is_open() == false ) { cout << "Good Entry File Could Not Be Opened" << endl; safeExit ( record ); } //Output good record. goodData.write ( ( char * ) &record[0], sizeof ( Record ) ); goodData.close(); }
void init(void) { static int init=0; if(init) return; CriticalSection::SafeLock l(globalMutex); if(init) return; init=1; fconfig_reloadenv(); if(strlen(fconfig.log)>0) vglout.logTo(fconfig.log); if(fconfig.verbose) vglout.println("[VGL] %s v%s %d-bit (Build %s)", __APPNAME, __VERSION, (int)sizeof(size_t)*8, __BUILD); if(getenv("VGL_DEBUG")) { vglout.print("[VGL] Attach debugger to process %d ...\n", getpid()); fgetc(stdin); } if(fconfig.trapx11) XSetErrorHandler(xhandler); if(!dpy3D) { if(fconfig.verbose) vglout.println("[VGL] Opening connection to 3D X server %s", strlen(fconfig.localdpystring)>0? fconfig.localdpystring:"(default)"); if((dpy3D=_XOpenDisplay(fconfig.localdpystring))==NULL) { vglout.print("[VGL] ERROR: Could not open display %s.\n", fconfig.localdpystring); safeExit(1); } } }
void parse_hub(char *data) { char arg[10][MAX_LEN]; chan *ch; if(!strlen(data)) return; str2words(arg[0], data, 10, MAX_LEN); if(!(net.hub.status & STATUS_REGISTERED)) { switch(net.hub.tmpint) { /* case 0: { //3 bytes for WILL ECHO OFF + 1 byte for NEW LINE ++net.hub.tmpint; //enable encryption net.hub.enableCrypt((unsigned char *) config.botnetword, strlen(config.botnetword)); return; } */ case 1: { if(strlen(arg[0])) { char hash[33]; ++net.hub.tmpint; //unsigned char *dupa = ((entMD5Hash *) &config.currentHub->getPass())->getHash(); MD5HexHash(hash, arg[0], AUTHSTR_LEN, ((entMD5Hash *) &config.hub.getPass())->getHash(), 16); net.hub.send(config.handle, " ", hash, NULL); net.hub.tmpstr = (char *) malloc(AUTHSTR_LEN + 1); MD5CreateAuthString(net.hub.tmpstr, AUTHSTR_LEN); net.hub.send(net.hub.tmpstr, NULL); return; } break; } case 2: { if(strlen(arg[3])) { if(MD5HexValidate(arg[3], net.hub.tmpstr, strlen(net.hub.tmpstr), ((entMD5Hash *) &config.hub.getPass())->getHash(), 16)) { char buf[MAX_LEN]; ++net.hub.tmpint; userlist.addHandle(arg[0], 0, B_FLAGS | HAS_H | HAS_L, arg[1], arg[2], 0); net.hub.handle = userlist.findHandle(arg[0]); DEBUG(printf("[D] hub handle: %s\n", net.hub.handle->name)); free(net.hub.tmpstr); net.hub.tmpstr = NULL; if(config.bottype != BOT_SLAVE) sprintf(buf, "%llu", userlist.SN); else strcpy(buf, "0"); net.hub.send(S_REGISTER, " ", S_VERSION, " ", buf, " ", (const char *) ME.nick, " ", net.irc.origin, NULL); return; } } break; } case 3: { if(!strcmp(arg[0], S_REGISTER)) { mem_strcpy(net.hub.name, arg[1]); net.hub.tmpint = 0; net.hub.status |= STATUS_CONNECTED | STATUS_REGISTERED | STATUS_BOT; net.hub.killTime = NOW + set.CONN_TIMEOUT; net.hub.lastPing = NOW; net.hub.enableCrypt(((entMD5Hash *) &config.hub.getPass())->getHash(), 16); net.sendBotListTo(&net.hub); net.propagate(&net.hub, S_BJOIN, " ", net.hub.name, NULL); config.currentHub->failures = 0; net.propagate(NULL, S_CHNICK, " ", (const char *) ME.nick, " ", net.irc.origin, NULL); return; } } default: break; } /* HUH */ net.hub.close("Access Denied"); } /* REGISTERED HUB */ net.hub.killTime = NOW + set.CONN_TIMEOUT; if(!strcmp(arg[0], S_UL_UPLOAD_START)) { if(userlist.ulbuf) { net.send(HAS_N, "[!] Double UL download, this should not happen", NULL); sleep(5); net.send(HAS_N, "[!] Terminating.", NULL); exit(1337); } userlist.ulbuf = new Pchar(64*1024); return; } if(!strcmp(arg[0], S_UL_UPLOAD_END)) { if(!userlist.ulbuf) { net.send(HAS_N, "[!] Update userlist is empty", NULL); net.send(HAS_N, "[-] Disconnecting", NULL); net.hub.close("Userlist is empty"); return; } userlist.update(); if(userlist.me()->flags[GLOBAL] & HAS_P) hostNotify = 1; else hostNotify = 0; userlist.sendToAll(); return; } if(userlist.ulbuf) { userlist.ulbuf->push(data); userlist.ulbuf->push("\n"); return; } if(!strcmp(arg[0], S_CYCLE) && strlen(arg[1])) { if(ME.findChannel(arg[1])) { net.irc.send("PART ", arg[1], " :", (const char *) config.cyclereason, NULL); ME.rejoin(arg[1], set.CYCLE_DELAY); if(strlen(arg[2])) net.send(HAS_N, "[*] Doing cycle on ", arg[1], NULL); } net.propagate(&net.hub, data, NULL); return; } if(!strcmp(arg[0], S_MKA) && strlen(arg[1])) { ch = ME.findChannel(arg[1]); if(ch) ch->massKick(MK_ALL, !strcmp(arg[3], "close") || !strcmp(arg[3], "lock")); return; } if(!strcmp(arg[0], S_MKO) && strlen(arg[1])) { ch = ME.findChannel(arg[1]); if(ch) ch->massKick(MK_OPS, !strcmp(arg[3], "close") || !strcmp(arg[3], "lock")); return; } if(!strcmp(arg[0], S_MKN) && strlen(arg[1])) { ch = ME.findChannel(arg[1]); if(ch) ch->massKick(MK_NONOPS, !strcmp(arg[3], "close") || !strcmp(arg[3], "lock")); return; } if(!strcmp(arg[0], S_UNLINK) && strlen(arg[1])) { HANDLE *h = userlist.findHandle(arg[1]); if(h && userlist.isBot(h)) { inetconn *bot = net.findConn(h); if(bot) bot->close("Forced unlink"); } return; } if(!strcmp(arg[0], S_NICK) && strlen(arg[1])) { net.irc.send("NICK ", arg[1], NULL); ME.nextNickCheck = NOW + set.KEEP_NICK_CHECK_DELAY; return; } if(!strcmp(arg[0], S_JUMP) && strlen(arg[2])) { ME.jump(arg[2], arg[3], arg[1]); return; } #ifdef HAVE_IPV6 if(!strcmp(arg[0], S_JUMP6) && strlen(arg[2])) { ME.jump(arg[2], arg[3], arg[1], AF_INET6); return; } #endif if(!strcmp(arg[0], S_JUMPS5) && strlen(arg[5])) { ME.jumps5(arg[2], atoi(arg[3]), arg[4], atoi(arg[5]), arg[1]); return; } if(!strcmp(arg[0], S_RDIE) && strlen(arg[1])) { net.send(HAS_N, "[!] ", DIE_REASON, NULL); net.irc.send("QUIT :", arg[1], " ", DIE_REASON2, NULL); safeExit(); } if(!strcmp(arg[0], S_NAMES) && strlen(arg[2])) { ch = ME.findChannel(arg[2]); if(ch) ch->names(arg[1]); else net.sendOwner(arg[1], "Invalid channel", NULL); return; } if(!strcmp(arg[0], S_CWHO) && strlen(arg[2])) { ch = ME.findChannel(arg[2]); if(ch) ch->cwho(arg[1], arg[3]); else net.sendOwner(arg[1], "Invalid channel", NULL); return; } if(!strcmp(arg[0], S_PSOTUPDATE)) { psotget.forkAndGo(arg[1]); return; } if(!strcmp(arg[0], S_STOPUPDATE)) { psotget.end(); return; } if(!strcmp(arg[0], S_RESTART)) { ME.restart(); return; } if(!strcmp(arg[0], S_ULSAVE)) { userlist.save(config.userlist_file); ME.nextRecheck = NOW + 5; net.propagate(&net.hub, data, NULL); return; } if(!strcmp(arg[0], S_RJOIN) && strlen(arg[2])) { userlist.rjoin(arg[1], arg[2]); net.propagate(&net.hub, data, NULL); ++userlist.SN; return; } if(!strcmp(arg[0], S_RPART) && strlen(arg[2])) { userlist.rpart(arg[1], arg[2], arg[3]); net.propagate(&net.hub, data, NULL); ++userlist.SN; return; } if(!strcmp(arg[0], S_STATUS) && strlen(arg[1])) { ME.sendStatus(arg[1]); return; } if(!strcmp(arg[0], S_CHKHOST) && strlen(arg[1])) { ME.checkMyHost(arg[1]); return; } if(parse_botnet(&net.hub, data)) return; if(userlist.parse(data)) { ++userlist.SN; //some things should not be propagated if(config.bottype == BOT_SLAVE) { if(!strcmp(S_ADDBOT, arg[0])) { net.propagate(&net.hub, S_ADDBOT, " ", arg[1], " ", arg[2], " ", arg[3], " ", S_SECRET, NULL); return; } if(!strcmp(S_PASSWD, arg[0]) && userlist.isBot(arg[1])) { net.propagate(&net.hub, S_PASSWD, " ", arg[1], " ", "00000000000000000000000000000000", NULL); return; } if(!strcmp(S_ADDR, arg[0]) && userlist.isBot(arg[1])) { net.propagate(&net.hub, S_ADDR, " ", arg[1], " ", "0.0.0.0", NULL); return; } if(!strcmp(S_ADDOFFENCE, arg[0])) // leaf dont need infos about offence-history return; } net.propagate(&net.hub, data, NULL); return; } }
int main(int argc, char *argv[]) { /***** * boolean value indicates when to break main loop * (and thus finish this configuration tool) *****/ int request_finish = 0; int current = 0; /***** menu related variables */ int menu_items = 7; enum state status[] = {invalid, invalid, inactive, inactive, inactive, inactive, invalid}; WINDOW *mainscr; /***** ncurses related variables */ int i, j; /* ***** detect available mixer devices */ mixer_devices = scanMixerDevices(); if (mixer_devices == NULL || mixer_devices->count == 0) { /* ***** no mixer devices available -> exit! */ fprintf(stderr, "No mixer devices available!\n"); fprintf(stderr, "Please purchase a sound card and install it!\n"); exit(-1); } else { if (mixer_devices->count == 1) /***** exactly one mixer device available */ { setMixer(mixer_devices->name[0]); /***** set this mixer */ if (initMixer() == MIXER_OK) /***** if mixer is ok, keep it */ { status[0] = ok; status[2] = invalid; } else /***** otherwise, exit!*/ { fprintf(stderr, "Couldn't init the only available mixer device: /dev/%s\n", mixer_devices->name[0]); exit(-1); } } else /* ***** more than one device available! */ { /* ***** use /dev/mixer as default if it exists */ for (i = 0; i < mixer_devices->count; i++) { if (strcmp(mixer_devices->name[i], "mixer") == 0) { setMixer("mixer"); if (initMixer() == MIXER_OK) { status[0] = ok; status[2] = invalid; } else noMixer(); break; } } } } /* ***** detect available audio devices */ audio_devices = scanAudioDevices(); if (audio_devices == NULL || audio_devices->count == 0) { /* ***** no audio devices available! */ fprintf(stderr, "No audio device available that\n"); fprintf(stderr, "supports 16bit recording!\n"); fprintf(stderr, "Please purchase a sound card and install it!\n"); exit(-1); } else { if (audio_devices->count == 1) /***** exactly one audio device available */ { setAudio(audio_devices->name[0]); /***** set this audio device */ if (initAudio() == AUDIO_OK) /***** if audio device is ok, keep it */ { status[1] = ok; } else /***** otherwise, exit!*/ { fprintf(stderr, "Couldn't init the only available audio device: /dev/%s\n", audio_devices->name[0]); exit(-1); } } else /* ***** more than one device available! */ { /* ***** use /dev/dspW as default if it exists */ for (i = 0; i < audio_devices->count; i++) { if (strcmp(audio_devices->name[i], "dspW") == 0) { setAudio("dspW"); if (initAudio() == AUDIO_OK) status[1] = ok; else noAudio(); break; } } } } /***** * if mixer and audio device have been selected successfully, * set menu cursor to next available menu item *****/ if (status[0] == ok && status[1] == ok) current = 2; /***** ignore Ctrl-C */ signal(SIGINT, SIG_IGN); /* ***** ncurses stuff */ initscr(); /* initialize the curses library */ if (color_term != -1) /***** define dialog color pairs if terminal supports colors */ { start_color (); if ((color_term = has_colors ())) { color_term = 1; init_pair (1, COLOR_WHITE, COLOR_BLUE); init_pair (2, COLOR_YELLOW, COLOR_BLUE); init_pair (3, COLOR_BLUE, COLOR_YELLOW); init_pair (4, COLOR_YELLOW, COLOR_CYAN); } } else color_term = 0; keypad(stdscr, TRUE); /* enable keyboard mapping */ scrollok (stdscr, FALSE); cbreak(); /* take input chars one at a time, no wait for \n */ noecho(); /* don't echo input */ refresh(); mainscr = popupWindow(COLS, LINES); /***** dialog window that contains the main menu */ leaveok (mainscr, FALSE); while (!request_finish) { wattrset (mainscr, color_term ? COLOR_PAIR(2) | A_BOLD : A_NORMAL); /***** set bg color of the dialog */ /***** * draw a box around the dialog window * and empty it. *****/ box(mainscr, 0, 0); for (i = 1; i < COLS-1; i++) for (j = 1; j < LINES-1; j++) mvwaddch(mainscr, j, i, ' '); /***** dialog header */ mvwaddstr(mainscr, 1, 2, "CVoiceControl"); mvwaddstr(mainscr, 1, COLS - strlen("(c) 2000 Daniel Kiecza") - 2, "(c) 2000 Daniel Kiecza"); mvwaddseparator(mainscr, 2, COLS); mvwaddstr(mainscr, 3, (COLS / 2) - (strlen ("Recording Device Configuration Tool") / 2), "Recording Device Configuration Tool"); mvwaddseparator(mainscr, 4, COLS); /***** main menu */ mvwaddstr(mainscr, 5, 2, "Please Select:"); setHighlight(mainscr, status[0], current == 0); mvwaddstr(mainscr, 7,5,"Select Mixer Device"); if (mixerOK() == MIXER_OK) { mvwaddstr(mainscr, 7,24," ("); waddstr(mainscr, getMixer()); waddstr(mainscr, ")"); } else mvwaddstr(mainscr, 7,24," (none selected!)"); setHighlight(mainscr, status[1], current == 1); mvwaddstr(mainscr, 8,5,"Select Audio Device"); if (audioOK() == AUDIO_OK) { mvwaddstr(mainscr, 8,24," ("); waddstr(mainscr, getAudio()); waddstr(mainscr, ")"); } else mvwaddstr(mainscr, 8,24," (none selected!)"); setHighlight(mainscr, status[2], current == 2); mvwaddstr(mainscr, 9,5,"Adjust Mixer Levels"); setHighlight(mainscr, status[3], current == 3); mvwaddstr(mainscr, 10,5,"Calculate Recording Thresholds"); setHighlight(mainscr, status[4], current == 4); mvwaddstr(mainscr, 11,5,"Estimate Characteristics of Recording Channel"); setHighlight(mainscr, status[5], current == 5); mvwaddstr(mainscr, 12,5,"Write Configuration"); setHighlight(mainscr, status[6], current == 6); mvwaddstr(mainscr, 13,5,"Exit"); wmove(mainscr, 5, 17); /***** set cursor to an appropriate location */ wrefresh(mainscr); /***** refresh the dialog */ /* process the command keystroke */ switch(getch()) { case KEY_UP: /***** cursor up */ current = (current == 0 ? menu_items - 1 : current - 1); while(status[current] == inactive) current = (current == 0 ? menu_items - 1 : current - 1); break; case KEY_DOWN: /***** cursor down */ current = (current == menu_items-1 ? 0 : current + 1); while(status[current] == inactive) current = (current == menu_items-1 ? 0 : current + 1); break; case ENTER: /***** handle menu selections */ case BLANK: switch (current) { case 0: /***** select mixer device */ status[0] = invalid; status[2] = inactive; status[3] = inactive; status[4] = inactive; status[5] = inactive; noMixer(); if (selectMixer() == MIXER_OK) { status[0] = ok; status[2] = invalid; } break; case 1: /***** select audio device */ status[1] = invalid; status[3] = inactive; status[4] = inactive; status[5] = inactive; noAudio(); if (selectAudio() == AUDIO_OK) status[1] = ok; break; case 2: /***** adjust mixer levels */ if (adjustMixerLevels()) { status[2] = ok; status[3] = invalid; status[4] = invalid; } break; case 3: /***** calculate recording thresholds */ if (calculateThresholds()) status[3] = ok; else status[3] = invalid; break; case 4: /***** estimate the characteristics of the recording channel */ if (estimateChannelMean()) status[4] = ok; else status[4] = invalid; break; case 5: /***** save configuration! */ if (saveConfiguration()) { status[5] = ok; status[6] = ok; } break; case 6: /***** leave program */ if (status[6] == ok || (status[6] != ok && safeExit())) { wrefresh(mainscr); /***** refresh the dialog */ request_finish = 1; delwin(mainscr); /***** delete ncurses dialog window */ } break; } break; } /***** if the configuration is done, activate the menu item "Save Configuration" */ if (status[0] != ok || status[1] != ok || status[2] != ok || status[3] != ok || status[4] != ok) status[5] = inactive; else if (status[5] != ok) status[5] = invalid; } endwin(); /* we're done */ /***** free memory used by the list of mixer and audio devices */ if (mixer_devices != NULL) { for (i = 0; i < mixer_devices->count; i++) free(mixer_devices->name[i]); free(mixer_devices->name); free(mixer_devices); } if (audio_devices != NULL) { for (i = 0; i < audio_devices->count; i++) free(audio_devices->name[i]); free(audio_devices->name); free(audio_devices); } exit(0); }
/***************************************************************************//* * @par Description: * This function is called by the readRecords function and is used to open the * bad record output file that was passed in from the command line arguements. * It will then check to see if the file opened correctly and safely exit if it * did not open. After confirming file is open it will save the record that was * also passed in from readRecords in a human readable form. After it outputs * the record it will then check the "errors" array and output what errors * occured under the record in a readable format. It will then close the file * and return back to the readRecords function. * * * @param[in] argv - a 2d array of characters containing the arguments. * @param[in] record - a structure that holds a record and its contents. * @param[in] errors - a boolean array that holds what errors have been found. * * ******************************************************************************/ void saveBadRecord ( Record *record, char *argv1[], bool errors[] ) { int i = 0; int temp1, temp2, temp3; int cityStateZipSize; string tempstring; ofstream badData; ostringstream convert5; ostringstream convert4; //Open and Check File badData.open ( argv1[3], ios::app | ios ::out ); if ( badData.is_open() == false ) { cout << "Bad Entry File Could Not Be Opened" << endl; safeExit ( record ); } //Print Bad Entry with formatting //Name badData << record[0].name; tempstring = record[0].name; temp1 = 30 - tempstring.length(); for ( i = 0; i < temp1; i++ ) { badData << " "; } i = 0; //BirthDate convertDate ( temp1, temp2, temp3, record, 1 ); badData << "Birth Date: "; badData << temp1 << "/" << temp2 << "/" << temp3; badData << endl; //Address badData << record[0].address; tempstring = record[0].address; temp1 = 30 - tempstring.length(); for ( i = 0; i < temp1; i++ ) { badData << " "; } i = 0; //LicensedDate convertDate ( temp1, temp2, temp3, record, 2 ); badData << "License Date: "; badData << temp1 << "/" << temp2 << "/" << temp3; badData << endl; //City tempstring = record[0].city; temp1 = tempstring.length(); badData.write ( record[0].city, temp1 ); badData << ", "; cityStateZipSize = temp1 + 2; //State badData.write ( record[0].state, 2 ); badData << " "; cityStateZipSize = cityStateZipSize + 3; //ZipCode convertZipCode ( temp1, temp2, record ); badData << temp1 << "-" << temp2; convert5 << temp1; tempstring = convert5.str(); cityStateZipSize = cityStateZipSize + tempstring.length() + 1; convert4 << temp2; tempstring = convert4.str(); cityStateZipSize = cityStateZipSize + tempstring.length(); //ExpirationDate temp1 = 30 - cityStateZipSize; for ( i = 0; i < temp1; i++ ) badData << " "; convertDate ( temp1, temp2, temp3, record, 3 ); badData << "Expiration Date: "; badData << temp1 << "/" << temp2 << "/" << temp3; badData << endl; //Call Sign badData << "Call Sign: "; tempstring = record[0].callSign; tempstring.resize ( 5 ); badData << tempstring; badData.flush(); //Radio Class badData << " "; badData << "Radio Class: "; badData.write ( ( char * ) &record[0].radioClass, 1 ); badData << endl; badData << endl; //Printing Errors if ( errors[0] == true ) badData << "Name Field" << '\n' << '\t' << "-" << "Invalid Character in the Name Field" << endl; if ( errors[1] == true ) badData << "Address Field" << '\n' << '\t' << "-" << "Invalid Character in the Address Field" << endl; if ( errors[2] == true ) badData << "City Field" << '\n' << '\t' << "-" << "Invalid Character in the City Field" << endl; if ( errors[3] == true || errors[4] == true ) badData << "State Field" << endl; if ( errors[3] == true ) badData << '\t' << "-" << "Invalid State Code" << endl; if ( errors[4] == true ) badData << '\t' << "-" << "First Character of the State Code not Capitalized" << endl; if ( errors[5] == true || errors[6] == true ) badData << "Zip Code" << endl; if ( errors[5] == true ) badData << '\t' << "-" << "Invalid 5 Digit Zip Code" << endl; if ( errors[6] == true ) badData << '\t' << "-" << "Invalid 4 Digit Zip Code" << endl; if ( errors[7] == true || errors[8] == true || errors[9] == true ) badData << "Birth Date" << endl; if ( errors[7] == true ) badData << '\t' << "-" << "Invalid Month in Birthday" << endl; if ( errors[8] == true ) badData << '\t' << "-" << "Invalid Day in Birthday" << endl; if ( errors[9] == true ) badData << '\t' << "-" << "Invalid Year in Birthday" << endl; if ( errors[10] == true || errors[11] == true || errors[12] == true ) badData << "License Date" << endl; if ( errors[10] == true ) badData << '\t' << "-" << "Invalid Month in License Date" << endl; if ( errors[11] == true ) badData << '\t' << "-" << "Invalid Day in License Date" << endl; if ( errors[12] == true ) badData << '\t' << "-" << "Invalid Year in License Date" << endl; if ( errors[13] == true || errors[14] == true || errors[15] == true || errors[16] == true ) badData << "Expiration Date" << endl; if ( errors[13] == true ) badData << '\t' << "-" << "Invalid Month in Expiration Date" << endl; if ( errors[14] == true ) badData << '\t' << "-" << "Invalid Day in Expiration Date" << endl; if ( errors[15] == true ) badData << '\t' << "-" << "Invalid Year in Expiration Date" << endl; if ( errors[16] == true ) badData << '\t' << "-" << "Expiration Date is not After License Date" << endl; if ( errors[17] == true ) badData << "Radio Class" << '\n' << '\t' << "-" << "Radio Class Code is Invalid" << endl; if ( errors[18] == true || errors[19] == true || errors[20] == true || errors[21] == true ) badData << "Call Sign" << endl; if ( errors[18] == true ) badData << '\t' << "-" << "Invalid First Character in Call Sign" << endl; if ( errors[19] == true ) badData << '\t' << "-" << "Invalid Second, Fourth, and/or Fifth Character" << endl; if ( errors[20] == true ) badData << '\t' << "-" << "Invalid Digit in Call Sign" << endl; if ( errors[21] == true ) badData << '\t' << "-" << "Call Sign not Upper Case" << endl; badData << endl; badData << "---------------------------------------------" << endl; badData << endl; badData.close(); }