void file_chooser_widget_rep::handle_get_string (get_string_event ev) { if (ev->which == "input") { string dir, name; a[0]["directory"]["input"] << get_string ("input", dir); if (type == "directory") { a[0]["directory"]["input"] << get_string ("input", name); if (name == "#f") { ev->s= "#f"; return; } url u= url_system (scm_unquote (dir)); ev->s= "(system->url " * scm_quote (as_string (u)) * ")"; } else { a[0]["file"]["input"] << get_string ("input", name); if (name == "#f") { ev->s= "#f"; return; } url u= url_system (scm_unquote (dir)) * url_system (scm_unquote (name)); ev->s= "(system->url " * scm_quote (convert(as_string (u), get_locale_charset () ,"Cork")) * ")"; } if (type == "image") { string hsize, vsize, xpos, ypos; wk_widget par= a[0]["image"]["parameters"]; par["hsize"]["input"] << get_string ("input", hsize); par["vsize"]["input"] << get_string ("input", vsize); par["xpos"]["input"] << get_string ("input", xpos); par["ypos"]["input"] << get_string ("input", ypos); ev->s= "(list " * ev->s * " " * hsize * " " * vsize * " " * xpos * " " * ypos * ")"; } } else attribute_widget_rep::handle_get_string (ev); }
const char * get_converter (const char *path) { char *from, *to, *iconv_path; iconv_path = find_iconv(); from = get_man_charset(path); to = get_locale_charset(); if (debug) fprintf(stderr, "get_converter: iconv_path=%s from=%s to=%s\n", iconv_path, from, to); if (iconv_path && is_conversion_supported(from, to)) return my_xsprintf("%s %s -f %s -t %s", iconv_path, iconv_extra_flags(), from, to); return NULL; }
int main (int argc, char *argv[]) { #ifdef HAVE_ICONV char *locale_charset; #endif int status = OK; program_name = base_name (argv[0]); if (STREQ (program_name, APROPOS_NAME)) { am_apropos = 1; argp_program_version = "apropos " PACKAGE_VERSION; } else { struct argp_option *optionp; am_apropos = 0; argp_program_version = "whatis " PACKAGE_VERSION; for (optionp = (struct argp_option *) whatis_argp.options; optionp->name || optionp->key || optionp->arg || optionp->flags || optionp->doc || optionp->group; ++optionp) { if (!optionp->name) continue; if (STREQ (optionp->name, "exact") || STREQ (optionp->name, "and")) optionp->flags |= OPTION_HIDDEN; } } init_debug (); pipeline_install_post_fork (pop_all_cleanups); init_locale (); internal_locale = setlocale (LC_MESSAGES, NULL); /* Use LANGUAGE only when LC_MESSAGES locale category is * neither "C" nor "POSIX". */ if (internal_locale && strcmp (internal_locale, "C") && strcmp (internal_locale, "POSIX")) multiple_locale = getenv ("LANGUAGE"); internal_locale = xstrdup (internal_locale ? internal_locale : "C"); if (argp_parse (am_apropos ? &apropos_argp : &whatis_argp, argc, argv, 0, 0, 0)) exit (FAIL); read_config_file (user_config_file != NULL); /* close this locale and reinitialise if a new locale was issued as an argument or in $MANOPT */ if (locale) { free (internal_locale); internal_locale = setlocale (LC_ALL, locale); if (internal_locale) internal_locale = xstrdup (internal_locale); else internal_locale = xstrdup (locale); debug ("main(): locale = %s, internal_locale = %s\n", locale, internal_locale); if (internal_locale) { setenv ("LANGUAGE", internal_locale, 1); locale_changed (); multiple_locale = NULL; } } /* sort out the internal manpath */ if (manp == NULL) manp = locale_manpath (get_manpath (alt_systems)); else free (get_manpath (NULL)); create_pathlist (manp, manpathlist); display_seen = hashtable_create (&null_hashtable_free); #ifdef HAVE_ICONV locale_charset = xasprintf ("%s//IGNORE", get_locale_charset ()); conv_to_locale = iconv_open (locale_charset, "UTF-8"); free (locale_charset); #endif /* HAVE_ICONV */ if (regex_opt) { int i; preg = XNMALLOC (num_keywords, regex_t); for (i = 0; i < num_keywords; ++i) xregcomp (&preg[i], keywords[i], REG_EXTENDED | REG_NOSUB | REG_ICASE); } if (!search ((const char **) keywords, num_keywords)) status = NOT_FOUND; if (regex_opt) { int i; for (i = 0; i < num_keywords; ++i) regfree (&preg[i]); free (preg); } #ifdef HAVE_ICONV if (conv_to_locale != (iconv_t) -1) iconv_close (conv_to_locale); #endif /* HAVE_ICONV */ hashtable_free (display_seen); free_pathlist (manpathlist); free (manp); free (internal_locale); free (program_name); exit (status); }
/** * * * @param argc * @param argv * * @return */ int main(int argc, char *argv[]) { FILE *input; FILE *new_file, *ole_file; char *filename =NULL; short int *tmp_charset; int c; int i; char *tempname; read_config_file(SYSTEMRC); #ifdef USERRC tempname=find_file(strdup(USERRC),getenv("HOME")); if (tempname) { read_config_file(tempname); free(tempname); } #endif #ifdef HAVE_LANGINFO get_locale_charset(); #endif check_charset(&dest_csname,dest_csname); while ((c=getopt(argc,argv,"Vls:d:p:"))!=-1) { switch(c) { case 'l': list_charsets(); exit(0); case 's': check_charset(&source_csname,optarg); source_charset=read_charset(source_csname); break; case 'd': check_charset(&dest_csname,optarg); break; case 'V': printf("Catdoc Version %s\n",CATDOC_VERSION); exit(0); default: help(); exit(1); } } /* If we are using system strftime, we need to set LC_TIME locale * category unless choosen charset is not same as system locale */ #if defined(HAVE_LANGINFO) && defined(HAVE_STRFTIME) && !defined(__TURB0C__) set_time_locale(); #endif /* charset conversion init*/ input_buffer=malloc(FILE_BUFFER); if (strcmp(dest_csname,"utf-8")) { tmp_charset=read_charset(dest_csname); if (!tmp_charset) { fprintf(stderr,"Cannot load target charset %s\n",dest_csname); exit(1); } target_charset=make_reverse_map(tmp_charset); free(tmp_charset); } else { target_charset=NULL; } spec_chars=read_substmap(stradd("ascii",SPEC_EXT)); if (!spec_chars) { fprintf(stderr,"Cannod read substitution map ascii%s\n", SPEC_EXT); exit(1); } replacements=read_substmap(stradd("ascii",REPL_EXT)); if (!replacements) { fprintf(stderr,"Cannod read substitution map ascii%s\n", REPL_EXT); exit(1); } if (optind>=argc) { if (isatty(fileno(stdin))) { help(); exit(0); } do_ppt(stdin,"STDIN"); exit (0); } for (i=optind;i<argc;i++) { filename = argv[i]; input=fopen(filename,"rb"); if (!input) { perror(filename); exit(1); } if ((new_file=ole_init(input, NULL, 0)) != NULL) { set_ole_func(); while((ole_file=ole_readdir(new_file)) != NULL) { int res=ole_open(ole_file); /* fprintf(stderr, "name = %s\n", ((oleEntry*)ole_file)->name); */ if (res >= 0) { if (strcasecmp(((oleEntry*)ole_file)->name , "PowerPoint Document") == 0) { do_ppt(ole_file,filename); } } ole_close(ole_file); } set_std_func(); ole_finish(); fclose(new_file); } else { fprintf(stderr, "%s is not OLE file or Error\n", filename); } } return 0; }