]> diplodocus.org Git - nmh/commitdiff
Remove MIME content caching code
authorKen Hornstein <kenh@pobox.com>
Wed, 24 Apr 2019 17:05:30 +0000 (13:05 -0400)
committerKen Hornstein <kenh@pobox.com>
Wed, 24 Apr 2019 17:05:30 +0000 (13:05 -0400)
Remove all of the MIME content caching code.  Besides being of dubious
value and having a number of 'interesting' security implications,
it apparently only would cache content if you ran it using mhn
(the necessary entry point was not copied over when mhn was split
apart) and it would only work on the top-level MIME content of a
message.

16 files changed:
Makefile.am
docs/pending-release-notes
h/mhcachesbr.h [deleted file]
man/mhlist.man
man/mhn.man
man/mhshow.man
man/mhstore.man
man/nmh.man
uip/mhbuild.c
uip/mhbuildsbr.c
uip/mhcachesbr.c [deleted file]
uip/mhlist.c
uip/mhn.c
uip/mhparse.c
uip/mhshow.c
uip/mhstore.c

index cf106bb009575aff501cfd84b61364e88138d16b..6a1c2dc1cecee471de02d709b4b84233834a3e4c 100644 (file)
@@ -341,7 +341,6 @@ noinst_HEADERS = \
     h/icalendar.h \
     h/mf.h \
     h/mh.h \
     h/icalendar.h \
     h/mf.h \
     h/mh.h \
-    h/mhcachesbr.h \
     h/mhparse.h \
     h/mime.h \
     h/mts.h \
     h/mhparse.h \
     h/mime.h \
     h/mts.h \
@@ -761,8 +760,11 @@ uip_ali_LDADD = $(LDADD) $(POSTLINK)
 uip_anno_SOURCES = uip/anno.c uip/annosbr.c
 uip_anno_LDADD = $(LDADD) $(POSTLINK)
 
 uip_anno_SOURCES = uip/anno.c uip/annosbr.c
 uip_anno_LDADD = $(LDADD) $(POSTLINK)
 
-uip_burst_SOURCES = uip/burst.c uip/mhparse.c uip/mhmisc.c uip/mhfree.c \
-                   uip/mhcachesbr.c
+uip_burst_SOURCES = uip/burst.c \
+                   uip/mhparse.c \
+                   uip/mhmisc.c \
+                   uip/mhfree.c \
+                   #
 uip_burst_LDADD = $(LDADD) $(ICONVLIB) $(POSTLINK)
 
 uip_comp_SOURCES = uip/comp.c uip/whatnowproc.c uip/whatnowsbr.c uip/sendsbr.c \
 uip_burst_LDADD = $(LDADD) $(ICONVLIB) $(POSTLINK)
 
 uip_comp_SOURCES = uip/comp.c uip/whatnowproc.c uip/whatnowsbr.c uip/sendsbr.c \
@@ -796,26 +798,47 @@ uip_install_mh_LDADD = $(LDADD) $(POSTLINK)
 uip_mark_SOURCES = uip/mark.c
 uip_mark_LDADD = $(LDADD) $(POSTLINK)
 
 uip_mark_SOURCES = uip/mark.c
 uip_mark_LDADD = $(LDADD) $(POSTLINK)
 
-uip_mhbuild_SOURCES = uip/mhbuild.c uip/mhbuildsbr.c uip/mhcachesbr.c \
-                     uip/mhlistsbr.c uip/mhoutsbr.c uip/mhmisc.c  \
-                     uip/mhfree.c uip/mhparse.c \
-                     uip/mhstoresbr.c uip/mhshowsbr.c
+uip_mhbuild_SOURCES = uip/mhbuild.c \
+                     uip/mhbuildsbr.c \
+                     uip/mhlistsbr.c \
+                     uip/mhoutsbr.c \
+                     uip/mhmisc.c \
+                     uip/mhfree.c \
+                     uip/mhparse.c \
+                     uip/mhstoresbr.c \
+                     uip/mhshowsbr.c \
+                     #
 uip_mhbuild_LDADD = $(LDADD) $(TERMLIB) $(ICONVLIB) $(POSTLINK)
 
 uip_mhbuild_LDADD = $(LDADD) $(TERMLIB) $(ICONVLIB) $(POSTLINK)
 
-uip_mhfixmsg_SOURCES = uip/mhfixmsg.c uip/mhparse.c uip/mhcachesbr.c \
-                      uip/mhoutsbr.c uip/mhmisc.c uip/mhfree.c \
-                      uip/mhshowsbr.c uip/mhlistsbr.c
+uip_mhfixmsg_SOURCES = uip/mhfixmsg.c \
+                      uip/mhparse.c \
+                      uip/mhoutsbr.c \
+                      uip/mhmisc.c \
+                      uip/mhfree.c \
+                      uip/mhshowsbr.c \
+                      uip/mhlistsbr.c \
+                      #
 uip_mhfixmsg_LDADD = $(LDADD) $(TERMLIB) $(ICONVLIB) $(POSTLINK)
 
 uip_mhical_SOURCES = uip/mhical.c
 uip_mhical_LDADD = $(LDADD) $(TERMLIB) $(ICONVLIB) $(POSTLINK)
 
 uip_mhfixmsg_LDADD = $(LDADD) $(TERMLIB) $(ICONVLIB) $(POSTLINK)
 
 uip_mhical_SOURCES = uip/mhical.c
 uip_mhical_LDADD = $(LDADD) $(TERMLIB) $(ICONVLIB) $(POSTLINK)
 
-uip_mhlist_SOURCES = uip/mhlist.c uip/mhparse.c uip/mhcachesbr.c \
-                    uip/mhlistsbr.c uip/mhmisc.c uip/mhfree.c
+uip_mhlist_SOURCES = uip/mhlist.c \
+                    uip/mhparse.c \
+                    uip/mhlistsbr.c \
+                    uip/mhmisc.c \
+                    uip/mhfree.c \
+                    #
 uip_mhlist_LDADD = $(LDADD) $(TERMLIB) $(ICONVLIB) $(POSTLINK)
 
 uip_mhlist_LDADD = $(LDADD) $(TERMLIB) $(ICONVLIB) $(POSTLINK)
 
-uip_mhn_SOURCES = uip/mhn.c uip/mhparse.c uip/mhcachesbr.c uip/mhshowsbr.c \
-                 uip/mhlistsbr.c uip/mhstoresbr.c uip/mhmisc.c uip/mhfree.c
+uip_mhn_SOURCES = uip/mhn.c \
+                 uip/mhparse.c \
+                 uip/mhshowsbr.c \
+                 uip/mhlistsbr.c \
+                 uip/mhstoresbr.c \
+                 uip/mhmisc.c \
+                 uip/mhfree.c \
+                 #
 uip_mhn_LDADD = $(LDADD) $(TERMLIB) $(ICONVLIB) $(POSTLINK)
 
 uip_mhparam_SOURCES = uip/mhparam.c
 uip_mhn_LDADD = $(LDADD) $(TERMLIB) $(ICONVLIB) $(POSTLINK)
 
 uip_mhparam_SOURCES = uip/mhparam.c
@@ -824,14 +847,23 @@ uip_mhparam_LDADD = $(LDADD) $(POSTLINK)
 uip_mhpath_SOURCES = uip/mhpath.c
 uip_mhpath_LDADD = $(LDADD) $(POSTLINK)
 
 uip_mhpath_SOURCES = uip/mhpath.c
 uip_mhpath_LDADD = $(LDADD) $(POSTLINK)
 
-uip_mhshow_SOURCES = uip/mhshow.c uip/mhparse.c uip/mhcachesbr.c \
-                    uip/mhshowsbr.c uip/mhlistsbr.c uip/mhmisc.c \
-                    uip/mhfree.c
+uip_mhshow_SOURCES = uip/mhshow.c \
+                    uip/mhparse.c \
+                    uip/mhshowsbr.c \
+                    uip/mhlistsbr.c \
+                    uip/mhmisc.c \
+                    uip/mhfree.c \
+                    #
 uip_mhshow_LDADD = $(LDADD) $(TERMLIB) $(ICONVLIB) $(POSTLINK)
 
 uip_mhshow_LDADD = $(LDADD) $(TERMLIB) $(ICONVLIB) $(POSTLINK)
 
