]>
diplodocus.org Git - nmh/blob - uip/inc.c
3 * inc.c -- incorporate messages from a maildrop into a folder
5 * This code is Copyright (c) 2002, by the authors of nmh. See the
6 * COPYRIGHT file in the root directory of the nmh distribution for
7 * complete copyright information.
11 /* Revised: Sat Apr 14 17:08:17 PDT 1990 (marvit@hplabs)
12 * Added hpux hacks to set and reset gid to be "mail" as needed. The reset
13 * is necessary so inc'ed mail is the group of the inc'er, rather than
14 * "mail". We setgid to egid only when [un]locking the mail file. This
15 * is also a major security precaution which will not be explained here.
17 * Fri Feb 7 16:04:57 PST 1992 John Romine <bug-mh@ics.uci.edu>
18 * NB: I'm not 100% sure that this setgid stuff is secure even now.
20 * See the *GROUPPRIVS() macros later. I'm reasonably happy with the setgid
21 * attribute. Running setuid root is probably not a terribly good idea, though.
22 * -- Peter Maydell <pmaydell@chiark.greenend.org.uk>, 04/1998
24 * Peter Maydell's patch slightly modified for nmh 0.28-pre2.
25 * Ruud de Rooij <ruud@debian.org> Wed, 22 Jul 1998 13:24:22 +0200
33 #include <h/dropsbr.h>
35 #include <h/fmt_scan.h>
36 #include <h/scansbr.h>
37 #include <h/signals.h>
44 # define SASLminc(a) (a)
46 # define SASLminc(a) 0
49 #define INC_SWITCHES \
50 X("audit audit-file", 0, AUDSW) \
51 X("noaudit", 0, NAUDSW) \
52 X("changecur", 0, CHGSW) \
53 X("nochangecur", 0, NCHGSW) \
54 X("file name", 0, FILESW) \
55 X("form formatfile", 0, FORMSW) \
56 X("format string", 5, FMTSW) \
57 X("host hostname", 0, HOSTSW) \
58 X("user username", 0, USERSW) \
59 X("pack file", 0, PACKSW) \
60 X("nopack", 0, NPACKSW) \
61 X("port name/number", 0, PORTSW) \
62 X("silent", 0, SILSW) \
63 X("nosilent", 0, NSILSW) \
64 X("truncate", 0, TRNCSW) \
65 X("notruncate", 0, NTRNCSW) \
66 X("width columns", 0, WIDTHSW) \
67 X("version", 0, VERSIONSW) \
68 X("help", 0, HELPSW) \
69 X("snoop", -5, SNOOPSW) \
70 X("sasl", SASLminc(-4), SASLSW) \
71 X("nosasl", SASLminc(-6), NOSASLSW) \
72 X("saslmech", SASLminc(-8), SASLMECHSW) \
73 X("proxy command", 0, PROXYSW) \
75 #define X(sw, minchars, id) id,
76 DEFINE_SWITCH_ENUM(INC
);
79 #define X(sw, minchars, id) { sw, minchars, id },
80 DEFINE_SWITCH_ARRAY(INC
, switches
);
84 * flags for the mail source
90 static struct Maildir_entry
{
94 static int num_maildir_entries
= 0;
97 extern char response
[];
102 static int mbx_style
= MMDF_FORMAT
;
103 static int pd
= NOTOK
;
108 static char *packfile
= NULL
;
109 static FILE *pf
= NULL
;
111 /* This is an attempt to simplify things by putting all the
112 * privilege ops into macros.
113 * *GROUPPRIVS() is related to handling the setgid MAIL property,
114 * and only applies if MAILGROUP is defined.
115 * Basically, SAVEGROUPPRIVS() is called right at the top of main()
116 * to initialise things, and then DROPGROUPPRIVS() and GETGROUPPRIVS()
117 * do the obvious thing.
119 * There's probably a better implementation if we're allowed to use
120 * BSD-style setreuid() rather than using POSIX saved-ids.
121 * Anyway, if you're euid root it's a bit pointless to drop the group
124 * I'm pretty happy that the security is good provided we aren't setuid root.
125 * The only things we trust with group=mail privilege are lkfopen()
130 * For setting and returning to "mail" gid
133 static int return_gid
;
134 #define TRYDROPGROUPPRIVS() DROPGROUPPRIVS()
135 #define DROPGROUPPRIVS() setgid(getgid())
136 #define GETGROUPPRIVS() setgid(return_gid)
137 #define SAVEGROUPPRIVS() return_gid = getegid()
139 /* define *GROUPPRIVS() as null; this avoids having lots of "#ifdef MAILGROUP"s */
140 #define TRYDROPGROUPPRIVS()
141 #define DROPGROUPPRIVS()
142 #define GETGROUPPRIVS()
143 #define SAVEGROUPPRIVS()
144 #endif /* not MAILGROUP */
146 /* these variables have to be globals so that done() can correctly clean up the lockfile */
147 static int locked
= 0;
148 static char *newmail
;
154 char *map_name(char *);
156 static void inc_done(int) NORETURN
;
157 static int pop_action(char *);
158 static int pop_pack(char *);
159 static int map_count(void);
162 maildir_srt(const void *va
, const void *vb
)
164 const struct Maildir_entry
*a
= va
, *b
= vb
;
165 if (a
->mtime
> b
->mtime
)
167 else if (a
->mtime
< b
->mtime
)
174 main (int argc
, char **argv
)
176 int chgflag
= 1, trnflag
= 1;
177 int noisy
= 1, width
= 0;
178 int hghnum
= 0, msgnum
= 0;
180 int incerr
= 0; /* <0 if inc hits an error which means it should not truncate mailspool */
181 char *cp
, *maildir
= NULL
, *folder
= NULL
;
182 char *format
= NULL
, *form
= NULL
;
183 char *host
= NULL
, *port
= NULL
, *user
= NULL
, *proxy
= NULL
;
184 char *audfile
= NULL
, *from
= NULL
, *saslmech
= NULL
;
185 char buf
[BUFSIZ
], **argp
, *nfs
, **arguments
;
186 struct msgs
*mp
= NULL
;
189 char b
[PATH_MAX
+ 1];
190 char *maildir_copy
= NULL
; /* copy of mail directory because the static gets overwritten */
194 char *MAILHOST_env_variable
;
198 /* absolutely the first thing we do is save our privileges,
199 * and drop them if we can.
205 setlocale(LC_ALL
, "");
207 invo_name
= r1bindex (argv
[0], '/');
209 /* read user profile/context */
212 mts_init (invo_name
);
213 arguments
= getarguments (invo_name
, argc
, argv
, 1);
218 * use MAILHOST environment variable if present,
220 * If that fails, use the default (if any)
221 * provided by mts.conf in mts_init()
223 if ((MAILHOST_env_variable
= getenv("MAILHOST")) != NULL
)
224 pophost
= MAILHOST_env_variable
;
226 * If there is a valid "pophost" entry in mts.conf,
227 * then use it as the default host.
229 if (pophost
&& *pophost
)
232 while ((cp
= *argp
++)) {
234 switch (smatch (++cp
, switches
)) {
236 ambigsw (cp
, switches
);
239 adios (NULL
, "-%s unknown", cp
);
242 snprintf (buf
, sizeof(buf
), "%s [+folder] [switches]", invo_name
);
243 print_help (buf
, switches
, 1);
246 print_version(invo_name
);
250 if (!(cp
= *argp
++) || *cp
== '-')
251 adios (NULL
, "missing argument to %s", argp
[-2]);
252 audfile
= getcpy (m_maildir (cp
));
266 * The flag `trnflag' has the value:
268 * 2 if -truncate is given
269 * 1 by default (truncating is default)
270 * 0 if -notruncate is given
280 if (!(cp
= *argp
++) || *cp
== '-')
281 adios (NULL
, "missing argument to %s", argp
[-2]);
282 from
= path (cp
, TFILE
);
285 * If the truncate file is in default state,
286 * change to not truncate.
300 if (!(form
= *argp
++) || *form
== '-')
301 adios (NULL
, "missing argument to %s", argp
[-2]);
305 if (!(format
= *argp
++) || *format
== '-')
306 adios (NULL
, "missing argument to %s", argp
[-2]);
311 if (!(cp
= *argp
++) || *cp
== '-')
312 adios (NULL
, "missing argument to %s", argp
[-2]);
317 if (!(host
= *argp
++) || *host
== '-')
318 adios (NULL
, "missing argument to %s", argp
[-2]);
322 if (!(port
= *argp
++) || *port
== '-')
323 adios (NULL
, "missing argument to %s", argp
[-2]);
327 if (!(user
= *argp
++) || *user
== '-')
328 adios (NULL
, "missing argument to %s", argp
[-2]);
332 if (!(packfile
= *argp
++) || *packfile
== '-')
333 adios (NULL
, "missing argument to %s", argp
[-2]);
351 if (!(saslmech
= *argp
++) || *saslmech
== '-')
352 adios (NULL
, "missing argument to %s", argp
[-2]);
355 if (!(proxy
= *argp
++) || *proxy
== '-')
356 adios (NULL
, "missing argument to %s", argp
[-2]);
360 if (*cp
== '+' || *cp
== '@') {
362 adios (NULL
, "only one folder at a time!");
364 folder
= pluspath (cp
);
366 adios (NULL
, "usage: %s [+folder] [switches]", invo_name
);
370 /* NOTE: above this point you should use TRYDROPGROUPPRIVS(),
371 * not DROPGROUPPRIVS().
376 /* guarantee dropping group priveleges; we might not have done so earlier */
380 * Where are we getting the new mail?
390 * Are we getting the mail from
393 if (inc_type
== INC_POP
) {
395 user
= getusername ();
397 pass
= getusername ();
399 ruserpass (host
, &user
, &pass
);
402 * initialize POP connection
404 if (pop_init (host
, port
, user
, pass
, proxy
, snoop
, sasl
,
406 adios (NULL
, "%s", response
);
408 /* Check if there are any messages */
409 if (pop_stat (&nmsgs
, &nbytes
) == NOTOK
)
410 adios (NULL
, "%s", response
);
414 adios (NULL
, "no mail to incorporate");
419 * We will get the mail from a file
420 * (typically the standard maildrop)
423 if (inc_type
== INC_FILE
) {
426 else if ((newmail
= getenv ("MAILDROP")) && *newmail
)
427 newmail
= m_mailpath (newmail
);
428 else if ((newmail
= context_find ("maildrop")) && *newmail
)
429 newmail
= m_mailpath (newmail
);
431 newmail
= concat (MAILDIR
, "/", MAILFIL
, NULL
);
433 if (stat (newmail
, &s1
) == NOTOK
|| s1
.st_size
== 0)
434 adios (NULL
, "no mail to incorporate");
435 if (s1
.st_mode
& S_IFDIR
) {
441 cp
= concat (newmail
, "/new", NULL
);
442 if ((md
= opendir(cp
)) == NULL
)
443 adios (NULL
, "unable to open %s", cp
);
444 while ((de
= readdir (md
)) != NULL
) {
445 if (de
->d_name
[0] == '.')
447 if (i
>= num_maildir_entries
) {
448 if ((Maildir
= realloc(Maildir
, sizeof(*Maildir
) * (2*i
+16))) == NULL
)
449 adios(NULL
, "not enough memory for %d messages", 2*i
+16);
450 num_maildir_entries
= 2*i
+16;
452 Maildir
[i
].filename
= concat (cp
, "/", de
->d_name
, NULL
);
453 if (stat(Maildir
[i
].filename
, &ms
) != 0)
454 adios (Maildir
[i
].filename
, "couldn't get delivery time");
455 Maildir
[i
].mtime
= ms
.st_mtime
;
460 cp
= concat (newmail
, "/cur", NULL
);
461 if ((md
= opendir(cp
)) == NULL
)
462 adios (NULL
, "unable to open %s", cp
);
463 while ((de
= readdir (md
)) != NULL
) {
464 if (de
->d_name
[0] == '.')
466 if (i
>= num_maildir_entries
) {
467 if ((Maildir
= realloc(Maildir
, sizeof(*Maildir
) * (2*i
+16))) == NULL
)
468 adios(NULL
, "not enough memory for %d messages", 2*i
+16);
469 num_maildir_entries
= 2*i
+16;
471 Maildir
[i
].filename
= concat (cp
, "/", de
->d_name
, NULL
);
472 if (stat(Maildir
[i
].filename
, &ms
) != 0)
473 adios (Maildir
[i
].filename
, "couldn't get delivery time");
474 Maildir
[i
].mtime
= ms
.st_mtime
;
480 adios (NULL
, "no mail to incorporate");
481 num_maildir_entries
= i
;
482 qsort (Maildir
, num_maildir_entries
, sizeof(*Maildir
), maildir_srt
);
485 if ((cp
= strdup(newmail
)) == (char *)0)
486 adios (NULL
, "error allocating memory to copy newmail");
491 /* skip the folder setup */
492 if ((inc_type
== INC_POP
) && packfile
)
495 if (!context_find ("path"))
496 free (path ("./", TFOLDER
));
498 folder
= getfolder (0);
499 maildir
= m_maildir (folder
);
501 if ((maildir_copy
= strdup(maildir
)) == (char *)0)
502 adios (maildir
, "error allocating memory to copy maildir");
504 if (!folder_exists(maildir
)) {
505 /* If the folder doesn't exist, and we're given the -silent flag,
509 create_folder(maildir
, 0, done
);
514 if (chdir (maildir
) == NOTOK
)
515 adios (maildir
, "unable to change directory to");
517 /* read folder and create message structure */
518 if (!(mp
= folder_read (folder
)))
519 adios (NULL
, "unable to read folder %s", folder
);
523 if (inc_type
== INC_FILE
&& Maildir
== NULL
) {
524 if (access (newmail
, W_OK
) != NOTOK
) {
527 SIGNAL (SIGHUP
, SIG_IGN
);
528 SIGNAL (SIGINT
, SIG_IGN
);
529 SIGNAL (SIGQUIT
, SIG_IGN
);
530 SIGNAL (SIGTERM
, SIG_IGN
);
533 GETGROUPPRIVS(); /* Reset gid to lock mail file */
534 in
= lkfopen (newmail
, "r");
537 adios (NULL
, "unable to lock and fopen %s", newmail
);
538 fstat (fileno(in
), &s1
);
541 if ((in
= fopen (newmail
, "r")) == NULL
)
542 adios (newmail
, "unable to read");
546 /* This shouldn't be necessary but it can't hurt. */
551 if ((i
= stat (audfile
, &st
)) == NOTOK
)
552 advise (NULL
, "Creating Receive-Audit: %s", audfile
);
553 if ((aud
= fopen (audfile
, "a")) == NULL
)
554 adios (audfile
, "unable to append to");
556 chmod (audfile
, m_gmprot ());
558 fprintf (aud
, from
? "<<inc>> %s -ms %s\n"
559 : host
? "<<inc>> %s -host %s -user %s\n"
561 dtimenow (0), from
? from
: host
, user
);
564 /* Get new format string */
565 nfs
= new_fs (form
, format
, FORMAT
);
568 printf ("Incorporating new mail into %s...\n\n", folder
);
574 * Get the mail from a POP server
576 if (inc_type
== INC_POP
) {
579 packfile
= path (packfile
, TFILE
);
580 if (stat (packfile
, &st
) == NOTOK
) {
582 adios (packfile
, "error on file");
583 cp
= concat ("Create file \"", packfile
, "\"? ", NULL
);
584 if (noisy
&& !getanswer (cp
))
588 msgnum
= map_count ();
589 if ((pd
= mbx_open (packfile
, mbx_style
, getuid(), getgid(), m_gmprot()))
591 adios (packfile
, "unable to open");
592 if ((pf
= fdopen (pd
, "w+")) == NULL
)
593 adios (NULL
, "unable to fdopen %s", packfile
);
595 hghnum
= msgnum
= mp
->hghmsg
;
597 * Check if we have enough message space for all the new
598 * messages. If not, then realloc the folder and add enough
599 * space for all new messages plus 10 additional slots.
601 if (mp
->hghmsg
+ nmsgs
>= mp
->hghoff
602 && !(mp
= folder_realloc (mp
, mp
->lowoff
, mp
->hghmsg
+ nmsgs
+ 10)))
603 adios (NULL
, "unable to allocate folder storage");
606 for (i
= 1; i
<= nmsgs
; i
++) {
609 fseek (pf
, 0L, SEEK_CUR
);
612 fwrite (mmdlm1
, 1, strlen (mmdlm1
), pf
);
615 if (pop_retr (i
, pop_pack
) == NOTOK
)
616 adios (NULL
, "%s", response
);
618 fseek (pf
, 0L, SEEK_CUR
);
621 adios (packfile
, "write error on");
622 fseek (pf
, start
, SEEK_SET
);
624 cp
= getcpy (m_name (msgnum
));
625 if ((pf
= fopen (cp
, "w+")) == NULL
)
626 adios (cp
, "unable to write");
627 chmod (cp
, m_gmprot ());
630 if (pop_retr (i
, pop_action
) == NOTOK
)
631 adios (NULL
, "%s", response
);
634 adios (cp
, "write error on");
635 fseek (pf
, 0L, SEEK_SET
);
637 switch (incerr
= scan (pf
, msgnum
, 0, nfs
, width
,
638 packfile
? 0 : msgnum
== mp
->hghmsg
+ 1 && chgflag
,
639 1, NULL
, stop
- start
, noisy
)) {
641 printf ("%*d empty\n", DMAXFOLDER
, msgnum
);
647 /* advise (cp, "unable to read"); already advised */
662 clear_msg_flags (mp
, msgnum
);
663 set_exists (mp
, msgnum
);
664 set_unseen (mp
, msgnum
);
665 mp
->msgflags
|= SEQMOD
;
670 fseek (pf
, stop
, SEEK_SET
);
671 fwrite (mmdlm2
, 1, strlen (mmdlm2
), pf
);
672 if (fflush (pf
) || ferror (pf
)) {
676 adios (packfile
, "write error on");
678 map_write (packfile
, pd
, 0, 0L, start
, stop
, pos
, size
, noisy
);
680 if (ferror(pf
) || fclose (pf
)) {
685 adios (cp
, "write error on");
690 if (trnflag
&& pop_dele (i
) == NOTOK
)
691 adios (NULL
, "%s", response
);
694 if (pop_quit () == NOTOK
)
695 adios (NULL
, "%s", response
);
697 mbx_close (packfile
, pd
);
703 * Get the mail from file (usually mail spool)
705 if (inc_type
== INC_FILE
&& Maildir
== NULL
) {
706 scan_detect_mbox_style (in
); /* the MAGIC invocation... */
707 hghnum
= msgnum
= mp
->hghmsg
;
710 * Check if we need to allocate more space for message status.
711 * If so, then add space for an additional 100 messages.
713 if (msgnum
>= mp
->hghoff
714 && !(mp
= folder_realloc (mp
, mp
->lowoff
, mp
->hghoff
+ 100))) {
715 advise (NULL
, "unable to allocate folder storage");
720 /* create scanline for new message */
721 switch (incerr
= scan (in
, msgnum
+ 1, msgnum
+ 1, nfs
, width
,
722 msgnum
== hghnum
&& chgflag
, 1, NULL
, 0L, noisy
)) {
729 fputs ("inc aborted!\n", aud
);
730 advise (NULL
, "aborted!"); /* doesn't clean up locks! */
734 advise (NULL
, "BUG in %s, number out of range", invo_name
);
738 advise (NULL
, "BUG in %s, scan() botch (%d)", invo_name
, incerr
);
744 * Run the external program hook on the message.
747 (void)snprintf(b
, sizeof (b
), "%s/%d", maildir_copy
, msgnum
+ 1);
748 (void)ext_hook("add-hook", b
, (char *)0);
758 if (mp
->lowmsg
== 0) mp
->lowmsg
= 1;
760 clear_msg_flags (mp
, msgnum
);
761 set_exists (mp
, msgnum
);
762 set_unseen (mp
, msgnum
);
763 mp
->msgflags
|= SEQMOD
;
766 /* If we get here there was some sort of error from scan(),
767 * so stop processing anything more from the spool.
771 } else if (inc_type
== INC_FILE
) { /* Maildir inbox to process */
776 hghnum
= msgnum
= mp
->hghmsg
;
777 for (i
= 0; i
< num_maildir_entries
; i
++) {
780 * Check if we need to allocate more space for message status.
781 * If so, then add space for an additional 100 messages.
783 if (msgnum
>= mp
->hghoff
784 && !(mp
= folder_realloc (mp
, mp
->lowoff
, mp
->hghoff
+ 100))) {
785 advise (NULL
, "unable to allocate folder storage");
790 sp
= Maildir
[i
].filename
;
791 cp
= getcpy (m_name (msgnum
));
793 if (!trnflag
|| link(sp
, cp
) == -1) {
794 static char buf
[65536];
797 if ((sf
= fopen (sp
, "r")) == NULL
)
798 adios (sp
, "unable to read for copy");
799 if ((pf
= fopen (cp
, "w+")) == NULL
)
800 adios (cp
, "unable to write for copy");
801 while ((nrd
= fread(buf
, 1, sizeof(buf
), sf
)) > 0)
802 if (fwrite(buf
, 1, nrd
, pf
) != nrd
)
804 if (ferror(sf
) || fflush(pf
) || ferror(pf
)) {
806 fclose(pf
); fclose(sf
); unlink(cp
);
808 adios(cp
, "copy error %s -> %s", sp
, cp
);
813 if (pf
== NULL
&& (pf
= fopen (cp
, "r")) == NULL
)
814 adios (cp
, "not available");
815 chmod (cp
, m_gmprot ());
817 fseek (pf
, 0L, SEEK_SET
);
818 switch (incerr
= scan (pf
, msgnum
, 0, nfs
, width
,
819 msgnum
== mp
->hghmsg
+ 1 && chgflag
,
820 1, NULL
, stop
- start
, noisy
)) {
822 printf ("%*d empty\n", DMAXFOLDER
, msgnum
);
828 /* advise (cp, "unable to read"); already advised */
839 * Run the external program hook on the message.
842 (void)snprintf(b
, sizeof (b
), "%s/%d", maildir_copy
, msgnum
+ 1);
843 (void)ext_hook("add-hook", b
, (char *)0);
850 clear_msg_flags (mp
, msgnum
);
851 set_exists (mp
, msgnum
);
852 set_unseen (mp
, msgnum
);
853 mp
->msgflags
|= SEQMOD
;
857 if (ferror(pf
) || fclose (pf
)) {
861 adios (cp
, "write error on");
866 if (trnflag
&& unlink (sp
) == NOTOK
)
867 adios (sp
, "couldn't unlink");
868 free (sp
); /* Free Maildir[i]->filename */
870 free (Maildir
); /* From now on Maildir is just a flag - don't dref! */
875 if (incerr
< 0) { /* error */
877 GETGROUPPRIVS(); /* Be sure we can unlock mail file */
878 (void) lkfclose (in
, newmail
); in
= NULL
;
879 DROPGROUPPRIVS(); /* And then return us to normal privileges */
881 fclose (in
); in
= NULL
;
883 adios (NULL
, "failed");
892 if ((inc_type
== INC_POP
) && packfile
)
896 * truncate file we are incorporating from
898 if (inc_type
== INC_FILE
&& Maildir
== NULL
) {
900 if (stat (newmail
, &st
) != NOTOK
&& s1
.st_mtime
!= st
.st_mtime
)
901 advise (NULL
, "new messages have arrived!\007");
904 if ((newfd
= creat (newmail
, 0600)) != NOTOK
)
907 admonish (newmail
, "error zero'ing");
908 unlink(map_name(newmail
));
912 printf ("%s not zero'd\n", newmail
);
916 if (msgnum
== hghnum
) {
917 admonish (NULL
, "no messages incorporated");
919 context_replace (pfolder
, folder
); /* update current folder */
921 mp
->curmsg
= hghnum
+ 1;
925 if (chgflag
) /* sigh... */
926 seq_setcur (mp
, mp
->curmsg
);
930 * unlock the mail spool
932 if (inc_type
== INC_FILE
&& Maildir
== NULL
) {
934 GETGROUPPRIVS(); /* Be sure we can unlock mail file */
935 (void) lkfclose (in
, newmail
); in
= NULL
;
936 DROPGROUPPRIVS(); /* And then return us to normal privileges */
938 fclose (in
); in
= NULL
;
942 seq_setunseen (mp
, 0); /* set the Unseen-Sequence */
943 seq_save (mp
); /* synchronize sequences */
944 context_save (); /* save the context file */
951 inc_done (int status
)
953 if (packfile
&& pd
!= NOTOK
)
954 mbx_close (packfile
, pd
);
958 lkfclose(in
, newmail
);
967 fprintf (pf
, "%s\n", s
);
968 stop
+= strlen (s
) + 1;
969 return 0; /* Is return value used? This was missing before 1999-07-15. */
978 snprintf (buffer
, sizeof(buffer
), "%s\n", s
);
979 for (j
= 0; (j
= stringdex (mmdlm1
, buffer
)) >= 0; buffer
[j
]++)
981 for (j
= 0; (j
= stringdex (mmdlm2
, buffer
)) >= 0; buffer
[j
]++)
984 size
+= strlen (buffer
) + 1;
985 return 0; /* Is return value used? This was missing before 1999-07-15. */
996 if (stat (packfile
, &st
) == NOTOK
)
998 if ((md
= open (cp
= map_name (packfile
), O_RDONLY
)) == NOTOK
999 || map_chk (cp
, md
, &d
, (long) st
.st_size
, 1)) {