1 /* 2 * Copyright (c) 1983 Eric P. Allman 3 * Copyright (c) 1988 Regents of the University of California. 4 * All rights reserved. 5 * 6 * %sccs.include.redist.c% 7 */ 8 9 #ifndef lint 10 static char sccsid[] = "@(#)headers.c 6.9 (Berkeley) 02/21/93"; 11 #endif /* not lint */ 12 13 # include <errno.h> 14 # include "sendmail.h" 15 16 /* 17 ** CHOMPHEADER -- process and save a header line. 18 ** 19 ** Called by collect and by readcf to deal with header lines. 20 ** 21 ** Parameters: 22 ** line -- header as a text line. 23 ** def -- if set, this is a default value. 24 ** e -- the envelope including this header. 25 ** 26 ** Returns: 27 ** flags for this header. 28 ** 29 ** Side Effects: 30 ** The header is saved on the header list. 31 ** Contents of 'line' are destroyed. 32 */ 33 34 chompheader(line, def, e) 35 char *line; 36 bool def; 37 register ENVELOPE *e; 38 { 39 register char *p; 40 register HDR *h; 41 HDR **hp; 42 char *fname; 43 char *fvalue; 44 struct hdrinfo *hi; 45 bool cond = FALSE; 46 BITMAP mopts; 47 48 if (tTd(31, 6)) 49 printf("chompheader: %s\n", line); 50 51 /* strip off options */ 52 clrbitmap(mopts); 53 p = line; 54 if (*p == '?') 55 { 56 /* have some */ 57 register char *q = strchr(p + 1, *p); 58 59 if (q != NULL) 60 { 61 *q++ = '\0'; 62 while (*++p != '\0') 63 setbitn(*p, mopts); 64 p = q; 65 } 66 else 67 usrerr("chompheader: syntax error, line \"%s\"", line); 68 cond = TRUE; 69 } 70 71 /* find canonical name */ 72 fname = p; 73 p = strchr(p, ':'); 74 if (p == NULL) 75 { 76 syserr("chompheader: syntax error, line \"%s\"", line); 77 return (0); 78 } 79 fvalue = &p[1]; 80 while (isascii(*--p) && isspace(*p)) 81 continue; 82 *++p = '\0'; 83 makelower(fname); 84 85 /* strip field value on front */ 86 if (*fvalue == ' ') 87 fvalue++; 88 89 /* see if it is a known type */ 90 for (hi = HdrInfo; hi->hi_field != NULL; hi++) 91 { 92 if (strcmp(hi->hi_field, fname) == 0) 93 break; 94 } 95 96 /* see if this is a resent message */ 97 if (!def && bitset(H_RESENT, hi->hi_flags)) 98 e->e_flags |= EF_RESENT; 99 100 /* if this means "end of header" quit now */ 101 if (bitset(H_EOH, hi->hi_flags)) 102 return (hi->hi_flags); 103 104 /* drop explicit From: if same as what we would generate -- for MH */ 105 p = "resent-from"; 106 if (!bitset(EF_RESENT, e->e_flags)) 107 p += 7; 108 if (!def && !QueueRun && strcmp(fname, p) == 0) 109 { 110 if (e->e_from.q_paddr != NULL && 111 strcmp(fvalue, e->e_from.q_paddr) == 0) 112 return (hi->hi_flags); 113 } 114 115 /* delete default value for this header */ 116 for (hp = &e->e_header; (h = *hp) != NULL; hp = &h->h_link) 117 { 118 if (strcmp(fname, h->h_field) == 0 && 119 bitset(H_DEFAULT, h->h_flags) && 120 !bitset(H_FORCE, h->h_flags)) 121 h->h_value = NULL; 122 } 123 124 /* create a new node */ 125 h = (HDR *) xalloc(sizeof *h); 126 h->h_field = newstr(fname); 127 h->h_value = NULL; 128 h->h_link = NULL; 129 bcopy((char *) mopts, (char *) h->h_mflags, sizeof mopts); 130 *hp = h; 131 h->h_flags = hi->hi_flags; 132 if (def) 133 h->h_flags |= H_DEFAULT; 134 if (cond) 135 h->h_flags |= H_CHECK; 136 if (h->h_value != NULL) 137 free((char *) h->h_value); 138 h->h_value = newstr(fvalue); 139 140 /* hack to see if this is a new format message */ 141 if (!def && bitset(H_RCPT|H_FROM, h->h_flags) && 142 (strchr(fvalue, ',') != NULL || strchr(fvalue, '(') != NULL || 143 strchr(fvalue, '<') != NULL || strchr(fvalue, ';') != NULL)) 144 { 145 e->e_flags &= ~EF_OLDSTYLE; 146 } 147 148 return (h->h_flags); 149 } 150 /* 151 ** ADDHEADER -- add a header entry to the end of the queue. 152 ** 153 ** This bypasses the special checking of chompheader. 154 ** 155 ** Parameters: 156 ** field -- the name of the header field. 157 ** value -- the value of the field. It must be lower-cased. 158 ** e -- the envelope to add them to. 159 ** 160 ** Returns: 161 ** none. 162 ** 163 ** Side Effects: 164 ** adds the field on the list of headers for this envelope. 165 */ 166 167 addheader(field, value, e) 168 char *field; 169 char *value; 170 ENVELOPE *e; 171 { 172 register HDR *h; 173 register struct hdrinfo *hi; 174 HDR **hp; 175 176 /* find info struct */ 177 for (hi = HdrInfo; hi->hi_field != NULL; hi++) 178 { 179 if (strcmp(field, hi->hi_field) == 0) 180 break; 181 } 182 183 /* find current place in list -- keep back pointer? */ 184 for (hp = &e->e_header; (h = *hp) != NULL; hp = &h->h_link) 185 { 186 if (strcmp(field, h->h_field) == 0) 187 break; 188 } 189 190 /* allocate space for new header */ 191 h = (HDR *) xalloc(sizeof *h); 192 h->h_field = field; 193 h->h_value = newstr(value); 194 h->h_link = *hp; 195 h->h_flags = hi->hi_flags | H_DEFAULT; 196 clrbitmap(h->h_mflags); 197 *hp = h; 198 } 199 /* 200 ** HVALUE -- return value of a header. 201 ** 202 ** Only "real" fields (i.e., ones that have not been supplied 203 ** as a default) are used. 204 ** 205 ** Parameters: 206 ** field -- the field name. 207 ** e -- the envelope containing the header. 208 ** 209 ** Returns: 210 ** pointer to the value part. 211 ** NULL if not found. 212 ** 213 ** Side Effects: 214 ** none. 215 */ 216 217 char * 218 hvalue(field, e) 219 char *field; 220 register ENVELOPE *e; 221 { 222 register HDR *h; 223 224 for (h = e->e_header; h != NULL; h = h->h_link) 225 { 226 if (!bitset(H_DEFAULT, h->h_flags) && strcmp(h->h_field, field) == 0) 227 return (h->h_value); 228 } 229 return (NULL); 230 } 231 /* 232 ** ISHEADER -- predicate telling if argument is a header. 233 ** 234 ** A line is a header if it has a single word followed by 235 ** optional white space followed by a colon. 236 ** 237 ** Parameters: 238 ** s -- string to check for possible headerness. 239 ** 240 ** Returns: 241 ** TRUE if s is a header. 242 ** FALSE otherwise. 243 ** 244 ** Side Effects: 245 ** none. 246 */ 247 248 bool 249 isheader(s) 250 register char *s; 251 { 252 while (*s > ' ' && *s != ':' && *s != '\0') 253 s++; 254 255 /* following technically violates RFC822 */ 256 while (isascii(*s) && isspace(*s)) 257 s++; 258 259 return (*s == ':'); 260 } 261 /* 262 ** EATHEADER -- run through the stored header and extract info. 263 ** 264 ** Parameters: 265 ** e -- the envelope to process. 266 ** queuejob -- set if running a queued job. 267 ** 268 ** Returns: 269 ** none. 270 ** 271 ** Side Effects: 272 ** Sets a bunch of global variables from information 273 ** in the collected header. 274 ** Aborts the message if the hop count is exceeded. 275 */ 276 277 eatheader(e, queuejob) 278 register ENVELOPE *e; 279 bool queuejob; 280 { 281 register HDR *h; 282 register char *p; 283 int hopcnt = 0; 284 char *msgid; 285 char msgidbuf[MAXNAME]; 286 287 if (tTd(32, 1)) 288 printf("----- collected header -----\n"); 289 msgid = "<none>"; 290 for (h = e->e_header; h != NULL; h = h->h_link) 291 { 292 extern char *capitalize(); 293 294 if (tTd(32, 1)) 295 printf("%s: %s\n", capitalize(h->h_field), h->h_value); 296 297 /* count the number of times it has been processed */ 298 if (bitset(H_TRACE, h->h_flags)) 299 hopcnt++; 300 301 /* send to this person if we so desire */ 302 if (GrabTo && bitset(H_RCPT, h->h_flags) && 303 !bitset(H_DEFAULT, h->h_flags) && 304 (!bitset(EF_RESENT, e->e_flags) || bitset(H_RESENT, h->h_flags))) 305 { 306 (void) sendtolist(h->h_value, (ADDRESS *) NULL, 307 &e->e_sendqueue, e); 308 } 309 310 /* save the message-id for logging */ 311 if (!queuejob && h->h_value != NULL && 312 strcmp(h->h_field, "message-id") == 0) 313 { 314 msgid = h->h_value; 315 if (bitset(H_DEFAULT, h->h_flags)) 316 { 317 expand(msgid, msgidbuf, 318 &msgidbuf[sizeof msgidbuf], e); 319 msgid = msgidbuf; 320 } 321 } 322 323 /* see if this is a return-receipt header */ 324 if (bitset(H_RECEIPTTO, h->h_flags)) 325 e->e_receiptto = h->h_value; 326 327 /* see if this is an errors-to header */ 328 if (bitset(H_ERRORSTO, h->h_flags)) 329 (void) sendtolist(h->h_value, (ADDRESS *) NULL, 330 &e->e_errorqueue, e); 331 } 332 if (tTd(32, 1)) 333 printf("----------------------------\n"); 334 335 /* store hop count */ 336 if (hopcnt > e->e_hopcount) 337 e->e_hopcount = hopcnt; 338 339 /* message priority */ 340 p = hvalue("precedence", e); 341 if (p != NULL) 342 e->e_class = priencode(p); 343 if (!queuejob) 344 e->e_msgpriority = e->e_msgsize 345 - e->e_class * WkClassFact 346 + e->e_nrcpts * WkRecipFact; 347 348 /* full name of from person */ 349 p = hvalue("full-name", e); 350 if (p != NULL) 351 define('x', p, e); 352 353 /* date message originated */ 354 p = hvalue("posted-date", e); 355 if (p == NULL) 356 p = hvalue("date", e); 357 if (p != NULL) 358 define('a', p, e); 359 360 /* 361 ** Log collection information. 362 */ 363 364 # ifdef LOG 365 if (!queuejob && LogLevel > 4) 366 { 367 char *name; 368 char hbuf[MAXNAME]; 369 char sbuf[MAXLINE]; 370 371 if (RealHostName == NULL) 372 name = "local"; 373 else if (RealHostName[0] == '[') 374 name = RealHostName; 375 else 376 { 377 extern char *inet_ntoa(); 378 379 name = hbuf; 380 (void)sprintf(hbuf, "%.80s (%s)", 381 RealHostName, inet_ntoa(RealHostAddr.sin_addr)); 382 } 383 384 /* some versions of syslog only take 5 printf args */ 385 sprintf(sbuf, "from=%.200s, size=%ld, class=%d, pri=%ld, nrcpts=%d, msgid=%.100s", 386 e->e_from.q_paddr, e->e_msgsize, e->e_class, 387 e->e_msgpriority, e->e_nrcpts, msgid); 388 syslog(LOG_INFO, "%s: %s, received from %s", 389 e->e_id, sbuf, name); 390 } 391 # endif /* LOG */ 392 } 393 /* 394 ** PRIENCODE -- encode external priority names into internal values. 395 ** 396 ** Parameters: 397 ** p -- priority in ascii. 398 ** 399 ** Returns: 400 ** priority as a numeric level. 401 ** 402 ** Side Effects: 403 ** none. 404 */ 405 406 priencode(p) 407 char *p; 408 { 409 register int i; 410 411 for (i = 0; i < NumPriorities; i++) 412 { 413 if (!strcasecmp(p, Priorities[i].pri_name)) 414 return (Priorities[i].pri_val); 415 } 416 417 /* unknown priority */ 418 return (0); 419 } 420 /* 421 ** CRACKADDR -- parse an address and turn it into a macro 422 ** 423 ** This doesn't actually parse the address -- it just extracts 424 ** it and replaces it with "$g". The parse is totally ad hoc 425 ** and isn't even guaranteed to leave something syntactically 426 ** identical to what it started with. However, it does leave 427 ** something semantically identical. 428 ** 429 ** This algorithm has been cleaned up to handle a wider range 430 ** of cases -- notably quoted and backslash escaped strings. 431 ** This modification makes it substantially better at preserving 432 ** the original syntax. 433 ** 434 ** Parameters: 435 ** addr -- the address to be cracked. 436 ** 437 ** Returns: 438 ** a pointer to the new version. 439 ** 440 ** Side Effects: 441 ** none. 442 ** 443 ** Warning: 444 ** The return value is saved in local storage and should 445 ** be copied if it is to be reused. 446 */ 447 448 char * 449 crackaddr(addr) 450 register char *addr; 451 { 452 register char *p; 453 register char c; 454 int cmtlev; 455 int realcmtlev; 456 int anglelev, realanglelev; 457 int copylev; 458 bool qmode; 459 bool realqmode; 460 bool skipping; 461 bool putgmac = FALSE; 462 bool quoteit = FALSE; 463 register char *bp; 464 char *buflim; 465 static char buf[MAXNAME]; 466 467 if (tTd(33, 1)) 468 printf("crackaddr(%s)\n", addr); 469 470 /* strip leading spaces */ 471 while (*addr != '\0' && isascii(*addr) && isspace(*addr)) 472 addr++; 473 474 /* 475 ** Start by assuming we have no angle brackets. This will be 476 ** adjusted later if we find them. 477 */ 478 479 bp = buf; 480 buflim = &buf[sizeof buf - 5]; 481 p = addr; 482 copylev = anglelev = realanglelev = cmtlev = realcmtlev = 0; 483 qmode = realqmode = FALSE; 484 485 while ((c = *p++) != '\0') 486 { 487 /* 488 ** If the buffer is overful, go into a special "skipping" 489 ** mode that tries to keep legal syntax but doesn't actually 490 ** output things. 491 */ 492 493 skipping = bp >= buflim; 494 495 if (copylev > 0 && !skipping) 496 *bp++ = c; 497 498 /* check for backslash escapes */ 499 if (c == '\\') 500 { 501 if ((c = *p++) == '\0') 502 { 503 /* too far */ 504 p--; 505 goto putg; 506 } 507 if (copylev > 0 && !skipping) 508 *bp++ = c; 509 goto putg; 510 } 511 512 /* check for quoted strings */ 513 if (c == '"') 514 { 515 qmode = !qmode; 516 if (copylev > 0 && !skipping) 517 realqmode = !realqmode; 518 continue; 519 } 520 if (qmode) 521 goto putg; 522 523 /* check for comments */ 524 if (c == '(') 525 { 526 cmtlev++; 527 528 /* allow space for closing paren */ 529 if (!skipping) 530 { 531 buflim--; 532 realcmtlev++; 533 if (copylev++ <= 0) 534 { 535 *bp++ = ' '; 536 *bp++ = c; 537 } 538 } 539 } 540 if (cmtlev > 0) 541 { 542 if (c == ')') 543 { 544 cmtlev--; 545 copylev--; 546 if (!skipping) 547 { 548 realcmtlev--; 549 buflim++; 550 } 551 } 552 continue; 553 } 554 else if (c == ')') 555 { 556 /* syntax error: unmatched ) */ 557 if (!skipping) 558 bp--; 559 } 560 561 562 /* check for characters that may have to be quoted */ 563 if (strchr(".'@,;:\\()", c) != NULL) 564 { 565 /* 566 ** If these occur as the phrase part of a <> 567 ** construct, but are not inside of () or already 568 ** quoted, they will have to be quoted. Note that 569 ** now (but don't actually do the quoting). 570 */ 571 572 if (cmtlev <= 0 && !qmode) 573 quoteit = TRUE; 574 } 575 576 /* check for angle brackets */ 577 if (c == '<') 578 { 579 register char *q; 580 581 /* oops -- have to change our mind */ 582 anglelev++; 583 if (!skipping) 584 realanglelev++; 585 586 bp = buf; 587 if (quoteit) 588 { 589 *bp++ = '"'; 590 591 /* back up over the '<' and any spaces */ 592 --p; 593 while (isascii(*--p) && isspace(*p)) 594 continue; 595 p++; 596 } 597 for (q = addr; q < p; ) 598 { 599 c = *q++; 600 if (bp < buflim) 601 { 602 if (quoteit && c == '"') 603 *bp++ = '\\'; 604 *bp++ = c; 605 } 606 } 607 if (quoteit) 608 { 609 *bp++ = '"'; 610 while ((c = *p++) != '<') 611 { 612 if (bp < buflim) 613 *bp++ = c; 614 } 615 *bp++ = c; 616 } 617 copylev = 0; 618 putgmac = quoteit = FALSE; 619 continue; 620 } 621 622 if (c == '>') 623 { 624 if (anglelev > 0) 625 { 626 anglelev--; 627 if (!skipping) 628 { 629 realanglelev--; 630 buflim++; 631 } 632 } 633 else if (!skipping) 634 { 635 /* syntax error: unmatched > */ 636 if (copylev > 0) 637 bp--; 638 continue; 639 } 640 if (copylev++ <= 0) 641 *bp++ = c; 642 continue; 643 } 644 645 /* must be a real address character */ 646 putg: 647 if (copylev <= 0 && !putgmac) 648 { 649 *bp++ = MACROEXPAND; 650 *bp++ = 'g'; 651 putgmac = TRUE; 652 } 653 } 654 655 /* repair any syntactic damage */ 656 if (realqmode) 657 *bp++ = '"'; 658 while (realcmtlev-- > 0) 659 *bp++ = ')'; 660 while (realanglelev-- > 0) 661 *bp++ = '>'; 662 *bp++ = '\0'; 663 664 if (tTd(33, 1)) 665 printf("crackaddr=>`%s'\n", buf); 666 667 return (buf); 668 } 669 /* 670 ** PUTHEADER -- put the header part of a message from the in-core copy 671 ** 672 ** Parameters: 673 ** fp -- file to put it on. 674 ** m -- mailer to use. 675 ** e -- envelope to use. 676 ** 677 ** Returns: 678 ** none. 679 ** 680 ** Side Effects: 681 ** none. 682 */ 683 684 /* 685 * Macro for fast max (not available in e.g. DG/UX, 386/ix). 686 */ 687 #ifndef MAX 688 # define MAX(a,b) (((a)>(b))?(a):(b)) 689 #endif 690 691 putheader(fp, m, e) 692 register FILE *fp; 693 register MAILER *m; 694 register ENVELOPE *e; 695 { 696 char buf[MAX(MAXLINE,BUFSIZ)]; 697 register HDR *h; 698 char obuf[MAXLINE]; 699 700 for (h = e->e_header; h != NULL; h = h->h_link) 701 { 702 register char *p; 703 extern bool bitintersect(); 704 705 if (bitset(H_CHECK|H_ACHECK, h->h_flags) && 706 !bitintersect(h->h_mflags, m->m_flags)) 707 continue; 708 709 /* handle Resent-... headers specially */ 710 if (bitset(H_RESENT, h->h_flags) && !bitset(EF_RESENT, e->e_flags)) 711 continue; 712 713 p = h->h_value; 714 if (bitset(H_DEFAULT, h->h_flags)) 715 { 716 /* macro expand value if generated internally */ 717 expand(p, buf, &buf[sizeof buf], e); 718 p = buf; 719 if (p == NULL || *p == '\0') 720 continue; 721 } 722 723 if (bitset(H_FROM|H_RCPT, h->h_flags)) 724 { 725 /* address field */ 726 bool oldstyle = bitset(EF_OLDSTYLE, e->e_flags); 727 728 if (bitset(H_FROM, h->h_flags)) 729 oldstyle = FALSE; 730 commaize(h, p, fp, oldstyle, m, e); 731 } 732 else 733 { 734 /* vanilla header line */ 735 register char *nlp; 736 extern char *capitalize(); 737 738 (void) sprintf(obuf, "%s: ", capitalize(h->h_field)); 739 while ((nlp = strchr(p, '\n')) != NULL) 740 { 741 *nlp = '\0'; 742 (void) strcat(obuf, p); 743 *nlp = '\n'; 744 putline(obuf, fp, m); 745 p = ++nlp; 746 obuf[0] = '\0'; 747 } 748 (void) strcat(obuf, p); 749 putline(obuf, fp, m); 750 } 751 } 752 } 753 /* 754 ** COMMAIZE -- output a header field, making a comma-translated list. 755 ** 756 ** Parameters: 757 ** h -- the header field to output. 758 ** p -- the value to put in it. 759 ** fp -- file to put it to. 760 ** oldstyle -- TRUE if this is an old style header. 761 ** m -- a pointer to the mailer descriptor. If NULL, 762 ** don't transform the name at all. 763 ** e -- the envelope containing the message. 764 ** 765 ** Returns: 766 ** none. 767 ** 768 ** Side Effects: 769 ** outputs "p" to file "fp". 770 */ 771 772 commaize(h, p, fp, oldstyle, m, e) 773 register HDR *h; 774 register char *p; 775 FILE *fp; 776 bool oldstyle; 777 register MAILER *m; 778 register ENVELOPE *e; 779 { 780 register char *obp; 781 int opos; 782 bool firstone = TRUE; 783 char obuf[MAXLINE + 3]; 784 extern char *capitalize(); 785 786 /* 787 ** Output the address list translated by the 788 ** mailer and with commas. 789 */ 790 791 if (tTd(14, 2)) 792 printf("commaize(%s: %s)\n", h->h_field, p); 793 794 obp = obuf; 795 (void) sprintf(obp, "%s: ", capitalize(h->h_field)); 796 opos = strlen(h->h_field) + 2; 797 obp += opos; 798 799 /* 800 ** Run through the list of values. 801 */ 802 803 while (*p != '\0') 804 { 805 register char *name; 806 register int c; 807 char savechar; 808 extern char *remotename(); 809 extern char *DelimChar; /* defined in prescan */ 810 811 /* 812 ** Find the end of the name. New style names 813 ** end with a comma, old style names end with 814 ** a space character. However, spaces do not 815 ** necessarily delimit an old-style name -- at 816 ** signs mean keep going. 817 */ 818 819 /* find end of name */ 820 while ((isascii(*p) && isspace(*p)) || *p == ',') 821 p++; 822 name = p; 823 for (;;) 824 { 825 char *oldp; 826 char pvpbuf[PSBUFSIZE]; 827 extern bool isatword(); 828 extern char **prescan(); 829 830 (void) prescan(p, oldstyle ? ' ' : ',', pvpbuf); 831 p = DelimChar; 832 833 /* look to see if we have an at sign */ 834 oldp = p; 835 while (*p != '\0' && isascii(*p) && isspace(*p)) 836 p++; 837 838 if (*p != '@' && !isatword(p)) 839 { 840 p = oldp; 841 break; 842 } 843 p += *p == '@' ? 1 : 2; 844 while (*p != '\0' && isascii(*p) && isspace(*p)) 845 p++; 846 } 847 /* at the end of one complete name */ 848 849 /* strip off trailing white space */ 850 while (p >= name && 851 ((isascii(*p) && isspace(*p)) || *p == ',' || *p == '\0')) 852 p--; 853 if (++p == name) 854 continue; 855 savechar = *p; 856 *p = '\0'; 857 858 /* translate the name to be relative */ 859 name = remotename(name, m, bitset(H_FROM, h->h_flags), 860 TRUE, FALSE, e); 861 if (*name == '\0') 862 { 863 *p = savechar; 864 continue; 865 } 866 867 /* output the name with nice formatting */ 868 opos += strlen(name); 869 if (!firstone) 870 opos += 2; 871 if (opos > 78 && !firstone) 872 { 873 (void) strcpy(obp, ",\n"); 874 putline(obuf, fp, m); 875 obp = obuf; 876 (void) sprintf(obp, " "); 877 opos = strlen(obp); 878 obp += opos; 879 opos += strlen(name); 880 } 881 else if (!firstone) 882 { 883 (void) sprintf(obp, ", "); 884 obp += 2; 885 } 886 887 /* strip off quote bits as we output */ 888 while ((c = *name++) != '\0' && obp < &obuf[MAXLINE]) 889 { 890 if (bitnset(M_7BITS, m->m_flags)) 891 c &= 0177; 892 *obp++ = c; 893 } 894 firstone = FALSE; 895 *p = savechar; 896 } 897 (void) strcpy(obp, "\n"); 898 putline(obuf, fp, m); 899 } 900 /* 901 ** ISATWORD -- tell if the word we are pointing to is "at". 902 ** 903 ** Parameters: 904 ** p -- word to check. 905 ** 906 ** Returns: 907 ** TRUE -- if p is the word at. 908 ** FALSE -- otherwise. 909 ** 910 ** Side Effects: 911 ** none. 912 */ 913 914 bool 915 isatword(p) 916 register char *p; 917 { 918 extern char lower(); 919 920 if (lower(p[0]) == 'a' && lower(p[1]) == 't' && 921 p[2] != '\0' && isascii(p[2]) && isspace(p[2])) 922 return (TRUE); 923 return (FALSE); 924 } 925