static void overwriteOldTables(const HDR *x) { // write the new symbol table to the original a.out, // beginning at the beginning of the original symbol table fseek(sym, N_SYMOFF(*x), 0); overwrite(newSym, sym); // write the new string table to the original a.out, // beginning right after the new symbol table long len = ftell(newSng) + 4; xfwrite(&len, 4, 1, sym); overwrite(newSng, sym); // rem: truncate, but probably doesn't need it. }
void SecString::setString(QString& str, bool DeleteSource){ QByteArray StrData = str.toUtf8(); int len = StrData.size(); unsigned char* buffer = new unsigned char[len]; RC4.encrypt((const unsigned char*)StrData.data(), buffer, len); crypt = QByteArray((const char*)buffer, len); overwrite(buffer, len); overwrite((unsigned char*)StrData.data(), len); delete [] buffer; if(DeleteSource){ overwrite(str); str=QString(); } lock(); }
//Element deletion void delete_element(char *query, node *root){ if (root == NULL){ printf("Empty Tree\n"); return; } node* del = bt_search(query, root); node* tmp; if (del == NULL) return; //The node has two children if (del->left!=NULL && del->right!=NULL){ tmp = findMax(del->left); overwrite(del, tmp); //Checking if the current node is the left or right parent's child if (tmp->parent->left == tmp) tmp->parent->left=NULL; else tmp->parent->right = NULL; free(tmp->data); free(tmp); } //The node has not any childFILE* fo = fopen( "treedata.txt", "a+" ); else if (del->left==NULL && del->right==NULL){ //Checking if the current node is the left or right parent's child if (del->parent->left == del) del->parent->left=NULL; else del->parent->right = NULL; free(del->data); free(del); } //The node has one child else{ if (del->left == NULL){ tmp = del->right; del->right = NULL; } else if (del->right == NULL){ tmp = del->left; del->left = NULL; } overwrite(del, tmp); del->left = tmp->left; del->right = tmp->right; free(tmp->data); free(tmp); } }
void overwrite_random(int num_passes) { int i; for (i = 0; i < num_passes; i++) { overwrite(W_RANDOM); } }
int main() { WINDOW *alpha; char text1[] = "Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat."; char text2[]= "Four score and seven years ago our fathers brought forth on this continent, a new nation, conceived in Liberty, and dedicated to the proposition that all men are created equal."; initscr(); /* Build windows */ alpha = newwin(0,0,0,0); /* Remember to check for errors! */ addstr(text1); /* Add text to stdscr and wait */ refresh(); getch(); waddstr(alpha,text2); /* Show win alpha and wait */ wrefresh(alpha); getch(); /* Copy text from one window to the other, destructively */ overwrite(stdscr,alpha); wrefresh(alpha); getch(); endwin(); return(0); }
void bb_playboard(Board *board, int skip) { int delta = 1; WINDOW *win; Node *node; erase(); node = board->first; while (skip--) { win = subwin( stdscr, node->anim->height, node->anim->width, node->begin_y, node->begin_x ); touchwin(win); mvwin(node->anim->last->win, node->begin_y, node->begin_x); overwrite(node->anim->last->win, win); mvwin(node->anim->last->win, -node->begin_y, -node->begin_x); wrefresh(win); node = node->next; delwin(win); } while (node != NULL) { delta = bb_playanim( node->anim, node->begin_y, node->begin_x, delta < 0 ); node = (delta < 0) ? node->prev : node->next; } }
//void ui_ncurses_tick_handler(player_t * player, int current_order, int current_pattern, int current_row, int current_tick, player_channel_t * channels) void ui_ncurses_tick_handler(player_t * player) { char tmp[200]; char tmp2[40]; char tmp3[30]; char note[4]; int i, j, k; int current_pattern = player->current_pattern; int current_row = player->current_row; player_channel_t * channels = player->channels; for (i = 0; i < ui_ncurses_layout.num_channels; i++) { module_pattern_data_t * data = &(player->module->patterns[current_pattern].rows[current_row].data[i]); if (data->period_index >= 0) wattron(ui_ncurses_layout.channel_panel.w, A_BOLD); sprintf(note, "..."); if (channels[i].period_index < 254) ui_periodindex2note(channels[i].period_index, note, player->module->module_type == module_type_it ? 0 : 1); /* tmp3[0] = 0; k = 0; if (channels[i].sample_num > 0) { for (j = 0; j < strlen(player->module->samples[channels[i].sample_num - 1].header.name); j++) { if (isprint(player->module->samples[channels[i].sample_num - 1].header.name[j])) { tmp3[k++] = player->module->samples[channels[i].sample_num - 1].header.name[j]; } } tmp3[k] = 0; } */ tmp2[0] = 0; if (data->effect_num) ui_effect_to_humanreadable(tmp2, data->effect_num, data->effect_value, player->channels[i].effect_last_value, player->module->module_type); //sprintf(tmp, "%-30s | %3s | %2i | %02x | %-27s | ", channels[i].sample_num ? player->module->samples[channels[i].sample_num - 1].header.name : "", note, channels[i].volume, channels[i].panning, tmp2); //mvwprintw(ui_ncurses_layout.channel_panel.w, i+1, 1, tmp); mvwprintw(ui_ncurses_layout.channel_panel.w, i+1, 1, "%-30s", channels[i].sample_num ? player->module->samples[channels[i].sample_num - 1].header.name : ""); mvwprintw(ui_ncurses_layout.channel_panel.w, i+1, 27, "| %3s | %2i | %02x | %-27s |", note, channels[i].volume, channels[i].panning, tmp2); wattroff(ui_ncurses_layout.channel_panel.w, A_BOLD); } if (ui_ncurses_layout.use_colors) wattron(ui_ncurses_layout.channel_panel.w, COLOR_PAIR(UI_NCURSES_COLORPAIR_WINDOW)); box(ui_ncurses_layout.channel_panel.w, 0, 0); if (ui_ncurses_layout.use_colors) wattroff(ui_ncurses_layout.channel_panel.w, COLOR_PAIR(UI_NCURSES_COLORPAIR_WINDOW)); if (ui_ncurses_layout.aux_panel.w) overwrite(ui_ncurses_layout.aux_panel.w, ui_ncurses_layout.channel_panel.w); wrefresh(ui_ncurses_layout.channel_panel.w); }
void ui_ncurses_channel_sample_handler(sample_t l , sample_t r, sample_t peak_l, sample_t peak_r, int channel) { char tmp[(SCOPE_SIZE * 2) + 2]; int i; for (i = 0; i < SCOPE_SIZE; i++) { if ( (int)(peak_l * SCOPE_SIZE) / SAMPLE_T_MAX >= (SCOPE_SIZE - i) ) tmp[i] = '='; else tmp[i] = '-'; } for (i = SCOPE_SIZE; i < SCOPE_SIZE * 2 + 1; i++) { if ( (int)(peak_r * SCOPE_SIZE) / SAMPLE_T_MAX >= (i - SCOPE_SIZE) ) tmp[i] = '='; else tmp[i] = '-'; } tmp[SCOPE_SIZE] = '|'; tmp[SCOPE_SIZE * 2 + 1] = 0; mvwprintw(ui_ncurses_layout.channel_panel.w, channel+1, 80, tmp); if (ui_ncurses_layout.aux_panel.w) overwrite(ui_ncurses_layout.aux_panel.w, ui_ncurses_layout.channel_panel.w); wrefresh(ui_ncurses_layout.channel_panel.w); }
bool CollectForOutput::collectDocument() { QFileInfo fi = QFileInfo(m_outputDirectory); newName = m_outputDirectory; if (!fi.exists()) return false; if (!fi.isDir() || !fi.isWritable()) return false; if ((m_Doc->hasName) && (!m_Doc->isConverted)) { QFileInfo fis(m_Doc->DocName); newName += fis.fileName(); } else newName += m_Doc->DocName+".sla"; m_Doc->hasName = true; if (m_compressDoc) { if (!newName.endsWith(".gz")) newName += ".gz"; } else { if (newName.endsWith(".gz")) newName = newName.remove(".gz"); } if (!overwrite(ScCore->primaryMainWindow(), newName)) return false; if (!ScCore->primaryMainWindow()->DoFileSave(newName)) return false; return true; }
/** * Overwrite a byte array with the byte containing '*'. That is, call * <pre> * overwrite(bytes, (byte)'*'); * </pre> * @param bytes The byte array to be overwritten. * @param size The size of the byte array. */ void CryptoHelper::overwrite(byte bytes[], size_t size) { ASSERT(bytes); ASSERT(size); // The called overload tests for ptr wrap overwrite(bytes, size, '*'); }
int Resume_curses(void) { clear(); refresh(); overwrite(save, stdscr); refresh(); return 0; }
int Suspend_curses(void) { overwrite(stdscr, save); clear(); refresh(); endwin(); return 0; }
void PDFExportDialog::DoExport() { bool createPath = false; QString fn = QDir::fromNativeSeparators(fileNameLineEdit->text()); // Checking if the path exists QFileInfo fi(fn); QString dirPath = QDir::toNativeSeparators(fi.absolutePath()); if (!QFile::exists(fi.absolutePath())) { if (QMessageBox::question(this, tr( "Save as PDF" ), tr("%1 does not exists and will be created, continue?").arg(dirPath), QMessageBox::Ok | QMessageBox::Cancel) == QMessageBox::Cancel) { return; } createPath = true; } // NOTE: Qt4 contains QDir::mkpath() QDir d(fn); if (createPath) { if (!d.mkpath(fi.absolutePath())) { QMessageBox::warning(this, CommonStrings::trWarning, tr("Cannot create directory: \n%1").arg(dirPath), CommonStrings::tr_OK); return; } } bool doIt = false; if (multiFile->isChecked()) doIt = true; else doIt = overwrite(this, fn); if (doIt) { EffVal = Options->EffVal; EffVal[Options->PgSel].pageViewDuration = Options->PageTime->value(); EffVal[Options->PgSel].pageEffectDuration = Options->EffectTime->value(); EffVal[Options->PgSel].effectType = Options->EffectType->currentIndex(); EffVal[Options->PgSel].Dm = Options->EDirection->currentIndex(); EffVal[Options->PgSel].M = Options->EDirection_2->currentIndex(); EffVal[Options->PgSel].Di = Options->EDirection_2_2->currentIndex(); Opts.LPISettings[Options->SelLPIcolor].Frequency = Options->LPIfreq->value(); Opts.LPISettings[Options->SelLPIcolor].Angle = Options->LPIangle->value(); Opts.LPISettings[Options->SelLPIcolor].SpotFunc = Options->LPIfunc->currentIndex(); accept(); } else return; }
QSet<QString> standardNames() { static QSet<QString> names; if (names.isEmpty()) { QStringList strings = QStringList() << ok().text << cancel().text << yes().text << no().text << discard().text << save().text << apply().text << close().text << help().text << overwrite().text << reset().text << cont().text << del().text << stop().text << remove().text << back().text << forward().text; foreach (QString s, strings) { names.insert(s.remove("&")); }
void SecString::unlock(){ locked = false; plain = QString(); if(!crypt.length()) return; const unsigned char* buffer = new unsigned char[crypt.length()]; RC4.decrypt( (quint8*)crypt.data(), (unsigned char*)buffer, crypt.length() ); plain = QString::fromUtf8((const char*)buffer, crypt.size()); overwrite((unsigned char*)buffer, crypt.size()); delete [] buffer; }
/* * dupwin -- * Create a copy of the given window. */ WINDOW * dupwin(WINDOW *win) { WINDOW *new_one; if ((new_one = __newwin(_cursesi_screen, win->maxy, win->maxx, win->begy, win->begx, FALSE)) == NULL) return NULL; overwrite(win, new_one); return new_one; }
void f(bool R[32], bool K[48], bool outcome[32]){ // expand each R from 32 to 48 bits to E int E_BIT[48] = { 32, 1, 2, 3, 4, 5, 4, 5, 6, 7, 8, 9, 8, 9, 10, 11, 12, 13, 12, 13, 14, 15, 16, 17, 16, 17, 18, 19, 20, 21, 20, 21, 22, 23, 24, 25, 24, 25, 26, 27, 28, 29, 28, 29, 30, 31, 32, 1 }; bool E[48]; for(int i = 0; i < 48; i++){ E[i] = R[E_BIT[i]-1]; } // XOR Kn and E(Rn-1) bool KxorE[48]; for(int i = 0; i < 48; i++){ KxorE[i] = XOR(K[i], E[i]); } // each array of 6 bits from KxorE is used as an address in S boxes, thus obtaining a 4-bit number bool S[32]; for(int i = 0; i < 48; i+=6){ bool answer[4]; lookUpInSBox(i/6, KxorE+i, answer); // save what we find in S-boxes into answer overwrite(S+(i/6)*4, answer, 4); } // now we use P to permute S[] to finally create the outcome int P[32] = { 16, 7, 20, 21, 29, 12, 28, 17, 1, 15, 23, 26, 5, 18, 31, 10, 2, 8, 24, 14, 32, 27, 3, 9, 19, 13, 30, 6, 22, 11, 4, 25 }; for(int i = 0; i < 32; i++){ outcome[i] = S[P[i]-1]; } }
/* * Display a new msg (giving him a chance to see the previous one if it * is up there with the --More--) */ endmsg() { /* Needed to track where we are for 5.0 (PC) curses */ register int x, y; strcpy(huh, msgbuf); if (mpos) { /* * If this message will fit on the line (plus space for --More-- * then just add it (only during combat). */ if (player.t_quiet < 0 && mpos + newpos + strlen(morestr) + 2 < cols) { wmove(msgw, 0, mpos + 2); newpos += mpos + 2; } else { wmove(msgw, 0, mpos); waddstr(msgw, morestr); draw(cw); draw(msgw); wait_for(' '); overwrite(cw,msgw); wmove(msgw, 0, 0); touchwin(cw); } } else { overwrite(cw,msgw); wmove(msgw, 0, 0); } waddstr(msgw, msgbuf); getyx(msgw, y, x); mpos = newpos; newpos = 0; wmove(msgw, y, x); draw(cw); clearok(msgw, FALSE); draw(msgw); }
void unarySortAdd(vec<Formula>& Xs,vec<Formula>& Ys,vec<Formula>& out_sorter,bool useShortCuts){ vec<Formula> propgationShortCuts; int XsLen = Xs.size(); int YsLen = Ys.size(); if (YsLen==0) { if (XsLen>0) { add(Xs,out_sorter); safeSortNetwork(out_sorter,propgationShortCuts); if (useShortCuts) overwrite(out_sorter,propgationShortCuts); } } else if (XsLen==0) add(Ys,out_sorter); else if (XsLen==1 & YsLen==1) { add(Xs,out_sorter); add(Ys,out_sorter); cmp2(out_sorter, 0); } else { int Ysize; for (Ysize = 2; Ysize < YsLen; Ysize *= 2); Ys.growTo(Ysize,_0_); propgationShortCuts.growTo(Ysize*2,_0_); addShortCuts(Ys,propgationShortCuts); if (XsLen <= YsLen) { Xs.growTo(Ysize,_0_); sortNetwork(Xs,propgationShortCuts); mergeNetwork(Xs,Ys,out_sorter,propgationShortCuts); } else { vec<vec<Formula> > SubXs; SubXs.push(); add(Ys,SubXs.last()); splitToGroups(Xs, Ysize, SubXs); sortGroups(SubXs,propgationShortCuts); mergeGroups(SubXs, Ysize, out_sorter,propgationShortCuts); } out_sorter.shrink(out_sorter.size() - XsLen-YsLen); if(useShortCuts) overwrite(out_sorter,propgationShortCuts); } }
void window_error(void) { WINDOW *win; int x,y; initscr(); /* init ncurses mode */ start_color(); init_pair(1, COLOR_BLACK, COLOR_WHITE); init_pair(2, COLOR_YELLOW, COLOR_BLUE); init_pair(3, COLOR_YELLOW, COLOR_RED); getmaxyx(stdscr, y, x); y = (y - 8) / 2.0; x = (x - 27) / 2.0; win = newwin(8, 27, y, x); wbkgd(win, COLOR_PAIR(3)); box(win, 0, 0); // wbkgdset(win, COLOR_PAIR(1)); mvwprintw(win, 2, 6, "!!!! ERROR !!!!"); mvwprintw(win, 4, 6, "Enter For Quit."); wrefresh(win); #if 0 mvwprintw(win, 2, 2, "User:"******"Pass:"******" "); mvwprintw(win, 4, 8, " "); wrefresh(win); mvwgetnstr(win, 2, 8, buff->pwd_name, USERNAME_LEN); noecho(); mvwgetnstr(win, 4, 8, buff->pwd_passwd, PASSWORD_LEN); overwrite(win, stdscr); echo(); #endif getchar(); delwin(win); touchwin(stdscr); endwin(); /* leave ncurses mode */ }
void overwrite_bytes(unsigned int byte1, unsigned int byte2, unsigned int byte3) { u_int32_t val[3], *p = (u_int32_t *)buffer; unsigned int i, mod12buffsize = allocated_buffsize - (allocated_buffsize % 12); val[0] = (byte1 << 24) | (byte2 << 16) | (byte3 << 8) | byte1; val[1] = (byte2 << 24) | (byte3 << 16) | (byte1 << 8) | byte2; val[2] = (byte3 << 24) | (byte1 << 16) | (byte2 << 8) | byte3; /* fill buffer 12 bytes at a time, optimized for 4-byte alignment */ for (i = 0; i < mod12buffsize; i += 12) { *p++ = val[0]; *p++ = val[1]; *p++ = val[2]; } while (i < allocated_buffsize) { buffer[i] = ((unsigned char *)&val[0])[i % 3]; i++; } overwrite(W_TRIPLE); }
bool Prefs_KeyboardShortcuts::exportKeySet(QString filename) { QFileInfo fi = QFileInfo(filename); QString exportFileName; if (filename.endsWith(".xml")) exportFileName = filename; else exportFileName = filename+".xml"; if (overwrite(this, exportFileName)) { bool ok; QString setName = QInputDialog::getText(this, tr("Export Keyboard Shortcuts to File"), tr("Enter the name of the shortcut set:"), QLineEdit::Normal, QString::null, &ok); if (!( ok && !setName.isEmpty()) ) return false; QDomDocument doc( "keymapentries" ); QString keyset=QString("<shortcutset name=\"%1\"></shortcutset>").arg(setName); doc.setContent(keyset); QDomElement keySetElement=doc.documentElement(); QMap<QString,Keys>::Iterator itEnd=keyMap.end(); for (QMap<QString,Keys>::Iterator it=keyMap.begin(); it!=itEnd; ++it) { if (it.value().keySequence.isEmpty() && it.key().isEmpty()) continue; QDomElement function_shortcut = doc.createElement("function"); function_shortcut.setAttribute("name", it.key()); function_shortcut.setAttribute("shortcut", getKeyText(it.value().keySequence)); keySetElement.appendChild(function_shortcut); } QFile f(filename); if(!f.open(QIODevice::WriteOnly)) return false; QDataStream s(&f); QByteArray xmltag("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"); s.writeRawData(xmltag.data(), xmltag.length()); QByteArray xmldoc = doc.toByteArray(4); s.writeRawData(xmldoc, xmldoc.length()); f.close(); } return true; }
int scr_restore(const char *filename) { FILE *filep; PDC_LOG(("scr_restore() - called: filename %s\n", filename)); if (filename && (filep = fopen(filename, "rb")) != NULL) { WINDOW *replacement = getwin(filep); fclose(filep); if (replacement) { int result = overwrite(replacement, curscr); delwin(replacement); return result; } } return ERR; }
void TestChunks::random(int count) { for (int idx=1; idx < count; idx++) { int action = rand() % 3; int pos = rand() % _data.size(); char b = char(rand() % 0x100); switch (action) { case 0: removeAt(pos); break; case 1: insert(pos, b); break; case 2: overwrite(pos, b); break; } } }
void DOHexEditor::paste() { if(!canPaste()) return; std::string clipstr = wstring_to_utf8str(gClipboard.getPasteWString()); const char* clip = clipstr.c_str(); std::vector<U8> new_data; if(mInData) { int len = strlen(clip); for(int i = 0; (i + 1) < len; i += 2) { int c = 0; if(sscanf(&(clip[i]), "%02X", &c) != 1) break; new_data.push_back(U8(c)); } } else { int len = strlen(clip); for(int i = 0; i < len; i++) { U8 c = 0; if(sscanf(&(clip[i]), "%c", &c) != 1) break; new_data.push_back(c); } } U32 start = mCursorPos; if(!mHasSelection) insert(start, new_data, TRUE); else { start = getProperSelectionStart(); overwrite(start, getProperSelectionEnd() - 1, new_data, TRUE); } moveCursor(start + new_data.size(), FALSE); }
/*VARARGS1*/ msg(char *fmt, ...) { va_list ap; /* * if the string is "", just clear the line */ if (*fmt == '\0') { overwrite(cw,msgw); wmove(msgw, 0, 0); clearok(msgw, FALSE); draw(msgw); mpos = 0; return; } /* * otherwise add to the message and flush it out */ va_start(ap,fmt); doadd(fmt, ap); va_end(ap); endmsg(); }
void window_login(WindowPasswd_t *buff) { WINDOW *win; int x,y; initscr(); /* init ncurses mode */ start_color(); init_pair(1, COLOR_BLACK, COLOR_WHITE); init_pair(2, COLOR_YELLOW, COLOR_BLUE); getmaxyx(stdscr, y, x); y = (y - 8) / 2.0; x = (x - 27) / 2.0; win = newwin(8, 27, y, x); wbkgd(win, COLOR_PAIR(2)); box(win, 0, 0); mvwprintw(win, 2, 2, "User:"******"Pass:"******" "); mvwprintw(win, 4, 8, " "); wrefresh(win); mvwgetnstr(win, 2, 8, buff->pwd_name, USERNAME_LEN); noecho(); mvwgetnstr(win, 4, 8, buff->pwd_passwd, PASSWORD_LEN); overwrite(win, stdscr); echo(); delwin(win); touchwin(stdscr); endwin(); /* leave ncurses mode */ }
KGuiItem KStdGuiItem::guiItem ( StdItem ui_enum ) { switch (ui_enum ) { case Ok : return ok(); case Cancel : return cancel(); case Yes : return yes(); case No : return no(); case Discard : return discard(); case Save : return save(); case DontSave : return dontSave(); case SaveAs : return saveAs(); case Apply : return apply(); case Clear : return clear(); case Help : return help(); case Close : return close(); case Defaults : return defaults(); case Back : return back(); case Forward : return forward(); case Print : return print(); case Continue : return cont(); case Open : return open(); case Quit : return quit(); case AdminMode: return adminMode(); case Reset : return reset(); case Delete : return del(); case Insert : return insert(); case Find : return find(); case Stop : return stop(); case Add : return add(); case Remove : return remove(); case Test : return test(); case Properties : return properties(); case Overwrite : return overwrite(); default : return KGuiItem(); }; }
dogen::formatters::artefact stitch_formatter:: format(const artefact_formatter_interface& stock_formatter, const context& ctx, const yarn::element& e) const { const auto al(stock_formatter.archetype_location()); const auto needs_guard(is_header(stock_formatter.inclusion_support_type())); const auto id(e.name().id()); assistant a(ctx, al, needs_guard, id); const auto& fp(a.artefact_properties().file_path()); auto stitch_template(fp); stitch_template.replace_extension(stitch_extension); /* * If the template does not yet exist, we should just create an * empty artefact. * * This scenario happens when creating a new model or when adding * a new artefact formatter for the first time. */ if (!boost::filesystem::exists(stitch_template)) { BOOST_LOG_SEV(lg, debug) << "Stitch template not found: " << fp.generic_string(); dogen::formatters::artefact r; r.overwrite(a.artefact_properties().overwrite()); return r; } /* * Since the template exists, we can instantiate it. */ auto r(instantiator_.instantiate(stitch_template)); r.overwrite(a.artefact_properties().overwrite()); r.dependencies().push_back(stitch_template); return r; }
int call_raw_print_msg(PANEL *panel, sip_msg_t *msg) { call_raw_info_t *info; int payload_lines, i, column, height, width; // Message ngrep style Header char header[256]; char payload[2048]; int color = 0; // Get panel information if (!(info = call_raw_info(panel))) return -1; // Get the pad window WINDOW *pad = info->pad; // Get current pad dimensions getmaxyx(pad, height, width); // Get message payload strcpy(payload, msg_get_payload(msg)); // Check how many lines we well need to draw this message payload_lines = 0; column = 0; for (i = 0; i < strlen(payload); i++) { if (column == width || payload[i] == '\n') { payload_lines++; column = 0; continue; } column++; } // Check if we have enough space in our huge pad to store this message if (info->padline + payload_lines > height) { // Create a new pad with more lines! pad = newpad(height + 500, COLS); // And copy all previous information overwrite(info->pad, pad); // Delete previous pad delwin(info->pad); // And store the new pad info->pad = pad; } // Color the message { if (setting_has_value(SETTING_COLORMODE, "request")) { // Determine arrow color if (msg_is_request(msg)) { color = CP_RED_ON_DEF; } else { color = CP_GREEN_ON_DEF; } } else if (info->group && setting_has_value(SETTING_COLORMODE, "callid")) { // Color by call-id color = call_group_color(info->group, msg->call); } else if (setting_has_value(SETTING_COLORMODE, "cseq")) { // Color by CSeq within the same call color = msg->cseq % 7 + 1; } // Turn on the message color wattron(pad, COLOR_PAIR(color)); // Print msg header wattron(pad, A_BOLD); mvwprintw(pad, info->padline++, 0, "%s", sip_get_msg_header(msg, header)); wattroff(pad, A_BOLD); // Print msg payload info->padline += draw_message_pos(pad, msg, info->padline); // Extra line between messages info->padline++; // Set this as the last printed message info->last = msg; return 0; }