extern.h: style nits
[s-mailx.git] / names.c
blob2fd090ea464c5bd8ad353a2da8202160c7afb31f
1 /*
2 * S-nail - a mail user agent derived from Berkeley Mail.
4 * Copyright (c) 2000-2004 Gunnar Ritter, Freiburg i. Br., Germany.
5 * Copyright (c) 2012 Steffen "Daode" Nurpmeso.
6 */
7 /*
8 * Copyright (c) 1980, 1993
9 * The Regents of the University of California. All rights reserved.
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
13 * are met:
14 * 1. Redistributions of source code must retain the above copyright
15 * notice, this list of conditions and the following disclaimer.
16 * 2. Redistributions in binary form must reproduce the above copyright
17 * notice, this list of conditions and the following disclaimer in the
18 * documentation and/or other materials provided with the distribution.
19 * 3. All advertising materials mentioning features or use of this software
20 * must display the following acknowledgement:
21 * This product includes software developed by the University of
22 * California, Berkeley and its contributors.
23 * 4. Neither the name of the University nor the names of its contributors
24 * may be used to endorse or promote products derived from this software
25 * without specific prior written permission.
27 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
28 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
29 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
30 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
31 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
32 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
33 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
34 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
35 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
36 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
37 * SUCH DAMAGE.
41 * Mail -- a mail program
43 * Handle name lists.
46 #include "rcv.h"
47 #include "extern.h"
48 #include <sys/stat.h>
49 #include <fcntl.h>
50 #include <time.h>
51 #include <unistd.h>
53 static struct name *tailof(struct name *name);
54 static struct name *extract1(char *line, enum gfield ntype, char *separators,
55 int copypfx);
56 static char *yankword(char *ap, char *wbuf, char *separators, int copypfx);
57 static int same_name(char *n1, char *n2);
58 static struct name *gexpand(struct name *nlist, struct grouphead *gh,
59 int metoo, int ntype);
60 static struct name *put(struct name *list, struct name *node);
61 static struct name *delname(struct name *np, char *name);
64 * Allocate a single element of a name list,
65 * initialize its name field to the passed
66 * name and return it.
68 struct name *
69 nalloc(char *str, enum gfield ntype)
71 struct name *np;
72 struct str in, out;
74 /*LINTED*/
75 np = (struct name *)salloc(sizeof *np);
76 np->n_flink = NULL;
77 np->n_blink = NULL;
78 np->n_type = ntype;
79 np->n_flags = 0;
80 if (ntype & GFULL) {
81 np->n_name = savestr(skin(str));
82 if (strcmp(np->n_name, str)) {
83 in.s = str;
84 in.l = strlen(str);
85 mime_fromhdr(&in, &out, TD_ISPR|TD_ICONV);
86 np->n_fullname = savestr(out.s);
87 free(out.s);
88 } else
89 np->n_fullname = np->n_name;
90 } else if (ntype & GSKIN)
91 np->n_fullname = np->n_name = savestr(skin(str));
92 else
93 np->n_fullname = np->n_name = savestr(str);
94 return(np);
97 struct name *
98 ndup(struct name *np, enum gfield ntype)
100 struct name *nnp;
102 nnp = (struct name*)salloc(sizeof *np);
103 nnp->n_flink = NULL;
104 nnp->n_blink = NULL;
105 nnp->n_type = ntype;
106 nnp->n_flags = np->n_flags;
107 nnp->n_name = savestr(np->n_name);
108 nnp->n_fullname = (((ntype & (GFULL|GSKIN)) == 0) ||
109 np->n_name == np->n_fullname)
110 ? nnp->n_name : savestr(np->n_fullname);
111 return (nnp);
115 * Find the tail of a list and return it.
117 static struct name *
118 tailof(struct name *name)
120 struct name *np;
122 np = name;
123 if (np == NULL)
124 return(NULL);
125 while (np->n_flink != NULL)
126 np = np->n_flink;
127 return(np);
131 * Extract a list of names from a line,
132 * and make a list of names from it.
133 * Return the list or NULL if none found.
135 struct name *
136 extract(char *line, enum gfield ntype)
138 return extract1(line, ntype, " \t,(", 0);
141 struct name *
142 sextract(char *line, enum gfield ntype)
144 if (line && strpbrk(line, ",\"\\(<"))
145 return extract1(line, ntype, ",", 1);
146 else
147 return extract(line, ntype);
150 struct name *
151 lextract(char *line, enum gfield ntype)
153 return (extract1(line, ntype, ",", 1));
156 static struct name *
157 extract1(char *line, enum gfield ntype, char *separators, int copypfx)
159 char *cp, *nbuf;
160 struct name *top, *np, *t;
162 if (line == NULL || *line == '\0')
163 return NULL;
164 top = NULL;
165 np = NULL;
166 cp = line;
167 nbuf = ac_alloc(strlen(line) + 1);
168 while ((cp = yankword(cp, nbuf, separators, copypfx)) != NULL) {
169 t = nalloc(nbuf, ntype);
170 if (top == NULL)
171 top = t;
172 else
173 np->n_flink = t;
174 t->n_blink = np;
175 np = t;
177 ac_free(nbuf);
178 return top;
182 * Turn a list of names into a string of the same names.
184 char *
185 detract(struct name *np, enum gfield ntype)
187 int s;
188 char *cp, *top;
189 struct name *p;
190 int comma;
192 comma = ntype & GCOMMA;
193 if (np == NULL)
194 return(NULL);
195 ntype &= ~GCOMMA;
196 s = 0;
197 if ((debug || value("debug")) && comma)
198 fprintf(stderr, catgets(catd, CATSET, 145,
199 "detract asked to insert commas\n"));
200 for (p = np; p != NULL; p = p->n_flink) {
201 if (ntype && (p->n_type & GMASK) != ntype)
202 continue;
203 s += strlen(p->n_fullname) + 1;
204 if (comma)
205 s++;
207 if (s == 0)
208 return(NULL);
209 s += 2;
210 top = salloc(s);
211 cp = top;
212 for (p = np; p != NULL; p = p->n_flink) {
213 if (ntype && (p->n_type & GMASK) != ntype)
214 continue;
215 cp = sstpcpy(cp, p->n_fullname);
216 if (comma && p->n_flink != NULL)
217 *cp++ = ',';
218 *cp++ = ' ';
220 *--cp = 0;
221 if (comma && *--cp == ',')
222 *cp = 0;
223 return(top);
227 * Grab a single word (liberal word)
228 * Throw away things between ()'s, and take anything between <>.
229 * Strip trailing whitespace as *ap* may come directly from user.
231 static char *
232 yankword(char *ap, char *wbuf, char *separators, int copypfx)
234 char *cp, *pp, *wp;
236 cp = ap;
237 wp = wbuf;
238 while (blankchar(*cp & 0377) || *cp == ',')
239 cp++;
240 pp = cp;
241 if ((cp = nexttoken(cp)) == NULL)
242 return NULL;
243 if (copypfx)
244 while (pp < cp)
245 *wp++ = *pp++;
246 if (*cp == '<')
247 while (*cp && (*wp++ = *cp++) != '>');
248 else {
249 int incomm = 0;
251 while (*cp && (incomm || !strchr(separators, *cp))) {
252 if (*cp == '\"') {
253 if (cp == ap || *(cp - 1) != '\\') {
254 if (incomm)
255 incomm--;
256 else
257 incomm++;
258 *wp++ = '\"';
259 } else if (cp != ap) {
260 *(wp - 1) = '\"';
262 cp++;
263 continue;
265 *wp++ = *cp++;
268 while (wp > wbuf && blankspacechar(wp[-1]))
269 --wp;
270 *wp = '\0';
271 return cp;
275 * For each recipient in the passed name list with a /
276 * in the name, append the message to the end of the named file
277 * and remove him from the recipient list.
279 * Recipients whose name begins with | are piped through the given
280 * program and removed.
282 struct name *
283 outof(struct name *names, FILE *fo, struct header *hp)
285 int pipecnt, xcnt, *fda, i;
286 char *shell, *date;
287 struct name *np;
288 time_t now;
289 FILE *fin = NULL, *fout;
290 (void)hp;
293 * Look through all recipients and do a quick return if no file or pipe
294 * addressee is found.
296 for (pipecnt = xcnt = 0, np = names; np != NULL; np = np->n_flink) {
297 assert(np->n_flags & NAME_ADDRSPEC_CHECKED);
298 if ((np->n_flags & NAME_ADDRSPEC_ISPIPE) != 0)
299 ++pipecnt;
300 else if ((np->n_flags & NAME_ADDRSPEC_ISFILE) != 0)
301 ++xcnt;
303 if (pipecnt == 0 && xcnt == 0)
304 goto jleave;
307 * Otherwise create an array of file descriptors for each found pipe
308 * addressee to get around the dup(2)-shared-file-offset problem, i.e.,
309 * each pipe subprocess needs its very own file descriptor, and we need
310 * to deal with that.
311 * To make our life a bit easier let's just use the auto-reclaimed
312 * string storage.
314 if (pipecnt == 0) {
315 fda = NULL;
316 shell = NULL;
317 } else {
318 fda = (int*)salloc(sizeof(int) * pipecnt);
319 for (i = 0; i < pipecnt; ++i)
320 fda[i] = -1;
321 if ((shell = value("SHELL")) == NULL)
322 shell = SHELL;
325 time(&now);
326 date = ctime(&now);
328 for (np = names; np != NULL;) {
329 if ((np->n_flags & (NAME_ADDRSPEC_ISFILE|NAME_ADDRSPEC_ISPIPE))
330 == 0) {
331 np = np->n_flink;
332 continue;
336 * See if we have copied the complete message out yet.
337 * If not, do so.
339 if (image < 0) {
340 int c;
341 char *tempEdit;
343 if ((fout = Ftemp(&tempEdit, "Re", "w", 0600, 1))
344 == NULL) {
345 perror(tr(146, "Creation of temporary image"));
346 ++senderr;
347 goto jcant;
349 image = open(tempEdit, O_RDWR);
350 if (image >= 0)
351 for (i = 0; i < pipecnt; ++i) {
352 int fd = open(tempEdit, O_RDONLY);
353 if (fd < 0) {
354 (void)close(image);
355 image = -1;
356 pipecnt = i;
357 break;
359 fda[i] = fd;
360 (void)fcntl(fd, F_SETFD, FD_CLOEXEC);
362 unlink(tempEdit);
363 Ftfree(&tempEdit);
364 if (image < 0) {
365 perror(tr(147, "Creating descriptor duplicate "
366 "of temporary image"));
367 ++senderr;
368 Fclose(fout);
369 goto jcant;
371 fcntl(image, F_SETFD, FD_CLOEXEC);
373 fprintf(fout, "From %s %s", myname, date);
374 c = EOF;
375 while (i = c, (c = getc(fo)) != EOF)
376 putc(c, fout);
377 rewind(fo);
378 if (i != '\n')
379 putc('\n', fout);
380 putc('\n', fout);
381 fflush(fout);
382 if (ferror(fout))
383 perror(tr(148, "Finalizing write of temporary "
384 "image"));
385 Fclose(fout);
387 /* If we have to serve file addressees, open reader */
388 if (xcnt != 0 && (fin = Fdopen(image, "r")) == NULL) {
389 perror(tr(149, "Failed to open a duplicate of "
390 "the temporary image"));
391 ++senderr;
392 (void)close(image);
393 image = -1;
394 goto jcant;
397 /* From now on use xcnt as a counter for pipecnt */
398 xcnt = 0;
402 * Now either copy "image" to the desired file
403 * or give it as the standard input to the desired
404 * program as appropriate.
407 if (np->n_flags & NAME_ADDRSPEC_ISPIPE) {
408 int pid;
409 sigset_t nset;
411 sigemptyset(&nset);
412 sigaddset(&nset, SIGHUP);
413 sigaddset(&nset, SIGINT);
414 sigaddset(&nset, SIGQUIT);
415 pid = start_command(shell, &nset,
416 fda[xcnt++], -1, "-c", np->n_name + 1, NULL);
417 if (pid < 0) {
418 ++senderr;
419 goto jcant;
421 free_child(pid);
422 } else {
423 char *fname = expand(np->n_name);
424 if ((fout = Zopen(fname, "a", NULL)) == NULL) {
425 perror(fname);
426 ++senderr;
427 goto jcant;
429 rewind(fin);
430 while ((i = getc(fin)) != EOF)
431 putc(i, fout);
432 if (ferror(fout)) {
433 ++senderr;
434 perror(fname);
436 Fclose(fout);
438 jcant:
440 * In days of old we removed the entry from the
441 * the list; now for sake of header expansion
442 * we leave it in and mark it as deleted.
444 np->n_type |= GDEL;
445 np = np->n_flink;
446 if (image < 0)
447 goto jdelall;
449 jleave:
450 if (fin != NULL)
451 Fclose(fin);
452 for (i = 0; i < pipecnt; ++i)
453 (void)close(fda[i]);
454 if (image >= 0) {
455 close(image);
456 image = -1;
458 return (names);
460 jdelall:
461 while (np != NULL) {
462 if ((np->n_flags & (NAME_ADDRSPEC_ISFILE|NAME_ADDRSPEC_ISPIPE))
463 != 0)
464 np->n_type |= GDEL;
465 np = np->n_flink;
467 goto jleave;
471 * Determine if the passed address is a local "send to file" address.
472 * If any of the network metacharacters precedes any slashes, it can't
473 * be a filename. We cheat with .'s to allow path names like ./...
475 int
476 is_fileaddr(char *name)
478 char *cp;
480 if (strchr(name, '@') != NULL)
481 return 0;
482 if (*name == '+')
483 return 1;
484 for (cp = name; *cp; cp++) {
485 if (*cp == '!' || *cp == '%')
486 return 0;
487 if (*cp == '/')
488 return 1;
490 return 0;
493 static int
494 same_name(char *n1, char *n2)
496 int c1, c2;
498 if (value("allnet") != NULL) {
499 do {
500 c1 = (*n1++ & 0377);
501 c2 = (*n2++ & 0377);
502 c1 = lowerconv(c1);
503 c2 = lowerconv(c2);
504 if (c1 != c2)
505 return 0;
506 } while (c1 != '\0' && c2 != '\0' && c1 != '@' && c2 != '@');
507 return 1;
508 } else
509 return asccasecmp(n1, n2) == 0;
513 * Map all of the aliased users in the invoker's mailrc
514 * file and insert them into the list.
515 * Changed after all these months of service to recursively
516 * expand names (2/14/80).
519 struct name *
520 usermap(struct name *names)
522 struct name *new, *np, *cp;
523 struct grouphead *gh;
524 int metoo;
526 new = NULL;
527 np = names;
528 metoo = (value("metoo") != NULL);
529 while (np != NULL) {
530 if (np->n_name[0] == '\\') {
531 cp = np->n_flink;
532 new = put(new, np);
533 np = cp;
534 continue;
536 gh = findgroup(np->n_name);
537 cp = np->n_flink;
538 if (gh != NULL)
539 new = gexpand(new, gh, metoo, np->n_type);
540 else
541 new = put(new, np);
542 np = cp;
544 return(new);
548 * Recursively expand a group name. We limit the expansion to some
549 * fixed level to keep things from going haywire.
550 * Direct recursion is not expanded for convenience.
553 static struct name *
554 gexpand(struct name *nlist, struct grouphead *gh, int metoo, int ntype)
556 struct group *gp;
557 struct grouphead *ngh;
558 struct name *np;
559 static int depth;
560 char *cp;
562 if (depth > MAXEXP) {
563 printf(catgets(catd, CATSET, 150,
564 "Expanding alias to depth larger than %d\n"), MAXEXP);
565 return(nlist);
567 depth++;
568 for (gp = gh->g_list; gp != NULL; gp = gp->ge_link) {
569 cp = gp->ge_name;
570 if (*cp == '\\')
571 goto quote;
572 if (strcmp(cp, gh->g_name) == 0)
573 goto quote;
574 if ((ngh = findgroup(cp)) != NULL) {
575 nlist = gexpand(nlist, ngh, metoo, ntype);
576 continue;
578 quote:
579 np = nalloc(cp, ntype|GFULL);
581 * At this point should allow to expand
582 * to self if only person in group
584 if (gp == gh->g_list && gp->ge_link == NULL)
585 goto skip;
586 if (!metoo && same_name(cp, myname))
587 np->n_type |= GDEL;
588 skip:
589 nlist = put(nlist, np);
591 depth--;
592 return(nlist);
596 * Concatenate the two passed name lists, return the result.
598 struct name *
599 cat(struct name *n1, struct name *n2)
601 struct name *tail;
603 if (n1 == NULL)
604 return(n2);
605 if (n2 == NULL)
606 return(n1);
607 tail = tailof(n1);
608 tail->n_flink = n2;
609 n2->n_blink = tail;
610 return(n1);
614 * Unpack the name list onto a vector of strings.
615 * Return an error if the name list won't fit.
617 char **
618 unpack(struct name *np)
620 char **ap, **top;
621 struct name *n;
622 int t, extra, metoo, verbose;
624 n = np;
625 if ((t = count(n)) == 0)
626 panic(catgets(catd, CATSET, 151, "No names to unpack"));
628 * Compute the number of extra arguments we will need.
629 * We need at least two extra -- one for "mail" and one for
630 * the terminating 0 pointer. Additional spots may be needed
631 * to pass along -f to the host mailer.
633 extra = 2;
634 extra++;
635 metoo = value("metoo") != NULL;
636 if (metoo)
637 extra++;
638 verbose = value("verbose") != NULL;
639 if (verbose)
640 extra++;
641 /*LINTED*/
642 top = (char **)salloc((t + extra) * sizeof *top);
643 ap = top;
644 *ap++ = "send-mail";
645 *ap++ = "-i";
646 if (metoo)
647 *ap++ = "-m";
648 if (verbose)
649 *ap++ = "-v";
650 for (; n != NULL; n = n->n_flink)
651 if ((n->n_type & GDEL) == 0)
652 *ap++ = n->n_name;
653 *ap = NULL;
654 return(top);
658 * Remove all of the duplicates from the passed name list by
659 * insertion sorting them, then checking for dups.
660 * Return the head of the new list.
662 struct name *
663 elide(struct name *names)
665 struct name *np, *t, *newn, *x;
667 if (names == NULL)
668 return (NULL);
669 /* Throw away all deleted nodes (XXX merge with plain sort below?) */
670 for (np = NULL; names != NULL; names = names->n_flink)
671 if ((names->n_type & GDEL) == 0) {
672 names->n_blink = np;
673 if (np)
674 np->n_flink = names;
675 else
676 newn = names;
677 np = names;
679 if (newn == NULL)
680 return (NULL);
682 np = newn->n_flink;
683 if (np != NULL)
684 np->n_blink = NULL;
685 newn->n_flink = NULL;
687 while (np != NULL) {
688 t = newn;
689 while (asccasecmp(t->n_name, np->n_name) < 0) {
690 if (t->n_flink == NULL)
691 break;
692 t = t->n_flink;
696 * If we ran out of t's, put the new entry after
697 * the current value of t.
700 if (asccasecmp(t->n_name, np->n_name) < 0) {
701 t->n_flink = np;
702 np->n_blink = t;
703 t = np;
704 np = np->n_flink;
705 t->n_flink = NULL;
706 continue;
710 * Otherwise, put the new entry in front of the
711 * current t. If at the front of the list,
712 * the new guy becomes the new head of the list.
715 if (t == newn) {
716 t = np;
717 np = np->n_flink;
718 t->n_flink = newn;
719 newn->n_blink = t;
720 t->n_blink = NULL;
721 newn = t;
722 continue;
726 * The normal case -- we are inserting into the
727 * middle of the list.
730 x = np;
731 np = np->n_flink;
732 x->n_flink = t;
733 x->n_blink = t->n_blink;
734 t->n_blink->n_flink = x;
735 t->n_blink = x;
739 * Now the list headed up by new is sorted.
740 * Go through it and remove duplicates.
743 np = newn;
744 while (np != NULL) {
745 t = np;
746 while (t->n_flink != NULL &&
747 asccasecmp(np->n_name, t->n_flink->n_name) == 0)
748 t = t->n_flink;
749 if (t == np || t == NULL) {
750 np = np->n_flink;
751 continue;
755 * Now t points to the last entry with the same name
756 * as np. Make np point beyond t.
759 np->n_flink = t->n_flink;
760 if (t->n_flink != NULL)
761 t->n_flink->n_blink = np;
762 np = np->n_flink;
764 return (newn);
768 * Put another node onto a list of names and return
769 * the list.
771 static struct name *
772 put(struct name *list, struct name *node)
774 node->n_flink = list;
775 node->n_blink = NULL;
776 if (list != NULL)
777 list->n_blink = node;
778 return(node);
782 * Determine the number of undeleted elements in
783 * a name list and return it.
785 int
786 count(struct name *np)
788 int c;
790 for (c = 0; np != NULL; np = np->n_flink)
791 if ((np->n_type & GDEL) == 0)
792 c++;
793 return c;
797 * Delete the given name from a namelist.
799 static struct name *
800 delname(struct name *np, char *name)
802 struct name *p;
804 for (p = np; p != NULL; p = p->n_flink)
805 if (same_name(p->n_name, name)) {
806 if (p->n_blink == NULL) {
807 if (p->n_flink != NULL)
808 p->n_flink->n_blink = NULL;
809 np = p->n_flink;
810 continue;
812 if (p->n_flink == NULL) {
813 if (p->n_blink != NULL)
814 p->n_blink->n_flink = NULL;
815 continue;
817 p->n_blink->n_flink = p->n_flink;
818 p->n_flink->n_blink = p->n_blink;
820 return np;
824 * Pretty print a name list
825 * Uncomment it if you need it.
829 void
830 prettyprint(struct name *name)
832 struct name *np;
834 np = name;
835 while (np != NULL) {
836 fprintf(stderr, "%s(%d) ", np->n_name, np->n_type);
837 np = np->n_flink;
839 fprintf(stderr, "\n");
843 struct name *
844 delete_alternates(struct name *np)
846 struct name *xp;
847 char **ap;
849 np = delname(np, myname);
850 if (altnames)
851 for (ap = altnames; *ap; ap++)
852 np = delname(np, *ap);
853 if ((xp = sextract(value("from"), GEXTRA|GSKIN)) != NULL)
854 while (xp) {
855 np = delname(np, xp->n_name);
856 xp = xp->n_flink;
858 if ((xp = sextract(value("replyto"), GEXTRA|GSKIN)) != NULL)
859 while (xp) {
860 np = delname(np, xp->n_name);
861 xp = xp->n_flink;
863 if ((xp = sextract(value("sender"), GEXTRA|GSKIN)) != NULL)
864 while (xp) {
865 np = delname(np, xp->n_name);
866 xp = xp->n_flink;
868 return np;
872 is_myname(char *name)
874 struct name *xp;
875 char **ap;
877 if (same_name(myname, name))
878 return 1;
879 if (altnames)
880 for (ap = altnames; *ap; ap++)
881 if (same_name(*ap, name))
882 return 1;
883 if ((xp = sextract(value("from"), GEXTRA|GSKIN)) != NULL)
884 while (xp) {
885 if (same_name(xp->n_name, name))
886 return 1;
887 xp = xp->n_flink;
889 if ((xp = sextract(value("replyto"), GEXTRA|GSKIN)) != NULL)
890 while (xp) {
891 if (same_name(xp->n_name, name))
892 return 1;
893 xp = xp->n_flink;
895 if ((xp = sextract(value("sender"), GEXTRA|GSKIN)) != NULL)
896 while (xp) {
897 if (same_name(xp->n_name, name))
898 return 1;
899 xp = xp->n_flink;
901 return 0;