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 3, 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, int fail)); 26 FILE *ck_fdopen P_((int fd, const char *name, const char *mode, int fail)); 27 void ck_fwrite P_((const VOID *ptr, size_t size, size_t nmemb, FILE *stream)); 28 size_t ck_fread P_((VOID *ptr, size_t size, size_t nmemb, FILE *stream)); 29 void ck_fflush P_((FILE *stream)); 30 void ck_fclose P_((FILE *stream)); 31 const char *follow_symlink P_((const char *path)); 32 size_t ck_getline P_((char **text, size_t *buflen, FILE *stream)); 33 FILE * ck_mkstemp P_((char **p_filename, char *tmpdir, char *base)); 34 void ck_rename P_((const char *from, const char *to, const char *unlink_if_fail)); 35 36 VOID *ck_malloc P_((size_t size)); 37 VOID *xmalloc P_((size_t size)); 38 VOID *ck_realloc P_((VOID *ptr, size_t size)); 39 char *ck_strdup P_((const char *str)); 40 VOID *ck_memdup P_((const VOID *buf, size_t len)); 41 void ck_free P_((VOID *ptr)); 42 43 struct buffer *init_buffer P_((void)); 44 char *get_buffer P_((struct buffer *b)); 45 size_t size_buffer P_((struct buffer *b)); 46 char *add_buffer P_((struct buffer *b, const char *p, size_t n)); 47 char *add1_buffer P_((struct buffer *b, int ch)); 48 void free_buffer P_((struct buffer *b)); 49 50 extern const char *myname; 51