cmd1.c (37453) | cmd1.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[] = "@(#)cmd1.c 8.1 (Berkeley) 6/6/93"; | 36static char sccsid[] = "@(#)cmd1.c 8.1 (Berkeley) 6/6/93"; |
37#endif 38static const char rcsid[] = 39 "$FreeBSD: head/usr.bin/mail/cmd1.c 74769 2001-03-25 04:57:05Z mikeh $"; |
|
36#endif /* not lint */ 37 38#include "rcv.h" 39#include "extern.h" 40 41/* 42 * Mail -- a mail program 43 * --- 267 unchanged lines hidden (view full) --- 311 nlines += message[*ip - 1].m_lines; 312 } 313 if (page || nlines > (*cp ? atoi(cp) : realscreenheight)) { 314 cp = value("PAGER"); 315 if (cp == NULL || *cp == '\0') 316 cp = _PATH_MORE; 317 obuf = Popen(cp, "w"); 318 if (obuf == NULL) { | 40#endif /* not lint */ 41 42#include "rcv.h" 43#include "extern.h" 44 45/* 46 * Mail -- a mail program 47 * --- 267 unchanged lines hidden (view full) --- 315 nlines += message[*ip - 1].m_lines; 316 } 317 if (page || nlines > (*cp ? atoi(cp) : realscreenheight)) { 318 cp = value("PAGER"); 319 if (cp == NULL || *cp == '\0') 320 cp = _PATH_MORE; 321 obuf = Popen(cp, "w"); 322 if (obuf == NULL) { |
319 perror(cp); | 323 warnx("%s", cp); |
320 obuf = stdout; 321 } else 322 signal(SIGPIPE, brokpipe); 323 } 324 } 325 for (ip = msgvec; *ip && ip - msgvec < msgCount; ip++) { 326 mp = &message[*ip - 1]; 327 touch(mp); 328 dot = mp; 329 if (value("quiet") == NOSTR) 330 fprintf(obuf, "Message %d:\n", *ip); | 324 obuf = stdout; 325 } else 326 signal(SIGPIPE, brokpipe); 327 } 328 } 329 for (ip = msgvec; *ip && ip - msgvec < msgCount; ip++) { 330 mp = &message[*ip - 1]; 331 touch(mp); 332 dot = mp; 333 if (value("quiet") == NOSTR) 334 fprintf(obuf, "Message %d:\n", *ip); |
331 (void) send(mp, obuf, doign ? ignore : 0, NOSTR); | 335 (void) sendmessage(mp, obuf, doign ? ignore : 0, NOSTR); |
332 } 333close_pipe: 334 if (obuf != stdout) { 335 /* 336 * Ignore SIGPIPE so it can't cause a duplicate close. 337 */ 338 signal(SIGPIPE, SIG_IGN); 339 Pclose(obuf); --- 42 unchanged lines hidden (view full) --- 382 dot = mp; 383 if (value("quiet") == NOSTR) 384 printf("Message %d:\n", *ip); 385 ibuf = setinput(mp); 386 c = mp->m_lines; 387 if (!lineb) 388 printf("\n"); 389 for (lines = 0; lines < c && lines <= topl; lines++) { | 336 } 337close_pipe: 338 if (obuf != stdout) { 339 /* 340 * Ignore SIGPIPE so it can't cause a duplicate close. 341 */ 342 signal(SIGPIPE, SIG_IGN); 343 Pclose(obuf); --- 42 unchanged lines hidden (view full) --- 386 dot = mp; 387 if (value("quiet") == NOSTR) 388 printf("Message %d:\n", *ip); 389 ibuf = setinput(mp); 390 c = mp->m_lines; 391 if (!lineb) 392 printf("\n"); 393 for (lines = 0; lines < c && lines <= topl; lines++) { |
390 if (readline(ibuf, linebuf, LINESIZE) < 0) | 394 if (readline(ibuf, linebuf, sizeof(linebuf)) < 0) |
391 break; 392 puts(linebuf); | 395 break; 396 puts(linebuf); |
393 lineb = blankline(linebuf); | 397 lineb = strspn(linebuf, " \t") == strlen(linebuf); |
394 } 395 } 396 return(0); 397} 398 399/* 400 * Touch all the given messages so that they will 401 * get mboxed. --- 30 unchanged lines hidden (view full) --- 432} 433 434/* 435 * List the folders the user currently has. 436 */ 437int 438folders() 439{ | 398 } 399 } 400 return(0); 401} 402 403/* 404 * Touch all the given messages so that they will 405 * get mboxed. --- 30 unchanged lines hidden (view full) --- 436} 437 438/* 439 * List the folders the user currently has. 440 */ 441int 442folders() 443{ |
440 char dirname[BUFSIZ]; | 444 char dirname[PATHSIZE]; |
441 char *cmd; 442 | 445 char *cmd; 446 |
443 if (getfold(dirname) < 0) { | 447 if (getfold(dirname, sizeof(dirname)) < 0) { |
444 printf("No value set for \"folder\"\n"); 445 return 1; 446 } 447 if ((cmd = value("LISTER")) == NOSTR) 448 cmd = "ls"; 449 (void) run_command(cmd, 0, -1, -1, dirname, NOSTR, NOSTR); 450 return 0; 451} | 448 printf("No value set for \"folder\"\n"); 449 return 1; 450 } 451 if ((cmd = value("LISTER")) == NOSTR) 452 cmd = "ls"; 453 (void) run_command(cmd, 0, -1, -1, dirname, NOSTR, NOSTR); 454 return 0; 455} |