X-Git-Url: https://diplodocus.org/git/nmh/blobdiff_plain/38c0aa73edd0e2951218a7f7f64658eb7a0eebaa..9779a9db4316e2348eb120c716acc41e6b12a849:/uip/mhbuild.c diff --git a/uip/mhbuild.c b/uip/mhbuild.c index 2306e378..48f7e4b4 100644 --- a/uip/mhbuild.c +++ b/uip/mhbuild.c @@ -5,16 +5,24 @@ * complete copyright information. */ -#include +#include "h/mh.h" +#include "sbr/getarguments.h" +#include "sbr/smatch.h" +#include "sbr/m_backup.h" +#include "sbr/context_find.h" +#include "sbr/readconfig.h" +#include "sbr/ambigsw.h" +#include "sbr/path.h" +#include "sbr/print_version.h" +#include "sbr/print_help.h" +#include "sbr/error.h" #include -#include -#include -#include -#include -#include -#include +#include "h/mts.h" +#include "h/tws.h" +#include "h/mime.h" +#include "h/mhparse.h" #include "h/done.h" -#include +#include "h/utils.h" #include "sbr/m_maildir.h" #include "sbr/m_mktemp.h" #include "mhfree.h" @@ -23,8 +31,8 @@ #define MHBUILD_SWITCHES \ X("auto", 0, AUTOSW) \ X("noauto", 0, NAUTOSW) \ - X("check", 0, CHECKSW) \ - X("nocheck", 0, NCHECKSW) \ + X("check", -5, CHECKSW) \ + X("nocheck", -7, NCHECKSW) \ X("directives", 0, DIRECTIVES) \ X("nodirectives", 0, NDIRECTIVES) \ X("headers", 0, HEADSW) \ @@ -39,8 +47,6 @@ 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) \ @@ -89,14 +95,14 @@ static char outfile[BUFSIZ]; int main (int argc, char **argv) { - int sizesw = 1, headsw = 1; + bool sizesw = true; + bool headsw = true; bool directives = true; bool autobuild = false; bool dist = false; - int verbosw = 0; + bool verbosw = false; bool dispo = false; size_t maxunencoded = MAXTEXTPERLN; - int *icachesw; char *cp, buf[BUFSIZ]; char buffer[BUFSIZ], *compfile = NULL; char **argp, **arguments; @@ -117,7 +123,7 @@ main (int argc, char **argv) die("cannot specify both standard input and a file"); compfile = cp; listsw = false; /* turn off -list if using standard in/out */ - verbosw = 0; /* turn off -verbose listings */ + verbosw = false; /* turn off -verbose listings */ break; } if (*cp == '-') { @@ -137,12 +143,12 @@ main (int argc, char **argv) done (0); case AUTOSW: - /* -auto implies -nodirectives */ + /* -auto implies -nodirectives */ autobuild = true; directives = false; continue; case NAUTOSW: - /* + /* * We're turning directives back on since this is likely here * to override a profile entry */ @@ -150,37 +156,16 @@ main (int argc, char **argv) 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: - checksw++; - continue; case NCHECKSW: - checksw = 0; + /* Currently a NOP */ continue; case HEADSW: - headsw++; + headsw = true; continue; case NHEADSW: - headsw = 0; + headsw = false; continue; case DIRECTIVES: @@ -205,10 +190,10 @@ main (int argc, char **argv) continue; case SIZESW: - sizesw++; + sizesw = true; continue; case NSIZESW: - sizesw = 0; + sizesw = false; continue; case CONTENTIDSW: @@ -219,7 +204,7 @@ main (int argc, char **argv) continue; case HEADERENCSW: { - int encoding; + int encoding; if (!(cp = *argp++) || *cp == '-') die("missing argument to %s", argp[-2]); @@ -245,7 +230,7 @@ main (int argc, char **argv) } case AUTOHEADERENCSW: - header_encoding = CE_UNKNOWN; + header_encoding = CE_UNKNOWN; continue; case MAXUNENCSW: @@ -258,10 +243,10 @@ main (int argc, char **argv) continue; case VERBSW: - verbosw++; + verbosw = true; continue; case NVERBSW: - verbosw = 0; + verbosw = false; continue; case DISPOSW: dispo = true; @@ -302,15 +287,6 @@ main (int argc, char **argv) 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)); @@ -369,7 +345,7 @@ main (int argc, char **argv) /* build the content structures for MIME message */ ct = build_mime (compfile, autobuild, dist, directives, header_encoding, - maxunencoded, verbosw); + maxunencoded, verbosw); /* * If ct == NULL, that means -auto was set and we found a MIME version