1151497Sru/* Copyright (C) 1989, 1990, 1991, 1992, 2004 Free Software Foundation, Inc.
2114402Sru     Written by James Clark (jjc@jclark.com)
3114402Sru
4114402SruThis file is part of groff.
5114402Sru
6114402Srugroff is free software; you can redistribute it and/or modify it under
7114402Sruthe terms of the GNU General Public License as published by the Free
8114402SruSoftware Foundation; either version 2, or (at your option) any later
9114402Sruversion.
10114402Sru
11114402Srugroff is distributed in the hope that it will be useful, but WITHOUT ANY
12114402SruWARRANTY; without even the implied warranty of MERCHANTABILITY or
13114402SruFITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
14114402Srufor more details.
15114402Sru
16114402SruYou should have received a copy of the GNU General Public License along
17114402Sruwith groff; see the file COPYING.  If not, write to the Free Software
18151497SruFoundation, 51 Franklin St - Fifth Floor, Boston, MA 02110-1301, USA. */
19114402Sru
20114402Sru#include <stdio.h>
21114402Sru#include <stdlib.h>
22114402Sru#include "assert.h"
23114402Sru
24151497Sruextern "C" const char *program_name;
25114402Sru
26114402Sruvoid assertion_failed(int lineno, const char *filename)
27114402Sru{
28114402Sru  if (program_name != 0)
29114402Sru    fprintf(stderr, "%s: ", program_name);
30114402Sru  fprintf(stderr, "Failed assertion at line %d, file `%s'.\n",
31114402Sru	  lineno, filename);
32114402Sru  fflush(stderr);
33114402Sru  abort();
34114402Sru}
35