projects
/
mmh
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fixed example to show that mhparam preserves case of component name.
[mmh]
/
uip
/
inc.c
diff --git
a/uip/inc.c
b/uip/inc.c
index
2a866e9
..
ee51219
100644
(file)
--- a/
uip/inc.c
+++ b/
uip/inc.c
@@
-34,7
+34,6
@@
#include <h/scansbr.h>
#include <h/signals.h>
#include <h/tws.h>
#include <h/scansbr.h>
#include <h/signals.h>
#include <h/tws.h>
-#include <h/mts.h>
#include <errno.h>
#include <signal.h>
#include <errno.h>
#include <signal.h>
@@
-51,21
+50,19
@@
static struct swit switches[] = {
{ "file name", 0 },
#define FORMSW 5
{ "form formatfile", 0 },
{ "file name", 0 },
#define FORMSW 5
{ "form formatfile", 0 },
-#define FMTSW 6
- { "format string", 5 },
-#define SILSW 7
+#define SILSW 6
{ "silent", 0 },
{ "silent", 0 },
-#define NSILSW 8
+#define NSILSW 7
{ "nosilent", 0 },
{ "nosilent", 0 },
-#define TRNCSW 9
+#define TRNCSW 8
{ "truncate", 0 },
{ "truncate", 0 },
-#define NTRNCSW 10
+#define NTRNCSW 9
{ "notruncate", 0 },
{ "notruncate", 0 },
-#define WIDTHSW 11
+#define WIDTHSW 10
{ "width columns", 0 },
{ "width columns", 0 },
-#define VERSIONSW 12
+#define VERSIONSW 11
{ "version", 0 },
{ "version", 0 },
-#define HELPSW 13
+#define HELPSW 12
{ "help", 0 },
};
{ "help", 0 },
};
@@
-121,8
+118,6
@@
static FILE *in;
/*
** prototypes
*/
/*
** prototypes
*/
-char *map_name(char *);
-
static void inc_done(int) NORETURN;
static void inc_done(int) NORETURN;
@@
-137,9
+132,9
@@
main(int argc, char **argv)
** not truncate mailspool
*/
char *cp, *maildir = NULL, *folder = NULL;
** not truncate mailspool
*/
char *cp, *maildir = NULL, *folder = NULL;
- char *format = NULL, *form = NULL;
+ char *form = NULL;
char *audfile = NULL, *from = NULL;
char *audfile = NULL, *from = NULL;
- char buf[BUFSIZ], **argp, *nfs, **arguments;
+ char buf[BUFSIZ], **argp, *fmtstr, **arguments;
struct msgs *mp = NULL;
struct stat st, s1;
FILE *aud = NULL;
struct msgs *mp = NULL;
struct stat st, s1;
FILE *aud = NULL;
@@
-168,7
+163,6
@@
main(int argc, char **argv)
/* read user profile/context */
context_read();
/* read user profile/context */
context_read();
- mts_init(invo_name);
arguments = getarguments(invo_name, argc, argv, 1);
argp = arguments;
arguments = getarguments(invo_name, argc, argv, 1);
argp = arguments;
@@
-244,13
+238,6
@@
main(int argc, char **argv)
if (!(form = *argp++) || *form == '-')
adios(NULL, "missing argument to %s",
argp[-2]);
if (!(form = *argp++) || *form == '-')
adios(NULL, "missing argument to %s",
argp[-2]);
- format = NULL;
- continue;
- case FMTSW:
- if (!(format = *argp++) || *format == '-')
- adios(NULL, "missing argument to %s",
- argp[-2]);
- form = NULL;
continue;
case WIDTHSW:
continue;
case WIDTHSW:
@@
-290,12
+277,12
@@
main(int argc, char **argv)
else if ((newmail = context_find("maildrop")) && *newmail)
newmail = toabsdir(newmail);
else {
else if ((newmail = context_find("maildrop")) && *newmail)
newmail = toabsdir(newmail);
else {
- newmail = concat(MAILDIR, "/", MAILFIL, NULL);
+ newmail = concat(mailspool, "/", getusername(), NULL);
}
if (stat(newmail, &s1) == NOTOK || s1.st_size == 0)
adios(NULL, "no mail to incorporate");
}
if (stat(newmail, &s1) == NOTOK || s1.st_size == 0)
adios(NULL, "no mail to incorporate");
- if ((cp = strdup(newmail)) == (char *)0)
+ if ((cp = strdup(newmail)) == NULL)
adios(NULL, "error allocating memory to copy newmail");
newmail = cp;
adios(NULL, "error allocating memory to copy newmail");
newmail = cp;
@@
-304,19
+291,10
@@
main(int argc, char **argv)
folder = getdeffol();
maildir = toabsdir(folder);
folder = getdeffol();
maildir = toabsdir(folder);
- if ((maildir_copy = strdup(maildir)) == (char *)0)
+ if ((maildir_copy = strdup(maildir)) == NULL)
adios(maildir, "error allocating memory to copy maildir");
adios(maildir, "error allocating memory to copy maildir");
- if (!folder_exists(maildir)) {
- /*
- ** If the folder doesn't exist, and we're given the -silent
- ** flag, just fail.
- */
- if (noisy)
- create_folder(maildir, 0, done);
- else
- done(1);
- }
+ create_folder(maildir, noisy ? 0 : 1, done);
if (chdir(maildir) == NOTOK)
adios(maildir, "unable to change directory to");
if (chdir(maildir) == NOTOK)
adios(maildir, "unable to change directory to");
@@
-359,7
+337,7
@@
main(int argc, char **argv)
chmod(audfile, m_gmprot());
fprintf(aud, from ? "<<inc>> %s -ms %s\n" : "<<inc>> %s\n",
chmod(audfile, m_gmprot());
fprintf(aud, from ? "<<inc>> %s -ms %s\n" : "<<inc>> %s\n",
- dtimenow(0), from);
+ dtimenow(), from);
}
#ifdef MHE
}
#ifdef MHE
@@
-377,7
+355,7
@@
main(int argc, char **argv)
#endif /* MHE */
/* Get new format string */
#endif /* MHE */
/* Get new format string */
- nfs = new_fs(form, format, FORMAT);
+ fmtstr = new_fs(form, FORMAT);
if (noisy) {
printf("Incorporating new mail into %s...\n\n", folder);
if (noisy) {
printf("Incorporating new mail into %s...\n\n", folder);
@@
-387,7
+365,7
@@
main(int argc, char **argv)
/*
** Get the mail from file (usually mail spool)
*/
/*
** Get the mail from file (usually mail spool)
*/
- m_unknown(in); /* the MAGIC invocation... */
+ thisisanmbox(in);
hghnum = msgnum = mp->hghmsg;
for (;;) {
/*
hghnum = msgnum = mp->hghmsg;
for (;;) {
/*
@@
-401,8
+379,9
@@
main(int argc, char **argv)
}
/* create scanline for new message */
}
/* create scanline for new message */
- switch (incerr = scan(in, msgnum + 1, msgnum + 1, nfs, width,
- msgnum == hghnum && chgflag, 1, NULL, 0L, noisy)) {
+ switch (incerr = scan(in, msgnum + 1, msgnum + 1,
+ noisy ? fmtstr : NULL, width,
+ msgnum == hghnum && chgflag, 1)) {
case SCNFAT:
case SCNEOF:
break;
case SCNFAT:
case SCNEOF:
break;
@@
-425,14
+404,13
@@
main(int argc, char **argv)
break;
case SCNMSG:
break;
case SCNMSG:
- case SCNENC:
/*
** Run the external program hook on the message.
*/
snprintf(b, sizeof (b), "%s/%d", maildir_copy,
msgnum + 1);
/*
** Run the external program hook on the message.
*/
snprintf(b, sizeof (b), "%s/%d", maildir_copy,
msgnum + 1);
- ext_hook("add-hook", b, (char *)0);
+ ext_hook("add-hook", b, NULL);
if (aud)
fputs(scanl, aud);
if (aud)
fputs(scanl, aud);
@@
-463,7
+441,7
@@
main(int argc, char **argv)
if (incerr < 0) { /* error */
if (locked) {
GETGROUPPRIVS(); /* Be sure we can unlock mail file */
if (incerr < 0) { /* error */
if (locked) {
GETGROUPPRIVS(); /* Be sure we can unlock mail file */
- (void) lkfclose(in, newmail); in = NULL;
+ lkfclose(in, newmail); in = NULL;
DROPGROUPPRIVS(); /*
** And then return us to normal
** privileges
DROPGROUPPRIVS(); /*
** And then return us to normal
** privileges
@@
-497,7
+475,6
@@
main(int argc, char **argv)
close(newfd);
else
admonish(newmail, "error zero'ing");
close(newfd);
else
admonish(newmail, "error zero'ing");
- unlink(map_name(newmail));
}
} else if (noisy) {
printf("%s not zero'd\n", newmail);
}
} else if (noisy) {
printf("%s not zero'd\n", newmail);
@@
-506,7
+483,7
@@
main(int argc, char **argv)
if (msgnum == hghnum) {
admonish(NULL, "no messages incorporated");
} else {
if (msgnum == hghnum) {
admonish(NULL, "no messages incorporated");
} else {
- context_replace(pfolder, folder); /* update current folder */
+ context_replace(curfolder, folder); /* update current folder */
if (chgflag)
mp->curmsg = hghnum + 1;
mp->hghmsg = msgnum;
if (chgflag)
mp->curmsg = hghnum + 1;
mp->hghmsg = msgnum;
@@
-521,13
+498,13
@@
main(int argc, char **argv)
*/
if (locked) {
GETGROUPPRIVS(); /* Be sure we can unlock mail file */
*/
if (locked) {
GETGROUPPRIVS(); /* Be sure we can unlock mail file */
- (void) lkfclose(in, newmail); in = NULL;
+ lkfclose(in, newmail); in = NULL;
DROPGROUPPRIVS(); /* And then return us to normal privileges */
} else {
fclose(in); in = NULL;
}
DROPGROUPPRIVS(); /* And then return us to normal privileges */
} else {
fclose(in); in = NULL;
}
- seq_setunseen(mp, 0); /* set the Unseen-Sequence */
+ seq_setunseen(mp, 1); /* add new msgs to unseen sequences */
seq_save(mp); /* synchronize sequences */
context_save(); /* save the context file */
done(0);
seq_save(mp); /* synchronize sequences */
context_save(); /* save the context file */
done(0);