summaryrefslogtreecommitdiff
path: root/support/dktools/test-dk4mai8ddi.c
blob: c3c20a99ace36db2b82d00805967b71d48218949 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
/*
	WARNING: This file was generated by dkct.
	Changes you make here will be lost if dkct is run again!
	You should modify the original source and run dkct on it.
	Original source: test-dk4mai8ddi.ctr
*/

/**	@file test-dk4mai8ddi.c The test-dk4mai8ddi module.
*/


#line 1 "test-dk4mai8ddi.ctr"


#include "dk4conf.h"

#include <stdio.h>

#include "dk4str8.h"
#include "dk4mao8d.h"
#include "dk4mai8ddi.h"



int main(void)
{
  char		 buf[128];
  char		 oub[128];
  dk4_er_t	 er;
  const char	*endptr	=	NULL;
  dk4_im_t	 um;
  int		 res;
  while(fgets(buf, sizeof(buf), stdin)) {
    dk4str8_normalize(buf, NULL);
    dk4error_init(&er);
    res = dk4ma_input_c8_dec_dk4_im_t(&um, buf, &endptr, 1, &er);
    if (0 != res) {
      if (dk4ma_write_c8_decimal_signed(oub, sizeof(oub), um, 0, &er)) {
        printf("Zahl gelesen: ");
	fputs(oub, stdout);
	printf("\n");
      } else {
        printf("Fehler beim String-Erzeugen!\n");
      }
    } else {
      printf("Fehler beim Einlesen: %d\n", er.ec);
      printf("Fehlerstelle: \"%s\"\n", (endptr ? endptr : "(NULL)"));
    }
  }
  return 0;
}