Deleted Added
full compact
cmd2.c (40189) cmd2.c (74769)
1/*
2 * Copyright (c) 1980, 1993
3 * The Regents of the University of California. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 18 unchanged lines hidden (view full) ---

27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31 * SUCH DAMAGE.
32 */
33
34#ifndef lint
1/*
2 * Copyright (c) 1980, 1993
3 * The Regents of the University of California. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 18 unchanged lines hidden (view full) ---

27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31 * SUCH DAMAGE.
32 */
33
34#ifndef lint
35#if 0
35static char sccsid[] = "@(#)cmd2.c 8.1 (Berkeley) 6/6/93";
36static char sccsid[] = "@(#)cmd2.c 8.1 (Berkeley) 6/6/93";
37#endif
38static const char rcsid[] =
39 "$FreeBSD: head/usr.bin/mail/cmd2.c 74769 2001-03-25 04:57:05Z mikeh $";
36#endif /* not lint */
37
38#include "rcv.h"
39#include <sys/wait.h>
40#include "extern.h"
41
42/*
43 * Mail -- a mail program

--- 138 unchanged lines hidden (view full) ---

182 return(1);
183 printf("\"%s\" ", file);
184 fflush(stdout);
185 if (access(file, 0) >= 0)
186 disp = "[Appended]";
187 else
188 disp = "[New file]";
189 if ((obuf = Fopen(file, "a")) == NULL) {
40#endif /* not lint */
41
42#include "rcv.h"
43#include <sys/wait.h>
44#include "extern.h"
45
46/*
47 * Mail -- a mail program

--- 138 unchanged lines hidden (view full) ---

186 return(1);
187 printf("\"%s\" ", file);
188 fflush(stdout);
189 if (access(file, 0) >= 0)
190 disp = "[Appended]";
191 else
192 disp = "[New file]";
193 if ((obuf = Fopen(file, "a")) == NULL) {
190 perror(NOSTR);
194 warn(NOSTR);
191 return(1);
192 }
193 for (ip = msgvec; *ip && ip-msgvec < msgCount; ip++) {
194 mp = &message[*ip - 1];
195 touch(mp);
195 return(1);
196 }
197 for (ip = msgvec; *ip && ip-msgvec < msgCount; ip++) {
198 mp = &message[*ip - 1];
199 touch(mp);
196 if (send(mp, obuf, ignore, NOSTR) < 0) {
197 perror(file);
200 if (sendmessage(mp, obuf, ignore, NOSTR) < 0) {
201 warnx("%s", file);
198 Fclose(obuf);
199 return(1);
200 }
201 if (mark)
202 mp->m_flag |= MSAVED;
203 }
204 fflush(obuf);
205 if (ferror(obuf))
202 Fclose(obuf);
203 return(1);
204 }
205 if (mark)
206 mp->m_flag |= MSAVED;
207 }
208 fflush(obuf);
209 if (ferror(obuf))
206 perror(file);
210 warn("%s", file);
207 Fclose(obuf);
208 printf("%s\n", disp);
209 return(0);
210}
211
212/*
213 * Write the indicated messages at the end of the passed
214 * file name, minus header and trailing blank line.

--- 147 unchanged lines hidden (view full) ---

362
363/*
364 * Interactively dump core on "core"
365 */
366int
367core()
368{
369 int pid;
211 Fclose(obuf);
212 printf("%s\n", disp);
213 return(0);
214}
215
216/*
217 * Write the indicated messages at the end of the passed
218 * file name, minus header and trailing blank line.

--- 147 unchanged lines hidden (view full) ---

366
367/*
368 * Interactively dump core on "core"
369 */
370int
371core()
372{
373 int pid;
370 extern union wait wait_status;
374 extern int wait_status;
371
372 switch (pid = fork()) {
373 case -1:
375
376 switch (pid = fork()) {
377 case -1:
374 perror("fork");
378 warn("fork");
375 return(1);
376 case 0:
377 abort();
378 _exit(1);
379 }
380 printf("Okie dokie");
381 fflush(stdout);
382 wait_child(pid);
379 return(1);
380 case 0:
381 abort();
382 _exit(1);
383 }
384 printf("Okie dokie");
385 fflush(stdout);
386 wait_child(pid);
383 if (wait_status.w_coredump)
387 if (WIFSIGNALED(wait_status) && WCOREDUMP(wait_status))
384 printf(" -- Core dumped.\n");
385 else
386 printf(" -- Can't dump core.\n");
387 return 0;
388}
389
390/*
391 * Clobber as many bytes of stack as the user requests.

--- 70 unchanged lines hidden (view full) ---

462}
463
464int
465ignore1(list, tab, which)
466 char *list[];
467 struct ignoretab *tab;
468 char *which;
469{
388 printf(" -- Core dumped.\n");
389 else
390 printf(" -- Can't dump core.\n");
391 return 0;
392}
393
394/*
395 * Clobber as many bytes of stack as the user requests.

--- 70 unchanged lines hidden (view full) ---

466}
467
468int
469ignore1(list, tab, which)
470 char *list[];
471 struct ignoretab *tab;
472 char *which;
473{
470 char field[BUFSIZ];
474 char field[LINESIZE];
471 register int h;
472 register struct ignore *igp;
473 char **ap;
474
475 if (*list == NOSTR)
476 return igshow(tab, which);
477 for (ap = list; *ap != 0; ap++) {
475 register int h;
476 register struct ignore *igp;
477 char **ap;
478
479 if (*list == NOSTR)
480 return igshow(tab, which);
481 for (ap = list; *ap != 0; ap++) {
478 istrcpy(field, *ap);
482 istrncpy(field, *ap, sizeof(field));
479 if (member(field, tab))
480 continue;
481 h = hash(field);
482 igp = (struct ignore *) calloc(1, sizeof (struct ignore));
483 igp->i_field = calloc((unsigned) strlen(field) + 1,
484 sizeof (char));
485 strcpy(igp->i_field, field);
486 igp->i_link = tab->i_head[h];

--- 44 unchanged lines hidden ---
483 if (member(field, tab))
484 continue;
485 h = hash(field);
486 igp = (struct ignore *) calloc(1, sizeof (struct ignore));
487 igp->i_field = calloc((unsigned) strlen(field) + 1,
488 sizeof (char));
489 strcpy(igp->i_field, field);
490 igp->i_link = tab->i_head[h];

--- 44 unchanged lines hidden ---