您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ textdomain函数代码示例

51自学网 2021-06-03 08:47:21
  C++
这篇教程C++ textdomain函数代码示例写得很实用,希望能帮到您。

本文整理汇总了C++中textdomain函数的典型用法代码示例。如果您正苦于以下问题:C++ textdomain函数的具体用法?C++ textdomain怎么用?C++ textdomain使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。

在下文中一共展示了textdomain函数的29个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: main

int main(int argc, char **argv){	int i, c, act = ACT_FDISK;	int colormode = UL_COLORMODE_AUTO;	struct fdisk_context *cxt;	setlocale(LC_ALL, "");	bindtextdomain(PACKAGE, LOCALEDIR);	textdomain(PACKAGE);	atexit(close_stdout);	fdisk_init_debug(0);	cxt = fdisk_new_context();	if (!cxt)		err(EXIT_FAILURE, _("failed to allocate libfdisk context"));	fdisk_context_set_ask(cxt, ask_callback, NULL);	while ((c = getopt(argc, argv, "b:c::C:hH:lL::sS:t:u::vV")) != -1) {		switch (c) {		case 'b':		{			size_t sz = strtou32_or_err(optarg,					_("invalid sector size argument"));			if (sz != 512 && sz != 1024 && sz != 2048 && sz != 4096)				usage(stderr);			fdisk_save_user_sector_size(cxt, sz, sz);			break;		}		case 'C':			fdisk_save_user_geometry(cxt,				strtou32_or_err(optarg,						_("invalid cylinders argument")),				0, 0);			break;		case 'c':			if (optarg) {				/* this setting is independent on the current				 * actively used label */				struct fdisk_label *lb = fdisk_context_get_label(cxt, "dos");				if (!lb)					err(EXIT_FAILURE, _("not found DOS label driver"));				if (strcmp(optarg, "=dos") == 0)					fdisk_dos_enable_compatible(lb, TRUE);				else if (strcmp(optarg, "=nondos") == 0)					fdisk_dos_enable_compatible(lb, FALSE);				else					usage(stderr);			}			/* use default if no optarg specified */			break;		case 'H':			fdisk_save_user_geometry(cxt, 0,				strtou32_or_err(optarg,						_("invalid heads argument")),				0);			break;		case 'S':			fdisk_save_user_geometry(cxt, 0, 0,				strtou32_or_err(optarg,					_("invalid sectors argument")));			break;		case 'l':			act = ACT_LIST;			break;		case 'L':			if (optarg)				colormode = colormode_or_err(optarg,						_("unsupported color mode"));			break;		case 's':			act = ACT_SHOWSIZE;			break;		case 't':		{			struct fdisk_label *lb = NULL;			while (fdisk_context_next_label(cxt, &lb) == 0)				fdisk_label_set_disabled(lb, 1);			lb = fdisk_context_get_label(cxt, optarg);			if (!lb)				errx(EXIT_FAILURE, _("unsupported disklabel: %s"), optarg);			fdisk_label_set_disabled(lb, 0);		}		case 'u':			if (optarg && *optarg == '=')				optarg++;			if (fdisk_context_set_unit(cxt, optarg) != 0)				usage(stderr);			break;		case 'V':		case 'v':			printf(UTIL_LINUX_VERSION);			return EXIT_SUCCESS;		case 'h':			usage(stdout);		default:			usage(stderr);		}//.........这里部分代码省略.........
开发者ID:maandree,项目名称:util-linux,代码行数:101,


示例2: main

/** * Program entry point * *	@param argc Number of argv elements *	@param argv Program name and arguments *	@param envp Program environment *	@return <i>0</i> Success *	@return <br><i>254</i> Initialization failed */intmain(int argc, char **argv, char **envp){  bk_s B = NULL;				/* Baka general structure */  BK_ENTRY_MAIN(B, __FUNCTION__, __FILE__, "SIMPLE");  int c;  int getopterr = 0;  int debug_level = 0;  char i18n_localepath[_POSIX_PATH_MAX];  char *i18n_locale;  struct program_config Pconfig, *pc = NULL;  poptContext optCon = NULL;  struct poptOption optionsTable[] =  {    {"debug", 'd', POPT_ARG_NONE, NULL, 'd', N_("Turn on debugging"), NULL },    {"verbose", 'v', POPT_ARG_NONE, NULL, 'v', N_("Turn on verbose message"), NULL },    {"no-seatbelts", 0, POPT_ARG_NONE, NULL, 0x1000, N_("Sealtbelts off & speed up"), NULL },    {"seatbelts", 0, POPT_ARG_NONE, NULL, 0x1001, N_("Enable function tracing"), NULL },    {"profiling", 0, POPT_ARG_STRING, NULL, 0x1002, N_("Enable and write profiling data"), N_("filename") },    POPT_AUTOHELP    POPT_TABLEEND  };  if (!(B=bk_general_init(argc, &argv, &envp, BK_ENV_GWD(NULL, "BK_ENV_CONF_APP", BK_APP_CONF), NULL, ERRORQUEUE_DEPTH, LOG_LOCAL0, 0)))  {    fprintf(stderr,"Could not perform basic initialization/n");    exit(254);  }  bk_fun_reentry(B);  // Enable error output  bk_error_config(B, BK_GENERAL_ERROR(B), ERRORQUEUE_DEPTH, stderr, BK_ERR_ERR,		  BK_ERR_ERR, BK_ERROR_CONFIG_FH |		  BK_ERROR_CONFIG_SYSLOGTHRESHOLD | BK_ERROR_CONFIG_HILO_PIVOT);  // i18n stuff  setlocale(LC_ALL, "");  if (!(i18n_locale = BK_GWD(B, STD_LOCALEDIR_KEY, NULL)))  {    i18n_locale = i18n_localepath;    snprintf(i18n_localepath, sizeof(i18n_localepath), "%s/%s", BK_ENV_GWD(B, STD_LOCALEDIR_ENV,STD_LOCALEDIR_DEF), STD_LOCALEDIR_SUB);  }  bindtextdomain(BK_GENERAL_PROGRAM(B), i18n_locale);  textdomain(BK_GENERAL_PROGRAM(B));  for (c = 0; optionsTable[c].longName || optionsTable[c].shortName; c++)  {    if (optionsTable[c].descrip) (*((char **)&(optionsTable[c].descrip)))=_(optionsTable[c].descrip);    if (optionsTable[c].argDescrip) (*((char **)&(optionsTable[c].argDescrip)))=_(optionsTable[c].argDescrip);  }  pc = &Pconfig;  memset(pc, 0, sizeof(*pc));  if (!(optCon = poptGetContext(NULL, argc, (const char **)argv, optionsTable, 0)))  {    bk_error_printf(B, BK_ERR_ERR, "Could not initialize options processing/n");    bk_exit(B, 254);  }  while ((c = poptGetNextOpt(optCon)) >= 0)  {    switch (c)    {    case 'd':					// debug      if (!debug_level)      {	// Set up debugging, from config file	bk_general_debug_config(B, stderr, BK_ERR_NONE, 0);	bk_debug_printf(B, "Debugging on/n");	debug_level++;      }      else if (debug_level == 1)      {	/*	 * Enable output of error and higher error logs (this can be	 * annoying so require -dd)	 */	bk_error_config(B, BK_GENERAL_ERROR(B), 0, stderr, BK_ERR_NONE, BK_ERR_ERR, BK_ERROR_CONFIG_FH | BK_ERROR_CONFIG_HILO_PIVOT | BK_ERROR_CONFIG_SYSLOGTHRESHOLD);	bk_debug_printf(B, "Extra debugging on/n");	debug_level++;      }      else if (debug_level == 2)      {	/*	 * Enable output of all levels of bk_error logs (this can be	 * very annoying so require -ddd)	 */	bk_error_config(B, BK_GENERAL_ERROR(B), 0, stderr, BK_ERR_NONE, BK_ERR_DEBUG, BK_ERROR_CONFIG_FH | BK_ERROR_CONFIG_HILO_PIVOT | BK_ERROR_CONFIG_SYSLOGTHRESHOLD);	bk_debug_printf(B, "Super-extra debugging on/n");//.........这里部分代码省略.........
开发者ID:SethRobertson,项目名称:libbk,代码行数:101,


示例3: main

int main(int argc, char *argv[]){    /* Workaround Qt platform integration plugin not advertising itself       as having the following capabilities:        - QPlatformIntegration::ThreadedOpenGL        - QPlatformIntegration::BufferQueueingOpenGL    */    setenv("QML_FORCE_THREADED_RENDERER", "1", 1);    setenv("QML_FIXED_ANIMATION_STEP", "1", 1);    // ignore favorites in unity-scopes-shell plugin    setenv("UNITY_SCOPES_NO_FAVORITES", "1", 1);    QGuiApplication::setApplicationName("Unity Scope Tool");    QGuiApplication *application;    application = new QGuiApplication(argc, argv);    QCommandLineParser parser;    parser.setApplicationDescription("Unity Scope Tool/n/n"    "This tool allows development and testing of scopes. Running it without/n"    "any arguments will open a session to all scopes available on the system./n"    "Otherwise passing a path to a scope config file will open a session with/n"    "only that scope (assuming that the binary implementing the scope can be/n"    "found in the same directory as the config file).");    QCommandLineOption helpOption = parser.addHelpOption();    parser.addPositionalArgument("scopes", "Paths to scope config files to spawn, optionally.", "[scopes...]");    QCommandLineOption includeSystemScopes("include-system-scopes",        "Initialize the registry with scopes installed on this system");    QCommandLineOption includeServerScopes("include-server-scopes",        "Initialize the registry with scopes on the default server");    parser.addOption(includeServerScopes);    parser.addOption(includeSystemScopes);    parser.parse(application->arguments());    if (parser.isSet(helpOption)) {        parser.showHelp();    }    QStringList extraScopes = parser.positionalArguments();    QScopedPointer<RegistryTracker> tracker;    if (!extraScopes.isEmpty()) {        bool systemScopes = parser.isSet(includeSystemScopes);        bool serverScopes = parser.isSet(includeServerScopes);        tracker.reset(new RegistryTracker(extraScopes, systemScopes, serverScopes));    }    bindtextdomain("unity8", translationDirectory().toUtf8().data());    textdomain("unity8");    QQuickView* view = new QQuickView();    view->setResizeMode(QQuickView::SizeRootObjectToView);    view->setTitle(QGuiApplication::applicationName());    view->engine()->setBaseUrl(QUrl::fromLocalFile(::qmlDirectory()));    QUrl source(::qmlDirectory() + "/ScopeTool.qml");    prependImportPaths(view->engine(), ::overrideImportPaths());    prependImportPaths(view->engine(), ::nonMirImportPaths());    appendImportPaths(view->engine(), ::fallbackImportPaths());    view->setSource(source);    view->show();    UnixSignalHandler signal_handler([]{        QGuiApplication::exit(0);    });    signal_handler.setupUnixSignalHandlers();    int result = application->exec();    delete view;    delete application;    return result;}
开发者ID:dumpster-of-things,项目名称:unity8,代码行数:79,


示例4: main

intmain (int argc, char *argv[]){  gboolean gui_possible;  int c;  int option_index;  char **cmdline = NULL;  int cmdline_source = 0;  struct config *config = new_config ();  setlocale (LC_ALL, "");  bindtextdomain (PACKAGE, LOCALEBASEDIR);  textdomain (PACKAGE);#if ! GLIB_CHECK_VERSION(2,32,0)  /* In glib2 < 2.32 you had to call g_thread_init().  In later glib2   * that is not required and should not be called.   */  if (glib_check_version (2, 32, 0) != NULL) /* This checks < 2.32 */    g_thread_init (NULL);#endif  gdk_threads_init ();  gdk_threads_enter ();  gui_possible = gtk_init_check (&argc, &argv);  for (;;) {    c = getopt_long (argc, argv, options, long_options, &option_index);    if (c == -1) break;    switch (c) {    case 0:			/* options which are long only */      if (STREQ (long_options[option_index].name, "long-options")) {        display_long_options (long_options);      }      else if (STREQ (long_options[option_index].name, "short-options")) {        display_short_options (options);      }      else if (STREQ (long_options[option_index].name, "cmdline")) {        cmdline = parse_cmdline_string (optarg);        cmdline_source = CMDLINE_SOURCE_COMMAND_LINE;      }      else {        fprintf (stderr, _("%s: unknown long option: %s (%d)/n"),                 guestfs_int_program_name, long_options[option_index].name, option_index);        exit (EXIT_FAILURE);      }      break;    case 'v':      config->verbose = 1;      break;    case 'V':      printf ("%s %s%s/n",              guestfs_int_program_name,              PACKAGE_VERSION, PACKAGE_VERSION_EXTRA);      exit (EXIT_SUCCESS);    case HELP_OPTION:      usage (EXIT_SUCCESS);    default:      usage (EXIT_FAILURE);    }  }  if (optind != argc) {    fprintf (stderr, _("%s: unused arguments on the command line/n"),             guestfs_int_program_name);    usage (EXIT_FAILURE);  }  set_config_defaults (config);  /* If /proc/cmdline exists and contains "p2v.server=" then we enable   * non-interactive configuration.   * If /proc/cmdline contains p2v.debug then we enable verbose mode   * even for interactive configuration.   */  if (cmdline == NULL) {    cmdline = parse_proc_cmdline ();    if (cmdline == NULL)      goto gui;    cmdline_source = CMDLINE_SOURCE_PROC_CMDLINE;  }  if (get_cmdline_key (cmdline, "p2v.debug") != NULL)    config->verbose = 1;  if (get_cmdline_key (cmdline, "p2v.server") != NULL)    kernel_configuration (config, cmdline, cmdline_source);  else {  gui:    if (!gui_possible) {      fprintf (stderr,               _("%s: gtk_init_check returned false, indicating that/n"                 "a GUI is not possible on this host.  Check X11, $DISPLAY etc./n"),               guestfs_int_program_name);      exit (EXIT_FAILURE);    }//.........这里部分代码省略.........
开发者ID:hedongzhang,项目名称:libguestfs,代码行数:101,


示例5: main

int main(int argc, char **argv){  int optind;  char **playlist_array;  int items;  struct stat stat_buf;  int i;  setlocale(LC_ALL, "");  bindtextdomain(PACKAGE, LOCALEDIR);  textdomain(PACKAGE);  ao_initialize();  stat_format = stat_format_create();  options_init(&options);  file_options_init(file_opts);  parse_std_configs(file_opts);  options.playlist = playlist_create();  optind = parse_cmdline_options(argc, argv, &options, file_opts);  audio_play_arg.devices = options.devices;  audio_play_arg.stat_format = stat_format;  /* Add remaining arguments to playlist */  for (i = optind; i < argc; i++) {    if (stat(argv[i], &stat_buf) == 0) {      if (S_ISDIR(stat_buf.st_mode)) {	if (playlist_append_directory(options.playlist, argv[i]) == 0)	  fprintf(stderr, 		  _("WARNING: Could not read directory %s./n"), argv[i]);      } else {	playlist_append_file(options.playlist, argv[i]);      }    } else /* If we can't stat it, it might be a non-disk source */      playlist_append_file(options.playlist, argv[i]);  }  /* Do we have anything left to play? */  if (playlist_length(options.playlist) == 0) {    cmdline_usage();    exit(1);  } else {    playlist_array = playlist_to_array(options.playlist, &items);    playlist_destroy(options.playlist);    options.playlist = NULL;  }  /* Don't use status_message until after this point! */  status_init(options.verbosity);  print_audio_devices_info(options.devices);  /* Setup buffer */  if (options.buffer_size > 0) {    /* Keep sample size alignment for surround sound with up to 10 channels */    options.buffer_size = (options.buffer_size + PRIMAGIC - 1) / PRIMAGIC * PRIMAGIC;    audio_buffer = buffer_create(options.buffer_size,				 options.buffer_size * options.prebuffer / 100,				 audio_play_callback, &audio_play_arg,				 AUDIO_CHUNK_SIZE);    if (audio_buffer == NULL) {      status_error(_("Error: Could not create audio buffer./n"));      exit(1);    }  } else    audio_buffer = NULL;  /* Setup signal handlers and callbacks */  signal (SIGINT, signal_handler);  signal (SIGTSTP, signal_handler);  signal (SIGCONT, signal_handler);  signal (SIGTERM, signal_handler);  if (options.remote) {    /* run the mainloop for the remote interface */    remote_mainloop();  } else {    do {      /* Shuffle playlist */      if (options.shuffle) {        int i;        srandom(time(NULL));        for (i = 0; i < items; i++) {          int j = i + random() % (items - i);          char *temp = playlist_array[i];          playlist_array[i] = playlist_array[j];          playlist_array[j] = temp;        }//.........这里部分代码省略.........
开发者ID:JoeyZheng,项目名称:deadbeef,代码行数:101,


示例6: main

int main(int argc, char *argv[]){	int status = 0;	int print = 0;	char *mapName = NULL;	char *saveName = NULL;	char *dirName = NULL;	char opt;	int count;	setlocale(LC_ALL, getenv(ENV_LANG));	textdomain("keymap");	// Graphics enabled?	graphics = graphicsAreEnabled();	// Check options	while (strchr("psT:?", (opt = getopt(argc, argv, "ps:T"))))	{		switch (opt)		{			case 'p':				// Just print out the map, if we're in text mode				print = 1;				break;			case 's':				// Save the map to a file				if (!optarg)				{					fprintf(stderr, "%s", _("Missing filename argument for -s "						"option/n"));					usage(argv[0]);					return (status = ERR_NULLPARAMETER);				}				saveName = optarg;				break;			case 'T':				// Force text mode				graphics = 0;				break;			case ':':				fprintf(stderr, _("Missing parameter for %s option/n"),					argv[optind - 1]);				usage(argv[0]);				return (status = ERR_NULLPARAMETER);			default:				fprintf(stderr, _("Unknown option '%c'/n"), optopt);				usage(argv[0]);				return (status = ERR_INVALID);		}	}	cwd = malloc(MAX_PATH_LENGTH);	selectedMap = malloc(sizeof(keyMap));	if (!cwd || !selectedMap)	{		status = ERR_MEMORY;		goto out;	}	strncpy(cwd, PATH_SYSTEM_KEYMAPS, MAX_PATH_LENGTH);	// Get the current map	status = keyboardGetMap(selectedMap);	if (status < 0)		goto out;	strncpy(currentName, selectedMap->name, KEYMAP_NAMELEN);	mapName = selectedMap->name;	// Did the user supply either a map name or a key map file name?	if ((argc > 1) && (optind < argc))	{		// Is it a file name?		status = fileFind(argv[optind], NULL);		if (status >= 0)		{			status = readMap(argv[optind], selectedMap);			if (status < 0)				goto out;			mapName = selectedMap->name;			dirName = dirname(argv[optind]);			if (dirName)			{				strncpy(cwd, dirName, MAX_PATH_LENGTH);				free(dirName);			}		}		else		{			// Assume we've been given a map name.			mapName = argv[optind];		}//.........这里部分代码省略.........
开发者ID:buddywithgol,项目名称:visopsys,代码行数:101,


示例7: main

int main(int argc, char **argv){	int	c;	int	fd;	int	mode = 0;	int	dig = 0;	loff_t	length = -2LL;	loff_t	offset = 0;	static const struct option longopts[] = {	    { "help",           0, 0, 'h' },	    { "version",        0, 0, 'V' },	    { "keep-size",      0, 0, 'n' },	    { "punch-hole",     0, 0, 'p' },	    { "collapse-range", 0, 0, 'c' },	    { "dig-holes",      0, 0, 'd' },	    { "zero-range",     0, 0, 'z' },	    { "offset",         1, 0, 'o' },	    { "length",         1, 0, 'l' },	    { "verbose",        0, 0, 'v' },	    { NULL,             0, 0, 0 }	};	static const ul_excl_t excl[] = {	/* rows and cols in in ASCII order */		{ 'c', 'd', 'p', 'z' },		{ 'c', 'n' },		{ 0 }	};	int excl_st[ARRAY_SIZE(excl)] = UL_EXCL_STATUS_INIT;	setlocale(LC_ALL, "");	bindtextdomain(PACKAGE, LOCALEDIR);	textdomain(PACKAGE);	atexit(close_stdout);	while ((c = getopt_long(argc, argv, "hvVncpdzl:o:", longopts, NULL))			!= -1) {		err_exclusive_options(c, longopts, excl, excl_st);		switch(c) {		case 'h':			usage(stdout);			break;		case 'c':			mode |= FALLOC_FL_COLLAPSE_RANGE;			break;		case 'd':			dig = 1;			break;		case 'l':			length = cvtnum(optarg);			break;		case 'n':			mode |= FALLOC_FL_KEEP_SIZE;			break;		case 'o':			offset = cvtnum(optarg);			break;		case 'p':			mode |= FALLOC_FL_PUNCH_HOLE | FALLOC_FL_KEEP_SIZE;			break;		case 'z':			mode |= FALLOC_FL_ZERO_RANGE;			break;		case 'v':			verbose++;			break;		case 'V':			printf(UTIL_LINUX_VERSION);			return EXIT_SUCCESS;		default:			usage(stderr);			break;		}	}	if (optind == argc)		errx(EXIT_FAILURE, _("no filename specified"));	filename = argv[optind++];	if (optind != argc)		errx(EXIT_FAILURE, _("unexpected number of arguments"));	if (dig) {		/* for --dig-holes the default is analyze all file */		if (length == -2LL)			length = 0;		if (length < 0)			errx(EXIT_FAILURE, _("invalid length value specified"));	} else {		/* it's safer to require the range specification (--length --offset) */		if (length == -2LL)			errx(EXIT_FAILURE, _("no length argument specified"));		if (length <= 0)			errx(EXIT_FAILURE, _("invalid length value specified"));	}	if (offset < 0)		errx(EXIT_FAILURE, _("invalid offset value specified"));//.........这里部分代码省略.........
开发者ID:Distrotech,项目名称:util-linux,代码行数:101,


示例8: main

intmain (gint argc, gchar *argv[]){	TrackerConfig *config;	TrackerMiner *miner_files;	TrackerMinerFilesIndex *miner_files_index;	GOptionContext *context;	GError *error = NULL;	gchar *log_filename = NULL;	gboolean do_mtime_checking;	gboolean do_crawling;	gboolean force_mtime_checking = FALSE;	gboolean store_available;	main_loop = NULL;	setlocale (LC_ALL, "");	bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR);	bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");	textdomain (GETTEXT_PACKAGE);	/* Set timezone info */	tzset ();	/* Translators: this messagge will apper immediately after the	 * usage string - Usage: COMMAND <THIS_MESSAGE>	 */	context = g_option_context_new (_("- start the tracker indexer"));	g_option_context_add_main_entries (context, entries, NULL);	g_option_context_parse (context, &argc, &argv, &error);	g_option_context_free (context);	if (error) {		g_printerr ("%s/n", error->message);		g_error_free (error);		return EXIT_FAILURE;	}	if (version) {		g_print ("/n" ABOUT "/n" LICENSE "/n");		return EXIT_SUCCESS;	}	if (eligible) {		check_eligible ();		return EXIT_SUCCESS;	}	/* Initialize logging */	config = tracker_config_new ();	if (verbosity > -1) {		tracker_config_set_verbosity (config, verbosity);	}	if (initial_sleep > -1) {		tracker_config_set_initial_sleep (config, initial_sleep);	}	tracker_log_init (tracker_config_get_verbosity (config),	                  &log_filename);	if (log_filename) {		g_message ("Using log file:'%s'", log_filename);		g_free (log_filename);	}	sanity_check_option_values (config);	/* This makes sure we don't steal all the system's resources */	initialize_priority_and_scheduling (tracker_config_get_sched_idle (config),	                                    tracker_db_manager_get_first_index_done () == FALSE);	main_loop = g_main_loop_new (NULL, FALSE);	g_message ("Checking if we're running as a daemon:");	g_message ("  %s %s",	           no_daemon ? "No" : "Yes",	           no_daemon ? "(forced by command line)" : "");	/* Create new TrackerMinerFiles object */	miner_files = tracker_miner_files_new (config, &error);	if (!miner_files) {		g_critical ("Couldn't create new Files miner: '%s'",		            error ? error->message : "unknown error");		g_object_unref (config);		tracker_log_shutdown ();		return EXIT_FAILURE;	}	tracker_writeback_init (TRACKER_MINER_FILES (miner_files),	                        config,	                        &error);	if (error) {		g_critical ("Couldn't create writeback handling: '%s'",		            error ? error->message : "unknown error");		g_object_unref (config);		g_object_unref (miner_files);//.........这里部分代码省略.........
开发者ID:amtep,项目名称:tracker,代码行数:101,


示例9: main

int main(int argc, char **argv){	int ch;	struct iovec iov;	struct utmp *utmpptr;	char *p;	char line[sizeof(utmpptr->ut_line) + 1];	int print_banner = TRUE;	char *mbuf, *fname = NULL;	size_t mbufsize;	unsigned timeout = WRITE_TIME_OUT;	char **mvec = NULL;	int mvecsz = 0;	static const struct option longopts[] = {		{ "nobanner",	no_argument,		0, 'n' },		{ "timeout",	required_argument,	0, 't' },		{ "version",	no_argument,		0, 'V' },		{ "help",	no_argument,		0, 'h' },		{ NULL,	0, 0, 0 }	};	setlocale(LC_ALL, "");	bindtextdomain(PACKAGE, LOCALEDIR);	textdomain(PACKAGE);	atexit(close_stdout);	while ((ch = getopt_long(argc, argv, "nt:Vh", longopts, NULL)) != -1) {		switch (ch) {		case 'n':			if (geteuid() == 0)				print_banner = FALSE;			else				warnx(_("--nobanner is available only for root"));			break;		case 't':			timeout = strtou32_or_err(optarg, _("invalid timeout argument"));			if (timeout < 1)				errx(EXIT_FAILURE, _("invalid timeout argument: %s"), optarg);			break;		case 'V':			printf(UTIL_LINUX_VERSION);			exit(EXIT_SUCCESS);		case 'h':			usage(stdout);		default:			usage(stderr);		}	}	argc -= optind;	argv += optind;	if (argc == 1 && access(argv[0], F_OK) == 0)		fname = argv[0];	else if (argc >= 1) {		mvec = argv;		mvecsz = argc;	}	mbuf = makemsg(fname, mvec, mvecsz, &mbufsize, print_banner);	iov.iov_base = mbuf;	iov.iov_len = mbufsize;	while((utmpptr = getutent())) {		if (!utmpptr->ut_user[0])			continue;#ifdef USER_PROCESS		if (utmpptr->ut_type != USER_PROCESS)			continue;#endif		/* Joey Hess reports that use-sessreg in /etc/X11/wdm/		   produces ut_line entries like :0, and a write		   to /dev/:0 fails. */		if (utmpptr->ut_line[0] == ':')			continue;		xstrncpy(line, utmpptr->ut_line, sizeof(utmpptr->ut_line));		if ((p = ttymsg(&iov, 1, line, timeout)) != NULL)			warnx("%s", p);	}	endutent();	free(mbuf);	exit(EXIT_SUCCESS);}
开发者ID:azat-archive,项目名称:util-linux,代码行数:84,


示例10: main

//.........这里部分代码省略.........      G_OPTION_ARG_NONE,      &arg_print_summary,      N_("Print a XML mail summary"),      NULL    },    {      "unset-obsolete-configuration",      '/0',      0,      G_OPTION_ARG_NONE,      &arg_unset_obsolete_configuration,      N_("Unset obsolete GConf configuration"),      NULL    },    {      "quit",      'q',      0,      G_OPTION_ARG_NONE,      &arg_quit,      N_("Quit Mail Notification"),      NULL    },    { NULL }  };  GOptionContext *option_context;  DBusGConnection *bus;  DBusGProxy *bus_proxy;  g_log_set_fatal_mask(NULL, G_LOG_LEVEL_CRITICAL);  g_log_set_handler(NULL, G_LOG_LEVEL_INFO, info_log_cb, NULL);#ifdef ENABLE_NLS  bindtextdomain(GETTEXT_PACKAGE, GNOMELOCALEDIR);  bind_textdomain_codeset(GETTEXT_PACKAGE, "UTF-8");  textdomain(GETTEXT_PACKAGE);#endif  g_set_application_name(_("Mail Notification"));  g_thread_init(NULL);  if (! g_thread_supported())    /*     * We cannot use mn_fatal_error_dialog() because gtk_init() has     * not been called yet.     */    g_critical(_("multi-threading is not available"));  gdk_threads_init();  GDK_THREADS_ENTER();  option_context = g_option_context_new(NULL);  g_option_context_add_main_entries(option_context, options, GETTEXT_PACKAGE);  gnome_program_init(PACKAGE,		     VERSION,		     LIBGNOME_MODULE,		     argc,		     argv,		     GNOME_PARAM_HUMAN_READABLE_NAME, _("Mail Notification"),		     GNOME_PROGRAM_STANDARD_PROPERTIES,		     GNOME_PARAM_GOPTION_CONTEXT, option_context,		     NULL);  gtk_init(&argc, &argv);
开发者ID:epienbroek,项目名称:mail-notification,代码行数:66,


示例11: main

intmain (int argc, char *argv[]){    struct sigaction sig_callback;    g_thread_init (NULL);    gdk_threads_init ();    gtk_init (&argc, &argv);    bindtextdomain (GETTEXT_PACKAGE, SNES9XLOCALEDIR);    bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");    textdomain (GETTEXT_PACKAGE);    memset (&Settings, 0, sizeof (Settings));    /* Allow original config file for backend settings */    S9xLoadConfigFiles (argv, argc);    /* Perform our config here */    gui_config = new Snes9xConfig ();    S9xInitInputDevices ();    gui_config->load_config_file ();    char *rom_filename = S9xParseArgs (argv, argc);    S9xReportControllers ();    if (!Memory.Init () || !S9xInitAPU ())        exit (3);    g_set_application_name ("Snes9x");    top_level = new Snes9xWindow (gui_config);    /* If we're going to fullscreen, do it before showing window to avoid flicker. */    if ((gui_config->full_screen_on_open && rom_filename) || (gui_config->fullscreen))        gtk_window_fullscreen (top_level->get_window ());    top_level->show ();    S9xInitDisplay (argc, argv);    Memory.PostRomInitFunc = S9xPostRomInit;    S9xPortSoundInit ();    gui_config->reconfigure ();    top_level->update_accels ();    Settings.Paused = TRUE;    syncing = 0;    idle_func_id = g_idle_add_full (IDLE_FUNC_PRIORITY,                                    S9xIdleFunc,                                    NULL,                                    NULL);    g_timeout_add (10000, S9xScreenSaverCheckFunc, NULL);    S9xNoROMLoaded ();    if (rom_filename)    {        if (S9xOpenROM (rom_filename) && gui_config->full_screen_on_open)            gtk_window_unfullscreen (top_level->get_window());    }    memset (&sig_callback, 0, sizeof (struct sigaction));    sig_callback.sa_handler = S9xTerm;    sigaction (15 /* SIGTERM */, &sig_callback, NULL);    sigaction (3  /* SIGQUIT */, &sig_callback, NULL);    sigaction (2  /* SIGINT  */, &sig_callback, NULL);    if (gui_config->fullscreen)    {        gui_config->fullscreen = 0;        needs_fullscreening = 1;    }#ifdef USE_JOYSTICK    gui_config->flush_joysticks ();#endif    gtk_window_present (top_level->get_window ());    gtk_main ();    return 0;}
开发者ID:juhalaukkanen,项目名称:snes9x,代码行数:92,


示例12: main

/** * main: **/intmain (int argc, char *argv[]){	AsAppValidateFlags validate_flags = 0;	gboolean nonet = FALSE;	gboolean relax = FALSE;	gboolean ret;	gboolean strict = FALSE;	gboolean verbose = FALSE;	gboolean version = FALSE;	gchar *filename = NULL;	gchar *output_format = NULL;	GError *error = NULL;	gint i;	gint retval = EXIT_CODE_SUCCESS;	gint retval_tmp;	GOptionContext *context;	const GOptionEntry options[] = {		{ "relax", 'r', 0, G_OPTION_ARG_NONE, &relax,			/* TRANSLATORS: this is the --relax argument */			_("Be less strict when checking files"), NULL },		{ "strict", 's', 0, G_OPTION_ARG_NONE, &strict,			/* TRANSLATORS: this is the --relax argument */			_("Be more strict when checking files"), NULL },		{ "nonet", '/0', 0, G_OPTION_ARG_NONE, &nonet,			/* TRANSLATORS: this is the --nonet argument */			_("Do not use network access"), NULL },		{ "verbose", 'v', 0, G_OPTION_ARG_NONE, &verbose,			/* TRANSLATORS: this is the --verbose argument */			_("Show extra debugging information"), NULL },		{ "version", '/0', 0, G_OPTION_ARG_NONE, &version,			/* TRANSLATORS: this is the --version argument */			_("Show the version number and then quit"), NULL },		{ "filename", '/0', 0, G_OPTION_ARG_STRING, &filename,			/* TRANSLATORS: this is the --filename argument */			_("The source filename when using a temporary file"), NULL },		{ "output-format", '/0', 0, G_OPTION_ARG_STRING, &output_format,			/* TRANSLATORS: this is the --output-format argument */			_("The output format [text|html|xml]"), NULL },		{ NULL}	};	setlocale (LC_ALL, "");	bindtextdomain (GETTEXT_PACKAGE, PACKAGE_LOCALE_DIR);	bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");	textdomain (GETTEXT_PACKAGE);#if !GLIB_CHECK_VERSION(2,36,0)	g_type_init ();#endif	context = g_option_context_new ("AppData Validation Program");	g_option_context_add_main_entries (context, options, NULL);	ret = g_option_context_parse (context, &argc, &argv, &error);	if (!ret) {		/* TRANSLATORS: this is where the user used unknown command		 * line switches -- the exact error follows */		g_print ("%s %s/n", _("Failed to parse command line:"), error->message);		g_error_free (error);		goto out;	}	/* big fat warning */	g_print ("THIS TOOL IS *DEPRECATED* AND WILL BE REMOVED SOON./n");	g_print ("Please use 'apstream-util validate' in appstream-glib./n/n");	/* just show the version */	if (version) {		g_print ("%s/n", PACKAGE_VERSION);		goto out;	}	/* verbose? */	if (verbose) {		g_log_set_fatal_mask (NULL, G_LOG_LEVEL_ERROR | G_LOG_LEVEL_CRITICAL);		g_log_set_handler ("AppDataTools",				   G_LOG_LEVEL_ERROR |				   G_LOG_LEVEL_CRITICAL |				   G_LOG_LEVEL_DEBUG |				   G_LOG_LEVEL_WARNING,				   appdata_validate_log_handler_cb, NULL);	} else {		/* hide all debugging */		g_log_set_fatal_mask (NULL, G_LOG_LEVEL_ERROR | G_LOG_LEVEL_CRITICAL);		g_log_set_handler ("AppDataTools",				   G_LOG_LEVEL_DEBUG,				   appdata_validate_log_ignore_cb, NULL);	}	if (argc < 2) {		retval = EXIT_CODE_USAGE;		/* TRANSLATORS: this is explaining how to use the tool */		g_print ("%s %s %s/n", _("Usage:"), argv[0], _("<file>"));		goto out;	}	/* make more strict or relaxed */	if (strict)//.........这里部分代码省略.........
开发者ID:hughsie,项目名称:appdata-tools,代码行数:101,


示例13: main

int main(int argc, char **argv){	int tty_fd;	struct termios ts;	int speed = 0, bits = '-', parity = '-', stop = '-';	int set_iflag = 0, clr_iflag = 0;	int ldisc;	int optc;	char *dev;	int intropause = 1;	char *introparm = NULL;	static const struct option opttbl[] = {		{"speed", required_argument, NULL, 's'},		{"sevenbits", no_argument, NULL, '7'},		{"eightbits", no_argument, NULL, '8'},		{"noparity", no_argument, NULL, 'n'},		{"evenparity", no_argument, NULL, 'e'},		{"oddparity", no_argument, NULL, 'o'},		{"onestopbit", no_argument, NULL, '1'},		{"twostopbits", no_argument, NULL, '2'},		{"iflag", required_argument, NULL, 'i'},		{"help", no_argument, NULL, 'h'},		{"version", no_argument, NULL, 'V'},		{"debug", no_argument, NULL, 'd'},	        {"intro-command", no_argument, NULL, 'c'},	        {"pause", no_argument, NULL, 'p'},		{NULL, 0, NULL, 0}	};	signal(SIGKILL, handler);	signal(SIGINT, handler);	setlocale(LC_ALL, "");	bindtextdomain(PACKAGE, LOCALEDIR);	textdomain(PACKAGE);	atexit(close_stdout);	/* parse options */	if (argc == 0)		usage(EXIT_SUCCESS);	while ((optc =		getopt_long(argc, argv, "dhV78neo12s:i:c:p:", opttbl,			    NULL)) >= 0) {		switch (optc) {		case 'd':			debug = 1;			break;		case '1':		case '2':			stop = optc;			break;		case '7':		case '8':			bits = optc;			break;		case 'n':		case 'e':		case 'o':			parity = optc;			break;		case 's':			speed = strtos32_or_err(optarg, _("invalid speed argument"));			break;		case 'p':			intropause = strtou32_or_err(optarg, _("invalid pause argument"));			if (intropause > 10)				errx(EXIT_FAILURE, "invalid pause: %s", optarg);			break;		case 'c':			introparm = optarg;			break;		case 'i':			parse_iflag(optarg, &set_iflag, &clr_iflag);			break;		case 'V':			printf(UTIL_LINUX_VERSION);			return EXIT_SUCCESS;		case 'h':			usage(EXIT_SUCCESS);		default:			errtryhelp(EXIT_FAILURE);		}	}	if (argc - optind != 2)		usage(EXIT_FAILURE);	/* parse line discipline specification */	ldisc = lookup_table(ld_discs, argv[optind]);	if (ldisc < 0)		ldisc = strtos32_or_err(argv[optind], _("invalid line discipline argument"));	/* ldisc specific option settings */	if (ldisc == N_GIGASET_M101) {		/* device specific defaults for line speed and data format */		if (speed == 0)			speed = 115200;		if (bits == '-')			bits = '8';//.........这里部分代码省略.........
开发者ID:sebras,项目名称:util-linux,代码行数:101,


示例14: main

int main(int argc, char **argv){    /* I18n */    setlocale(LC_ALL, "");#if ENABLE_NLS    bindtextdomain(PACKAGE, LOCALEDIR);    textdomain(PACKAGE);#endif    abrt_init(argv);    const char *program_usage_string = _(        "& [-v -i -n INCREMENT] -e|--event EVENT DIR..."        );    char *event_name = NULL;    int interactive = 0; /* must be _int_, OPT_BOOL expects that! */    int nice_incr = 0;    struct options program_options[] = {        OPT__VERBOSE(&g_verbose),        OPT_STRING('e', "event" , &event_name, "EVENT",  _("Run EVENT on DIR")),        OPT_BOOL('i', "interactive" , &interactive, _("Communicate directly to the user")),        OPT_INTEGER('n',     "nice" , &nice_incr,   _("Increment the nice value by INCREMENT")),        OPT_END()    };    parse_opts(argc, argv, program_options, program_usage_string);    argv += optind;    if (!*argv || !event_name)        show_usage_and_die(program_usage_string, program_options);    load_abrt_conf();    const char *const opt_env_nice = getenv("ABRT_EVENT_NICE");    if (opt_env_nice != NULL && opt_env_nice[0] != '/0')    {        log_debug("Using ABRT_EVENT_NICE=%s to increment the nice value", opt_env_nice);        nice_incr = xatoi(opt_env_nice);    }    if (nice_incr != 0)    {        log_debug("Incrementing the nice value by %d", nice_incr);        const int ret = nice(nice_incr);        if (ret == -1)            perror_msg_and_die("Failed to increment the nice value");    }    bool post_create = (strcmp(event_name, "post-create") == 0);    char *dump_dir_name = NULL;    while (*argv)    {        dump_dir_name = xstrdup(*argv++);        int i = strlen(dump_dir_name);        while (--i >= 0)            if (dump_dir_name[i] != '/')                break;        dump_dir_name[++i] = '/0';        struct dump_dir *dd = dd_opendir(dump_dir_name, /*flags:*/ DD_OPEN_READONLY);        if (!dd)            return 1;        uid = dd_load_text_ext(dd, FILENAME_UID, DD_FAIL_QUIETLY_ENOENT);        dd_close(dd);        struct run_event_state *run_state = new_run_event_state();        if (!interactive)            make_run_event_state_forwarding(run_state);        run_state->logging_callback = do_log;        if (post_create)            run_state->post_run_callback = is_crash_a_dup;        int r = run_event_on_dir_name(run_state, dump_dir_name, event_name);        const bool no_action_for_event = (r == 0 && run_state->children_count == 0);        free_run_event_state(run_state);        /* Needed only if is_crash_a_dup() was called, but harmless         * even if it wasn't:         */        dup_uuid_fini();        dup_corebt_fini();        if (no_action_for_event)            error_msg_and_die("No actions are found for event '%s'", event_name);//TODO: consider this case:// new dump is created, post-create detects that it is a dup,// but then load_crash_info(dup_name) *FAILS*.// In this case, we later delete damaged dup_name (right?)// but new dump never gets its FILENAME_COUNT set!        /* Is crash a dup? (In this case, is_crash_a_dup() should have         * aborted "post-create" event processing as soon as it saw uuid         * and determined that there is another crash with same uuid.         * In this case it sets crash_dump_dup_name)         */        if (crash_dump_dup_name)//.........这里部分代码省略.........
开发者ID:wlindauer,项目名称:abrt,代码行数:101,


示例15: main

int main(int argc, char **argv){	int permission = 0644;	int opt;	size_t size = 0;	int nsems = 0;	int ask_shm = 0, ask_msg = 0, ask_sem = 0;	static const struct option longopts[] = {		{"shmem", required_argument, NULL, 'M'},		{"semaphore", required_argument, NULL, 'S'},		{"queue", no_argument, NULL, 'Q'},		{"mode", required_argument, NULL, 'p'},		{"version", no_argument, NULL, 'V'},		{"help", no_argument, NULL, 'h'},		{NULL, 0, NULL, 0}	};	setlocale(LC_ALL, "");	bindtextdomain(PACKAGE, LOCALEDIR);	textdomain(PACKAGE);	atexit(close_stdout);	while((opt = getopt_long(argc, argv, "hM:QS:p:Vh", longopts, NULL)) != -1) {		switch(opt) {		case 'M':			size = strtou64_or_err(optarg, _("failed to parse size"));			ask_shm = 1;			break;		case 'Q':			ask_msg = 1;			break;		case 'S':			nsems = strtos32_or_err(optarg, _("failed to parse elements"));			ask_sem = 1;			break;		case 'p':			permission = strtoul(optarg, NULL, 8);			break;		case 'h':			usage(stdout);			break;		case 'V':			printf(UTIL_LINUX_VERSION);			return EXIT_SUCCESS;		default:			ask_shm = ask_msg = ask_sem = 0;			break;		}	}	if(!ask_shm && !ask_msg && !ask_sem)		usage(stderr);	if (ask_shm) {		int shmid;		if (-1 == (shmid = create_shm(size, permission)))			err(EXIT_FAILURE, _("create share memory failed"));		else			printf(_("Shared memory id: %d/n"), shmid);	}	if (ask_msg) {		int msgid;		if (-1 == (msgid = create_msg(permission)))			err(EXIT_FAILURE, _("create message queue failed"));		else			printf(_("Message queue id: %d/n"), msgid);	}	if (ask_sem) {		int semid;		if (-1 == (semid = create_sem(nsems, permission)))			err(EXIT_FAILURE, _("create semaphore failed"));		else			printf(_("Semaphore id: %d/n"), semid);	}	return EXIT_SUCCESS;}
开发者ID:CSRedRat,项目名称:util-linux,代码行数:79,


示例16: main

int main(int argc, char **argv){	char *path;	int c, fd, verbose = 0, secure = 0, secsize;	uint64_t end, blksize, step, range[2], stats[2];	struct stat sb;	struct timeval now, last;	static const struct option longopts[] = {	    { "help",      0, 0, 'h' },	    { "version",   0, 0, 'V' },	    { "offset",    1, 0, 'o' },	    { "length",    1, 0, 'l' },	    { "step",      1, 0, 'p' },	    { "secure",    0, 0, 's' },	    { "verbose",   0, 0, 'v' },	    { NULL,        0, 0, 0 }	};	setlocale(LC_ALL, "");	bindtextdomain(PACKAGE, LOCALEDIR);	textdomain(PACKAGE);	atexit(close_stdout);	range[0] = 0;	range[1] = ULLONG_MAX;	step = 0;	while ((c = getopt_long(argc, argv, "hVsvo:l:p:", longopts, NULL)) != -1) {		switch(c) {		case 'h':			usage(stdout);			break;		case 'V':			printf(UTIL_LINUX_VERSION);			return EXIT_SUCCESS;		case 'l':			range[1] = strtosize_or_err(optarg,					_("failed to parse length"));			break;		case 'o':			range[0] = strtosize_or_err(optarg,					_("failed to parse offset"));			break;		case 'p':			step = strtosize_or_err(optarg,					_("failed to parse step"));			break;		case 's':			secure = 1;			break;		case 'v':			verbose = 1;			break;		default:			usage(stderr);			break;		}	}	if (optind == argc)		errx(EXIT_FAILURE, _("no device specified"));	path = argv[optind++];	if (optind != argc) {		warnx(_("unexpected number of arguments"));		usage(stderr);	}	fd = open(path, O_WRONLY);	if (fd < 0)		err(EXIT_FAILURE, _("cannot open %s"), path);	if (fstat(fd, &sb) == -1)		err(EXIT_FAILURE, _("stat of %s failed"), path);	if (!S_ISBLK(sb.st_mode))		errx(EXIT_FAILURE, _("%s: not a block device"), path);	if (ioctl(fd, BLKGETSIZE64, &blksize))		err(EXIT_FAILURE, _("%s: BLKGETSIZE64 ioctl failed"), path);	if (ioctl(fd, BLKSSZGET, &secsize))		err(EXIT_FAILURE, _("%s: BLKSSZGET ioctl failed"), path);	/* check offset alignment to the sector size */	if (range[0] % secsize)		errx(EXIT_FAILURE, _("%s: offset %" PRIu64 " is not aligned "			 "to sector size %i"), path, range[0], secsize);	/* is the range end behind the end of the device ?*/	if (range[0] > blksize)		errx(EXIT_FAILURE, _("%s: offset is greater than device size"), path);	end = range[0] + range[1];	if (end < range[0] || end > blksize)		end = blksize;	range[1] = (step > 0) ? step : end - range[0];	/* check length alignment to the sector size */	if (range[1] % secsize)//.........这里部分代码省略.........
开发者ID:ArakniD,项目名称:util-linux,代码行数:101,


示例17: main

int main(int argc, char *argv[]) try {    setlocale(LC_ALL, "");#if ENABLE_NLS    bindtextdomain("sdcv",                   //"./locale"//< for testing                   GETTEXT_TRANSLATIONS_PATH //< should be                   );    textdomain("sdcv");#endif    gboolean show_version = FALSE;    gboolean show_list_dicts = FALSE;    glib::StrArr use_dict_list;    gboolean non_interactive = FALSE;    gboolean utf8_output = FALSE;    gboolean utf8_input = FALSE;    glib::CharStr opt_data_dir;    gboolean colorize = FALSE;    const GOptionEntry entries[] = {        { "version", 'v', 0, G_OPTION_ARG_NONE, &show_version,          _("display version information and exit"), nullptr },        { "list-dicts", 'l', 0, G_OPTION_ARG_NONE, &show_list_dicts,          _("display list of available dictionaries and exit"), nullptr },        { "use-dict", 'u', 0, G_OPTION_ARG_STRING_ARRAY, get_addr(use_dict_list),          _("for search use only dictionary with this bookname"),          _("bookname") },        { "non-interactive", 'n', 0, G_OPTION_ARG_NONE, &non_interactive,          _("for use in scripts"), nullptr },        { "utf8-output", '0', 0, G_OPTION_ARG_NONE, &utf8_output,          _("output must be in utf8"), nullptr },        { "utf8-input", '1', 0, G_OPTION_ARG_NONE, &utf8_input,          _("input of sdcv in utf8"), nullptr },        { "data-dir", '2', 0, G_OPTION_ARG_STRING, get_addr(opt_data_dir),          _("use this directory as path to stardict data directory"),          _("path/to/dir") },        { "color", 'c', 0, G_OPTION_ARG_NONE, &colorize,          _("colorize the output"), nullptr },        { nullptr },    };    glib::Error error;    GOptionContext *context = g_option_context_new(_(" words"));    g_option_context_set_help_enabled(context, TRUE);    g_option_context_add_main_entries(context, entries, nullptr);    const gboolean parse_res = g_option_context_parse(context, &argc, &argv, get_addr(error));    g_option_context_free(context);    if (!parse_res) {        fprintf(stderr, _("Invalid command line arguments: %s/n"),                error->message);        return EXIT_FAILURE;    }    if (show_version) {        printf(_("Console version of Stardict, version %s/n"), gVersion);        return EXIT_SUCCESS;    }    const gchar *stardict_data_dir = g_getenv("STARDICT_DATA_DIR");    std::string data_dir;    if (!opt_data_dir) {        if (stardict_data_dir)            data_dir = stardict_data_dir;        else            data_dir = "/usr/share/stardict/dic";    } else {        data_dir = get_impl(opt_data_dir);    }    const char *homedir = g_getenv("HOME");    if (!homedir)        homedir = g_get_home_dir();    const std::list<std::string> dicts_dir_list = {        std::string(homedir) + G_DIR_SEPARATOR + ".stardict" + G_DIR_SEPARATOR + "dic",        data_dir    };    if (show_list_dicts) {        printf(_("Dictionary's name   Word count/n"));        std::list<std::string> order_list, disable_list;        for_each_file(dicts_dir_list, ".ifo", order_list,                      disable_list, [](const std::string &filename, bool) -> void {                          DictInfo dict_info;                          if (dict_info.load_from_ifo_file(filename, false)) {                              const std::string bookname = utf8_to_locale_ign_err(dict_info.bookname);                              printf("%s    %d/n", bookname.c_str(), dict_info.wordcount);                          }                      });        return EXIT_SUCCESS;    }    std::list<std::string> disable_list;    if (use_dict_list) {        std::list<std::string> empty_list;        for_each_file(dicts_dir_list, ".ifo", empty_list, empty_list,                      [&disable_list, &use_dict_list](const std::string &filename, bool) -> void {//.........这里部分代码省略.........
开发者ID:biji,项目名称:sdcv,代码行数:101,


示例18: main

intmain(    int		argc,    char **	argv){    char *line = NULL;    char *qdisk = NULL;    char *qamdevice = NULL;    char *optstr = NULL;    char *err_extra = NULL;    char *s, *fp;    int ch;    dle_t *dle = NULL;    int level;    GSList *errlist;    level_t *alevel;    if (argc > 1 && argv && argv[1] && g_str_equal(argv[1], "--version")) {	printf("selfcheck-%s/n", VERSION);	return (0);    }    /* initialize */    /*     * Configure program for internationalization:     *   1) Only set the message locale for now.     *   2) Set textdomain for all amanda related programs to "amanda"     *      We don't want to be forced to support dozens of message catalogs.     */      setlocale(LC_MESSAGES, "C");    textdomain("amanda");     safe_fd(-1, 0);    openbsd_fd_inform();    safe_cd();    set_pname("selfcheck");    /* Don't die when child closes pipe */    signal(SIGPIPE, SIG_IGN);    add_amanda_log_handler(amanda_log_stderr);    add_amanda_log_handler(amanda_log_syslog);    dbopen(DBG_SUBDIR_CLIENT);    startclock();    dbprintf(_("version %s/n"), VERSION);    g_printf("OK version %s/n", VERSION);    print_platform();    if(argc > 2 && g_str_equal(argv[1], "amandad")) {	amandad_auth = g_strdup(argv[2]);    }    config_init(CONFIG_INIT_CLIENT, NULL);    /* (check for config errors comes later) */    check_running_as(RUNNING_AS_CLIENT_LOGIN);    our_features = am_init_feature_set();    our_feature_string = am_feature_to_string(our_features);    /* handle all service requests */    /*@[email
C++ textfieldRendererScaleChangedWithSize函数代码示例
C++ textcolor函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。