Exemplo n.º 1
0
static int
key_listing(int verbose)
{
  GList *keyrings, *current;
  if (gnome_keyring_list_keyring_names_sync(&keyrings) != OK) {
    fprintf(stderr, "Couldn't get list of keyring names\n");
    return 1;
  }

  for (current = keyrings; current; current = current->next) {
    GList *ids, *cid;
    gchar *keyring = (gchar *)current->data;
    printf("Keyring %s\n", keyring);

    if (gnome_keyring_list_item_ids_sync(keyring, &ids) != OK) {
      fprintf(stderr, "Couldn't list IDs on keyring %s\n", keyring);
      continue;
    }

    for (cid = ids; cid; cid = cid->next) {
      GnomeKeyringItemInfo *info;
      GnomeKeyringResult result =
        gnome_keyring_item_get_info_full_sync(keyring, GPOINTER_TO_INT(cid->data), GNOME_KEYRING_ITEM_INFO_SECRET, &info);
      if (result == GNOME_KEYRING_RESULT_OK) {
        printf(" %s\n", gnome_keyring_item_info_get_display_name(info));
        if (verbose)
          detailed_key_listing(keyring, GPOINTER_TO_INT(cid->data));

        gnome_keyring_item_info_free(info);
      } else {
#define CHECKIT(X) case GNOME_KEYRING_RESULT_ ## X: printf(#X "\n"); break
        switch (result) {
          CHECKIT(OK); // warning if not included
          CHECKIT(DENIED);
          CHECKIT(NO_KEYRING_DAEMON);
          CHECKIT(ALREADY_UNLOCKED);
          CHECKIT(NO_SUCH_KEYRING);
          CHECKIT(BAD_ARGUMENTS);
          CHECKIT(IO_ERROR);
          CHECKIT(CANCELLED);
          CHECKIT(KEYRING_ALREADY_EXISTS);
          CHECKIT(NO_MATCH);
        }
      }
    }
  }

  return 0;
}
Exemplo n.º 2
0
int FBSD_StartupGraphics(void) {
 
 int gmode;

 VGAInfo.fd=0;  /* STDIN */

 VGAInfo.flags=0;

 catchallsigs();
 
 #define CHECKIT(xxx) if ((xxx)<0) goto fatal_error;

 /* set noncanonical input mode */
 
 if (tcgetattr(VGAInfo.fd,&VGAInfo.oti)) goto fatal_error;
 VGAInfo.ti.c_lflag&=~(ICANON | ECHOKE | ECHOE | ECHONL | ECHOPRT | ECHOCTL | ECHO | ISIG);
 VGAInfo.ti.c_cc[VMIN]=VGAInfo.ti.c_cc[VTIME]=0;
 if (tcsetattr(VGAInfo.fd,TCSANOW,&VGAInfo.ti)) goto fatal_error;

 VGAInfo.flags |= TTY_STARTED;

 /* set raw keyboard mode */
 
 CHECKIT(ioctl(VGAInfo.fd,KDGKBMODE,&VGAInfo.oldkmode));
 CHECKIT(ioctl(VGAInfo.fd,KDSKBMODE,K_RAW));
 CHECKIT(fcntl(VGAInfo.fd,F_SETFL,O_NONBLOCK));
 VGAInfo.flags |= KBD_RAWMODE;

 gmode=M_VGA13;
 CHECKIT(ioctl(VGAInfo.fd,FBIO_GETMODE,&VGAInfo.oldmode));
 CHECKIT(ioctl(VGAInfo.fd,FBIO_SETMODE,&gmode));
 VGAInfo.flags |= GRAPH_MODE;

 VGAInfo.bufsize=0x10000;
 VGAInfo.lfb=mmap(0,0x10000,PROT_READ|PROT_WRITE,MAP_SHARED,VGAInfo.fd,0);
 if (!VGAInfo.lfb) goto fatal_error;
 VGAInfo.flags |= FB_MAPPED;

 CHECKIT(SavePalette());
 VGAInfo.flags |= PALETTE_SAVED;

 VideoBuffer=VGAInfo.lfb;
 
 /* All ok */
 return 0;
 
fatal_error: 

 /* OOPS! Console can't set up graphics! */

  FBSD_ShutdownGraphics();
  return -1;
}