source: vendor/diffutils/2.8.1/lib/c-stack.c@ 2662

Last change on this file since 2662 was 2556, checked in by bird, 20 years ago

diffutils 2.8.1

File size: 6.0 KB
RevLine 
[2556]1/* Stack overflow handling.
2
3 Copyright (C) 2002 Free Software Foundation, Inc.
4
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2, or (at your option)
8 any later version.
9
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software Foundation,
17 Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
18
19/* Written by Paul Eggert. */
20
21/* This module assumes that each stack frame is smaller than a page.
22 If you use alloca, dynamic arrays, or large local variables, your
23 program may extend the stack by more than a page at a time. If so,
24 the code below may incorrectly report a program error, or worse
25 yet, may not detect the overflow at all. To avoid this problem,
26 don't use large local arrays. */
27
28#if HAVE_CONFIG_H
29# include <config.h>
30#endif
31
32#include "gettext.h"
33#define _(msgid) gettext (msgid)
34
35#include <errno.h>
36#ifndef ENOTSUP
37# define ENOTSUP EINVAL
38#endif
39
40#if HAVE_INTTYPES_H
41# include <inttypes.h>
42#else
43# if HAVE_STDINT_H
44# include <stdint.h>
45# endif
46#endif
47
48#include <signal.h>
49#include <stdlib.h>
50#include <string.h>
51
52#if HAVE_UNISTD_H
53# include <unistd.h>
54#endif
55#ifndef STDERR_FILENO
56# define STDERR_FILENO 2
57#endif
58
59#include "c-stack.h"
60#include "exitfail.h"
61
62extern char *program_name;