示例#1
0
void
sfsgroupmgr::changelogquery (str group, unsigned int vers, grpmgr_query_cb qcb)
{
  str gname;
  str ghost;

  if (!parsegroup (group, &gname, &ghost)) {
    (*qcb) (NULL, NULL);
    return;
  }
  gstate *st = New gstate (NULL, NULL, gname, ghost, false, vers,
                           wrap (this, &sfsgroupmgr::clquery_done, qcb));

  kmgr->connect (ghost, wrap (this, &sfsgroupmgr::clquery_login_cb, st));
}
示例#2
0
void
sfsgroupmgr::update (str group, vec<str> *members, vec<str> *owners, bool create)
{
  str gname;
  str ghost;

  if (!parsegroup (group, &gname, &ghost)) {
    exit (1);
  }
  gstate *st = New gstate (NULL, NULL, gname, ghost, false, 0,
                           wrap (this, &sfsgroupmgr::update_group,
			         members, owners, create ? gname : str (NULL)));
  kmgr->login (ghost,
               wrap (this, &sfsgroupmgr::login_cb, st),
	       NULL, KM_NOSRP | KM_NOESK);
}
示例#3
0
文件: ext2.c 项目: stroucki/plan9port
static int
ext2group(Ext2 *fs, u32int i, Group *g)
{
	Block *b;
	u64int addr;

	if(i >= fs->ngroup)
		return -1;

	addr = fs->groupaddr + i/fs->descperblock;
	b = diskread(fs->disk, fs->blocksize, addr*fs->blocksize);
	if(b == nil)
		return -1;
	parsegroup(g, b->data+i%fs->descperblock*GroupSize);
	blockput(b);
	return 0;
}
示例#4
0
void
sfsgroupmgr::do_query (str group, grpmgr_query_cb qcb, bool expanded)
{
  str gname;
  str ghost;

  if (!parsegroup (group, &gname, &ghost)) {
    (*qcb) (NULL, NULL);
    return;
  }
  gstate *st = New gstate (NULL, NULL, gname, ghost, expanded, 0,
                           wrap (this, &sfsgroupmgr::query_done, qcb));

  if (issrpkey (ghost))
    kmgr->login (ghost, wrap (this, &sfsgroupmgr::login_cb, st),
	         NULL, KM_NOSRP | KM_NOESK);
  else
    kmgr->connect (ghost, wrap (this, &sfsgroupmgr::connect_cb, st));
}
示例#5
0
文件: rnn.c 项目: AlbertJP/envytools
static int trytop (struct rnndb *db, char *file, xmlNode *node) {
	if (!strcmp(node->name, "enum")) {
		parseenum(db, file, node);
		return 1;
	} else if (!strcmp(node->name, "bitset")) {
		parsebitset(db, file, node);
		return 1;
	} else if (!strcmp(node->name, "group")) {
		parsegroup(db, file, node);
		return 1;
	} else if (!strcmp(node->name, "domain")) {
		parsedomain(db, file, node);
		return 1;
	} else if (!strcmp(node->name, "spectype")) {
		parsespectype(db, file, node);
		return 1;
	} else if (!strcmp(node->name, "import")) {
		xmlAttr *attr = node->properties;
		char *subfile = 0;
		while (attr) {
			if (!strcmp(attr->name, "file")) {
				subfile = getattrib(db, file, node->line, attr);
			} else {
				fprintf (stderr, "%s:%d: wrong attribute \"%s\" for import\n", file, node->line, attr->name);
				db->estatus = 1;
			}
			attr = attr->next;
		}
		if (!subfile) {
			fprintf (stderr, "%s:%d: missing \"file\" attribute for import\n", file, node->line);
			db->estatus = 1;
		} else {
			rnn_parsefile(db, subfile);
		}
		return 1;
	} else if (!strcmp(node->name, "copyright")) {
		parsecopyright(db, file, node);
		return 1;
	}
	return 0;
}