tools/tparser.c
static void arg_read(int argc, char **argv, struct argtable_s *table)
{
    if (argc < 5 || argc > 6)
        error_msg("Not enough or too many arguments");

    // Check and read type signatures
    size_t source_len = strlen(argv[1]);
    size_t destin_len = strlen(argv[2]);
    size_t output_len = strlen(argv[3]);
    size_t input_len  = strlen(argv[4]);

    assert(source_len < MAX_LENGTH);
    assert(destin_len < MAX_LENGTH);
    assert(output_len < MAX_LENGTH);
    assert(input_len  < MAX_LENGTH);

    strcpy(table->source, argv[1]);
    strcpy(table->destin, argv[2]);
    strcpy(table->input_type, argv[3]);
    strcpy(table->output_type, argv[4]);

    table->suffix[0] = table->input_type[0];
    table->suffix[1] = table->output_type[0];

    // if user provides their own suffix
    if (argc == 6) {
        size_t suffix_len = strlen(argv[5]);
        assert(suffix_len < MAX_LENGTH);
        table->suffix[0] = argv[5][0];
        table->suffix[1] = argv[5][1];
    }
}
// Read arguments into the structure argtable
Read arguments into the structure argtable
Read arguments into the structure argtable
static void arg_read(int argc, char **argv, struct argtable_s *table)
{
    if (argc < 5 || argc > 6)
        error_msg("Not enough or too many arguments");
    size_t source_len = strlen(argv[1]);
    size_t destin_len = strlen(argv[2]);
    size_t output_len = strlen(argv[3]);
    size_t input_len  = strlen(argv[4]);
    assert(source_len < MAX_LENGTH);
    assert(destin_len < MAX_LENGTH);
    assert(output_len < MAX_LENGTH);
    assert(input_len  < MAX_LENGTH);
    strcpy(table->source, argv[1]);
    strcpy(table->destin, argv[2]);
    strcpy(table->input_type, argv[3]);
    strcpy(table->output_type, argv[4]);
    table->suffix[0] = table->input_type[0];
    table->suffix[1] = table->output_type[0];
    if (argc == 6) {
        size_t suffix_len = strlen(argv[5]);
        assert(suffix_len < MAX_LENGTH);
        table->suffix[0] = argv[5][0];
        table->suffix[1] = argv[5][1];
    }
}
static void arg_read ( int argc , char * * argv , struct argtable_s * table ) { if ( argc < 5 || argc > 6 ) error_msg ( " " ) ; size_t source_len = strlen ( argv [ 1 ] ) ; size_t destin_len = strlen ( argv [ 2 ] ) ; size_t output_len = strlen ( argv [ 3 ] ) ; size_t input_len = strlen ( argv [ 4 ] ) ; assert ( source_len < MAX_LENGTH ) ; assert ( destin_len < MAX_LENGTH ) ; assert ( output_len < MAX_LENGTH ) ; assert ( input_len < MAX_LENGTH ) ; strcpy ( table -> source , argv [ 1 ] ) ; strcpy ( table -> destin , argv [ 2 ] ) ; strcpy ( table -> input_type , argv [ 3 ] ) ; strcpy ( table -> output_type , argv [ 4 ] ) ; table -> suffix [ 0 ] = table -> input_type [ 0 ] ; table -> suffix [ 1 ] = table -> output_type [ 0 ] ; if ( argc == 6 ) { size_t suffix_len = strlen ( argv [ 5 ] ) ; assert ( suffix_len < MAX_LENGTH ) ; table -> suffix [ 0 ] = argv [ 5 ] [ 0 ] ; table -> suffix [ 1 ] = argv [ 5 ] [ 1 ] ; } }
Read arguments into the structure argtable
Read arguments into the structure argtable
// Check and read type signatures // if user provides their own suffix