Back to index

glibc  2.9
Defines | Functions
tst-fmon.c File Reference
#include <stdio.h>
#include <locale.h>
#include <monetary.h>
#include <string.h>
#include <stdlib.h>

Go to the source code of this file.

Defines

#define EXIT_SUCCESS   0
#define EXIT_FAILURE   1
#define EXIT_SETLOCALE   2
#define EXIT_STRFMON   3

Functions

int main (int argc, char *argv[])

Define Documentation

#define EXIT_FAILURE   1

Definition at line 37 of file tst-fmon.c.

#define EXIT_SETLOCALE   2

Definition at line 38 of file tst-fmon.c.

#define EXIT_STRFMON   3

Definition at line 39 of file tst-fmon.c.

#define EXIT_SUCCESS   0

Definition at line 36 of file tst-fmon.c.


Function Documentation

int main ( int  argc,
char *  argv[] 
)

Definition at line 42 of file tst-fmon.c.

{
  char *s = malloc (201);

  if (setlocale (LC_MONETARY, argv[1]) == NULL)
    {
      fprintf (stderr, "setlocale(LC_MONETARY, \"%s\"): %m\n", argv[1]);
      exit (EXIT_SETLOCALE);
    }

  if (strfmon (s, 200, argv[2], (double) atof (argv[3])) == -1)
    {
      perror ("strfmon");
      exit (EXIT_STRFMON);
    }

  if (strcmp (s, argv[4]) != 0)
    {
      printf ("\
Locale: \"%s\" Format: \"%s\" Value: \"%s\" Received: \"%s\" Expected: \"%s\" => %s\n",
             argv[1], argv[2], argv[3], s, argv[4],
             strcmp (s, argv[4]) != 0 ? "false" : "correct");
      exit (EXIT_FAILURE);
    }

  return EXIT_SUCCESS;
}

Here is the call graph for this function: