void filetree_print_file_size(gpointer user, gpointer user_data) { struct filename_list_node *fln = (struct filename_list_node *) user; guint64 *file_size = (guint64 *) fln->d; (void) user_data; print_utf8_string(fln->fr->display); g_print(", %" G_GUINT64_FORMAT "\n", *file_size); }
static gboolean print_tree_entries(gpointer key, gpointer value, gpointer data) { int i; for (i = 0; i < GPOINTER_TO_INT(data); ++i) { putchar(' '); } print_utf8_string(((struct filename_representations*) key)->display); putchar('\n'); if (value) { g_tree_foreach((Filetree) value, print_tree_entries, GINT_TO_POINTER(GPOINTER_TO_INT(data) + 2)); } return FALSE; }
static void list_keyblock_print ( KBNODE keyblock, int secret ) { int rc = 0; KBNODE kbctx; KBNODE node; PKT_public_key *pk; PKT_secret_key *sk; u32 keyid[2]; int any=0; /* get the keyid from the keyblock */ node = find_kbnode( keyblock, secret? PKT_SECRET_KEY : PKT_PUBLIC_KEY ); if( !node ) { log_error("Oops; key lost!\n"); dump_kbnode( keyblock ); return; } if( secret ) { pk = NULL; sk = node->pkt->pkt.secret_key; keyid_from_sk( sk, keyid ); printf("sec %4u%c/%08lX %s ", nbits_from_sk( sk ), pubkey_letter( sk->pubkey_algo ), (ulong)keyid[1], datestr_from_sk( sk ) ); } else { pk = node->pkt->pkt.public_key; sk = NULL; keyid_from_pk( pk, keyid ); printf("pub %4u%c/%08lX %s ", nbits_from_pk( pk ), pubkey_letter( pk->pubkey_algo ), (ulong)keyid[1], datestr_from_pk( pk ) ); } for( kbctx=NULL; (node=walk_kbnode( keyblock, &kbctx, 0)) ; ) { if( node->pkt->pkttype == PKT_USER_ID && !opt.fast_list_mode ) { if( any ) printf("uid%*s", 28, ""); if ( node->pkt->pkt.user_id->is_revoked ) fputs ("[revoked] ", stdout); print_utf8_string( stdout, node->pkt->pkt.user_id->name, node->pkt->pkt.user_id->len ); putchar('\n'); if( !any ) { if( opt.fingerprint ) fingerprint( pk, sk ); if( opt.with_key_data ) print_key_data( pk, keyid ); any = 1; } } else if( node->pkt->pkttype == PKT_PUBLIC_SUBKEY ) { u32 keyid2[2]; PKT_public_key *pk2 = node->pkt->pkt.public_key; if( !any ) { putchar('\n'); if( opt.fingerprint ) fingerprint( pk, sk ); /* of the main key */ any = 1; } keyid_from_pk( pk2, keyid2 ); printf("sub %4u%c/%08lX %s", nbits_from_pk( pk2 ), pubkey_letter( pk2->pubkey_algo ), (ulong)keyid2[1], datestr_from_pk( pk2 ) ); if( pk2->expiredate ) { printf(_(" [expires: %s]"), expirestr_from_pk( pk2 ) ); } putchar('\n'); if( opt.fingerprint > 1 ) fingerprint( pk2, NULL ); if( opt.with_key_data ) print_key_data( pk2, keyid2 ); } else if( node->pkt->pkttype == PKT_SECRET_SUBKEY ) { u32 keyid2[2]; PKT_secret_key *sk2 = node->pkt->pkt.secret_key; if( !any ) { putchar('\n'); if( opt.fingerprint ) fingerprint( pk, sk ); /* of the main key */ any = 1; } keyid_from_sk( sk2, keyid2 ); printf("ssb %4u%c/%08lX %s\n", nbits_from_sk( sk2 ), pubkey_letter( sk2->pubkey_algo ), (ulong)keyid2[1], datestr_from_sk( sk2 ) ); if( opt.fingerprint > 1 ) fingerprint( NULL, sk2 ); } else if( opt.list_sigs && node->pkt->pkttype == PKT_SIGNATURE ) { PKT_signature *sig = node->pkt->pkt.signature; int sigrc; char *sigstr; if( !any ) { /* no user id, (maybe a revocation follows)*/ if( sig->sig_class == 0x20 ) puts("[revoked]"); else if( sig->sig_class == 0x18 ) puts("[key binding]"); else if( sig->sig_class == 0x28 ) puts("[subkey revoked]"); else putchar('\n'); if( opt.fingerprint ) fingerprint( pk, sk ); any=1; } if( sig->sig_class == 0x20 || sig->sig_class == 0x28 || sig->sig_class == 0x30 ) sigstr = "rev"; else if( (sig->sig_class&~3) == 0x10 ) sigstr = "sig"; else if( sig->sig_class == 0x18 ) sigstr = "sig"; else { printf("sig " "[unexpected signature class 0x%02x]\n",sig->sig_class ); continue; } if( opt.check_sigs ) { fflush(stdout); rc = check_key_signature( keyblock, node, NULL ); switch( rc ) { case 0: sigrc = '!'; break; case G10ERR_BAD_SIGN: sigrc = '-'; break; case G10ERR_NO_PUBKEY: case G10ERR_UNU_PUBKEY: sigrc = '?'; break; default: sigrc = '%'; break; } } else { rc = 0; sigrc = ' '; } fputs( sigstr, stdout ); printf("%c %08lX %s ", sigrc, (ulong)sig->keyid[1], datestr_from_sig(sig)); if( sigrc == '%' ) printf("[%s] ", g10_errstr(rc) ); else if( sigrc == '?' ) ; else if ( !opt.fast_list_mode ) { size_t n; char *p = get_user_id( sig->keyid, &n ); print_utf8_string( stdout, p, n ); m_free(p); } putchar('\n'); /* fixme: check or list other sigs here */ } } putchar('\n'); }