head.c (99112) | head.c (108988) |
---|---|
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 --- 23 unchanged lines hidden (view full) --- 32 */ 33 34#ifndef lint 35#if 0 36static char sccsid[] = "@(#)head.c 8.2 (Berkeley) 4/20/95"; 37#endif 38#endif /* not lint */ 39#include <sys/cdefs.h> | 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 --- 23 unchanged lines hidden (view full) --- 32 */ 33 34#ifndef lint 35#if 0 36static char sccsid[] = "@(#)head.c 8.2 (Berkeley) 4/20/95"; 37#endif 38#endif /* not lint */ 39#include <sys/cdefs.h> |
40__FBSDID("$FreeBSD: head/usr.bin/mail/head.c 99112 2002-06-30 05:25:07Z obrien $"); | 40__FBSDID("$FreeBSD: head/usr.bin/mail/head.c 108988 2003-01-09 05:08:37Z mikeh $"); |
41 42#include "rcv.h" 43#include "extern.h" 44 45/* 46 * Mail -- a mail program 47 * 48 * Routines for processing and detecting headlines. --- 6 unchanged lines hidden (view full) --- 55 */ 56int 57ishead(linebuf) 58 char linebuf[]; 59{ 60 struct headline hl; 61 char parbuf[BUFSIZ]; 62 | 41 42#include "rcv.h" 43#include "extern.h" 44 45/* 46 * Mail -- a mail program 47 * 48 * Routines for processing and detecting headlines. --- 6 unchanged lines hidden (view full) --- 55 */ 56int 57ishead(linebuf) 58 char linebuf[]; 59{ 60 struct headline hl; 61 char parbuf[BUFSIZ]; 62 |
63 if (strncmp(linebuf, "From ", 5)) | 63 if (strncmp(linebuf, "From ", 5) != 0) |
64 return (0); 65 parse(linebuf, &hl, parbuf); | 64 return (0); 65 parse(linebuf, &hl, parbuf); |
66 if (hl.l_from == NULL || hl.l_date == NULL) { 67 fail(linebuf, "No from or date field"); | 66 if (hl.l_date == NULL) { 67 fail(linebuf, "No date field"); |
68 return (0); 69 } 70 if (!isdate(hl.l_date)) { 71 fail(linebuf, "Date field not legal date"); 72 return (0); 73 } 74 /* 75 * I guess we got it! --- 32 unchanged lines hidden (view full) --- 108 hl->l_tty = NULL; 109 hl->l_date = NULL; 110 cp = line; 111 sp = pbuf; 112 /* 113 * Skip over "From" first. 114 */ 115 cp = nextword(cp, word); | 68 return (0); 69 } 70 if (!isdate(hl.l_date)) { 71 fail(linebuf, "Date field not legal date"); 72 return (0); 73 } 74 /* 75 * I guess we got it! --- 32 unchanged lines hidden (view full) --- 108 hl->l_tty = NULL; 109 hl->l_date = NULL; 110 cp = line; 111 sp = pbuf; 112 /* 113 * Skip over "From" first. 114 */ 115 cp = nextword(cp, word); |
116 /* 117 * Check for missing return-path. 118 */ 119 if (isdate(cp)) { 120 hl->l_date = copyin(cp, &sp); 121 return; 122 } |
|
116 cp = nextword(cp, word); | 123 cp = nextword(cp, word); |
117 if (*word != '\0') | 124 if (strlen(word) > 0) |
118 hl->l_from = copyin(word, &sp); | 125 hl->l_from = copyin(word, &sp); |
119 if (cp != NULL && cp[0] == 't' && cp[1] == 't' && cp[2] == 'y') { | 126 if (cp != NULL && strncmp(cp, "tty", 3) == 0) { |
120 cp = nextword(cp, word); 121 hl->l_tty = copyin(word, &sp); 122 } 123 if (cp != NULL) 124 hl->l_date = copyin(cp, &sp); 125} 126 127/* --- 155 unchanged lines hidden --- | 127 cp = nextword(cp, word); 128 hl->l_tty = copyin(word, &sp); 129 } 130 if (cp != NULL) 131 hl->l_date = copyin(cp, &sp); 132} 133 134/* --- 155 unchanged lines hidden --- |