| 1 | /* utility functions for `patch' */ | 
|---|
| 2 |  | 
|---|
| 3 | /* $Id: util.h,v 1.20 2003/05/20 13:56:48 eggert Exp $ */ | 
|---|
| 4 |  | 
|---|
| 5 | /* Copyright (C) 1986 Larry Wall | 
|---|
| 6 |  | 
|---|
| 7 | Copyright (C) 1992, 1993, 1997, 1998, 1999, 2001, 2002, 2003 Free | 
|---|
| 8 | Software Foundation, Inc. | 
|---|
| 9 |  | 
|---|
| 10 | This program is free software; you can redistribute it and/or modify | 
|---|
| 11 | it under the terms of the GNU General Public License as published by | 
|---|
| 12 | the Free Software Foundation; either version 2, or (at your option) | 
|---|
| 13 | any later version. | 
|---|
| 14 |  | 
|---|
| 15 | This program is distributed in the hope that it will be useful, | 
|---|
| 16 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 
|---|
| 17 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | 
|---|
| 18 | GNU General Public License for more details. | 
|---|
| 19 |  | 
|---|
| 20 | You should have received a copy of the GNU General Public License | 
|---|
| 21 | along with this program; see the file COPYING. | 
|---|
| 22 | If not, write to the Free Software Foundation, | 
|---|
| 23 | 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */ | 
|---|
| 24 |  | 
|---|
| 25 | /* An upper bound on the print length of a signed decimal line number. | 
|---|
| 26 | Add one for the sign.  */ | 
|---|
| 27 | #define LINENUM_LENGTH_BOUND (sizeof (LINENUM) * CHAR_BIT / 3 + 1) | 
|---|
| 28 |  | 
|---|
| 29 | XTERN enum backup_type backup_type; | 
|---|
| 30 |  | 
|---|
| 31 | bool ok_to_reverse (char const *, ...) __attribute__ ((format (printf, 1, 2))); | 
|---|
| 32 | void ask (char const *, ...) __attribute__ ((format (printf, 1, 2))); | 
|---|
| 33 | void say (char const *, ...) __attribute__ ((format (printf, 1, 2))); | 
|---|
| 34 |  | 
|---|
| 35 | void fatal (char const *, ...) | 
|---|
| 36 | __attribute__ ((noreturn, format (printf, 1, 2))); | 
|---|
| 37 | void pfatal (char const *, ...) | 
|---|
| 38 | __attribute__ ((noreturn, format (printf, 1, 2))); | 
|---|
| 39 |  | 
|---|
| 40 | char *fetchname (char *, int, time_t *); | 
|---|
| 41 | char *savebuf (char const *, size_t); | 
|---|
| 42 | char *savestr (char const *); | 
|---|
| 43 | char const *version_controller (char const *, bool, struct stat const *, char **, char **); | 
|---|
| 44 | bool version_get (char const *, char const *, bool, bool, char const *, struct stat *); | 
|---|
| 45 | int create_file (char const *, int, mode_t); | 
|---|
| 46 | int systemic (char const *); | 
|---|
| 47 | char *format_linenum (char[LINENUM_LENGTH_BOUND + 1], LINENUM); | 
|---|
| 48 | void Fseek (FILE *, file_offset, int); | 
|---|
| 49 | void copy_file (char const *, char const *, int, mode_t); | 
|---|
| 50 | void exit_with_signal (int) __attribute__ ((noreturn)); | 
|---|
| 51 | void ignore_signals (void); | 
|---|
| 52 | void init_time (void); | 
|---|
| 53 | void memory_fatal (void) __attribute__ ((noreturn)); | 
|---|
| 54 | void move_file (char const *, int volatile *, char *, mode_t, bool); | 
|---|
| 55 | void read_fatal (void) __attribute__ ((noreturn)); | 
|---|
| 56 | void remove_prefix (char *, size_t); | 
|---|
| 57 | void removedirs (char *); | 
|---|
| 58 | void set_signals (bool); | 
|---|
| 59 | void write_fatal (void) __attribute__ ((noreturn)); | 
|---|