X-Git-Url: http://git.marmaro.de/?p=mmh;a=blobdiff_plain;f=sbr%2Ffolder_addmsg.c;h=5d1690e03618869a1e35c17e23559f5bbbaf67a7;hp=e26e3bf4fa475e6e90cd1c499372984a3c328622;hb=ced6090a330d3d83d0bce709f756aa3d7d65fea4;hpb=337338b404931f06f0db2119c9e145e8ca5a9860 diff --git a/sbr/folder_addmsg.c b/sbr/folder_addmsg.c index e26e3bf..5d1690e 100644 --- a/sbr/folder_addmsg.c +++ b/sbr/folder_addmsg.c @@ -1,19 +1,19 @@ /* - * folder_addmsg.c -- Link message into folder - * - * 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. - */ +** folder_addmsg.c -- Link message into folder +** +** 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 #include #include /* - * Link message into a folder. Return the new number - * of the message. If an error occurs, return -1. - */ +** Link message into a folder. Return the new number +** of the message. If an error occurs, return -1. +*/ int folder_addmsg (struct msgs **mpp, char *msgfile, int selected, @@ -39,17 +39,17 @@ folder_addmsg (struct msgs **mpp, char *msgfile, int selected, } /* - * We might need to make several attempts - * in order to add the message to the folder. - */ + ** We might need to make several attempts + ** in order to add the message to the folder. + */ for (;; msgnum++) { /* - * See if we need more space. If we need space at the - * end, then we allocate space for an addition 100 messages. - * If we need space at the beginning of the range, then just - * extend message status range to cover this message number. - */ + ** See if we need more space. If we need space at the + ** end, then we allocate space for an addition 100 messages. + ** If we need space at the beginning of the range, then just + ** extend message status range to cover this message number. + */ if (msgnum > mp->hghoff) { if ((mp = folder_realloc (mp, mp->lowoff, msgnum + 100))) *mpp = mp; @@ -67,9 +67,9 @@ folder_addmsg (struct msgs **mpp, char *msgfile, int selected, } /* - * If a message is already in that slot, - * then loop to next available slot. - */ + ** If a message is already in that slot, + ** then loop to next available slot. + */ if (does_exist (mp, msgnum)) continue; @@ -102,8 +102,8 @@ folder_addmsg (struct msgs **mpp, char *msgfile, int selected, } /* - * check if this is highest or lowest message - */ + ** check if this is highest or lowest message + */ if (mp->nummsg == 0) { mp->lowmsg = msgnum; mp->hghmsg = msgnum; @@ -121,12 +121,14 @@ folder_addmsg (struct msgs **mpp, char *msgfile, int selected, snprintf (newmsg, sizeof(newmsg), "%s/%s", mp->foldpath, nmsg); /* - * Now try to link message into folder. - * Then run the external hook on the message if one was specified in the context. - * Run the refile hook if we're moving the message from one place to another. - * We have to construct the from path name for this because it's not there. - * Run the add hook if the message is getting copied or linked somewhere else. - */ + ** Now try to link message into folder. Then run the + ** external hook on the message if one was specified in + ** the context. Run the refile hook if we're moving the + ** message from one place to another. We have to construct + ** the from path name for this because it's not there. + ** Run the add hook if the message is getting copied or + ** linked somewhere else. + */ if (link (msgfile, newmsg) != -1) { if (deleting) { @@ -145,11 +147,12 @@ folder_addmsg (struct msgs **mpp, char *msgfile, int selected, #endif /* EISREMOTE */ /* - * Check if the file in our desired location is the same - * as the source file. If so, then just leave it alone - * and return. Otherwise, we will continue the main loop - * and try again at another slot (hghmsg+1). - */ + ** Check if the file in our desired location is + ** the same as the source file. If so, then just + ** leave it alone and return. Otherwise, we will + ** continue the main loop and try again at another + ** slot (hghmsg+1). + */ if (linkerr == EEXIST) { if (stat (msgfile, &st2) == 0 && stat (newmsg, &st1) == 0 && st2.st_ino == st1.st_ino) { @@ -160,11 +163,11 @@ folder_addmsg (struct msgs **mpp, char *msgfile, int selected, } /* - * If link failed because we are trying to link - * across devices, then check if there is a message - * already in the desired location. If so, then return - * error, else just copy the message. - */ + ** If link failed because we are trying to link + ** across devices, then check if there is a message + ** already in the desired location. If so, then return + ** error, else just copy the message. + */ if (linkerr == EXDEV) { if (stat (newmsg, &st1) == 0) { advise (NULL, "message %s:%s already exists", mp->foldpath, newmsg); @@ -195,9 +198,9 @@ folder_addmsg (struct msgs **mpp, char *msgfile, int selected, } /* - * Else, some other type of link error, - * so just return error. - */ + ** Else, some other type of link error, + ** so just return error. + */ advise (newmsg, "error linking %s to", msgfile); return -1; }