X-Git-Url: https://git.llucax.com/software/mutt-debian.git/blobdiff_plain/14c29200cb58d3c4a0830265f2433849781858d0..939639fcf1dad1b8f3a85d641f41d11c49281f3c:/lib.h?ds=inline diff --git a/lib.h b/lib.h index 8e8d395..49fc868 100644 --- a/lib.h +++ b/lib.h @@ -1,6 +1,6 @@ /* - * Copyright (C) 1996-2000 Michael R. Elkins - * Copyright (C) 1999-2000 Thomas Roessler + * Copyright (C) 1996-2000,2007 Michael R. Elkins + * Copyright (C) 1999-2005,2007 Thomas Roessler * * This program is free software; you can redistribute it * and/or modify it under the terms of the GNU General Public @@ -126,11 +126,13 @@ void mutt_exit (int); MUTT_LIB_WHERE FILE *debugfile MUTT_LIB_INITVAL(0); MUTT_LIB_WHERE int debuglevel MUTT_LIB_INITVAL(0); -# define dprint(N,X) do { if(debuglevel>=N && debugfile) fprintf X; } while (0) +void mutt_debug (FILE *, const char *, ...); + +# define dprint(N,X) do { if(debuglevel>=N && debugfile) mutt_debug X; } while (0) # else -# define dprint(N,X) +# define dprint(N,X) do { } while (0) # endif @@ -139,13 +141,17 @@ MUTT_LIB_WHERE int debuglevel MUTT_LIB_INITVAL(0); #define S_ERR 127 #define S_BKG 126 +/* Flags for mutt_read_line() */ +#define M_CONT (1<<0) /* \-continuation */ +#define M_EOL (1<<1) /* don't strip \n/\r\n */ + /* The actual library functions. */ FILE *safe_fopen (const char *, const char *); char *mutt_concatn_path (char *, size_t, const char *, size_t, const char *, size_t); char *mutt_concat_path (char *, const char *, const char *, size_t); -char *mutt_read_line (char *, size_t *, FILE *, int *); +char *mutt_read_line (char *, size_t *, FILE *, int *, int); char *mutt_skip_whitespace (char *); char *mutt_strlower (char *); char *mutt_substrcpy (char *, const char *, const char *, size_t); @@ -154,6 +160,16 @@ char *safe_strcat (char *, size_t, const char *); char *safe_strncat (char *, size_t, const char *, size_t); char *safe_strdup (const char *); +/* strtol() wrappers with range checking; they return + * 0 success + * -1 format error + * -2 overflow (for int and short) + * the int pointer may be NULL to test only without conversion + */ +int mutt_atos (const char *, short *); +int mutt_atoi (const char *, int *); +int mutt_atol (const char *, long *); + const char *mutt_stristr (const char *, const char *); const char *mutt_basename (const char *); @@ -166,10 +182,13 @@ int mutt_strcmp (const char *, const char *); int mutt_strncasecmp (const char *, const char *, size_t); int mutt_strncmp (const char *, const char *, size_t); int mutt_strcoll (const char *, const char *); +int safe_asprintf (char **, const char *, ...); int safe_open (const char *, int); int safe_rename (const char *, const char *); int safe_symlink (const char *, const char *); int safe_fclose (FILE **); +int safe_fsync_close (FILE **); +int mutt_rmtree (const char *); size_t mutt_quote_filename (char *, size_t, const char *); size_t mutt_strlen (const char *);