| 1 | /* Functions from hack's utils library.
|
|---|
| 2 | Copyright (C) 1989, 1990, 1991, 1998, 1999, 2003
|
|---|
| 3 | 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
|
|---|
| 17 | Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
|
|---|
| 18 |
|
|---|
| 19 | #include <stdio.h>
|
|---|
| 20 |
|
|---|
| 21 | #include "basicdefs.h"
|
|---|
| 22 |
|
|---|
| 23 | void panic P_((const char *str, ...));
|
|---|
| 24 |
|
|---|
| 25 | FILE *ck_fopen P_((const char *name, const char *mode, bool fail));
|
|---|
| 26 | void ck_fwrite P_((const VOID *ptr, size_t size, size_t nmemb, FILE *stream));
|
|---|
| 27 | size_t ck_fread P_((VOID *ptr, size_t size, size_t nmemb, FILE *stream));
|
|---|
| 28 | void ck_fflush P_((FILE *stream));
|
|---|
| 29 | void ck_fclose P_((FILE *stream));
|
|---|
| 30 | size_t ck_getline P_((char **text, size_t *buflen, FILE *stream));
|
|---|
| 31 | FILE * ck_mkstemp P_((char **p_filename, char *tmpdir, char *base));
|
|---|
| 32 | void ck_rename P_((const char *from, const char *to, const char *unlink_if_fail));
|
|---|
| 33 |
|
|---|
| 34 | VOID *ck_malloc P_((size_t size));
|
|---|
| 35 | VOID *xmalloc P_((size_t size));
|
|---|
| 36 | VOID *ck_realloc P_((VOID *ptr, size_t size));
|
|---|
| 37 | char *ck_strdup P_((const char *str));
|
|---|
| 38 | VOID *ck_memdup P_((const VOID *buf, size_t len));
|
|---|
| 39 | void ck_free P_((VOID *ptr));
|
|---|
| 40 |
|
|---|
| 41 | struct buffer *init_buffer P_((void));
|
|---|
| 42 | char *get_buffer P_((struct buffer *b));
|
|---|
| 43 | size_t size_buffer P_((struct buffer *b));
|
|---|
| 44 | char *add_buffer P_((struct buffer *b, const char *p, size_t n));
|
|---|
| 45 | char *add1_buffer P_((struct buffer *b, int ch));
|
|---|
| 46 | void free_buffer P_((struct buffer *b));
|
|---|
| 47 |
|
|---|
| 48 | extern const char *myname;
|
|---|