[Define as 1 if iconv() only converts exactly and we should treat
all return values other than (size_t)(-1) as equivalent.])
-AH_BOTTOM([/* fseeko portability defines */
-#ifdef HAVE_FSEEKO
-# define LOFF_T off_t
-# if SIZEOF_OFF_T == 8
-# define OFF_T_FMT "%lld"
-# else
-# define OFF_T_FMT "%ld"
-# endif
-#else
-# define LOFF_T long
-# define fseeko fseek
-# define ftello ftell
-# define OFF_T_FMT "%ld"
-#endif
-])
MUTT_C99_INTTYPES
ac_aux_path_sendmail=/usr/sbin:/usr/lib
* below is to avoid creating a HEADER structure in message_handler().
*/
int
-mutt_copy_hdr (FILE* in, FILE* out, LOFF_T off_start, LOFF_T off_end,
+mutt_copy_hdr (FILE* in, FILE* out, off_t off_start, off_t off_end,
int flags, const char *prefix) {
int from = 0;
int this_is_from;
}
if (flags & CH_UPDATE_LEN && (flags & CH_NOLEN) == 0) {
- fprintf (out, "Content-Length: " OFF_T_FMT "\n", h->content->length);
+ fprintf (out, "Content-Length: %zd\n", h->content->length);
if (h->lines != 0 || h->content->length == 0)
fprintf (out, "Lines: %d\n", h->lines);
}
}
/* Count the number of lines and bytes to be deleted in this body*/
-static int count_delete_lines (FILE * fp, BODY * b, LOFF_T *length,
+static int count_delete_lines (FILE * fp, BODY * b, off_t *length,
size_t datelen)
{
int dellines = 0;
{
char prefix[SHORT_STRING];
STATE s;
- LOFF_T new_offset = -1;
+ off_t new_offset = -1;
int rc = 0;
if (flags & M_CM_PREFIX) {
else if (hdr->attach_del && (chflags & CH_UPDATE_LEN)) {
int new_lines;
- LOFF_T new_length = body->length;
+ off_t new_length = body->length;
char date[SHORT_STRING];
mutt_make_date (date, sizeof (date));
if (mutt_copy_header (fpin, hdr, fpout,
chflags | CH_NOLEN | CH_NONEWLINE, NULL))
return -1;
- fprintf (fpout, "Content-Length: " OFF_T_FMT "\n", new_length);
+ fprintf (fpout, "Content-Length: %zd\n", new_length);
if (new_lines <= 0)
new_lines = 0;
else
#ifdef DEBUG
{
- LOFF_T fail = ((ftello (fpout) - new_offset) - new_length);
+ off_t fail = ((ftello (fpout) - new_offset) - new_length);
if (fail) {
mutt_error ("The length calculation was wrong by %ld bytes", fail);
if (part->deleted) {
fprintf (fpout,
"Content-Type: message/external-body; access-type=x-mutt-deleted;\n"
- "\texpiration=%s; length=" OFF_T_FMT "\n"
+ "\texpiration=%s; length=%zd\n"
"\n", date + 5, part->length);
if (ferror (fpout))
return -1;
#define M_CM_DECODE_CRYPT (M_CM_DECODE_PGP | M_CM_DECODE_SMIME)
#define M_CM_VERIFY (1<<11) /* do signature verification */
-int mutt_copy_hdr (FILE *, FILE *, LOFF_T, LOFF_T, int, const char *);
+int mutt_copy_hdr (FILE *, FILE *, off_t, off_t, int, const char *);
int mutt_copy_header (FILE *, HEADER *, FILE *, int, const char *);
int _mutt_copy_message (FILE * fpout, FILE * fpin,
HEADER * hdr, BODY * body, int flags, int chflags);
int clearsign = 0;
long start_pos = 0;
long bytes;
- LOFF_T last_pos, offset;
+ off_t last_pos, offset;
char buf[HUGE_STRING];
FILE *pgpout = NULL;
. on a line by itself ends input\n");
static char **be_snarf_data (FILE * f, char **buf, int *bufmax, int *buflen,
- LOFF_T offset, int bytes, int prefix)
+ off_t offset, int bytes, int prefix)
{
char tmp[HUGE_STRING];
char *p = tmp;
{
struct stat st;
BODY *b;
- LOFF_T off_start;
+ off_t off_start;
int rc = 0;
off_start = ftello (s->fpin);
/* struct used by mutt_sync_mailbox() to store new offsets */
struct m_update_t {
short valid;
- LOFF_T hdr;
- LOFF_T body;
+ off_t hdr;
+ off_t body;
long lines;
- LOFF_T length;
+ off_t length;
};
int count = 0, oldmsgcount = ctx->msgcount;
int lines;
time_t t, tz;
- LOFF_T loc, tmploc;
+ off_t loc, tmploc;
HEADER *hdr;
struct stat sb;
HEADER *curhdr;
time_t t, tz;
int count = 0, lines = 0;
- LOFF_T loc;
+ off_t loc;
#ifdef NFS_ATTRIBUTE_HACK
struct utimbuf newtime;
* save time by not having to search for the next message marker).
*/
if (curhdr->content->length > 0) {
- LOFF_T tmploc;
+ off_t tmploc;
loc = ftello (ctx->fp);
tmploc = loc + curhdr->content->length + 1;
if (fseeko (ctx->fp, tmploc, SEEK_SET) != 0 ||
fgets (buf, sizeof (buf), ctx->fp) == NULL ||
str_ncmp ("From ", buf, 5) != 0) {
- debug_print (1, ("bad content-length in message %d (cl="
- OFF_T_FMT ")\n", curhdr->index, curhdr->content->length));
+ debug_print (1, ("bad content-length in message %d (cl=%zd)\n",
+ curhdr->index, curhdr->content->length));
debug_print (1, ("LINE: %s\n", buf));
if (fseeko (ctx->fp, loc, SEEK_SET) != 0) { /* nope, return the previous position */
debug_print (1, ("fseeko() failed\n"));
int rc = -1;
int need_sort = 0; /* flag to resort mailbox if new mail arrives */
int first = -1; /* first message to be written */
- LOFF_T offset; /* location in mailbox to write changed messages */
+ off_t offset; /* location in mailbox to write changed messages */
struct stat statbuf;
struct utimbuf utimebuf;
struct m_update_t *newOffset = NULL;
PARAMETER *parameter; /* parameters of the content-type */
char *description; /* content-description */
char *form_name; /* Content-Disposition form-data name param */
- LOFF_T hdr_offset; /* offset in stream where the headers begin.
+ off_t hdr_offset; /* offset in stream where the headers begin.
* this info is used when invoking metamail,
* where we need to send the headers of the
* attachment
*/
- LOFF_T offset; /* offset where the actual data begins */
- LOFF_T length; /* length (in bytes) of attachment */
+ off_t offset; /* offset where the actual data begins */
+ off_t length; /* length (in bytes) of attachment */
char *filename; /* when sending a message, this is the file
* to which this structure refers
*/
time_t date_sent; /* time when the message was sent (UTC) */
time_t received; /* time when the message was placed in the mailbox */
- LOFF_T offset; /* where in the stream does this message begin? */
+ off_t offset; /* where in the stream does this message begin? */
int lines; /* how many lines in the body of this message? */
int index; /* the absolute (unsorted) message number */
int msgno; /* number displayed to the user */
if (tag) *tag = #a; e = 1; err = NULL; \
}
-int mutt_env_to_idna (ENVELOPE * env, char **tag, char **err)
+int mutt_env_to_idna (ENVELOPE * env, const char **tag, char **err)
{
int e = 0;
int mutt_addrlist_to_local (ADDRESS *);
void mutt_env_to_local (ENVELOPE *);
-int mutt_env_to_idna (ENVELOPE *, char **, char **);
+int mutt_env_to_idna (ENVELOPE *, const char **, char **);
const char *mutt_addr_for_display (ADDRESS * a);
fputs (buf, f);
if (h->env->references)
mutt_write_references (h->env->references, f);
- snprintf (buf, sizeof (buf), "\t" OFF_T_FMT "\t%d\tXref: %s\n",
+ snprintf (buf, sizeof (buf), "\t%zd\t%d\tXref: %s\n",
h->content->length, h->lines, NONULL (h->env->xref));
if (fputs (buf, f) == EOF) {
fclose (f);
};
struct line_t {
- LOFF_T offset;
+ off_t offset;
short type;
short continuation;
short chunks;
}
static int
-fill_buffer (FILE * f, LOFF_T *last_pos, LOFF_T offset, unsigned char *buf,
+fill_buffer (FILE * f, off_t *last_pos, off_t offset, unsigned char *buf,
unsigned char *fmt, size_t blen, int *buf_ready)
{
unsigned char *p;
*/
static int
-display_line (FILE * f, LOFF_T *last_pos, struct line_t **lineInfo, int n,
+display_line (FILE * f, off_t *last_pos, struct line_t **lineInfo, int n,
int *last, int *max, int flags, struct q_class_t **QuoteList,
int *q_level, int *force_redraw, regex_t * SearchRE)
{
int r = -1;
int redraw = REDRAW_FULL;
FILE *fp = NULL;
- LOFF_T last_pos = 0, last_offset = 0;
+ off_t last_pos = 0, last_offset = 0;
int old_smart_wrap, old_markers;
struct stat sb;
regex_t SearchRE;
* digest 1 if reading a multipart/digest, 0 otherwise
*/
-BODY *mutt_parse_multipart (FILE * fp, const char *boundary, LOFF_T end_off,
+BODY *mutt_parse_multipart (FILE * fp, const char *boundary, off_t end_off,
int digest)
{
#ifdef SUN_ATTACHMENT
LIST *last = NULL;
char *line = mem_malloc (LONG_STRING);
char *p;
- LOFF_T loc;
+ off_t loc;
int matched;
size_t linelen = LONG_STRING;
char buf[LONG_STRING + 1];
int clearsign = 0, rv, rc;
long start_pos = 0;
long bytes;
- LOFF_T last_pos, offset;
+ off_t last_pos, offset;
char buf[HUGE_STRING];
char outfile[_POSIX_PATH_MAX];
char tmpfname[_POSIX_PATH_MAX];
static void pgp_dearmor (FILE * in, FILE * out)
{
char line[HUGE_STRING];
- LOFF_T start;
- LOFF_T end;
+ off_t start;
+ off_t end;
char *r;
STATE state;
unsigned char *pgp_read_packet (FILE * fp, size_t * len)
{
size_t used = 0;
- LOFF_T startpos;
+ off_t startpos;
unsigned char ctb;
unsigned char b;
size_t material;
#ifdef HAVE_FGETPOS
fpos_t pos;
#else
- LOFF_T pos;
+ off_t pos;
#endif
pgp_key_t root = NULL;
#ifdef HAVE_FGETPOS
fpos_t pos, keypos;
#else
- LOFF_T pos, keypos;
+ off_t pos, keypos;
#endif
unsigned char *buff = NULL;
BODY *mutt_remove_multipart (BODY *);
BODY *mutt_make_multipart (BODY *);
BODY *mutt_new_body (void);
-BODY *mutt_parse_multipart (FILE *, const char *, LOFF_T, int);
+BODY *mutt_parse_multipart (FILE *, const char *, off_t, int);
BODY *mutt_parse_messageRFC822 (FILE *, BODY *);
BODY *mutt_read_mime_header (FILE *, int);
return (args);
}
-static char **add_option (char **args, size_t * argslen, size_t * argsmax,
- char *s)
+static char **add_option(char **args, size_t * argslen, size_t * argsmax,
+ const char *s)
{
- if (*argslen == *argsmax)
- mem_realloc (&args, (*argsmax += 5) * sizeof (char *));
- args[(*argslen)++] = s;
- return (args);
+ if (*argslen == *argsmax) {
+ mem_realloc(&args, (*argsmax += 5) * sizeof (char *));
+ }
+ args[(*argslen)++] = s;
+ return (args);
}
static int mutt_invoke_sendmail (ADDRESS * from, /* the sender */
rewind (tempfp);
while (fgets (sasha, sizeof (sasha), tempfp) != NULL)
lines++;
- fprintf (msg->fp, "Content-Length: " OFF_T_FMT "\n", ftello (tempfp));
+ fprintf (msg->fp, "Content-Length: %zd\n", ftello (tempfp));
fprintf (msg->fp, "Lines: %d\n\n", lines);
/* copy the body and clean up */