void cEvent::Dump(FILE *f, const char *Prefix, bool InfoOnly) const { if (InfoOnly || startTime + duration + Setup.EPGLinger * 60 >= time(NULL)) { fprintf(f, "%sE %u %ld %d %X %X\n", Prefix, eventID, startTime, duration, tableID, version); if (!isempty(title)) fprintf(f, "%sT %s\n", Prefix, title); if (!isempty(shortText)) fprintf(f, "%sS %s\n", Prefix, shortText); if (!isempty(description)) { strreplace(description, '\n', '|'); fprintf(f, "%sD %s\n", Prefix, description); strreplace(description, '|', '\n'); } if (components) { for (int i = 0; i < components->NumComponents(); i++) { tComponent *p = components->Component(i); if (!Setup.UseDolbyDigital && p->stream == 0x02 && p->type == 0x05) continue; fprintf(f, "%sX %s\n", Prefix, *p->ToString()); } } if (vps) fprintf(f, "%sV %ld\n", Prefix, vps); if (!InfoOnly) fprintf(f, "%se\n", Prefix); } }
const char *cRecDone::ToText(void) { char* tmpDescr = description?strdup(description):NULL; if (tmpDescr) strreplace(tmpDescr, '\n', '|'); char* tmpInfo = aux?strdup(aux):NULL; if (tmpInfo) strreplace(tmpInfo, '\n', '|'); if (buffer) free(buffer); buffer = NULL; cChannel *channel = Channels.GetByChannelID(channelID, true, true); if (!channel) LogFile.Log(3,"invalid channel in recs done!"); msprintf(&buffer, "R %ld %d %d\nC %s\n%s%s%s%s%s%s%s%s%s%s%s%sr", startTime, duration, searchID, channel?CHANNELSTRING(channel):"", title?"T ":"",title?title:"", title?"\n":"", shortText?"S ":"",shortText?shortText:"", shortText?"\n":"", tmpDescr?"D ":"",tmpDescr?tmpDescr:"", tmpDescr?"\n":"", tmpInfo?"@ ":"",tmpInfo?tmpInfo:"", tmpInfo?"\n":""); if (tmpDescr) free(tmpDescr); if (tmpInfo) free(tmpInfo); return buffer; }
static int _add_mirror(alpm_db_t *db, char *value) { const char *dbname = alpm_db_get_name(db); /* let's attempt a replacement for the current repo */ char *temp = strreplace(value, "$repo", dbname); /* let's attempt a replacement for the arch */ const char *arch = config->arch; char *server; if(arch) { server = strreplace(temp, "$arch", arch); free(temp); } else { if(strstr(temp, "$arch")) { free(temp); pm_printf(ALPM_LOG_ERROR, _("mirror '%s' contains the '%s' variable, but no '%s' is defined.\n"), value, "$arch", "Architecture"); return 1; } server = temp; } if(alpm_db_add_server(db, server) != 0) { /* pm_errno is set by alpm_db_setserver */ pm_printf(ALPM_LOG_ERROR, _("could not add server URL to database '%s': %s (%s)\n"), dbname, server, alpm_strerror(alpm_errno(config->handle))); free(server); return 1; } free(server); return 0; }
static void parse_review_site(GlyrQuery * s, GlyrMemCache * cache, GList ** result_items) { if(cache != NULL) { gsize nodelen = (sizeof REVIEW_START) - 1; gchar * node = cache->data; while(continue_search(g_list_length(*result_items),s) && (node = strstr(node+nodelen,REVIEW_START)) != NULL) { gchar * data = get_search_value(node,REVIEW_START,REVIEW_END); if(data != NULL) { GlyrMemCache * item = DL_init(); gchar * kill_br = strreplace(data," <br />\n",""); item->data = strreplace(kill_br,". ",".\n"); item->size = strlen(item->data); item->dsrc = g_strdup(cache->dsrc); *result_items = g_list_prepend(*result_items, item); g_free(kill_br); g_free(data); } } DL_free(cache); } }
void cEvent::Dump(FILE *f, const char *Prefix, bool InfoOnly) const { if (InfoOnly || startTime + duration + Setup.EPGLinger * 60 >= time(NULL)) { fprintf(f, "%sE %u %ld %d %X %X\n", Prefix, eventID, startTime, duration, tableID, version); if (!isempty(title)) fprintf(f, "%sT %s\n", Prefix, title); if (!isempty(shortText)) fprintf(f, "%sS %s\n", Prefix, shortText); if (!isempty(description)) { strreplace(description, '\n', '|'); fprintf(f, "%sD %s\n", Prefix, description); strreplace(description, '|', '\n'); } if (contents[0]) { fprintf(f, "%sG", Prefix); for (int i = 0; Contents(i); i++) fprintf(f, " %02X", Contents(i)); fprintf(f, "\n"); } if (parentalRating) fprintf(f, "%sR %d\n", Prefix, parentalRating); if (components) { for (int i = 0; i < components->NumComponents(); i++) { tComponent *p = components->Component(i); fprintf(f, "%sX %s\n", Prefix, *p->ToString()); } } if (vps) fprintf(f, "%sV %ld\n", Prefix, vps); if (!InfoOnly) fprintf(f, "%se\n", Prefix); } }
/*----------------------------------------------------------------------------- AnsiToOem: Converts from ANSI to 850 -----------------------------------------------------------------------------*/ char *AnsiToOem(char *szAnsiText) { static char szOemText[1024] = ""; if (szAnsiText == NULL) return (NULL); if (strlen(szAnsiText) == 0) return (szAnsiText); memset(szOemText, 0, 1024); strcpy(szOemText, szAnsiText); strreplace(szOemText, '�', '�'); strreplace(szOemText, '�', '�'); strreplace(szOemText, '�', '�'); strreplace(szOemText, '�', '�'); strreplace(szOemText, '�', '�'); strreplace(szOemText, '�', '�'); strreplace(szOemText, '�', '�'); strreplace(szOemText, '�', '�'); strreplace(szOemText, '�', '�'); strreplace(szOemText, '�', '�'); return(szOemText); }
std::string sunjwbase::fixnewline(const std::string& str) { std::string ret; std::string strRepairSrc(""), strRepairDst(""); // 修理换行符, /10->/13/10, /13/13/10->/13/10 strRepairSrc += (char)10; strRepairDst += (char)13; strRepairDst += (char)10; ret = strreplace(str, strRepairSrc, strRepairDst); strRepairSrc = (char)13; strRepairSrc += (char)13; strRepairSrc += (char)10; ret = strreplace(ret, strRepairSrc, strRepairDst); // 修理换行符, /13->/13/10, /13/10/10->/13/10 strRepairSrc = ""; strRepairDst = ""; strRepairSrc += (char)13; strRepairDst += (char)13; strRepairDst += (char)10; ret = strreplace(ret, strRepairSrc, strRepairDst); strRepairSrc = (char)13; strRepairSrc += (char)10; strRepairSrc += (char)10; ret = strreplace(ret, strRepairSrc, strRepairDst); return ret; }
TEST(corestr,strreplace) { std::string value = "Main string"; EXPECT_EQ(1, strreplace(value,"str","aaa")); EXPECT_STREQ("Main aaaing", value.c_str()); EXPECT_EQ(4, strreplace(value,"a","b")); }
void info_xml_creator::output(FILE *out) { m_output = out; // output the DTD fprintf(m_output, "<?xml version=\"1.0\"?>\n"); std::string dtd(s_dtd_string); strreplace(dtd, "__XML_ROOT__", emulator_info::get_xml_root()); strreplace(dtd, "__XML_TOP__", emulator_info::get_xml_top()); fprintf(m_output, "%s\n\n", dtd.c_str()); // top-level tag fprintf(m_output, "<%s build=\"%s\" debug=\"" #ifdef MAME_DEBUG "yes" #else "no" #endif "\" mameconfig=\"%d\">\n", emulator_info::get_xml_root(), xml_normalize_string(build_version), CONFIG_VERSION ); // iterate through the drivers, outputting one at a time while (m_drivlist.next()) output_one(); // output devices (both devices with roms and slot devices) output_devices(); // close the top level tag fprintf(m_output, "</%s>\n",emulator_info::get_xml_root()); }
string escape(string value) { strreplace(value, '&', "&"); strreplace(value, '<', "<"); strreplace(value, '>', ">"); strreplace(value, '"', """); strreplace(value, '\'', "'"); return value; }
void print_packages(const alpm_list_t *packages) { const alpm_list_t *i; if(!config->print_format) { config->print_format = strdup("%l"); } for(i = packages; i; i = alpm_list_next(i)) { alpm_pkg_t *pkg = i->data; char *string = strdup(config->print_format); char *temp = string; /* %n : pkgname */ if(strstr(temp, "%n")) { string = strreplace(temp, "%n", alpm_pkg_get_name(pkg)); free(temp); temp = string; } /* %v : pkgver */ if(strstr(temp, "%v")) { string = strreplace(temp, "%v", alpm_pkg_get_version(pkg)); free(temp); temp = string; } /* %l : location */ if(strstr(temp, "%l")) { char *pkgloc = pkg_get_location(pkg); string = strreplace(temp, "%l", pkgloc); free(pkgloc); free(temp); temp = string; } /* %r : repo */ if(strstr(temp, "%r")) { const char *repo = "local"; alpm_db_t *db = alpm_pkg_get_db(pkg); if(db) { repo = alpm_db_get_name(db); } string = strreplace(temp, "%r", repo); free(temp); temp = string; } /* %s : size */ if(strstr(temp, "%s")) { char *size; pm_asprintf(&size, "%jd", (intmax_t)pkg_get_size(pkg)); string = strreplace(temp, "%s", size); free(size); free(temp); } printf("%s\n", string); free(string); } }
static GList * review_metallum_parse(cb_object * capo) { GList * result_items = NULL; gsize nodelen = strlen(NODE_START); gchar * node = capo->cache->data; gint node_ctr = 0; while((node = strstr(node+nodelen,NODE_START)) != NULL) { /* Only take the album url, not the other urls */ if(++node_ctr % 2 == 0) { node += nodelen; gchar * content_url = copy_value(node,strstr(node,NODE_END)); if(content_url != NULL) { gchar * review_url = strreplace(content_url,"/albums/","/reviews/"); if(review_url != NULL) { parse_review_site(capo->s, download_single(review_url,capo->s,NULL), &result_items); g_free(review_url); } g_free(content_url); } } } return result_items; }
static void stgopt(char *start,char *end,int (*outputfunc)(char *str)) { char symbols[MAX_OPT_VARS+1][MAX_ALIAS+1]; int seq,match_length,repl_length; int matches; char *debut=start; /* save original start of the buffer */ assert(sequences!=NULL); /* do not match anything if debug-level is maximum */ if (pc_optimize>sOPTIMIZE_NONE && sc_status==statWRITE) { do { matches=0; start=debut; while (start<end) { seq=0; while (sequences[seq].find!=NULL) { assert(seq>=0); if (*sequences[seq].find<sOPTIMIZE_NUMBER) { if (*sequences[seq].find>pc_optimize) break; /* don't look further */ seq++; /* continue with next string */ continue; } /* if */ if (matchsequence(start,end,sequences[seq].find,symbols,&match_length)) { char *replace=replacesequence(sequences[seq].replace,symbols,&repl_length); /* If the replacement is bigger than the original section, we may need * to "grow" the staging buffer. This is quite complex, due to the * re-ordering of expressions that can also happen in the staging * buffer. In addition, it should not happen: the peephole optimizer * must replace sequences with *shorter* sequences, not longer ones. * So, I simply forbid sequences that are longer than the ones they * are meant to replace. */ assert(match_length>=repl_length); if (match_length>=repl_length) { strreplace(start,replace,match_length,repl_length,(int)(end-start)); end-=match_length-repl_length; free(replace); code_idx-=opcodes(sequences[seq].opc)+opargs(sequences[seq].arg); seq=0; /* restart search for matches */ matches++; } else { /* actually, we should never get here (match_length<repl_length) */ assert(0); free(replace); seq++; } /* if */ } else { seq++; } /* if */ } /* while */ assert(sequences[seq].find==NULL || *sequences[seq].find<sOPTIMIZE_NUMBER); start += strlen(start) + 1; /* to next string */ } /* while (start<end) */ } while (matches>0); } /* if (pc_optimize>sOPTIMIZE_NONE && sc_status==statWRITE) */ for (start=debut; start<end; start+=strlen(start)+1) outputfunc(start); }
static void output_footer_and_close_file(util::core_file::ptr &&file, std::string &templatefile, std::string &path) { std::string modified(templatefile); strreplace(modified, "<!--PATH-->", path.c_str()); file->write(modified.c_str(), modified.length()); file.reset(); }
static GlyrMemCache * parse_page(GlyrMemCache * dl, cb_object * capo) { GlyrMemCache * result = NULL; if(dl != NULL) { gchar * begin = strstr(dl->data,LYR_BEGIN); if(begin != NULL) { begin += (sizeof LYR_BEGIN) - 1; gchar * end = strstr(begin,LYR_ENDIN); if(end != NULL) { *(end) = 0; gchar * no_br_tags = strreplace(begin,"<br />",NULL); if(no_br_tags != NULL) { result = DL_init(); result->data = beautify_string(no_br_tags); result->size = (result->data) ? strlen(result->data) : 0; result->dsrc = g_strdup(dl->dsrc); g_free(no_br_tags); } } } } return result; }
const char *cPendingNotification::ToText(void) const { char* tmpFormatted = formatted!=""?strdup(formatted.c_str()):NULL; if (tmpFormatted) strreplace(tmpFormatted, '\n', '|'); if (buffer) free(buffer); buffer = NULL; #if VDRVERSNUM > 20300 LOCK_CHANNELS_READ; const cChannels *vdrchannels = Channels; #else cChannels *vdrchannels = &Channels; #endif const cChannel *channel = vdrchannels->GetByChannelID(channelID, true, true); if (!channel) LogFile.Log(3,"invalid channel in pending notifications!"); msprintf(&buffer, "N %d %u %d %d %ld\nC %s\n%s%s%sn", type, eventID, timerMod, searchID, start, channel?CHANNELSTRING(channel):"", tmpFormatted?"F ":"",tmpFormatted?tmpFormatted:"", tmpFormatted?"\n":""); if (tmpFormatted) free(tmpFormatted); return buffer; }
static GList * lyrics_lyricsreg_parse (cb_object * capo) { GList * result_list = NULL; gchar * start = strstr (capo->cache->data, INFO_BEGIN); if (start != NULL) { start += (sizeof INFO_BEGIN) - 1; gchar * end = strstr (start,INFO_ENDIN); if (end != NULL) { * (end) = 0; gchar * no_br_tags = strreplace (start,"<br />",NULL); if (no_br_tags != NULL) { GlyrMemCache * tmp = DL_init(); tmp->data = beautify_string (no_br_tags); tmp->size = tmp->data ? strlen (tmp->data) : 0; g_free (no_br_tags); if (tmp->data != NULL) { result_list = g_list_prepend (result_list,tmp); } } } } return result_list; }
//------------------------------------------------- // load_data_info //------------------------------------------------- void datfile_manager::load_data_info(const game_driver *drv, std::string &buffer, int type) { dataindex const *index_idx = nullptr; drvindex const *driver_idx = nullptr; std::string const *tag; std::string filename; switch (type) { case UI_HISTORY_LOAD: filename = "history.dat"; tag = &TAG_BIO; index_idx = &m_histidx; break; case UI_MAMEINFO_LOAD: filename = "mameinfo.dat"; tag = &TAG_MAME; index_idx = &m_mameidx; driver_idx = &m_drvidx; break; case UI_SYSINFO_LOAD: filename = "sysinfo.dat"; tag = &TAG_BIO; index_idx = &m_sysidx; break; case UI_MESSINFO_LOAD: filename = "messinfo.dat"; tag = &TAG_MAME; index_idx = &m_messidx; driver_idx = &m_messdrvidx; break; case UI_STORY_LOAD: filename = "story.dat"; tag = &TAG_STORY; index_idx = &m_storyidx; break; case UI_GINIT_LOAD: filename = "gameinit.dat"; tag = &TAG_MAME; index_idx = &m_ginitidx; break; default: assert(false); return; } fileptr const datfile = parseopen(filename.c_str()); if (datfile) { load_data_text(datfile.get(), drv, buffer, *index_idx, *tag); // load driver info if (driver_idx && !driver_idx->empty()) load_driver_text(datfile.get(), drv, buffer, *driver_idx, TAG_DRIVER); // cleanup mameinfo and sysinfo double line spacing if (((*tag == TAG_MAME) && (type != UI_GINIT_LOAD)) || (type == UI_SYSINFO_LOAD)) strreplace(buffer, "\n\n", "\n"); } }
static void output_footer_and_close_file(core_file *file, std::string &templatefile, std::string &title) { std::string modified(templatefile); strreplace(modified, "<!--TITLE-->", title.c_str()); core_fwrite(file, modified.c_str(), modified.length()); core_fclose(file); }
void SystemData::launchGame(GameData* game) { std::cout << "Attempting to launch game...\n"; //suspend SDL joystick events (these'll pile up even while something else is running) SDL_JoystickEventState(0); Renderer::deinit(); std::string command = mLaunchCommand; command = strreplace(command, "%ROM%", game->getBashPath()); std::cout << " " << command << "\n"; std::cout << "=====================================================\n"; int exitCode = system(command.c_str()); std::cout << "=====================================================\n"; if(exitCode != 0) std::cout << "...launch terminated with nonzero exit code!\n"; Renderer::init(); //re-enable SDL joystick events SDL_JoystickEventState(1); }
static void parse_lyrics_page (const gchar * url, GList ** result_list, cb_object * capo) { GlyrMemCache * lyrcache = download_single (url,capo->s,"<!-- eBay Relevance Ad -->"); if (lyrcache != NULL) { gchar * lyr_begin = strstr (lyrcache->data,LYRIC_BEGIN); if (lyr_begin != NULL) { gchar * lyr_endin = strstr (lyr_begin,"</div>"); if (lyr_endin != NULL) { gchar * lyrics = copy_value (lyr_begin,lyr_endin); if (lyrics != NULL) { GlyrMemCache * result = DL_init(); result->data = strreplace (lyrics,"<br />",""); result->size = strlen (result->data); result->dsrc = g_strdup (url); *result_list = g_list_prepend (*result_list,result); } g_free (lyrics); } } DL_free (lyrcache); } }
/* Need to strip "/.." components and transform '\\' to '/' for physfs */ static char *normalize(char * name, const char *basedir) { int last = strlen(name)-1; strreplace(name,'\\','/'); while (last >= 0 && name[last] == '/') name[last--] = 0; if (last > 0 && name[last] == '.' && name[last-1] == '/') name[last-1] = 0; if (last > 1 && name[last] == '.' && name[last-1] == '.' && name[last-2] == '/') { name[last-2] = 0; char *slash = strrchr(name,'/'); if (slash) *slash = 0; } if (strlen(basedir) > strlen(name)) { strcpy(name,basedir); strreplace(name,'\\','/'); } last = strlen(name)-1; while (last >= 0 && name[last] == '/') name[last--] = 0; if (name[0] == 0) name[0] = '/'; //LOG_MSG("File access: %s",name); return name; }
void setAverage(HWND hwndDlg, int res, int count, int total) { memset(tmp, 0, sizeof(tmp)); GetDlgItemText(hwndDlg, res, tmp, sizeof(tmp)); char average[10] = { 0 }; sprintf(average, "%0.1f", (count) ? ((float) total / (float) count) : 0); strreplace(tmp, "%AVG%", average); SetDlgItemText(hwndDlg, res, tmp); }
void setCounter(HWND hwndDlg, int res, int count) { memset(tmp, 0, sizeof(tmp)); GetDlgItemText(hwndDlg, res, tmp, sizeof(tmp)); char counter[10] = { 0 }; sprintf(counter, "%d", count); strreplace(tmp, "%COUNT%", counter); SetDlgItemText(hwndDlg, res, tmp); }
void setHeaderVersion(HWND hwndDlg) { memset(tmp, 0, sizeof(tmp)); GetDlgItemText(hwndDlg, IDC_MLHDR_VER, tmp, sizeof(tmp)); char version[10] = { 0 }; sprintf(version, "0x%x", MLHDR_VER); strreplace(tmp, "%VERSION%", version); SetDlgItemText(hwndDlg, IDC_MLHDR_VER, tmp); }
sdl_options::sdl_options() : osd_options() { std::string ini_path(INI_PATH); add_entries(sdl_options::s_option_entries); strreplace(ini_path,"APP_NAME", emulator_info::get_appname_lower()); set_default_value(SDLOPTION_INIPATH, ini_path.c_str()); }
void ui_menu_video_options::populate() { const char *subtext = ""; std::string tempstring; int viewnum; int enabled; /* add items for each view */ for (viewnum = 0; ; viewnum++) { const char *name = target->view_name(viewnum); if (name == NULL) break; /* create a string for the item, replacing underscores with spaces */ tempstring.assign(name); strreplace(tempstring, "_", " "); item_append(tempstring.c_str(), NULL, 0, (void *)(FPTR)(VIDEO_ITEM_VIEW + viewnum)); } /* add a separator */ item_append(MENU_SEPARATOR_ITEM, NULL, 0, NULL); /* add a rotate item */ switch (target->orientation()) { case ROT0: subtext = "None"; break; case ROT90: subtext = "CW 90" UTF8_DEGREES; break; case ROT180: subtext = "180" UTF8_DEGREES; break; case ROT270: subtext = "CCW 90" UTF8_DEGREES; break; } item_append("Rotate", subtext, MENU_FLAG_LEFT_ARROW | MENU_FLAG_RIGHT_ARROW, (void *)VIDEO_ITEM_ROTATE); /* backdrop item */ enabled = target->backdrops_enabled(); item_append("Backdrops", enabled ? "Enabled" : "Disabled", enabled ? MENU_FLAG_LEFT_ARROW : MENU_FLAG_RIGHT_ARROW, (void *)VIDEO_ITEM_BACKDROPS); /* overlay item */ enabled = target->overlays_enabled(); item_append("Overlays", enabled ? "Enabled" : "Disabled", enabled ? MENU_FLAG_LEFT_ARROW : MENU_FLAG_RIGHT_ARROW, (void *)VIDEO_ITEM_OVERLAYS); /* bezel item */ enabled = target->bezels_enabled(); item_append("Bezels", enabled ? "Enabled" : "Disabled", enabled ? MENU_FLAG_LEFT_ARROW : MENU_FLAG_RIGHT_ARROW, (void *)VIDEO_ITEM_BEZELS); /* cpanel item */ enabled = target->cpanels_enabled(); item_append("CPanels", enabled ? "Enabled" : "Disabled", enabled ? MENU_FLAG_LEFT_ARROW : MENU_FLAG_RIGHT_ARROW, (void *)VIDEO_ITEM_CPANELS); /* marquee item */ enabled = target->marquees_enabled(); item_append("Marquees", enabled ? "Enabled" : "Disabled", enabled ? MENU_FLAG_LEFT_ARROW : MENU_FLAG_RIGHT_ARROW, (void *)VIDEO_ITEM_MARQUEES); /* cropping */ enabled = target->zoom_to_screen(); item_append("View", enabled ? "Cropped" : "Full", enabled ? MENU_FLAG_RIGHT_ARROW : MENU_FLAG_LEFT_ARROW, (void *)VIDEO_ITEM_ZOOM); }
static const gchar *lyrics_lyricsvip_url(GlyrQuery *settings) { gchar *result = NULL; gchar *artist_clean = strreplace(settings->artist, " ", "-"); if(artist_clean != NULL) { gchar *title_clean = strreplace(settings->title, " ", "-"); if(title_clean != NULL) { gchar *prep_artist = curl_easy_escape(NULL, artist_clean, 0); gchar *prep_title = curl_easy_escape(NULL, title_clean, 0); result = g_strdup_printf(LV_URL, prep_artist, prep_title); g_free(title_clean); curl_free(prep_artist); curl_free(prep_title); } g_free(artist_clean); } return result; }
void menu_video_options::populate(float &customtop, float &custombottom) { const char *subtext = ""; std::string tempstring; int viewnum; int enabled; /* add items for each view */ for (viewnum = 0; ; viewnum++) { const char *name = target->view_name(viewnum); if (name == nullptr) break; /* create a string for the item, replacing underscores with spaces */ tempstring.assign(name); strreplace(tempstring, "_", " "); item_append(tempstring, "", 0, (void *)(uintptr_t)(VIDEO_ITEM_VIEW + viewnum)); } /* add a separator */ item_append(menu_item_type::SEPARATOR); /* add a rotate item */ switch (target->orientation()) { case ROT0: subtext = "None"; break; case ROT90: subtext = "CW 90" UTF8_DEGREES; break; case ROT180: subtext = "180" UTF8_DEGREES; break; case ROT270: subtext = "CCW 90" UTF8_DEGREES; break; } item_append(_("Rotate"), subtext, FLAG_LEFT_ARROW | FLAG_RIGHT_ARROW, (void *)VIDEO_ITEM_ROTATE); /* backdrop item */ enabled = target->backdrops_enabled(); item_append(_("Backdrops"), enabled ? _("Enabled") : _("Disabled"), enabled ? FLAG_LEFT_ARROW : FLAG_RIGHT_ARROW, (void *)VIDEO_ITEM_BACKDROPS); /* overlay item */ enabled = target->overlays_enabled(); item_append(_("Overlays"), enabled ? _("Enabled") : _("Disabled"), enabled ? FLAG_LEFT_ARROW : FLAG_RIGHT_ARROW, (void *)VIDEO_ITEM_OVERLAYS); /* bezel item */ enabled = target->bezels_enabled(); item_append(_("Bezels"), enabled ? _("Enabled") : _("Disabled"), enabled ? FLAG_LEFT_ARROW : FLAG_RIGHT_ARROW, (void *)VIDEO_ITEM_BEZELS); /* cpanel item */ enabled = target->cpanels_enabled(); item_append(_("CPanels"), enabled ? _("Enabled") : _("Disabled"), enabled ? FLAG_LEFT_ARROW : FLAG_RIGHT_ARROW, (void *)VIDEO_ITEM_CPANELS); /* marquee item */ enabled = target->marquees_enabled(); item_append(_("Marquees"), enabled ? _("Enabled") : _("Disabled"), enabled ? FLAG_LEFT_ARROW : FLAG_RIGHT_ARROW, (void *)VIDEO_ITEM_MARQUEES); /* cropping */ enabled = target->zoom_to_screen(); item_append(_("View"), enabled ? _("Cropped") : _("Full"), enabled ? FLAG_RIGHT_ARROW : FLAG_LEFT_ARROW, (void *)VIDEO_ITEM_ZOOM); }
int main(int argc, char* argv[]) { setlocale(0, "russian"); int i=0; int N=0; char* str= NULL; // строка для работы FILE *f; // исходный файл FILE *f1; // файл для печати unsigned long long te, tb; if (argc < 4) { printf("Нет достаточного числа аргументов!"); return BADARG; } f = fopen(argv[1], "r"); if (f == NULL) { printf("Невозможно открыть исходный файл!"); return BADINFILE; } f1 = fopen(argv[2], "w"); if (f1 == NULL) { printf("Невозможно открыть файл результата!"); fclose(f); return BADOUTFILE; } if (strcmp(argv[3],"")==0) { printf("Заменяемая строка пуста!"); fclose(f); fclose(f1); return BADINSUBSTR; } te = tick(); while ((str = freadstring(f, &N)) != NULL) { i++; if (strreplace(&str, argv[3], argv[4], N) == -1) { printf("Строка %i не была обработана и выведена в файл", i); } else fprintf(f1, "%s", str); free(str); } tb = tick(); fclose(f); fclose(f1); printf("\nУспешно завершено! Время работы программы: %llu", tb - te); getch(); return 0; }