]> diplodocus.org Git - nmh/commitdiff
implement the long-neglected 'folder -noprint'
authorPaul Fox <pgf@foxharp.boston.ma.us>
Sun, 7 Jan 2018 18:12:02 +0000 (13:12 -0500)
committerPaul Fox <pgf@foxharp.boston.ma.us>
Wed, 10 Jan 2018 02:08:42 +0000 (21:08 -0500)
man/folder.man
uip/folder.c

index ad8fbee..a4be417 100644 (file)
@@ -21,7 +21,7 @@ folder, folders \- set/list current nmh folder/message
 .RB [ \-list " | " \-nolist ]
 .RB [ \-push " | " \-pop ]
 .RB [ \-pack " | " \-nopack ]
-.RB [ \-print ]
+.RB [ \-print " | " \-noprint ]
 .RB [ \-verbose " | " \-noverbose ]
 .HP 5
 .B folders
@@ -57,7 +57,14 @@ argument is given, this corresponds to a \*(lqcd\*(rq operation
 in the shell; when no
 .I +folder
 argument is given, this corresponds roughly to a \*(lqpwd\*(rq
-operation in the shell.)
+operation in the shell.) If
+.B \-noprint
+is specified, a
+.I +folder
+and/or
+.I msg
+may still be specified to set the current folder and/or message,
+but the folder summary will not be printed.
 .PP
 If the specified (or default) folder doesn't exist,
 .B folder
@@ -75,12 +82,6 @@ Specifying
 will cause
 .B folder
 to print an error message and exit without creating a folder.
-.\"
-.\" note - this doesn't work at present
-.\" If `\-noprint' is specified,
-.\" a `+folder' and/or `msg' may still be specified
-.\" to set the current folder and/or message,
-.\" but the folder summary will not be printed.
 .SS "Multiple Folders"
 Specifying
 .B \-all
@@ -249,8 +250,9 @@ to the \*(lqdirs\*(rq operation in the shell.  The
 .BR \-pop ,
 and
 .B \-list
-switches all disable
-.BR \-print .
+switches disable the default
+.B \-print
+behavior.
 .SH FILES
 .TP 20
 $HOME/.mh_profile
@@ -297,12 +299,12 @@ msg
 \-noverbose
 .TP
 \-print
-is the default if no
+is the default if none of
 .BR -list ,
 .BR \-push ,
 or
 .B \-pop
-is specified.
+are specified.
 .TP
 \-list
 is the default if
index a41e7fe..8a79498 100644 (file)
@@ -130,7 +130,7 @@ nonexistent_folder (int status)
 int
 main (int argc, char **argv)
 {
-    bool printsw = false;
+    int printsw = -1;
     bool listsw = false;
     bool pushsw = false;
     bool popsw = false;
@@ -224,10 +224,10 @@ main (int argc, char **argv)
                    continue;
 
                case PRNTSW: 
-                   printsw = true;
+                   printsw = 1;
                    continue;
                case NPRNTSW: 
-                   printsw = false;
+                   printsw = 0;
                    continue;
 
                case LISTSW: 
@@ -265,11 +265,13 @@ 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 not directed via -print/-noprint, we print folder summary
+     * info unless if we're working with the folder stack (i.e.,
+     * -push, -pop, or -list).
      */
-    if (!pushsw && !popsw && !listsw)
-       printsw = true;
+    if (printsw == -1) {
+       printsw = !(pushsw || popsw || listsw);
+    }
 
     /* Pushing a folder onto the folder stack */
     if (pushsw) {
@@ -394,7 +396,8 @@ main (int argc, char **argv)
     /*
      * Print out folder information
      */
-    print_folders();
+    if (printsw)
+       print_folders();
 
     context_save ();   /* save the context file */
     done (0);