コード例 #1
0
ファイル: openssl.c プロジェクト: Vonage/openssl
int list_main(int argc, char **argv)
{
    char *prog;
    HELPLIST_CHOICE o;
    int done = 0;

    prog = opt_init(argc, argv, list_options);
    while ((o = opt_next()) != OPT_EOF) {
        switch (o) {
        case OPT_EOF:  /* Never hit, but suppresses warning */
        case OPT_ERR:
            BIO_printf(bio_err, "%s: Use -help for summary.\n", prog);
            return 1;
        case OPT_HELP:
            opt_help(list_options);
            break;
        case OPT_COMMANDS:
            list_type(FT_general);
            break;
        case OPT_DIGEST_COMMANDS:
            list_type(FT_md);
            break;
        case OPT_DIGEST_ALGORITHMS:
            EVP_MD_do_all_sorted(list_md_fn, bio_out);
            break;
        case OPT_CIPHER_COMMANDS:
            list_type(FT_cipher);
            break;
        case OPT_CIPHER_ALGORITHMS:
            EVP_CIPHER_do_all_sorted(list_cipher_fn, bio_out);
            break;
        case OPT_PK_ALGORITHMS:
            list_pkey();
            break;
        case OPT_PK_METHOD:
            list_pkey_meth();
            break;
        case OPT_DISABLED:
            list_disabled();
            break;
        case OPT_MISSING_HELP:
            list_missing_help();
            break;
        }
        done = 1;
    }

    if (!done) {
        BIO_printf(bio_err, "%s: Use -help for summary.\n", prog);
        return 1;
    }

    return 0;
}
コード例 #2
0
ファイル: bencoding.c プロジェクト: hivesolutions/viriatum
ERROR_CODE _bencoding_list_start_callback(struct bencoding_engine_t *bencoding_engine) {
    /* allocates space for the linked list and for the type
    structure that will encapsulate it */
    struct linked_list_t *list;
    struct type_t *type;

    /* retrieves the bencoding handler from the template engine context
    then uses it to store the (current) value */
    struct bencoding_handler_t *bencoding_handler = (struct bencoding_handler_t *) bencoding_engine->context;

    /* creates a new linked list for the new structure (sequence) context
    and then creates the respective type for the list */
    create_linked_list(&list);
    create_type(&type, LIST_TYPE);
    *type = list_type(list);

    /* adds the sequence type to the sequence stack and then adds the
    current handler key to the key stack, then updates the current sequence
    reference and the current key in the handler */
    append_value_linked_list(bencoding_handler->sequence_stack, (void *) type);
    append_value_linked_list(bencoding_handler->key_stack, (void *) bencoding_handler->key);
    bencoding_handler->sequence = type;
    bencoding_handler->key = NULL;

    /* in case there is no top type defined for the handler sets the
    current type as the top type (base type) */
    if(bencoding_handler->top == NULL) { bencoding_handler->top = type; }

    /* unsets the next key flag to avoid any possible misbehavior, colliding
    with the hash map structure */
    bencoding_handler->next_key = 0;

    /* raises no error */
    RAISE_NO_ERROR;
}
コード例 #3
0
ファイル: openssl.c プロジェクト: regoecuaycong/openssl
int list_main(int argc, char **argv)
{
    char *prog;
    HELPLIST_CHOICE o;

    prog = opt_init(argc, argv, list_options);
    while ((o = opt_next()) != OPT_EOF) {
        switch (o) {
        case OPT_EOF:
        case OPT_ERR:
            BIO_printf(bio_err, "%s: Use -help for summary.\n", prog);
            return 1;
        case OPT_HELP:
            opt_help(list_options);
            break;
        case OPT_COMMANDS:
            list_type(FT_general);
            break;
        case OPT_DIGEST_COMMANDS:
            list_type(FT_md);
            break;
        case OPT_DIGEST_ALGORITHMS:
            EVP_MD_do_all_sorted(list_md_fn, bio_out);
            break;
        case OPT_CIPHER_COMMANDS:
            list_type(FT_cipher);
            break;
        case OPT_CIPHER_ALGORITHMS:
            EVP_CIPHER_do_all_sorted(list_cipher_fn, bio_out);
            break;
        case OPT_PK_ALGORITHMS:
            list_pkey();
            break;
        }
    }

    return 0;
}
コード例 #4
0
ファイル: openssl.c プロジェクト: ciz/openssl
int list_main(int argc, char **argv)
{
    char *prog;
    HELPLIST_CHOICE o;
    int one = 0, done = 0;

    prog = opt_init(argc, argv, list_options);
    while ((o = opt_next()) != OPT_EOF) {
        switch (o) {
        case OPT_EOF:  /* Never hit, but suppresses warning */
        case OPT_ERR:
opthelp:
            BIO_printf(bio_err, "%s: Use -help for summary.\n", prog);
            return 1;
        case OPT_HELP:
            opt_help(list_options);
            break;
        case OPT_ONE:
            one = 1;
            break;
        case OPT_COMMANDS:
            list_type(FT_general, one);
            break;
        case OPT_DIGEST_COMMANDS:
            list_type(FT_md, one);
            break;
        case OPT_DIGEST_ALGORITHMS:
            EVP_MD_do_all_sorted(list_md_fn, bio_out);
            break;
        case OPT_MAC_ALGORITHMS:
            EVP_MAC_do_all_sorted(list_mac_fn, bio_out);
            break;
        case OPT_CIPHER_COMMANDS:
            list_type(FT_cipher, one);
            break;
        case OPT_CIPHER_ALGORITHMS:
            EVP_CIPHER_do_all_sorted(list_cipher_fn, bio_out);
            break;
        case OPT_PK_ALGORITHMS:
            list_pkey();
            break;
        case OPT_PK_METHOD:
            list_pkey_meth();
            break;
        case OPT_DISABLED:
            list_disabled();
            break;
        case OPT_MISSING_HELP:
            list_missing_help();
            break;
        case OPT_OBJECTS:
            list_objects();
            break;
        case OPT_OPTIONS:
            list_options_for_command(opt_arg());
            break;
        }
        done = 1;
    }
    if (opt_num_rest() != 0) {
        BIO_printf(bio_err, "Extra arguments given.\n");
        goto opthelp;
    }

    if (!done)
        goto opthelp;

    return 0;
}