/*
- * burst.c -- explode digests into individual messages
- *
- * This code is Copyright (c) 2002, by the authors of nmh. See the
- * COPYRIGHT file in the root directory of the nmh distribution for
- * complete copyright information.
- */
+** burst.c -- explode digests into individual messages
+**
+** This code is Copyright (c) 2002, by the authors of nmh. See the
+** COPYRIGHT file in the root directory of the nmh distribution for
+** complete copyright information.
+*/
#include <h/mh.h>
};
/*
- * static prototypes
- */
+** static prototypes
+*/
static int find_delim (int, struct smsg *);
static void burst (struct msgs **, int, struct smsg *, int, int, int, char *);
static void cpybrst (FILE *, FILE *, char *, char *, int);
context_replace (pfolder, folder); /* update current folder */
/*
- * If -inplace is given, then the first message burst becomes
- * the current message (which will now show a table of contents).
- * Otherwise, the first message extracted from the first digest
- * becomes the current message.
- */
+ ** If -inplace is given, then the first message burst becomes
+ ** the current message (which will now show a table of contents).
+ ** Otherwise, the first message extracted from the first digest
+ ** becomes the current message.
+ */
if (inplace) {
if (mp->lowsel != mp->curmsg)
seq_setcur (mp, mp->lowsel);
/*
- * Scan the message and find the beginning and
- * end of all the messages in the digest.
- */
+** Scan the message and find the beginning and
+** end of all the messages in the digest.
+*/
static int
find_delim (int msgnum, struct smsg *smsgs)
/*
- * Burst out the messages in the digest into the folder
- */
+** Burst out the messages in the digest into the folder
+*/
static void
burst (struct msgs **mpp, int msgnum, struct smsg *smsgs, int numburst,
mp = *mpp;
/*
- * See if we have enough space in the folder
- * structure for all the new messages.
- */
+ ** See if we have enough space in the folder
+ ** structure for all the new messages.
+ */
if ((mp->hghmsg + numburst > mp->hghoff) &&
!(mp = folder_realloc (mp, mp->lowoff, mp->hghmsg + numburst)))
adios (NULL, "unable to allocate folder storage");
mp->nummsg += numburst;
/*
- * If this is not the highest SELECTED message, then
- * increment mp->hghsel by numburst, since the highest
- * SELECTED is about to be slid down by that amount.
- */
+ ** If this is not the highest SELECTED message, then
+ ** increment mp->hghsel by numburst, since the highest
+ ** SELECTED is about to be slid down by that amount.
+ */
if (msgnum < mp->hghsel)
mp->hghsel += numburst;
/*
- * If -inplace is given, renumber the messages after the
- * source message, to make room for each of the messages
- * contained within the digest.
- *
- * This is equivalent to refiling a message from the point
- * of view of the external hooks.
- */
+ ** If -inplace is given, renumber the messages after the
+ ** source message, to make room for each of the messages
+ ** contained within the digest.
+ **
+ ** This is equivalent to refiling a message from the point
+ ** of view of the external hooks.
+ */
if (inplace) {
for (i = mp->hghmsg; j > msgnum; i--, j--) {
strncpy (f1, m_name (i), sizeof(f1));
unset_selected (mp, msgnum);
/* new hghmsg is hghmsg + numburst
- *
- * At this point, there is an array of numburst smsgs, each
- * element of which contains the starting and stopping offsets
- * (seeks) of the message in the digest. The inplace flag is set
- * if the original digest is replaced by a message containing
- * the table of contents. smsgs[0] is that table of contents.
- * Go through the message numbers in reverse order (high to low).
- *
- * Set f1 to the name of the destination message, f2 to the name
- * of a scratch file. Extract a message from the digest to the
- * scratch file. Move the original message to a backup file if
- * the destination message number is the same as the number of
- * the original message, which only happens if the inplace flag
- * is set. Then move the scratch file to the destination message.
- *
- * Moving the original message to the backup file is equivalent
- * to deleting the message from the point of view of the external
- * hooks. And bursting each message is equivalent to adding a
- * new message.
- */
+ **
+ ** At this point, there is an array of numburst smsgs, each
+ ** element of which contains the starting and stopping offsets
+ ** (seeks) of the message in the digest. The inplace flag is set
+ ** if the original digest is replaced by a message containing
+ ** the table of contents. smsgs[0] is that table of contents.
+ ** Go through the message numbers in reverse order (high to low).
+ **
+ ** Set f1 to the name of the destination message, f2 to the name
+ ** of a scratch file. Extract a message from the digest to the
+ ** scratch file. Move the original message to a backup file if
+ ** the destination message number is the same as the number of
+ ** the original message, which only happens if the inplace flag
+ ** is set. Then move the scratch file to the destination message.
+ **
+ ** Moving the original message to the backup file is equivalent
+ ** to deleting the message from the point of view of the external
+ ** hooks. And bursting each message is equivalent to adding a
+ ** new message.
+ */
i = inplace ? msgnum + numburst : mp->hghmsg;
for (j = numburst; j >= (inplace ? 0 : 1); i--, j--) {
#define S3 2
/*
- * Copy a mesage which is being burst out of a digest.
- * It will remove any "dashstuffing" in the message.
- */
+** Copy a mesage which is being burst out of a digest.
+** It will remove any "dashstuffing" in the message.
+*/
static void
cpybrst (FILE *in, FILE *out, char *ifile, char *ofile, int len)