fgetpos (fp, &pos);
FGETPOS(fp,pos);
static pgp_key_t *pgp_parse_keyblock (FILE * fp){  unsigned char *buff;  unsigned char pt = 0;  unsigned char last_pt;  size_t l;  short err = 0;  fpos_t pos;    pgp_key_t *root = NULL;  pgp_key_t **last = &root;  pgp_key_t *p = NULL;  pgp_uid_t *uid = NULL;  pgp_uid_t **addr = NULL;    fgetpos (fp, &pos);    while (!err && (buff = pgp_read_packet (fp, &l)) != NULL)  {    last_pt = pt;    pt = buff[0] & 0x3f;    /* check if we have read the complete key block. */        if ((pt == PT_SECKEY || pt == PT_PUBKEY) && root)    {      fsetpos (fp, &pos);      return root;    }        switch (pt)    {      case PT_SECKEY:      case PT_PUBKEY:      case PT_SUBKEY:      case PT_SUBSECKEY:      {	if (!(*last = p = pgp_parse_keyinfo (buff, l)))	{	  err = 1;	  break;	}	last = &p->next;	addr = &p->address;		if (pt == PT_SUBKEY || pt == PT_SUBSECKEY)	{	  p->flags |= KEYFLAG_SUBKEY;	  if (p != root)	  {	    p->parent  = root;	    p->address = pgp_copy_uids (root->address, p);	    while (*addr) addr = &(*addr)->next;	  }	}		if (pt == PT_SECKEY || pt == PT_SUBSECKEY)	  p->flags |= KEYFLAG_SECRET;	break;      }      case PT_SIG:      {	pgp_parse_sig (buff, l, p);	break;      }      case PT_TRUST:      {	if (p && (last_pt == PT_SECKEY || last_pt == PT_PUBKEY ||		  last_pt == PT_SUBKEY || last_pt == PT_SUBSECKEY))	{	  if (buff[1] & 0x20)	  {	    p->flags |= KEYFLAG_DISABLED;	  }	}	else if (last_pt == PT_NAME && uid)	{	  uid->trust = buff[1];	}	break;      }      case PT_NAME:      {	char *chr;	if (!addr)	  break;	chr = safe_malloc (l);	memcpy (chr, buff + 1, l - 1);	chr[l - 1] = '\0';	*addr = uid = safe_calloc (1, sizeof (pgp_uid_t)); /* XXX */	uid->addr = chr;	uid->parent = p;	uid->trust = 0;	addr = &uid->next;	/* the following tags are generated by	 * pgp 2.6.3in.	 */	if (strstr (chr, "ENCR"))	  p->flags |= KEYFLAG_PREFER_ENCRYPTION;	if (strstr (chr, "SIGN"))	  p->flags |= KEYFLAG_PREFER_SIGNING;	break;      }    }    fgetpos (fp, &pos);  }  if (err)    pgp_free_key (&root);    return root;  }