-uip_mhstore_SOURCES = uip/mhstore.c uip/mhparse.c uip/mhcachesbr.c \
-                     uip/mhshowsbr.c uip/mhlistsbr.c uip/mhstoresbr.c \
-                     uip/mhmisc.c uip/mhfree.c
+uip_mhstore_SOURCES = uip/mhstore.c \
+                     uip/mhparse.c \
+                     uip/mhshowsbr.c \
+                     uip/mhlistsbr.c \
+                     uip/mhstoresbr.c \
+                     uip/mhmisc.c \
+                     uip/mhfree.c \
+                     #
 uip_mhstore_LDADD = $(LDADD) $(TERMLIB) $(ICONVLIB) $(POSTLINK)
 
 uip_msgchk_SOURCES = uip/msgchk.c uip/popsbr.c
 uip_mhstore_LDADD = $(LDADD) $(TERMLIB) $(ICONVLIB) $(POSTLINK)
 
 uip_msgchk_SOURCES = uip/msgchk.c uip/popsbr.c
index 5438191d9f40a700648bd194a24445335b45ec79..4a4d0623b30f9098776f66216af6df449ded6505 100644 (file)
@@ -13,6 +13,10 @@ NEW FEATURES
 OBSOLETE FEATURES
 -----------------
 
 OBSOLETE FEATURES
 -----------------
 
+- The MIME content cache functionality has been mostly non-functional since
+  the development on nmh, and consequently all of the content caching code
+  and related switches (-cache/-rcache/-wcache) have been removed.
+
 -------------------
 DEPRECATED FEATURES
 -------------------
 -------------------
 DEPRECATED FEATURES
 -------------------
diff --git a/h/mhcachesbr.h b/h/mhcachesbr.h
deleted file mode 100644 (file)
index 6e6beac..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-/* mhcachesbr.h -- definitions for manipulating MIME content cache
- */
-
-/*
- * various cache policies
- */
-
-#define CACHE_SWITCHES \
-    X("never", 0, CACHE_NEVER) \
-    X("private", 0, CACHE_PRIVATE) \
-    X("public", 0, CACHE_PUBLIC) \
-    X("ask", 0, CACHE_ASK) \
-
-#define X(sw, minchars, id) id,
-DEFINE_SWITCH_ENUM(CACHE);
-#undef X
-extern struct swit *cache_policy;
-
-void cache_all_messages(CT *cts);
-int find_cache(CT ct, int policy, int *writing, char *id,
-    char *buffer, int buflen);
-
-extern int rcachesw;
-extern int wcachesw;
-
-extern char *cache_public;
-extern char *cache_private;
index e352f047da7e816f455f175ad6dbd80f080d6b1f..69a53579ca724e9fda2a54b371165170296a1241 100644 (file)
@@ -26,10 +26,6 @@ mhlist \- list information about nmh MIME messages
 .RB [ \-noprefer ]
 .RB [ \-headers " | " \-noheaders ]
 .RB [ \-realsize " | " \-norealsize ]
 .RB [ \-noprefer ]
 .RB [ \-headers " | " \-noheaders ]
 .RB [ \-realsize " | " \-norealsize ]
-.RB [ \-rcache
-.IR policy ]
-.RB [ \-wcache
-.IR policy ]
 .RB [ \-changecur " | " \-nochangecur ]
 .RB [ \-verbose " | " \-noverbose ]
 .RB [ \-disposition " | " \-nodisposition ]
 .RB [ \-changecur " | " \-nochangecur ]
 .RB [ \-verbose " | " \-noverbose ]
 .RB [ \-disposition " | " \-nodisposition ]
@@ -224,8 +220,6 @@ to make common part numbering possible across all three programs.
 .RB ` \-nocheck '
 .RB ` \-headers '
 .RB ` \-realsize '
 .RB ` \-nocheck '
 .RB ` \-headers '
 .RB ` \-realsize '
-.RB ` \-rcache\ ask '
-.RB ` \-wcache\ ask '
 .RB ` \-changecur '
 .RB ` \-noverbose '
 .RB ` \-nodisposition '
 .RB ` \-changecur '
 .RB ` \-noverbose '
 .RB ` \-nodisposition '
index beb0633ece3b09371b6517b99b9f91b82ebc2432..40354c9de7ae1ec9a6be333994e78234cdc5fe2f 100644 (file)
@@ -3,7 +3,7 @@
 .\" %nmhwarning%
 .
 .SH NAME
 .\" %nmhwarning%
 .
 .SH NAME
-mhn \- display/list/store/cache nmh MIME messages
+mhn \- display/list/store nmh MIME messages
 .SH SYNOPSIS
 .HP 5
 .na
 .SH SYNOPSIS
 .HP 5
 .na
@@ -23,7 +23,6 @@ mhn \- display/list/store/cache nmh MIME messages
 .RB [ \-show " | " \-noshow ]
 .RB [ \-list " | " \-nolist ]
 .RB [ \-store " | " \-nostore ]
 .RB [ \-show " | " \-noshow ]
 .RB [ \-list " | " \-nolist ]
 .RB [ \-store " | " \-nostore ]
-.RB [ \-cache " | " \-nocache ]
 .RB [ \-headers " | " \-noheaders ]
 .RB [ \-realsize " | " \-norealsize ]
 .RB [ \-serialonly " | " \-noserialonly ]
 .RB [ \-headers " | " \-noheaders ]
 .RB [ \-realsize " | " \-norealsize ]
 .RB [ \-serialonly " | " \-noserialonly ]
@@ -31,10 +30,6 @@ mhn \- display/list/store/cache nmh MIME messages
 .IR formfile ]
 .RB [ \-pause " | " \-nopause ]
 .RB [ \-auto " | " \-noauto ]
 .IR formfile ]
 .RB [ \-pause " | " \-nopause ]
 .RB [ \-auto " | " \-noauto ]
-.RB [ \-rcache
-.IR policy ]
-.RB [ \-wcache
-.IR policy ]
 .PP
 .HP 5
 .B mhn
 .PP
 .HP 5
 .B mhn
index c7fc14388482bfd83f7b65cb358f1b2c6d8c46c5..166f26b08be0a52d0b761172e9a6cdc2b3571a85 100644 (file)
@@ -32,10 +32,6 @@ mhshow \- display nmh MIME messages
 .IR formfile ]
 .RB [ \-markform
 .IR formfile ]
 .IR formfile ]
 .RB [ \-markform
 .IR formfile ]
-.RB [ \-rcache
-.IR policy ]
-.RB [ \-wcache
-.IR policy ]
 .ad
 .SH DESCRIPTION
 The
 .ad
 .SH DESCRIPTION
 The
@@ -583,54 +579,6 @@ For the \*(lqurl\*(rq access-type,
 will look for the \*(lqnmh-access-url\*(rq profile entry.  See
 .IR mhstore (1)
 for more details.
 will look for the \*(lqnmh-access-url\*(rq profile entry.  See
 .IR mhstore (1)
 for more details.
-.SS "The Content Cache"
-When
-.B mhshow
-encounters an external content containing a \*(lqContent-ID:\*(rq field,
-and if the content allows caching, then depending on the caching behavior of
-.BR mhshow ,
-the content might be read from or written to a cache.
-.PP
-The caching behavior of
-.B mhshow
-is controlled with the
-.B \-rcache
-and
-.B \-wcache
-switches, which define the policy for reading from, and writing to, the cache,
-respectively.  One of four policies may be specified: \*(lqpublic\*(rq,
-indicating that
-.B mhshow
-should make use of a publicly-accessible content cache; \*(lqprivate\*(rq,
-indicating that
-.B mhshow
-should make use of the user's private content cache;
-\*(lqnever\*(rq, indicating that
-.B mhshow
-should never make use of caching; and, \*(lqask\*(rq, indicating that
-.B mhshow
-should ask the user.
-.PP
-There are two directories where contents may be cached: the profile entry
-\*(lqnmh-cache\*(rq names a directory containing world-readable contents, and,
-the profile entry \*(lqnmh-private-cache\*(rq names a directory containing
-private contents.  The former should be an absolute (rooted) directory name.
-.PP
-For example,
-.PP
-.RS 5
-nmh-cache: /tmp
-.RE
-.PP
-might be used if you didn't care that the cache got wiped after each
-reboot of the system.  The latter is interpreted relative to the user's
-nmh directory, if not rooted, e.g.,
-.PP
-.RS 5
-nmh-private-cache: .cache
-.RE
-.PP
-(which is the default value).
 .SS "User Environment"
 Because the display environment in which
 .B mhshow
 .SS "User Environment"
 Because the display environment in which
 .B mhshow
@@ -736,8 +684,6 @@ is checked.
 ^mhlproc:~^Default program to display message headers
 ^nmh-access-ftp:~^Program to retrieve contents via FTP
 ^nmh-access-url:~^Program to retrieve contents via HTTP
 ^mhlproc:~^Default program to display message headers
 ^nmh-access-ftp:~^Program to retrieve contents via FTP
 ^nmh-access-url:~^Program to retrieve contents via HTTP
-^nmh-cache~^Public directory to store cached external contents
-^nmh-private-cache~^Personal directory to store cached external contents
 ^mhshow-charset-<charset>~^Template for environment to render character sets
 ^mhshow-show-<type>*~^Template for displaying contents
 ^moreproc:~^Default program to display text/plain content
 ^mhshow-charset-<charset>~^Template for environment to render character sets
 ^mhshow-show-<type>*~^Template for displaying contents
 ^moreproc:~^Default program to display text/plain content
@@ -759,8 +705,6 @@ is checked.
 .RB ` \-textonly '
 .RB ` \-inlineonly '
 .RB ` \-form\ mhl.headers '
 .RB ` \-textonly '
 .RB ` \-inlineonly '
 .RB ` \-form\ mhl.headers '
-.RB ` \-rcache\ ask '
-.RB ` \-wcache\ ask '
 .fi
 .SH CONTEXT
 If a folder is given, it will become the current folder.  The last
 .fi
 .SH CONTEXT
 If a folder is given, it will become the current folder.  The last
index 8347a627e02dc5fa81822cc6cf4ac428cbb53b13..6750584b0726bdb771df45bc3c34e681e4d585d5 100644 (file)
@@ -29,10 +29,6 @@ mhstore \- store contents of nmh MIME messages into files
 .RB [ \-auto " | " \-noauto ]
 .RB [ \-clobber
 .IR always " | " auto " | " suffix " | " ask " | " never ]
 .RB [ \-auto " | " \-noauto ]
 .RB [ \-clobber
 .IR always " | " auto " | " suffix " | " ask " | " never ]
-.RB [ \-rcache
-.IR policy ]
-.RB [ \-wcache
-.IR policy ]
 .RB [ \-verbose " | " \-noverbose ]
 .ad
 .SH DESCRIPTION
 .RB [ \-verbose " | " \-noverbose ]
 .ad
 .SH DESCRIPTION
@@ -477,56 +473,6 @@ to determine the program to use to perform the HTTP retrieval.  This program
 is invoked with one argument: the URL of the content to retrieve.  The program
 should write the content to standard out, and should terminate with a status
 of zero if the retrieval is successful and a non-zero exit status otherwise.
 is invoked with one argument: the URL of the content to retrieve.  The program
 should write the content to standard out, and should terminate with a status
 of zero if the retrieval is successful and a non-zero exit status otherwise.
-.SS "The Content Cache"
-When
-.B mhstore
-encounters an external content containing a
-\*(lqContent-ID:\*(rq field, and if the content allows caching, then
-depending on the caching behavior of
-.BR mhstore ,
-the content might be read from or written to a cache.
-.PP
-The caching behavior of
-.B mhstore
-is controlled with the
-.B \-rcache
-and
-.B \-wcache
-switches, which define the policy for reading from, and writing to, the cache,
-respectively.  One of four policies may be
-specified: \*(lqpublic\*(rq, indicating that
-.B mhstore
-should make use
-of a publicly-accessible content cache; \*(lqprivate\*(rq, indicating that
-.B mhstore
-should make use of the user's private content cache;
-\*(lqnever\*(rq, indicating that
-.B mhstore
-should never make use of caching; and, \*(lqask\*(rq, indicating that
-.B mhstore
-should ask the user.
-.PP
-There are two directories where contents may be cached: the profile entry
-\*(lqnmh-cache\*(rq names a directory containing world-readable contents, and,
-the profile entry \*(lqnmh-private-cache\*(rq names a directory containing
-private contents.  The former should be an absolute (rooted) directory
-name.
-.PP
-For example,
-.PP
-.RS 5
-nmh-cache: /tmp
-.RE
-.PP
-might be used if you didn't care that the cache got wiped after each
-reboot of the system.  The latter is interpreted relative to the user's
-nmh directory, if not rooted, e.g.,
-.PP
-.RS 5
-nmh-private-cache: .cache
-.RE
-.PP
-(which is the default value).
 .SS "User Environment"
 Because the environment in which
 .B mhstore
 .SS "User Environment"
 Because the environment in which
 .B mhstore
@@ -594,8 +540,6 @@ is checked.
 ^Current\-Folder:~^To find the default current folder
 ^nmh-access-ftp:~^Program to retrieve contents via FTP
 ^nmh-access-url:~^Program to retrieve contents via HTTP
 ^Current\-Folder:~^To find the default current folder
 ^nmh-access-ftp:~^Program to retrieve contents via FTP
 ^nmh-access-url:~^Program to retrieve contents via HTTP
-^nmh-cache~^Public directory to store cached external contents
-^nmh-private-cache~^Personal directory to store cached external contents
 ^nmh-storage~^Directory to store contents
 ^mhstore-store-<type>*~^Template for storing contents
 .fi
 ^nmh-storage~^Directory to store contents
 ^mhstore-store-<type>*~^Template for storing contents
 .fi
@@ -612,8 +556,6 @@ is checked.
 .RB ` \-noauto '
 .RB ` \-clobber\ always '
 .RB ` \-nocheck '
 .RB ` \-noauto '
 .RB ` \-clobber\ always '
 .RB ` \-nocheck '
-.RB ` \-rcache\ ask '
-.RB ` \-wcache\ ask '
 .RB ` \-verbose '
 .SH CONTEXT
 If a folder is given, it will become the current folder.  The last
 .RB ` \-verbose '
 .SH CONTEXT
 If a folder is given, it will become the current folder.  The last
index 111efeee496cef2e67f8dc9f25e1677d9304f18c..93fcf8d1ba22b2481ed3a76ba76c378d00ee6a20 100644 (file)
@@ -383,7 +383,7 @@ produce formatted listings of nmh messages
 list information about content of MIME messages
 .TP
 .IR mhn (1)
 list information about content of MIME messages
 .TP
 .IR mhn (1)
-display/list/store/cache MIME messages
+display/list/store MIME messages
 .TP
 .IR mhshow (1)
 display MIME messages
 .TP
 .IR mhshow (1)
 display MIME messages
index 59ca2ec50c88bc6b61c26f72934d1878ccdedfca..34a797e478bfdff625b90a3640edbf0ffa248efb 100644 (file)
@@ -21,7 +21,6 @@
 #include "h/tws.h"
 #include "h/mime.h"
 #include "h/mhparse.h"
 #include "h/tws.h"
 #include "h/mime.h"
 #include "h/mhparse.h"
-#include "h/mhcachesbr.h"
 #include "h/done.h"
 #include "h/utils.h"
 #include "sbr/m_maildir.h"
 #include "h/done.h"
 #include "h/utils.h"
 #include "sbr/m_maildir.h"
@@ -48,8 +47,6 @@
     X("noverbose", 0, NVERBSW) \
     X("disposition", 0, DISPOSW) \
     X("nodisposition", 0, NDISPOSW) \
     X("noverbose", 0, NVERBSW) \
     X("disposition", 0, DISPOSW) \
     X("nodisposition", 0, NDISPOSW) \
-    X("rcache policy", 0, RCACHESW) \
-    X("wcache policy", 0, WCACHESW) \
     X("contentid", 0, CONTENTIDSW) \
     X("nocontentid", 0, NCONTENTIDSW) \
     X("headerencoding encoding-algorithm", 0, HEADERENCSW) \
     X("contentid", 0, CONTENTIDSW) \
     X("nocontentid", 0, NCONTENTIDSW) \
     X("headerencoding encoding-algorithm", 0, HEADERENCSW) \
@@ -106,7 +103,6 @@ main (int argc, char **argv)
     bool verbosw = false;
     bool dispo = false;
     size_t maxunencoded = MAXTEXTPERLN;
     bool verbosw = false;
     bool dispo = false;
     size_t maxunencoded = MAXTEXTPERLN;
-    int *icachesw;
     char *cp, buf[BUFSIZ];
     char buffer[BUFSIZ], *compfile = NULL;
     char **argp, **arguments;
     char *cp, buf[BUFSIZ];
     char buffer[BUFSIZ], *compfile = NULL;
     char **argp, **arguments;
@@ -160,25 +156,6 @@ main (int argc, char **argv)
                directives = true;
                continue;
 
                directives = true;
                continue;
 
-           case RCACHESW:
-               icachesw = &rcachesw;
-               goto do_cache;
-           case WCACHESW:
-               icachesw = &wcachesw;
-           do_cache: ;
-               if (!(cp = *argp++) || *cp == '-')
-                   die("missing argument to %s", argp[-2]);
-               switch (*icachesw = smatch (cp, cache_policy)) {
-               case AMBIGSW:
-                   ambigsw (cp, cache_policy);
-                   done (1);
-               case UNKWNSW:
-                   die("%s unknown", cp);
-               default:
-                   break;
-               }
-               continue;
-
            case CHECKSW:
            case NCHECKSW:
                /* Currently a NOP */
            case CHECKSW:
            case NCHECKSW:
                /* Currently a NOP */
@@ -310,15 +287,6 @@ main (int argc, char **argv)
        fclose (fp);
     }
 
        fclose (fp);
     }
 
-    /* Check for public cache location */
-    if ((cache_public = context_find (nmhcache)) && *cache_public != '/')
-       cache_public = NULL;
-
-    /* Check for private cache location */
-    if (!(cache_private = context_find (nmhprivcache)))
-       cache_private = ".cache";
-    cache_private = mh_xstrdup(m_maildir(cache_private));
-
     if (!context_find ("path"))
        free (path ("./", TFOLDER));
 
     if (!context_find ("path"))
        free (path ("./", TFOLDER));
 
index cee0ee568722bf2343394f1071f52670b93ed425..04dc4a7b73735d104f17492da9bb4835d7b477cb 100644 (file)
@@ -42,7 +42,6 @@
 #include "h/mhparse.h"
 #include "h/done.h"
 #include "h/utils.h"
 #include "h/mhparse.h"
 #include "h/done.h"
 #include "h/utils.h"
-#include "h/mhcachesbr.h"
 #include "mhmisc.h"
 #include "sbr/m_mktemp.h"
 #include "sbr/message_id.h"
 #include "mhmisc.h"
 #include "sbr/m_mktemp.h"
 #include "sbr/message_id.h"
diff --git a/uip/mhcachesbr.c b/uip/mhcachesbr.c
deleted file mode 100644 (file)
index 498efe2..0000000
+++ /dev/null
@@ -1,422 +0,0 @@
-/* mhcachesbr.c -- routines to manipulate the MIME content cache
- *
- * 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"
-#include "sbr/m_gmprot.h"
-#include "sbr/m_getfld.h"
-#include "sbr/read_yes_or_no_if_tty.h"
-#include "sbr/trimcpy.h"
-#include "sbr/error.h"
-#include <fcntl.h>
-#include "h/mts.h"
-#include "h/tws.h"
-#include "h/mime.h"
-#include "h/mhparse.h"
-#include "h/mhcachesbr.h"
-#include "h/utils.h"
-#include "mhmisc.h"
-#include "sbr/lock_file.h"
-#include "sbr/m_mktemp.h"
-
-#ifdef HAVE_SYS_TIME_H
-# include <sys/time.h>
-#endif
-#include <time.h>
-
-#define X(sw, minchars, id) { sw, minchars, id },
-DEFINE_SWITCH_ARRAY(CACHE, caches);
-#undef X
-struct swit *cache_policy = caches;
-
-extern int debugsw;
-
-/* cache policies */
-int rcachesw = CACHE_ASK;
-int wcachesw = CACHE_ASK;
-
-/*
- * Location of public and private cache.  These must
- * be set before these routines are called.
- */
-char *cache_public;
-char *cache_private;
-
-/*
- * static prototypes
- */
-static void cache_content (CT);
-static int find_cache_aux (int, char *, char *, char *, int);
-static int find_cache_aux2 (char *, char *, char *, int);
-
-
-/*
- * Top level entry point to cache content
- * from a group of messages
- */
-
-void
-cache_all_messages (CT *cts)
-{
-    CT ct, *ctp;
-
-    for (ctp = cts; *ctp; ctp++) {
-       ct = *ctp;
-       if (type_ok (ct, 1)) {
-           cache_content (ct);
-           if (ct->c_fp) {
-               fclose (ct->c_fp);
-               ct->c_fp = NULL;
-           }
-           if (ct->c_ceclosefnx)
-               (*ct->c_ceclosefnx) (ct);
-       }
-    }
-    flush_errors ();
-}
-
-
-/*
- * Entry point to cache content from external sources.
- */
-
-static void
-cache_content (CT ct)
-{
-    int        cachetype;
-    char *file, cachefile[BUFSIZ];
-    CE ce = &ct->c_cefile;
-
-    if (!ct->c_id) {
-       inform("no %s: field in %s", ID_FIELD, ct->c_file);
-       return;
-    }
-
-    if (!ce) {
-       inform("unable to decode %s", ct->c_file);
-       return;
-    }
-
-    if (find_cache (NULL, wcachesw != CACHE_NEVER ? wcachesw : CACHE_ASK,
-                   &cachetype, ct->c_id, cachefile, sizeof(cachefile))
-           == NOTOK) {
-       inform("unable to cache %s's contents", ct->c_file);
-       return;
-    }
-    if (wcachesw != CACHE_NEVER && wcachesw != CACHE_ASK) {
-       fflush (stdout);
-       fprintf (stderr, "caching message %s as file %s\n", ct->c_file,
-                cachefile);
-    }
-
-    if (ce->ce_file) {
-       int mask = umask (cachetype ? ~m_gmprot () : 0222);
-       FILE *fp;
-
-       if (debugsw)
-           fprintf (stderr, "caching by copying %s...\n", ce->ce_file);
-
-       file = NULL;
-       if ((*ct->c_ceopenfnx) (ct, &file) == NOTOK)
-           goto reset_umask;
-
-       if ((fp = fopen (cachefile, "w"))) {
-           int cc;
-           char buffer[BUFSIZ];
-           FILE *gp = ce->ce_fp;
-
-           fseek (gp, 0L, SEEK_SET);
-
-           while ((cc = fread (buffer, sizeof(*buffer), sizeof(buffer), gp))
-                      > 0)
-               if ((int) fwrite (buffer, sizeof(*buffer), cc, fp) < cc) {
-                   advise ("cache_content", "fwrite");
-               }
-           fflush (fp);
-
-           if (ferror (gp)) {
-               admonish (ce->ce_file, "error reading");
-               (void) m_unlink (cachefile);
-           } else {
-               if (ferror (fp)) {
-                   admonish (cachefile, "error writing");
-                   (void) m_unlink (cachefile);
-               }
-           }
-           fclose (fp);
-       } else
-           content_error (cachefile, ct, "unable to fopen for writing");
-reset_umask:
-       umask (mask);
-    } else {
-       if (debugsw)
-           fprintf (stderr, "in place caching...\n");
-
-       file = cachefile;
-       if ((*ct->c_ceopenfnx) (ct, &file) != NOTOK)
-           chmod (cachefile, cachetype ? m_gmprot () : 0444);
-    }
-}
-
-
-int
-find_cache (CT ct, int policy, int *writing, char *id,
-       char *buffer, int buflen)
-{
-    int        status = NOTOK;
-
-    if (id == NULL)
-       return NOTOK;
-    id = trimcpy (id);
-
-    if (debugsw)
-       fprintf (stderr, "find_cache %s(%d) %s %s\n", caches[policy].sw,
-                policy, writing ? "writing" : "reading", id);
-
-    switch (policy) {
-       case CACHE_NEVER:
-       default:
-           break;
-
-       case CACHE_ASK:
-       case CACHE_PUBLIC:
-           if (cache_private
-                   && !writing
-                   && find_cache_aux (0, cache_private, id,
-                                      buffer, buflen) == OK) {
-               if (access (buffer, R_OK) != NOTOK) {
-got_private:
-                   if (writing)
-                       *writing = 1;
-got_it:
-                   status = OK;
-                   break;
-               }
-           }
-           if (cache_public
-                   && find_cache_aux (writing ? 1 : 0, cache_public, id,
-                                      buffer, buflen) == OK) {
-               if (writing || access (buffer, R_OK) != NOTOK) {
-                   if (writing)
-                       *writing = 0;
-                   goto got_it;
-               }
-           }
-           break;
-
-       case CACHE_PRIVATE:
-           if (cache_private
-                   && find_cache_aux (writing ? 2 : 0, cache_private, id,
-                                      buffer, buflen) == OK) {
-               if (writing || access (buffer, R_OK) != NOTOK)
-                   goto got_private;
-           }
-           break;
-
-    }
-
-    if (status == OK && policy == CACHE_ASK) {
-       int len, buflen;
-       char *bp, query[BUFSIZ];
-
-       /* Get buffer ready to go */
-       bp = query;
-       buflen = sizeof(query);
-
-       /* Now, construct query */
-       if (writing) {
-           snprintf (bp, buflen, "Make cached, publicly-accessible copy");
-       } else {
-           struct stat st;
-
-           snprintf (bp, buflen, "Use cached copy");
-           len = strlen (bp);
-           bp += len;
-           buflen -= len;
-
-           if (ct->c_partno) {
-               snprintf (bp, buflen, " of content %s", ct->c_partno);
-               len = strlen (bp);
-               bp += len;
-               buflen -= len;
-           }
-
-           stat (buffer, &st);
-           snprintf (bp, buflen, " (size %lu octets)",
-                           (unsigned long) st.st_size);
-       }
-       len = strlen (bp);
-       bp += len;
-       buflen -= len;
-
-       snprintf (bp, buflen, "\n    in file %s? ", buffer);
-
-       /* Now, check answer */
-       if (!read_yes_or_no_if_tty (query))
-           status = NOTOK;
-    }
-
-    if (status == OK && writing) {
-       if (*writing && strchr(buffer, '/'))
-           make_intermediates (buffer);
-       (void) m_unlink (buffer);
-    }
-
-    free (id);
-    return status;
-}
-
-
-static int
-find_cache_aux (int writing, char *directory, char *id,
-       char *buffer, int buflen)
-{
-    int        mask;
-    bool usemap;
-    char mapfile[BUFSIZ], mapname[BUFSIZ];
-    FILE *fp;
-    int failed_to_lock = 0;
-    static int partno, pid;
-    static time_t clock = 0;
-
-    usemap = true;
-
-    if (debugsw)
-       fprintf (stderr, "find_cache_aux %s usemap=%d\n", directory, usemap);
-
-    snprintf (mapfile, sizeof(mapfile), "%s/cache.map", directory);
-    if (find_cache_aux2 (mapfile, id, mapname, sizeof(mapname)) == OK)
-       goto done_map;
-
-    if (!writing) {
-       if (usemap)
-           return NOTOK;
-
-use_raw:
-       snprintf (buffer, buflen, "%s/%s", directory, id);
-       return OK;
-    }
-
-    if (!usemap && access (mapfile, W_OK) == NOTOK)
-       goto use_raw;
-
-    if (clock != 0) {
-       time_t now;
-       
-       time (&now);
-       if (now > clock)
-           clock = 0;
-    } else {
-       pid = getpid ();
-    }
-
-    if (clock == 0) {
-       time (&clock);
-       partno = 0;
-    } else {
-       if (partno > 0xff) {
-           clock++;
-           partno = 0;
-       }
-    }
-
-    snprintf (mapname, sizeof(mapname), "%08x%04x%02x",
-               (unsigned int) (clock & 0xffffffff),
-               (unsigned int) (pid & 0xffff),
-               (unsigned int) (partno++ & 0xff));
-
-    if (debugsw)
-       fprintf (stderr, "creating mapping %s->%s\n", mapname, id);
-
-    make_intermediates (mapfile);
-    mask = umask (writing == 2 ? 0077 : 0);
-    if (!(fp = lkfopendata (mapfile, "a", &failed_to_lock)) && errno == ENOENT) {
-       int fd;
-
-       if ((fd = creat (mapfile, 0666)) != NOTOK) {
-           close (fd);
-           fp = lkfopendata (mapfile, "a", &failed_to_lock);
-            if (failed_to_lock) {
-               adios (mapfile, "failed to lock");
-            }
-       }
-    }
-    umask (mask);
-    if (!fp)
-       return NOTOK;
-    fprintf (fp, "%s: %s\n", mapname, id);
-    lkfclosedata (fp, mapfile);
-
-done_map:
-    if (*mapname == '/')
-       strncpy (buffer, mapname, buflen);
-    else
-       snprintf (buffer, buflen, "%s/%s", directory, mapname);
-    if (debugsw)
-       fprintf (stderr, "use %s\n", buffer);
-
-    return OK;
-}
-
-
-static int
-find_cache_aux2 (char *mapfile, char *id, char *mapname, int namelen)
-{
-    int        state;
-    char buf[NMH_BUFSIZ], name[NAMESZ];
-    FILE *fp;
-    m_getfld_state_t gstate;
-    int failed_to_lock = 0;
-
-    if (!(fp = lkfopendata (mapfile, "r", &failed_to_lock)))
-       return NOTOK;
-
-    gstate = m_getfld_state_init(fp);
-    for (;;) {
-       int result;
-       char *cp, *dp;
-       int bufsz = sizeof buf;
-
-       switch (state = m_getfld2(&gstate, name, buf, &bufsz)) {
-           case FLD:
-           case FLDPLUS:
-               strncpy (mapname, name, namelen);
-               if (state != FLDPLUS)
-                   cp = buf;
-               else {
-                   cp = mh_xstrdup(buf);
-                   while (state == FLDPLUS) {
-                       bufsz = sizeof buf;
-                       state = m_getfld2(&gstate, name, buf, &bufsz);
-                       cp = add (buf, cp);
-                   }
-               }
-               dp = trimcpy (cp);
-               if (cp != buf)
-                   free (cp);
-               if (debugsw)
-                   fprintf (stderr, "compare %s to %s <- %s\n", id, dp,
-                            mapname);
-               result = strcmp (id, dp);
-               free (dp);
-               if (result == 0) {
-                   lkfclosedata (fp, mapfile);
-                   return OK;
-               }
-               continue;
-
-           case BODY:
-           case FILEEOF:
-           default:
-               break;
-       }
-       break;
-    }
-    m_getfld_state_destroy (&gstate);
-
-    lkfclosedata (fp, mapfile);
-    return NOTOK;
-}
index c5b2fe8268d90851c9e9c02f1bc2da17ec022f3a..6faef9b696b601416e432d1d1422ca6b74b9506e 100644 (file)
@@ -30,7 +30,6 @@
 #include "h/tws.h"
 #include "h/mime.h"
 #include "h/mhparse.h"
 #include "h/tws.h"
 #include "h/mime.h"
 #include "h/mhparse.h"
-#include "h/mhcachesbr.h"
 #include "h/done.h"
 #include "h/utils.h"
 #include "mhmisc.h"
 #include "h/done.h"
 #include "h/utils.h"
 #include "mhmisc.h"
@@ -53,8 +52,6 @@
     X("type content", 0, TYPESW) \
     X("prefer content", 0, PREFERSW) \
     X("noprefer", 0, NPREFERSW) \
     X("type content", 0, TYPESW) \
     X("prefer content", 0, PREFERSW) \
     X("noprefer", 0, NPREFERSW) \
-    X("rcache policy", 0, RCACHESW) \
-    X("wcache policy", 0, WCACHESW) \
     X("changecur", 0, CHGSW) \
     X("nochangecur", 0, NCHGSW) \
     X("version", 0, VERSIONSW) \
     X("changecur", 0, CHGSW) \
     X("nochangecur", 0, NCHGSW) \
     X("version", 0, VERSIONSW) \
@@ -91,7 +88,7 @@ main (int argc, char **argv)
     bool chgflag = true;
     bool verbosw = false;
     bool dispo = false;
     bool chgflag = true;
     bool verbosw = false;
     bool dispo = false;
-    int msgnum, *icachesw;
+    int msgnum;
     char *cp, *file = NULL, *folder = NULL;
     char *maildir, buf[100], **argp;
     char **arguments;
     char *cp, *file = NULL, *folder = NULL;
     char *maildir, buf[100], **argp;
     char **arguments;
@@ -127,25 +124,6 @@ main (int argc, char **argv)
                print_version(invo_name);
                done (0);
 
                print_version(invo_name);
                done (0);
 
-           case RCACHESW:
-               icachesw = &rcachesw;
-               goto do_cache;
-           case WCACHESW:
-               icachesw = &wcachesw;
-do_cache:
-               if (!(cp = *argp++) || *cp == '-')
-                   die("missing argument to %s", argp[-2]);
-               switch (*icachesw = smatch (cp, cache_policy)) {
-               case AMBIGSW:
-                   ambigsw (cp, cache_policy);
-                   done (1);
-               case UNKWNSW:
-                   die("%s unknown", cp);
-               default:
-                   break;
-               }
-               continue;
-
            case CHECKSW:
            case NCHECKSW:
                /* Currently a NOP */
            case CHECKSW:
            case NCHECKSW:
                /* Currently a NOP */
@@ -241,15 +219,6 @@ do_cache:
     parts[npart] = NULL;
     types[ntype] = NULL;
 
     parts[npart] = NULL;
     types[ntype] = NULL;
 
-    /* Check for public cache location */
-    if ((cache_public = context_find (nmhcache)) && *cache_public != '/')
-       cache_public = NULL;
-
-    /* Check for private cache location */
-    if (!(cache_private = context_find (nmhprivcache)))
-       cache_private = ".cache";
-    cache_private = mh_xstrdup(m_maildir(cache_private));
-
     if (!context_find ("path"))
        free (path ("./", TFOLDER));
 
     if (!context_find ("path"))
        free (path ("./", TFOLDER));
 
index 7d2abb3fbb32bd4c8ae9530a2198e976b9f5b7ea..c5c39eccdf7ec9b48b8fdeac59be2066a9bdfd02 100644 (file)
--- a/uip/mhn.c
+++ b/uip/mhn.c
@@ -1,4 +1,4 @@
-/* mhn.c -- display, list, cache, or store the contents of MIME messages
+/* mhn.c -- display, list, or store the contents of MIME 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
  *
  * This code is Copyright (c) 2002, by the authors of nmh.  See the
  * COPYRIGHT file in the root directory of the nmh distribution for
@@ -32,7 +32,6 @@
 #include "h/fmt_scan.h"
 #include "h/mime.h"
 #include "h/mhparse.h"
 #include "h/fmt_scan.h"
 #include "h/mime.h"
 #include "h/mhparse.h"
-#include "h/mhcachesbr.h"
 #include "h/done.h"
 #include "h/utils.h"
 #include "mhmisc.h"
 #include "h/done.h"
 #include "h/utils.h"
 #include "mhmisc.h"
@@ -43,8 +42,6 @@
 #define MHN_SWITCHES \
     X("auto", 0, AUTOSW) \
     X("noauto", 0, NAUTOSW) \
 #define MHN_SWITCHES \
     X("auto", 0, AUTOSW) \
     X("noauto", 0, NAUTOSW) \
-    X("cache", 0, CACHESW) \
-    X("nocache", 0, NCACHESW) \
     X("check", -5, CHECKSW) \
     X("nocheck", -7, NCHECKSW) \
     X("headers", 0, HEADSW) \
     X("check", -5, CHECKSW) \
     X("nocheck", -7, NCHECKSW) \
     X("headers", 0, HEADSW) \
@@ -63,8 +60,6 @@
     X("form formfile", 0, FORMSW) \
     X("part number", 0, PARTSW) \
     X("type content", 0, TYPESW) \
     X("form formfile", 0, FORMSW) \
     X("part number", 0, PARTSW) \
     X("type content", 0, TYPESW) \
-    X("rcache policy", 0, RCACHESW) \
-    X("wcache policy", 0, WCACHESW) \
     X("version", 0, VERSIONSW) \
     X("help", 0, HELPSW) \
     /*                                 \
     X("version", 0, VERSIONSW) \
     X("help", 0, HELPSW) \
     /*                                 \
@@ -107,7 +102,6 @@ static int rfc934sw = 0;
 /*
  * what action to take?
  */
 /*
  * what action to take?
  */
-static bool cachesw;
 static bool listsw;
 static bool showsw;
 static bool storesw;
 static bool listsw;
 static bool showsw;
 static bool storesw;
@@ -126,7 +120,7 @@ main (int argc, char **argv)
     bool sizesw = true;
     bool headsw = true;
     bool autosw = false;
     bool sizesw = true;
     bool headsw = true;
     bool autosw = false;
-    int msgnum, *icachesw;
+    int msgnum;
     char *cp, *file = NULL, *folder = NULL;
     char *maildir, buf[100], **argp;
     char **arguments;
     char *cp, *file = NULL, *folder = NULL;
     char *maildir, buf[100], **argp;
     char **arguments;
@@ -172,32 +166,6 @@ main (int argc, char **argv)
                autosw = false;
                continue;
 
                autosw = false;
                continue;
 
-           case CACHESW:
-               cachesw = true;
-               continue;
-           case NCACHESW:
-               cachesw = false;
-               continue;
-
-           case RCACHESW:
-               icachesw = &rcachesw;
-               goto do_cache;
-           case WCACHESW:
-               icachesw = &wcachesw;
-do_cache:
-               if (!(cp = *argp++) || *cp == '-')
-                   die("missing argument to %s", argp[-2]);
-               switch (*icachesw = smatch (cp, cache_policy)) {
-               case AMBIGSW:
-                   ambigsw (cp, cache_policy);
-                   done (1);
-               case UNKWNSW:
-                   die("%s unknown", cp);
-               default:
-                   break;
-               }
-               continue;
-
            case CHECKSW:
            case NCHECKSW:
                /* Currently a NOP */
            case CHECKSW:
            case NCHECKSW:
                /* Currently a NOP */
@@ -345,15 +313,6 @@ do_cache:
        fclose (fp);
     }
 
        fclose (fp);
     }
 
-    /* Check for public cache location */
-    if ((cache_public = context_find (nmhcache)) && *cache_public != '/')
-       cache_public = NULL;
-
-    /* Check for private cache location */
-    if (!(cache_private = context_find (nmhprivcache)))
-       cache_private = ".cache";
-    cache_private = mh_xstrdup(m_maildir(cache_private));
-
     /*
      * Cache the current directory before we do any chdirs()'s.
      */
     /*
      * Cache the current directory before we do any chdirs()'s.
      */
@@ -369,8 +328,8 @@ do_cache:
        char *vec[MAXARGS];
        int vecp;
 
        char *vec[MAXARGS];
        int vecp;
 
-       if (showsw || storesw || cachesw)
-           die("cannot use -build with -show, -store, -cache");
+       if (showsw || storesw)
+           die("cannot use -build with -show, -store");
        if (msgs.size < 1)
            die("need to specify a %s composition file", invo_name);
        if (msgs.size > 1)
        if (msgs.size < 1)
            die("need to specify a %s composition file", invo_name);
        if (msgs.size > 1)
@@ -395,7 +354,7 @@ do_cache:
     /*
      * Process a mhn composition file (old MH style)
      */
     /*
      * Process a mhn composition file (old MH style)
      */
-    if (msgs.size == 1 && !folder && !npart && !cachesw
+    if (msgs.size == 1 && !folder && !npart
        && !showsw && !storesw && !ntype && !file
        && (cp = getenv ("mhdraft"))
        && strcmp (cp, msgs.msgs[0]) == 0) {
        && !showsw && !storesw && !ntype && !file
        && (cp = getenv ("mhdraft"))
        && strcmp (cp, msgs.msgs[0]) == 0) {
@@ -479,11 +438,11 @@ do_cache:
      * You can't give more than one of these flags
      * at a time.
      */
      * You can't give more than one of these flags
      * at a time.
      */
-    if (showsw + listsw + storesw + cachesw > 1)
-       die("can only use one of -show, -list, -store, -cache at same time");
+    if (showsw + listsw + storesw > 1)
+       die("can only use one of -show, -list, -store at same time");
 
     /* If no action is specified, assume -show */
 
     /* If no action is specified, assume -show */
-    if (!listsw && !showsw && !storesw && !cachesw)
+    if (!listsw && !showsw && !storesw)
        showsw = true;
 
     userrs = true;
        showsw = true;
 
     userrs = true;
@@ -528,12 +487,6 @@ do_cache:
        context_save ();                  /* save the context file  */
     }
 
        context_save ();                  /* save the context file  */
     }
 
-    /*
-     * Cache the message content
-     */
-    if (cachesw)
-       cache_all_messages (cts);
-
     /*
      * Show the message content
      */
     /*
      * Show the message content
      */
index 74ec577f631796ec2b5a3df98087d0c36ea1f7fd..f0cdc687a12531af88b7bc2131c4dccb784d1c1b 100644 (file)
@@ -27,7 +27,6 @@
 #include "h/mhparse.h"
 #include "h/utils.h"
 #include "mhmisc.h"
 #include "h/mhparse.h"
 #include "h/utils.h"
 #include "mhmisc.h"
-#include "h/mhcachesbr.h"
 #include "sbr/m_mktemp.h"
 #include "mhfree.h"
 #ifdef HAVE_ICONV
 #include "sbr/m_mktemp.h"
 #include "mhfree.h"
 #ifdef HAVE_ICONV
@@ -138,7 +137,7 @@ static int openBase64 (CT, char **);
 static int InitQuoted (CT);
 static int openQuoted (CT, char **);
 static int Init7Bit (CT);
 static int InitQuoted (CT);
 static int openQuoted (CT, char **);
 static int Init7Bit (CT);
-static int openExternal (CT, CT, CE, char **, int *);
+static int openExternal (CT, CE, char **, int *);
 static int InitFile (CT);
 static int openFile (CT, char **);
 static int InitFTP (CT);
 static int InitFile (CT);
 static int openFile (CT, char **);
 static int InitFTP (CT);
@@ -2242,10 +2241,8 @@ clean_up:
  */
 
 static int
  */
 
 static int
-openExternal (CT ct, CT cb, CE ce, char **file, int *fd)
+openExternal (CT ct, CE ce, char **file, int *fd)
 {
 {
-    char cachefile[BUFSIZ];
-
     if (ce->ce_fp) {
        fseek (ce->ce_fp, 0L, SEEK_SET);
        goto ready_already;
     if (ce->ce_fp) {
        fseek (ce->ce_fp, 0L, SEEK_SET);
        goto ready_already;
@@ -2259,16 +2256,6 @@ openExternal (CT ct, CT cb, CE ce, char **file, int *fd)
        goto ready_already;
     }
 
        goto ready_already;
     }
 
-    if (find_cache(ct, rcachesw, NULL, cb->c_id,
-               cachefile, sizeof(cachefile)) != NOTOK) {
-       if ((ce->ce_fp = fopen (cachefile, "r"))) {
-           ce->ce_file = mh_xstrdup(cachefile);
-           ce->ce_unlink = 0;
-           goto ready_already;
-       }
-        admonish (cachefile, "unable to fopen for reading");
-    }
-
     *fd = ce->ce_fp ? fileno (ce->ce_fp) : -1;
     return OK;
 
     *fd = ce->ce_fp ? fileno (ce->ce_fp) : -1;
     return OK;
 
@@ -2292,12 +2279,11 @@ InitFile (CT ct)
 static int
 openFile (CT ct, char **file)
 {
 static int
 openFile (CT ct, char **file)
 {
-    int        fd, cachetype;
-    char cachefile[BUFSIZ];
+    int        fd;
     struct exbody *e = ct->c_ctexbody;
     CE ce = &ct->c_cefile;
 
     struct exbody *e = ct->c_ctexbody;
     CE ce = &ct->c_cefile;
 
-    switch (openExternal (e->eb_parent, e->eb_content, ce, file, &fd)) {
+    switch (openExternal (e->eb_parent, ce, file, &fd)) {
        case NOTOK:
            return NOTOK;
 
        case NOTOK:
            return NOTOK;
 
@@ -2321,39 +2307,6 @@ openFile (CT ct, char **file)
        return NOTOK;
     }
 
        return NOTOK;
     }
 
-    if ((!e->eb_permission || strcasecmp (e->eb_permission, "read-write"))
-           && find_cache (NULL, wcachesw, &cachetype, e->eb_content->c_id,
-               cachefile, sizeof(cachefile)) != NOTOK) {
-       int mask;
-       FILE *fp;
-
-       mask = umask (cachetype ? ~m_gmprot () : 0222);
-       if ((fp = fopen (cachefile, "w"))) {
-           int cc;
-           char buffer[BUFSIZ];
-           FILE *gp = ce->ce_fp;
-
-           fseek (gp, 0L, SEEK_SET);
-
-           while ((cc = fread (buffer, sizeof(*buffer), sizeof(buffer), gp))
-                      > 0)
-               if ((int) fwrite (buffer, sizeof(*buffer), cc, fp) < cc) {
-                   advise ("openFile", "fwrite");
-               }
-           fflush (fp);
-
-           if (ferror (gp)) {
-               admonish (ce->ce_file, "error reading");
-               (void) m_unlink (cachefile);
-           } else if (ferror (fp)) {
-                admonish (cachefile, "error writing");
-                (void) m_unlink (cachefile);
-            }
-           fclose (fp);
-       }
-       umask (mask);
-    }
-
     fseek (ce->ce_fp, 0L, SEEK_SET);
     *file = ce->ce_file;
     return fileno (ce->ce_fp);
     fseek (ce->ce_fp, 0L, SEEK_SET);
     *file = ce->ce_file;
     return fileno (ce->ce_fp);
@@ -2373,12 +2326,10 @@ InitFTP (CT ct)
 static int
 openFTP (CT ct, char **file)
 {
 static int
 openFTP (CT ct, char **file)
 {
-    int        cachetype;
-    bool caching;
     int fd;
     int len, buflen;
     char *bp, *ftp, *user, *pass;
     int fd;
     int len, buflen;
     char *bp, *ftp, *user, *pass;
-    char buffer[BUFSIZ], cachefile[BUFSIZ];
+    char buffer[BUFSIZ];
     struct exbody *e;
     CE ce = &ct->c_cefile;
     static char *username = NULL;
     struct exbody *e;
     CE ce = &ct->c_cefile;
     static char *username = NULL;
@@ -2392,7 +2343,7 @@ openFTP (CT ct, char **file)
     if (!ftp)
        return NOTOK;
 
     if (!ftp)
        return NOTOK;
 
-    switch (openExternal (e->eb_parent, e->eb_content, ce, file, &fd)) {
+    switch (openExternal (e->eb_parent, ce, file, &fd)) {
        case NOTOK:
            return NOTOK;
 
        case NOTOK:
            return NOTOK;
 
@@ -2460,21 +2411,9 @@ openFTP (CT ct, char **file)
     }
 
     ce->ce_unlink = (*file == NULL);
     }
 
     ce->ce_unlink = (*file == NULL);
-    caching = false;
-    cachefile[0] = '\0';
-    if ((!e->eb_permission || strcasecmp (e->eb_permission, "read-write"))
-           && find_cache (NULL, wcachesw, &cachetype, e->eb_content->c_id,
-               cachefile, sizeof(cachefile)) != NOTOK) {
-       if (*file == NULL) {
-           ce->ce_unlink = 0;
-           caching = true;
-       }
-    }
 
     if (*file)
        ce->ce_file = mh_xstrdup(*file);
 
     if (*file)
        ce->ce_file = mh_xstrdup(*file);
-    else if (caching)
-       ce->ce_file = mh_xstrdup(cachefile);
     else {
        char *tempfile;
        if ((tempfile = m_mktemp2(NULL, invo_name, NULL, NULL)) == NULL) {
     else {
        char *tempfile;
        if ((tempfile = m_mktemp2(NULL, invo_name, NULL, NULL)) == NULL) {
@@ -2531,40 +2470,6 @@ openFTP (CT ct, char **file)
        }
     }
 
        }
     }
 
-    if (cachefile[0]) {
-       if (caching)
-           chmod (cachefile, cachetype ? m_gmprot () : 0444);
-       else {
-           int mask;
-           FILE *fp;
-
-           mask = umask (cachetype ? ~m_gmprot () : 0222);
-           if ((fp = fopen (cachefile, "w"))) {
-               int cc;
-               FILE *gp = ce->ce_fp;
-
-               fseek (gp, 0L, SEEK_SET);
-
-               while ((cc= fread (buffer, sizeof(*buffer), sizeof(buffer), gp))
-                          > 0)
-                   if ((int) fwrite (buffer, sizeof(*buffer), cc, fp) < cc) {
-                       advise ("openFTP", "fwrite");
-                   }
-               fflush (fp);
-
-               if (ferror (gp)) {
-                   admonish (ce->ce_file, "error reading");
-                   (void) m_unlink (cachefile);
-               } else if (ferror (fp)) {
-                    admonish (cachefile, "error writing");
-                    (void) m_unlink (cachefile);
-                }
-               fclose (fp);
-           }
-           umask (mask);
-       }
-    }
-
     fseek (ce->ce_fp, 0L, SEEK_SET);
     *file = ce->ce_file;
     return fileno (ce->ce_fp);
     fseek (ce->ce_fp, 0L, SEEK_SET);
     *file = ce->ce_file;
     return fileno (ce->ce_fp);
@@ -2591,7 +2496,7 @@ openMail (CT ct, char **file)
     struct exbody *e = ct->c_ctexbody;
     CE ce = &ct->c_cefile;
 
     struct exbody *e = ct->c_ctexbody;
     CE ce = &ct->c_cefile;
 
-    switch (openExternal (e->eb_parent, e->eb_content, ce, file, &fd)) {
+    switch (openExternal (e->eb_parent, ce, file, &fd)) {
        case NOTOK:
            return NOTOK;
 
        case NOTOK:
            return NOTOK;
 
@@ -2706,10 +2611,7 @@ openURL (CT ct, char **file)
     struct exbody *e = ct->c_ctexbody;
     CE ce = &ct->c_cefile;
     char *urlprog, *program;
     struct exbody *e = ct->c_ctexbody;
     CE ce = &ct->c_cefile;
     char *urlprog, *program;
-    char buffer[BUFSIZ], cachefile[BUFSIZ];
     int fd;
     int fd;
-    bool caching;
-    int cachetype;
     struct msgs_array args = { 0, 0, NULL};
     pid_t child_id;
 
     struct msgs_array args = { 0, 0, NULL};
     pid_t child_id;
 
@@ -2721,7 +2623,7 @@ openURL (CT ct, char **file)
        return NOTOK;
     }
 
        return NOTOK;
     }
 
-    switch (openExternal(e->eb_parent, e->eb_content, ce, file, &fd)) {
+    switch (openExternal(e->eb_parent, ce, file, &fd)) {
        case NOTOK:
            return NOTOK;
 
        case NOTOK:
            return NOTOK;
 
@@ -2738,21 +2640,9 @@ openURL (CT ct, char **file)
     }
 
     ce->ce_unlink = (*file == NULL);
     }
 
     ce->ce_unlink = (*file == NULL);
-    caching = false;
-    cachefile[0] = '\0';
-
-    if (find_cache(NULL, wcachesw, &cachetype, e->eb_content->c_id,
-                  cachefile, sizeof(cachefile)) != NOTOK) {
-       if (*file == NULL) {
-           ce->ce_unlink = 0;
-           caching = true;
-       }
-    }
 
     if (*file)
         ce->ce_file = mh_xstrdup(*file);
 
     if (*file)
         ce->ce_file = mh_xstrdup(*file);
-    else if (caching)
-        ce->ce_file = mh_xstrdup(cachefile);
     else {
        char *tempfile;
        if ((tempfile = m_mktemp2(NULL, invo_name, NULL, NULL)) == NULL) {
     else {
        char *tempfile;
        if ((tempfile = m_mktemp2(NULL, invo_name, NULL, NULL)) == NULL) {
@@ -2791,37 +2681,6 @@ openURL (CT ct, char **file)
        }
     }
 
        }
     }
 
-    if (cachefile[0]) {
-       if (caching)
-           chmod(cachefile, cachetype ? m_gmprot() : 0444);
-       else {
-           int mask;
-           FILE *fp;
-
-           mask = umask (cachetype ? ~m_gmprot() : 0222);
-           if ((fp = fopen(cachefile, "w"))) {
-               int cc;
-               FILE *gp = ce->ce_fp;
-
-               fseeko(gp, 0, SEEK_SET);
-
-               while ((cc = fread(buffer, sizeof(*buffer),
-                                  sizeof(buffer), gp)) > 0)
-                   if ((int) fwrite(buffer, sizeof(*buffer), cc, fp) < cc) {
-                       advise ("openURL", "fwrite");
-                   }
-
-               fflush(fp);
-
-               if (ferror(gp)) {
-                   admonish(ce->ce_file, "error reading");
-                   (void) m_unlink (cachefile);
-               }
-           }
-           umask(mask);
-       }
-    }
-
     fseeko(ce->ce_fp, 0, SEEK_SET);
     *file = ce->ce_file;
     return fileno(ce->ce_fp);
     fseeko(ce->ce_fp, 0, SEEK_SET);
     *file = ce->ce_file;
     return fileno(ce->ce_fp);
index 6009fdc50f9388b445dad7e5546d048c21afbe87..130b646dd2ece90fb4339645007b4f52b2bc1fa4 100644 (file)
@@ -33,7 +33,6 @@
 #include "h/fmt_scan.h"
 #include "h/mime.h"
 #include "h/mhparse.h"
 #include "h/fmt_scan.h"
 #include "h/mime.h"
 #include "h/mhparse.h"
-#include "h/mhcachesbr.h"
 #include "h/done.h"
 #include "h/utils.h"
 #include "mhmisc.h"
 #include "h/done.h"
 #include "h/utils.h"
 #include "mhmisc.h"
@@ -63,8 +62,6 @@
     X("type content", 0, TYPESW) \
     X("prefer content", 0, PREFERSW) \
     X("noprefer", 0, NPREFERSW) \
     X("type content", 0, TYPESW) \
     X("prefer content", 0, PREFERSW) \
     X("noprefer", 0, NPREFERSW) \
-    X("rcache policy", 0, RCACHESW) \
-    X("wcache policy", 0, WCACHESW) \
     X("version", 0, VERSIONSW) \
     X("help", 0, HELPSW) \
     /*                                 \
     X("version", 0, VERSIONSW) \
     X("help", 0, HELPSW) \
     /*                                 \
@@ -102,7 +99,7 @@ static void pipeser (int);
 int
 main (int argc, char **argv)
 {
 int
 main (int argc, char **argv)
 {
-    int msgnum, *icachesw, concatsw = -1, textonly = -1, inlineonly = -1;
+    int msgnum, concatsw = -1, textonly = -1, inlineonly = -1;
     char *cp, *file = NULL;
     char *maildir, buf[100], **argp;
     char **arguments;
     char *cp, *file = NULL;
     char *maildir, buf[100], **argp;
     char **arguments;
@@ -139,25 +136,6 @@ main (int argc, char **argv)
                print_version(invo_name);
                done (0);
 
                print_version(invo_name);
                done (0);
 
-           case RCACHESW:
-               icachesw = &rcachesw;
-               goto do_cache;
-           case WCACHESW:
-               icachesw = &wcachesw;
-do_cache:
-               if (!(cp = *argp++) || *cp == '-')
-                   die("missing argument to %s", argp[-2]);
-               switch (*icachesw = smatch (cp, cache_policy)) {
-               case AMBIGSW:
-                   ambigsw (cp, cache_policy);
-                   done (1);
-               case UNKWNSW:
-                   die("%s unknown", cp);
-               default:
-                   break;
-               }
-               continue;
-
            case CHECKSW:
            case NCHECKSW:
                /* Currently a NOP */
            case CHECKSW:
            case NCHECKSW:
                /* Currently a NOP */
@@ -318,15 +296,6 @@ do_cache:
        fclose (fp);
     }
 
        fclose (fp);
     }
 
-    /* Check for public cache location */
-    if ((cache_public = context_find (nmhcache)) && *cache_public != '/')
-       cache_public = NULL;
-
-    /* Check for private cache location */
-    if (!(cache_private = context_find (nmhprivcache)))
-       cache_private = ".cache";
-    cache_private = mh_xstrdup(m_maildir(cache_private));
-
     if (!context_find ("path"))
        free (path ("./", TFOLDER));
 
     if (!context_find ("path"))
        free (path ("./", TFOLDER));
 
index 6ea99f30ea1d32b1a6030a6ee89bc7cecd9df726..11edb39815e9d95632f33533de18fd211af55260 100644 (file)
@@ -31,7 +31,6 @@
 #include "h/tws.h"
 #include "h/mime.h"
 #include "h/mhparse.h"
 #include "h/tws.h"
 #include "h/mime.h"
 #include "h/mhparse.h"
-#include "h/mhcachesbr.h"
 #include "h/done.h"
 #include "h/utils.h"
 #include "mhmisc.h"
 #include "h/done.h"
 #include "h/utils.h"
 #include "mhmisc.h"
@@ -51,8 +50,6 @@
     X("type content", 0, TYPESW) \
     X("prefer content", 0, PREFERSW) \
     X("noprefer", 0, NPREFERSW) \
     X("type content", 0, TYPESW) \
     X("prefer content", 0, PREFERSW) \
     X("noprefer", 0, NPREFERSW) \
-    X("rcache policy", 0, RCACHESW) \
-    X("wcache policy", 0, WCACHESW) \
     X("version", 0, VERSIONSW) \
     X("help", 0, HELPSW) \
     X("clobber always|auto|suffix|ask|never", 0, CLOBBERSW) \
     X("version", 0, VERSIONSW) \
     X("help", 0, HELPSW) \
     X("clobber always|auto|suffix|ask|never", 0, CLOBBERSW) \
@@ -81,7 +78,7 @@ static void pipeser (int);
 int
 main (int argc, char **argv)
 {
 int
 main (int argc, char **argv)
 {
-    int msgnum, *icachesw;
+    int msgnum;
     bool autosw = false;
     /* verbosw defaults to 1 for backward compatibility. */
     bool verbosw = true;
     bool autosw = false;
     /* verbosw defaults to 1 for backward compatibility. */
     bool verbosw = true;
@@ -132,25 +129,6 @@ main (int argc, char **argv)
                autosw = false;
                continue;
 
                autosw = false;
                continue;
 
-           case RCACHESW:
-               icachesw = &rcachesw;
-               goto do_cache;
-           case WCACHESW:
-               icachesw = &wcachesw;
-do_cache:
-               if (!(cp = *argp++) || *cp == '-')
-                   die("missing argument to %s", argp[-2]);
-               switch (*icachesw = smatch (cp, cache_policy)) {
-               case AMBIGSW:
-                   ambigsw (cp, cache_policy);
-                   done (1);
-               case UNKWNSW:
-                   die("%s unknown", cp);
-               default:
-                   break;
-               }
-               continue;
-
            case CHECKSW:
            case NCHECKSW:
                /* Currently a NOP */
            case CHECKSW:
            case NCHECKSW:
                /* Currently a NOP */
@@ -250,15 +228,6 @@ do_cache:
        fclose (fp);
     }
 
        fclose (fp);
     }
 
-    /* Check for public cache location */
-    if ((cache_public = context_find (nmhcache)) && *cache_public != '/')
-       cache_public = NULL;
-
-    /* Check for private cache location */
-    if (!(cache_private = context_find (nmhprivcache)))
-       cache_private = ".cache";
-    cache_private = mh_xstrdup(m_maildir(cache_private));
-
     /*
      * Cache the current directory before we do any chdirs()'s.
      */
     /*
      * Cache the current directory before we do any chdirs()'s.
      */