Reformated comments and long lines
[mmh] / uip / folder.c
index 6f0f8b8..a5326c1 100644 (file)
@@ -1,12 +1,12 @@
 /*
- * folder(s).c -- set/list the current message and/or folder
- *             -- push/pop a folder onto/from the folder stack
- *             -- list the folder stack
- *
- * This code is Copyright (c) 2002, 2008, by the authors of nmh.  See the
- * COPYRIGHT file in the root directory of the nmh distribution for
- * complete copyright information.
- */
+** folder(s).c -- set/list the current message and/or folder
+**             -- push/pop a folder onto/from the folder stack
+**             -- list the folder stack
+**
+** This code is Copyright (c) 2002, 2008, 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>
 #include <h/crawl_folders.h>
@@ -81,9 +81,9 @@ static char *stack = "Folder-Stack";
 static char folder[BUFSIZ];
 
 /*
- * Structure to hold information about
- * folders as we scan them.
- */
+** Structure to hold information about
+** folders as we scan them.
+*/
 struct FolderInfo {
        char *name;
        int nummsg;
@@ -95,15 +95,15 @@ struct FolderInfo {
 };
 
 /*
- * Dynamically allocated space to hold
- * all the folder information.
- */
+** Dynamically allocated space to hold
+** all the folder information.
+*/
 static struct FolderInfo *fi;
 static int maxFolderInfo;
 
 /*
- * static prototypes
- */
+** static prototypes
+*/
 static int get_folder_info (char *, char *);
 static crawl_callback_t get_folder_info_callback;
 static void print_folders (void);
@@ -128,9 +128,9 @@ main (int argc, char **argv)
        context_read();
 
        /*
-        * If program was invoked with name ending
-        * in `s', then add switch `-all'.
-        */
+       ** If program was invoked with name ending
+       ** in `s', then add switch `-all'.
+       */
        if (argv[0][strlen (argv[0]) - 1] == 's')
                all = 1;
 
@@ -256,9 +256,9 @@ main (int argc, char **argv)
        nmhdir = concat (m_maildir (""), "/", NULL);
 
        /*
-        * If we aren't working with the folder stack
-        * (-push, -pop, -list) then the default is to print.
-        */
+       ** If we aren't working with the folder stack
+       ** (-push, -pop, -list) then the default is to print.
+       */
        if (pushsw == 0 && popsw == 0 && listsw == 0)
                printsw++;
 
@@ -305,7 +305,8 @@ main (int argc, char **argv)
                                cp = add (*ap, add (" ", cp));
                        context_replace (stack, cp);  /* update folder stack */
                } else {
-                       context_del (stack);  /* delete folder stack entry from context */
+                       /* delete folder stack entry from context */
+                       context_del (stack);
                }
                free (dp);
        }
@@ -313,7 +314,8 @@ main (int argc, char **argv)
                cp = m_maildir(argfolder);
                if (access (cp, F_OK) == NOTOK)
                        adios (cp, "unable to find folder");
-               context_replace (pfolder, argfolder);  /* update current folder   */
+               /* update current folder   */
+               context_replace (pfolder, argfolder);
                context_save ();  /* save the context file   */
                argfolder = NULL;
        }
