ia5.c
author viric <viriketo@gmail.com>
Fri, 30 Mar 2012 18:54:55 +0200
changeset 31 2bcc08d0f1d8
parent 8 09ec33061ff3
permissions -rw-r--r--
Fixing an error message
#include <stdio.h>
#include <stdlib.h>
#include "dictre.h"

int main(int argn, char **argv)
{
    int val;
    char *input;
    char *end;
    char type;

    if (argn != 3 || (argv[1][1] != 'w' && argv[1][1] != 'n') )
    {
        printf("usage: %s <-w word | -n num>\n", argv[0]);
        return 0;
    }

    type = argv[1][1];
    input = argv[2];
    if(type == 'n')
    {
        /* Whole string number */
        char tmp[20];

        val = strtol(input, &end, 10);
        num_to_ia5(tmp, val);
        printf("%s\n", tmp);
    } else
    {
        val = str2int(input);
        printf("%i\n", val);
    }
    return 0;
}