ia5.c
author viric <viriketo@gmail.com>
Fri, 30 Mar 2012 18:56:20 +0200
changeset 33 ebbedaa090be
parent 8 09ec33061ff3
permissions -rw-r--r--
Adding what I had in the web for zparsetext (akcentiga)
viric@8
     1
#include <stdio.h>
viric@8
     2
#include <stdlib.h>
viric@8
     3
#include "dictre.h"
viric@8
     4
viric@8
     5
int main(int argn, char **argv)
viric@8
     6
{
viric@8
     7
    int val;
viric@8
     8
    char *input;
viric@8
     9
    char *end;
viric@8
    10
    char type;
viric@8
    11
viric@8
    12
    if (argn != 3 || (argv[1][1] != 'w' && argv[1][1] != 'n') )
viric@8
    13
    {
viric@8
    14
        printf("usage: %s <-w word | -n num>\n", argv[0]);
viric@8
    15
        return 0;
viric@8
    16
    }
viric@8
    17
viric@8
    18
    type = argv[1][1];
viric@8
    19
    input = argv[2];
viric@8
    20
    if(type == 'n')
viric@8
    21
    {
viric@8
    22
        /* Whole string number */
viric@8
    23
        char tmp[20];
viric@8
    24
viric@8
    25
        val = strtol(input, &end, 10);
viric@8
    26
        num_to_ia5(tmp, val);
viric@8
    27
        printf("%s\n", tmp);
viric@8
    28
    } else
viric@8
    29
    {
viric@8
    30
        val = str2int(input);
viric@8
    31
        printf("%i\n", val);
viric@8
    32
    }
viric@8
    33
    return 0;
viric@8
    34
}