/*
   <p>Report an error and exit the program.</p>

   <kbd>
   <b>environ - C programming support functions</b><br>
   Copyright (C) 2005  Martin C Gregorie
   
   This program is free software; you can redistribute it and/or
   modify it under the terms of the Lesser GNU General Public License.
   
   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU General Public License for more details.
  
   You should have received a copy of the Lesser GNU General Public License
   along with this program; if not, write to the Free Software
   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
   </kbd>
  
   <p>Contact Martin Gregorie at <i>martin@gregorie.org</i></p>
*/

#include <stdlib.h>
#include <stdio.h>
#include <errno.h>
#include "environ.h"

/*
   Ends the process with the current <i>errno</i> value as
   the return code after outputting an error message of the form

   <b>fffff: eeeee ppppp</b>

   <u>f</u> is normally the program name, <u>e</u> is a short
   description of the reason for abandoning the program and
   <u>p</u> is either blank or an extension of the reason, e.g.

   <kbd>error(progname, "can't open", filename);</kbd>

   would output: <i>progname: can't open filename</i>
*/
void error(char *f, char *e, char *p)
{
    fprintf(stderr,"\n%s: %s %s\n",f,e,p);
    exit(errno);
}