@@ -338,13 +340,16 @@ main (int argc, char **argv)
        fi = mh_xmalloc (maxFolderInfo * sizeof(*fi));
 
        /*
-        * Scan the folders
-        */
+       ** Scan the folders
+       */
        if (all || ftotal > 0) {
                /*
-                * If no folder is given, do them all
-                */
-               /* change directory to base of nmh directory for crawl_folders */
+               ** If no folder is given, do them all
+               */
+               /*
+               ** change directory to base of nmh directory for
+               ** crawl_folders
+               */
                if (chdir (nmhdir) == NOTOK)
                        adios (nmhdir, "unable to change directory to");
                if (!argfolder) {
@@ -356,13 +361,14 @@ main (int argc, char **argv)
                } else {
                        strncpy (folder, argfolder, sizeof(folder));
                        if (get_folder_info (argfolder, msg)) {
-                               context_replace (pfolder, argfolder);/* update current folder */
-                               context_save ();  /* save the context file */
+                               /* update current folder */
+                               context_replace (pfolder, argfolder);
+                               context_save ();
                        }
                        /*
-                        * Since recurse wasn't done in get_folder_info(),
-                        * we still need to list all level-1 sub-folders.
-                        */
+                       ** Since recurse wasn't done in get_folder_info(),
+                       ** we still need to list all level-1 sub-folders.
+                       */
                        if (!frecurse)
                                crawl_folders (folder, get_folder_info_callback, NULL);
                }
@@ -370,9 +376,9 @@ main (int argc, char **argv)
                strncpy (folder, argfolder ? argfolder : getfolder (1), sizeof(folder));
 
                /*
-                * Check if folder exists.  If not, then see if
-                * we should create it, or just exit.
-                */
+               ** Check if folder exists.  If not, then see if
+               ** we should create it, or just exit.
+               */
                create_folder (m_maildir (folder), fcreat, done);
 
                if (get_folder_info (folder, msg) && argfolder) {
@@ -382,11 +388,11 @@ main (int argc, char **argv)
        }
 
        /*
-        * Print out folder information
-        */
+       ** Print out folder information
+       */
        print_folders();
 
-       context_save ();  /* save the context file */
+       context_save ();
        done (0);
        return 1;
 }
@@ -400,9 +406,9 @@ get_folder_info_body (char *fold, char *msg, boolean *crawl_children)
        i = total_folders++;
 
        /*
-        * if necessary, reallocate the space
-        * for folder information
-        */
+       ** if necessary, reallocate the space
+       ** for folder information
+       */
        if (total_folders >= maxFolderInfo) {
                maxFolderInfo += CRAWL_NUMFOLDERS;
                fi = mh_xrealloc (fi, maxFolderInfo * sizeof(*fi));
@@ -418,8 +424,8 @@ get_folder_info_body (char *fold, char *msg, boolean *crawl_children)
 
        if ((ftotal > 0) || !fshort || msg || fpack) {
                /*
-                * create message structure and get folder info
-                */
+               ** create message structure and get folder info
+               */
                if (!(mp = folder_read (fold))) {
                        admonish (NULL, "unable to read folder %s", fold);
                        return 0;
@@ -473,13 +479,12 @@ get_folder_info (char *fold, char *msg)
        if (crawl_children) {
                crawl_folders (fold, get_folder_info_callback, NULL);
        }
-
-       return retval;
+return retval;
 }
 
 /*
- * Print folder information
- */
+** Print folder information
+*/
 
 static void
 print_folders (void)
@@ -492,9 +497,9 @@ print_folders (void)
        char tmpname[BUFSIZ];
 
        /*
-        * compute a few values needed to for
-        * printing various fields
-        */
+       ** compute a few values needed to for
+       ** printing various fields
+       */
        for (i = 0; i < total_folders; i++) {
                /* length of folder name */
                len = strlen (fi[i].name);
@@ -539,8 +544,8 @@ print_folders (void)
                nummsgdigits = 2;
 
        /*
-        * Print the header
-        */
+       ** Print the header
+       */
        if (fheader > 0 || (all && !fshort && fheader >= 0))
                printf ("%-*s %*s %-*s; %-*s %*s\n",
                                maxlen+1, "FOLDER",
@@ -550,8 +555,8 @@ print_folders (void)
                                9, "(OTHERS)");
 
        /*
-        * Print folder information
-        */
+       ** Print folder information
+       */
        if (all || fshort || ftotal < 1) {
                for (i = 0; i < total_folders; i++) {
                        if (fshort) {
@@ -596,8 +601,8 @@ print_folders (void)
        }
 
        /*
-        * Print folder/message totals
-        */
+       ** Print folder/message totals
+       */
        if (ftotal > 0 || (all && !fshort && ftotal >= 0)) {
                if (all)
                        printf ("\n");
@@ -610,8 +615,8 @@ print_folders (void)
 }
 
 /*
- * Set the current message and sychronize sequences
- */
+** Set the current message and sychronize sequences
+*/
 
 static int
 sfold (struct msgs *mp, char *msg)
@@ -634,8 +639,8 @@ sfold (struct msgs *mp, char *msg)
 
 
 /*
- * Do the read only folders
- */
+** Do the read only folders
+*/
 
 static void
 readonly_folders (void)