示例#1
0
/**
 * @brief Pull messages from server and process
 */
void Parser::update() {
	updater.execute();

	// Parse the dump
	unsigned int uid = parse_dump(updater.getDump());
	updater.setLastUpdate(uid);
}
示例#2
0
文件: util.c 项目: malaise/c
/* Parse arguments, exit on error */
extern void parse_args (const int argc, const char *argv[]) {
  char buffer [sizeof(prog_name)];
  char *debugstr;

  /* Store program name (basename alters buffer) */
  strcpy (buffer, argv[0]);
  strcpy (prog_name, basename(buffer));

  /* Set debug */
  debugstr = getenv (DEBUG_VAR);
  if ( (debugstr != NULL) && (toupper(debugstr[0]) == 'Y') ) {
   debug = TRUE;
  }

  /* Parse arguments */
  if (argc == 1) {
    error ("missing argument", "");
  } else if (argc == 2) {
    if ( (strcmp (argv[1], "-h") == 0)
      || (strcmp (argv[1], "--help") == 0) ) {
      usage();
      exit (ERROR_EXIT_CODE);
    } else if ( (strcmp (argv[1], "-v") == 0)
             || (strcmp (argv[1], "--version") == 0) ) {
      fprintf (stderr, "%s version %s\n", prog_name, VERSION);
      exit (ERROR_EXIT_CODE);
    } else {
      dump_kind = no_dump;
      parse_arg (argv[1]);
    }
  } else if (argc == 3) {
    if (parse_dump(argv[1])) {
      trace ("Dump detected as arg 1", "");
      parse_arg (argv[2]);
    } else if (parse_dump(argv[2])) {
      trace ("Dump detected as arg 2", "");
      parse_arg (argv[1]);
    } else {
      trace ("Full not detected", "");
      error ("invalid arguments", "");
    }
  } else {
    error ("too many arguments", "");
  }
}
示例#3
0
int
VOLSER_AFSVolRestore(struct rx_call *call,
		     const int32_t transid,
		     const int32_t flags,
		     const struct restoreCookie *cookie)
{
    int ret = 0;
    struct trans *trans;
    struct dp_part *dp;
    volume_handle *vh;

    mlog_log(MDEBVOLDB, "VOLSER_AFSVolRestore");

    if (!sec_is_superuser(call)) {
	ret = VOLSERBAD_ACCESS;
	goto out;
    }

    ret = vld_verify_trans(transid);
    if (ret)
	goto out;

    ret = vld_get_trans(transid, &trans);
    if (ret)
	goto out;
    
    ret = volser_fetch_vh (trans->partition, trans->volid, &dp, &vh);
    if (ret) {
	vld_put_trans(trans);
	goto out;
    }

    ret = parse_dump(call, vh);
    if (ret) {
	vld_free (vh);
	dp_free (dp);
	vld_put_trans(trans);
	goto out;
    }

    ret = vld_rebuild(vh);

    vld_info_write(vh);

    vld_free (vh);
    dp_free (dp);

    vld_put_trans(trans);

 out:
    VOLSER_EXIT;
    
    return ret;
}
示例#4
0
void        parse_user_input(t_state *state, char **argv, int count)
{
    int     i;
    
    i = 1;
    parse_champ_count(state, argv, count);
    parse_champ_number(state, argv, i, count);
    parse_dump(state, argv, i, count);
    check_if_champs_assigned(state, argv);
    ft_check_file(state, argv, count);
}
示例#5
0
文件: pd.c 项目: gllort/mud
int comando(int argc, string * argv) {
    write(parse_dump()+"\n");
    return 1;
}