Subversion Repositories Kolibri OS

Rev

Blame | Last modification | View Log | Download | RSS feed

  1.  
  2. /*=============================================================================
  3.    GNU UnRTF, a command-line program to convert RTF documents to other formats.
  4.    Copyright (C) 2000,2001 Zachary Thayer Smith
  5.  
  6.    This program is free software; you can redistribute it and/or modify
  7.    it under the terms of the GNU General Public License as published by
  8.    the Free Software Foundation; either version 2 of the License, or
  9.    (at your option) any later version.
  10.  
  11.    This program is distributed in the hope that it will be useful,
  12.    but WITHOUT ANY WARRANTY; without even the implied warranty of
  13.    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  14.    GNU General Public License for more details.
  15.  
  16.    You should have received a copy of the GNU General Public License
  17.    along with this program; if not, write to the Free Software
  18.    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  19.  
  20.    The author is reachable by electronic mail at tuorfa@yahoo.com.
  21. =============================================================================*/
  22.  
  23.  
  24. /*----------------------------------------------------------------------
  25.  * Module name:    error
  26.  * Author name:    Zach Smith
  27.  * Create date:    01 Sep 00
  28.  * Purpose:        Management of errors and warnings, when reporting
  29.  *                 the source code file/line is not necessary.
  30.  *----------------------------------------------------------------------
  31.  * Changes
  32.  * 10 Oct 00, tuorfa@yahoo.com: added usage()
  33.  * 15 Oct 00, tuorfa@yahoo.com: improved output readability
  34.  * 22 Sep 01, tuorfa@yahoo.com: removed mention of line number in handlers
  35.  * 22 Sep 01, tuorfa@yahoo.com: added function-level comment blocks
  36.  *--------------------------------------------------------------------*/
  37.  
  38.  
  39. #include <stdio.h>
  40. #include <stdlib.h>
  41.  
  42. #include "defs.h"
  43. #include "main.h"
  44.  
  45.  
  46.  
  47. /*========================================================================
  48.  * Name:        usage
  49.  * Purpose:     Prints usage information and exits with an error.
  50.  * Args:        None.
  51.  * Returns:     None.
  52.  *=======================================================================*/
  53.  
  54. void
  55. usage ()
  56. {
  57.         fprintf (stdout, "Usage: %s\n", USAGE);
  58.         exit(0);
  59. }
  60.  
  61.  
  62.  
  63. /*========================================================================
  64.  * Name:        error_handler
  65.  * Purpose:     Prints error message and other useful info, then exits.
  66.  * Args:        Message.
  67.  * Returns:     None.
  68.  *=======================================================================*/
  69.  
  70. void
  71. error_handler (char* message)
  72. {
  73.         fprintf (stderr, "Error: %s\n", message);
  74.         exit(10);
  75. }
  76.  
  77.  
  78. /*========================================================================
  79.  * Name:        warning_handler
  80.  * Purpose:     Prints useful info to stderr, but doesn't exit.
  81.  * Args:        Message.
  82.  * Returns:     None.
  83.  *=======================================================================*/
  84.  
  85. void
  86. warning_handler (char* message)
  87. {
  88.         fprintf (stderr, "Warning: %s\n", message);
  89. }
  90.