/fm/error.c
C | 65 lines | 36 code | 9 blank | 20 comment | 2 complexity | dd97991586be398c0e696e00632880ef MD5 | raw file
Possible License(s): LGPL-3.0
- /*
- * error.c: this file is part of the FM project.
- *
- * FM, a fast and optimized C implementation of Fourier-Motzkin
- * projection algorithm.
- *
- * Copyright (C) 2006-2008 Louis-Noel Pouchet
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 3
- * of the License, or (at your option) any later version.
- *
- * The complete GNU Lesser General Public Licence Notice can be found
- * as the `COPYING.LESSER' file in the root directory.
- *
- * Author:
- * Louis-Noel Pouchet <Louis-Noel.Pouchet@inria.fr>
- *
- */
- #if HAVE_CONFIG_H
- # include <fm/config.h>
- #endif
- #include <fm/common.h>
- #include <fm/error.h>
- static void error (int exit_status, const char *mode,
- const char *message);
- const char *program_name = NULL;
- void
- set_program_name (const char *path)
- {
- if (! program_name)
- program_name = xstrdup (basename (path));
- }
- static void
- error (int exit_status, const char *mode, const char *message)
- {
- fprintf (stderr, "%s: %s: %s.\n", program_name, mode, message);
- if (exit_status >= 0)
- exit (exit_status);
- }
- void
- fm_warning (const char *message)
- {
- error (-1, "warning", message);
- }
- void
- fm_error (const char *message)
- {
- error (-1, "ERROR", message);
- }
- void
- fm_fatal (const char *message)
- {
- error (EXIT_FAILURE, "FATAL", message);
- }