//------------------------------------------ void radio_butts_init(OBJREC *o,long *params) { char *c,*z; long cnt=0,*q,*d; int i; d=params; for (i=0;i<*params;i++) { d+=1; c=get_title(d); cnt+=strlen(c);cnt++; } q=(long *)getmem(cnt+8); o->userptr=(void *)q; *q++=1;*q++=*params; d=params; z=(char *)q; for (i=0;i<*params;i++) { d+=1; c=get_title(d); strcpy(z,c); z=strchr(z,'\0');z++; } }
s32 __sort_title(struct discHdr * hdr1, struct discHdr * hdr2, bool desc) { char *title1 = get_title(hdr1); char *title2 = get_title(hdr2); title1 = skip_sort_ignore(title1); title2 = skip_sort_ignore(title2); if (desc) return mbs_coll(title2, title1); else return mbs_coll(title1, title2); }
void on_execute() { const k3d::script::code code(m_view->get_buffer()->get_text()); const k3d::mime::type mime_type = k3d::mime::type::lookup(code.source()); if(mime_type.empty()) { k3d::ngui::error_message( _("Unknown script language"), _("Could not identify the MIME-type for this script. " " K-3D supports multiple scripting languages, and the MIME-type is used to " "match scripts to the correct script engines. " "You can add a \"magic token\" at the beginning of a script to " "force identification of its MIME-type - for example, add \"#python\" at the " "beginning of a Python script." )); return; } const k3d::string_t name = get_title(); k3d::iscript_engine::context context; if(m_document) context["document"] = m_document; m_running = true; update_title(); k3d::ngui::execute_script(code, name, context); m_running = false; update_title(); }
struct Record* load_Record(FILE* infile) { struct Record* new_record; int ID, rating; char medium[ MEDIUM_MAX_SIZE ]; char title [ TITLE_MAX_BUFF_SIZE ]; /* read in from the file making sure not to overflow the buffer */ if ( fscanf( infile, "%d %" STRINGIFY( MEDIUM_MAX_SIZE )"s %d\n", &ID, medium, &rating ) != 3 ) return NULL; if ( get_title( infile, title ) ) return NULL; new_record = create_Record( medium, title ); /* update it's member vars from the defaults to the input values */ new_record->rating = rating; new_record->ID = ID; /* set Record ID to the max value we have seen loading from the file and decrement it back to what it was before create_Record() was called */ if( ID > Record_ID_counter ) Record_ID_counter = ID + 1; else Record_ID_counter--; return new_record; }
/* * Returns the current ps_buffer value into string. On some platforms * the string will not be null-terminated, so return the effective * length into *displen. * The return code indicates the error. */ int get_ps_title(int *displen, const char** string) { int rc = is_ps_title_available(); if (rc != PS_TITLE_SUCCESS) return rc; #ifdef PS_USE_WIN32 { MyGetConsoleTitle get_title = NULL; HMODULE hMod = LoadLibrary("kernel32.dll"); if (!hMod) { return PS_TITLE_WINDOWS_ERROR; } /* NOTE we don't use _UNICODE*/ get_title = (MyGetConsoleTitle)GetProcAddress(hMod, "GetConsoleTitleA"); if (!get_title) { return PS_TITLE_WINDOWS_ERROR; } if (!(ps_buffer_cur_len = get_title(ps_buffer, (DWORD)ps_buffer_size))) { return PS_TITLE_WINDOWS_ERROR; } } #endif *displen = (int)ps_buffer_cur_len; *string = ps_buffer; return PS_TITLE_SUCCESS; }
//-------------------------------------------------------------------------- // Create graph for current decompiled function graph_info_t * graph_info_t::create(ea_t func_ea, citem_t *highlighted) { graph_info_t *r; func_t *pfn = get_func(func_ea); if ( pfn == NULL ) return NULL; r = new graph_info_t(); r->func_ea = pfn->startEA; r->fg.highlighted = highlighted; size_t num_inst = 0; for(graphinfo_list_t::iterator it = instances.begin() ; it != instances.end() ; it ++) { if(((*(it))->func_ea == func_ea) && (num_inst < (*(it))->func_instance_no)) num_inst = (*(it))->func_instance_no; } r->func_instance_no = ++ num_inst; get_title(func_ea, num_inst, &r->title); instances.push_back(r); return r; }
static int get_medium_and_title( char* medium, char* title ) { if ( scanf( "%" STRINGIFY( MEDIUM_MAX_SIZE ) "s" , medium) != 1 || !get_title( stdin, title ) ) { return 1; } return 0; }
static gchar *get_text_for_data(RyostklconfigProDimnessSelector *dimness_selector) { RyostklconfigProDimnessSelectorPrivate *priv = dimness_selector->priv; GtkTreeIter iter; gboolean valid; guint type; GtkTreeModel *model; gchar *text; type = priv->dimness_type; switch (type) { case RYOS_LIGHT_DIMNESS_TYPE_MACRO: text = g_strdup_printf(_("Macro: %s/%s"), priv->light_macro->macroset_name, priv->light_macro->macro_name); break; default: model = gtk_combo_box_get_model(GTK_COMBO_BOX(dimness_selector)); valid = find_type(model, type, &iter); if (valid) text = get_title(model, &iter); else text = g_strdup_printf(_("FIXME (0x%02x)"), type); break; } return text; }
//------------------------------------------ void button_init(OBJREC *o,char *title) { char *v; title=get_title(title); o->userptr=(void *)getmem(strlen(title)+1); strcpy((char *)o->userptr,title); v=(char *)o->data; *v=0; }
int add_favorite(struct tab *t, struct karg *args) { char file[PATH_MAX]; FILE *f; char *line = NULL; size_t urilen, linelen; const gchar *uri, *title; if (t == NULL) return (1); /* don't allow adding of xtp pages to favorites */ if (t->xtp_meaning != XT_XTP_TAB_MEANING_NORMAL) { show_oops(t, "%s: can't add xtp pages to favorites", __func__); return (1); } snprintf(file, sizeof file, "%s" PS "%s", work_dir, XT_FAVS_FILE); if ((f = fopen(file, "r+")) == NULL) { show_oops(t, "Can't open favorites file: %s", strerror(errno)); return (1); } title = get_title(t, FALSE); uri = get_uri(t); if (title == NULL || uri == NULL) { show_oops(t, "can't add page to favorites"); goto done; } urilen = strlen(uri); for (;;) { if ((line = fparseln(f, &linelen, NULL, NULL, 0)) == NULL) if (feof(f) || ferror(f)) break; if (linelen == urilen && !strcmp(line, uri)) goto done; free(line); line = NULL; } fprintf(f, "\n%s\n%s", title, uri); done: if (line) free(line); fclose(f); update_favorite_tabs(NULL); return (0); }
void periapsis_app::init() { // initialize main window int sw = get_console()->get_width(); int sh = get_console()->get_height(); int x = (sw / 2) - (main_window::WIDTH / 2); int y = (sh / 2) - (main_window::HEIGHT / 2); widgets.push(new main_window(*global_console, get_title(), x, y)); } // periapsis_app::init()
///============================================================================================= void GlobalInfo_i::GetGlobalInfoW(GlobalInfo * Info) const { LogTrace(); Info->StructSize = sizeof(*Info); Info->MinFarVersion = get_min_version(); Info->Version = get_version(); Info->Author = get_author(); Info->Description = get_description(); Info->Guid = *get_guid(); Info->Title = get_title(); }
int GuiGameBrowser::FindMenuItem(int currentItem, int direction) { int nextItem = currentItem + direction; if(nextItem < 0 || nextItem >= gameCnt) return -1; if(strlen(get_title(&gameList[nextItem])) > 0) return nextItem; else return FindMenuItem(nextItem, direction); }
int setup_menu(Image *image, Setup *setup) { char line[MAXC]; /* Generic string for reading input */ printf("\nAdjust display menu\n"); printf("-------------------\n"); printf(" Enter one of the following codes:\n"); printf(" f - Change display range\n"); printf(" p - Change pixel scale of image\n"); printf(" t - Change title\n"); printf(" z - Change display center and size (crude zoom)\n"); printf(" (%d %d centered at %f %f)\n",setup->xsize,setup->ysize, setup->centx,setup->centy); printf(" + - Toggle compass display on/off\n"); printf(" x - Add/move the cross-hair marker\n"); printf(" q - Quit out of display adjustment and continue with program\n"); printf("\nEnter option: [q] "); fgets(line,MAXC,stdin); if(line[0] == '\n') return 0; else { switch(line[0]) { case 'f': case 'F': get_frange(image,setup); break; case 'p': case 'P': get_pixscale(image,setup); break; case 't': case 'T': get_title(image,setup); break; case 'z': case 'Z': get_imsize(image,setup); break; case '+': toggle_compass(setup); break; case 'x': setup->drawmarker = TRUE; get_marker_info(setup); break; case 'q': case 'Q': return 0; break; default: fprintf(stderr,"\nsetup_menu: Not a valid option.\n"); break; } } return 1; }
/* redraws properties change dialog */ void redraw_attr_dialog(void) { const char *title; int i; int x, y; size_t title_len; int need_ellipsis; werase(change_win); if(file_is_dir) wresize(change_win, 11, WIDTH); else wresize(change_win, 9, WIDTH); y = 2; x = 2; for(i = 0; i < ATTR_COUNT; i++) { mvwaddstr(change_win, y, x, " [ ] "); mvwaddstr(change_win, y, x + 5, attr_strings[i]); if(attrs[i]) mvwaddch(change_win, y, x + 2, (attrs[i] < 0) ? 'X' : '*'); y += 1; } if(file_is_dir) mvwaddstr(change_win, y + 1, x, " [ ] Set Recursively"); getmaxyx(stdscr, y, x); mvwin(change_win, (y - getmaxy(change_win))/2, (x - getmaxx(change_win))/2); box(change_win, 0, 0); x = getmaxx(change_win); title = get_title(); title_len = strlen(title); need_ellipsis = (title_len > (size_t)x - 2); if(need_ellipsis) { x -= 3; title_len = x; } mvwaddnstr(change_win, 0, (getmaxx(change_win) - title_len)/2, title, x - 2); if(need_ellipsis) { waddstr(change_win, "..."); } draw_curr(); }
void GuiGameBrowser::UpdateListEntries() { int next = listOffset; for(int i=0; i<pagesize; i++) { if(next >= 0) { if(game[i]->GetState() == STATE_DISABLED) { game[i]->SetVisible(true); game[i]->SetState(STATE_DEFAULT); } gameTxt[i]->SetText(get_title(&gameList[next])); gameTxt[i]->SetPosition(24, 0); gameTxtOver[i]->SetText(get_title(&gameList[next])); gameTxtOver[i]->SetPosition(24, 0); if (Settings.marknewtitles) { bool isNew = NewTitles::Instance()->IsNew(gameList[next].id); if (isNew) { gameTxt[i]->SetMaxWidth(maxTextWidth - (newGames->GetWidth() + 1), GuiText::DOTTED); gameTxtOver[i]->SetMaxWidth(maxTextWidth - (newGames->GetWidth() + 1), GuiText::SCROLL); } else { gameTxt[i]->SetMaxWidth(maxTextWidth, GuiText::DOTTED); gameTxtOver[i]->SetMaxWidth(maxTextWidth, GuiText::SCROLL); } newImg[i]->SetVisible(isNew); } gameIndex[i] = next; next = this->FindMenuItem(next, 1); } else { game[i]->SetVisible(false); game[i]->SetState(STATE_DISABLED); } } }
// Sets title to what the name of the current menu should be void menu_entries_get_title(char *title, size_t title_len) { const char *dir = NULL; const char *label = NULL; unsigned menu_type = 0; menu_list_t *menu_list = menu_list_get_ptr(); if (!menu_list) return; menu_list_get_last_stack(menu_list, &dir, &label, &menu_type); get_title(label, dir, menu_type, title, title_len); }
void VirtualWifiNotifyIcon::set_notify_tip(NOTIFYSTATUS notify_status/* =NOSTART */,CONST_STR sz_ssid/* =EMPTYSTRING */,CONST_STR sz_key/* =EMPTYSTRING */) { char sz_tip[1024]={0}; switch(notify_status) { case NOSTART: { sprintf(sz_tip,SZ_STATUS_NOSTART,get_title()); SetIcon(LoadIcon(m_notifyiconinfo->NoStartPath)); break; } case STARTED: { start_dynamic_show(); if (sz_ssid!=EMPTYSTRING&&sz_key!=EMPTYSTRING) { sprintf(sz_tip,SZ_STATUS_STARTED,get_title(),sz_ssid,sz_key); } SetIcon(LoadIcon(m_notifyiconinfo->StartPath)); break; } } SetTip(sz_tip); }
int I_ReadSigSet(FILE * fd, struct SigSet *S) { char tag[256]; I_InitSigSet(S); while (gettag(fd, tag)) { if (eq(tag, "title:")) get_title(fd, S); if (eq(tag, "nbands:")) get_nbands(fd, S); if (eq(tag, "class:")) get_class(fd, S); } return 1; /* for now assume success */ }
bool window::set_title(const std::string &str) { { std::lock_guard<std::mutex> lock(m_lock); SDL_SetWindowTitle(m_sdl_window, str.c_str()); } if(get_title() != str) { assert(false); sdl::log_debug_error_check(); return false; } return true; }
char *title_read(int wid) { char *title=get_title(wid); size_t title_len = strlen(title); char *title_string=malloc(title_len+2); if ( !title_string ) { syslog(LOG_ERR, "failed to allocate in %s: %s\n", __func__, strerror(ENOMEM)); } memset(title_string, 0, title_len+2); if ( title_len && sprintf(title_string, "%s\n", title) < 0 ) { syslog(LOG_ERR, "failed to store title string in %s\n", __func__); } free(title); return title_string; }
void on_btnSearch_clicked (GtkWidget *widget, void * user_data) { puts("\nFunction on_btnSearch_clicked:"); if (!strcmp((const char *)gtk_entry_get_text(gui->urlTxt),"")) puts("Empty URL provided"); else puts((const char *)gtk_entry_get_text(gui->urlTxt)); if (strcmp((const char *)gtk_entry_get_text(gui->urlTxt),"")) { int size,k; GtkListStore* list_store; GtkCellRenderer* renderer; GtkTreeIter iter; gtk_cell_layout_clear(GTK_CELL_LAYOUT(gui->qualBox)); list_store = gtk_list_store_new ( 1 , GTK_TYPE_STRING); gtk_combo_box_set_model(GTK_COMBO_BOX(gui->qualBox), GTK_TREE_MODEL(list_store)); renderer = gtk_cell_renderer_text_new(); gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(gui->qualBox), renderer, 0x01); gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(gui->qualBox), renderer, "text", 0, NULL); gtk_widget_set_sensitive(widget,0x00); get_format((const char *)gtk_entry_get_text(gui->urlTxt), &size); printf("Got format. Size: %d\n", size); // cstring format[size]; puts("Format info:"); for (k=0; k<size; ++k) { cstring format = malloc(35*sizeof(char)); sprintf(format,"%d: %s [%s]%c",quality[k]->value,quality[k]->format, quality[k]->size,'\0'); GtkTreeIter * iter; gtk_list_store_append(list_store, &iter); gtk_list_store_set(list_store, &iter, 0, format,-1); free(format); } // cstring filename = malloc(257*sizeof(char)); get_title((const char *) gtk_entry_get_text(gui->urlTxt), &title); printf("%s.%s\n",title,quality[0]->format); // sprintf(filename,"%s.%s", title, quality[0]->format); gtk_combo_box_set_active(GTK_COMBO_BOX(gui->qualBox),0); gtk_widget_set_sensitive(widget,0x01); //http://www.youtube.com/watch?v=SniIBm-PWUM } }
//-------------------------------------------------------------------------- graph_info_t * graph_info_t::create(ea_t func_ea) { graph_info_t *r = find(func_ea); // not there? create it if ( r == NULL ) { // we need a function! func_t *pfn = get_func(func_ea); if ( pfn == NULL ) return NULL; r = new graph_info_t(); get_title(func_ea, &r->title); r->func_ea = pfn->startEA; instances.push_back(r); } return r; }
int password(char *user) { char message[STRING_SIZE]; char password[STRING_SIZE]; char commandstring[STRING_SIZE]; char *tmpstring; if (!strcmp(user, "root")) { strcpy(message, gettext("TR_ENTER_ROOT_PASSWORD")); } else if (!strcmp(user, "admin")) { /* workaround gcc warning, there is really 2 %s there */ tmpstring = strdup(gettext("TR_ENTER_ADMIN_PASSWORD")); snprintf(message, STRING_SIZE, tmpstring, NAME, NAME); free(tmpstring); } else if (!strcmp(user, "backup")) { strcpy(message, gettext("TR_ENTER_BACKUP_PASSWORD")); } else if (!strcmp(user, "dial")) { strcpy(message, gettext("TR_ENTER_DIAL_PASSWORD")); } else { return FAILURE; } if (getpassword(password, message) == SUCCESS) { if (!strcmp(user, "admin") || !strcmp(user, "dial")) { snprintf(commandstring, STRING_SIZE, "/usr/sbin/htpasswd -m -b /var/ipcop/auth/users %s '%s'", user, password); } else { snprintf(commandstring, STRING_SIZE, "/bin/echo '%s:%s' | /usr/sbin/chpasswd", user, password); } if (mysystemhidden(commandstring)) { snprintf(message, STRING_SIZE, "%s %s", gettext("TR_PROBLEM_SETTING_PASSWORD_FOR"), user); newtWinMessage(get_title(), gettext("TR_OK"), message); return FAILURE; } } return SUCCESS; }
static struct Record* find_record_by_title( struct Ordered_container* lib_title ) { char title[ TITLE_ARRAY_SIZE ]; struct Record* rec; if( get_title( stdin, title ) ) { print_error( "Could not read an integer value!\n" ); return NULL; } rec = get_data_ptr( lib_title, comp_Record_to_title, title ); if ( rec == NULL ) { print_error( "No record with that title!\n" ); } return rec; }
Key2KanaTable * StyleFile::get_key2kana_table (std::string section) { Key2KanaTable *table = NULL; std::vector<std::string> keys; bool success = get_key_list (keys, section); if (success) { table = new Key2KanaTable (get_title ()); std::vector<std::string>::iterator it; for (it = keys.begin (); it != keys.end (); it++) { std::vector<std::string> array; get_string_array (array, section, *it); table->append_rule (*it, array); } } return table; }
std::string NoteOfTheDay::get_content( const Glib::Date & date, const gnote::NoteManager & manager) { const std::string title = get_title(date); // Attempt to load content from template const gnote::Note::Ptr template_note = manager.find( s_template_title); if (0 != template_note) { std::string xml_content = template_note->xml_content(); return xml_content.replace(xml_content.find(s_template_title, 0), s_template_title.length(), title); } else { return get_template_content(title); } }
void XAbstractGui::toggle_mouse_capture() { XTextProperty titleProperty; Display *dpy; const char *title; char **list; dpy = getDisplay(); cursor_type = (cursor_type == FLX_DEFAULT_CURSOR) ? FLX_INVISIBLE_CURSOR : FLX_DEFAULT_CURSOR; title = get_title(); list = const_cast<char **>(&title); if (XStringListToTextProperty(list, 1, &titleProperty) != 0) { XSetWMName(dpy, getWindow(FLX_MAIN), &titleProperty); XFree(titleProperty.value); } if (cursor_type == FLX_DEFAULT_CURSOR) { XUngrabPointer(dpy, CurrentTime); } else { unsigned int event_mask; event_mask = ButtonPressMask | ButtonReleaseMask | EnterWindowMask | LeaveWindowMask | PointerMotionMask | PointerMotionHintMask | Button1MotionMask | Button2MotionMask | Button3MotionMask | Button4MotionMask | Button5MotionMask | ButtonMotionMask | KeymapStateMask; XGrabPointer(dpy, getWindow(), True, event_mask, GrabModeAsync, GrabModeAsync, getWindow(), None, CurrentTime); } set_cursor(cursor_type); }
void Save_Game_List() { struct discHdr *buffer = NULL; u32 cnt, len; s32 ret; char name[200]; FILE *f; int i; // Get Game List ret = WBFS_GetCount(&cnt); if (ret < 0) return; printf_x(gt("Saving gamelist.txt ... ")); __console_flush(0); len = sizeof(struct discHdr) * cnt; buffer = (struct discHdr *)memalign(32, len); if (!buffer) goto error; memset(buffer, 0, len); ret = WBFS_GetHeaders(buffer, cnt, sizeof(struct discHdr)); if (ret < 0) goto error; snprintf(D_S(name), "%s/%s", USBLOADER_PATH, "gamelist.txt"); f = fopen(name, "wb"); if (!f) goto error; fprintf(f, "# CFG USB Loader game list %s\n", CFG_VERSION); for (i=0; i<gameCnt; i++) { fprintf(f, "# %.6s %s\n", gameList[i].id, gameList[i].title); fprintf(f, "%.6s = %s\n", gameList[i].id, get_title(&gameList[i])); } fclose(f); SAFE_FREE(buffer); printf("OK"); return; error: SAFE_FREE(buffer); printf(gt("ERROR")); }
void processes ( ) { std::unique_lock<std::mutex> lk ( m_mutex ); m_cv.wait ( lk ); #ifdef DEBUG std::cout << "Traffic simul started." << std::endl; #endif for ( ; m_run; ) { if ( ++m_time > ( m_minutes*60*1000 ) /m_delay ) { m_run = false; break; } else { traffic_run(); std::this_thread::sleep_for ( std::chrono::milliseconds ( m_delay ) ); } } std::cout << "The traffic simulation is over." << std::endl; for ( auto c:m_cop_cars ) *logFile << *c << std::endl; logFile->close (); boost::filesystem::rename ( boost::filesystem::path ( logfile ), boost::filesystem::path ( get_title ( logfile ) ) ); }