ARGSUSED*/
| 484 | |
| 485 | /*ARGSUSED*/ |
| 486 | void |
| 487 | readmail(struct obj *otmp UNUSED) |
| 488 | { |
| 489 | int i; |
| 490 | enum delivery_types delivery = normal_delivery; |
| 491 | const char *recipient = 0; |
| 492 | static const char *const junk_templates[] = { |
| 493 | "%sReport bugs to <%s>.%s", /*** must be first entry ***/ |
| 494 | "Please disregard previous letter.", |
| 495 | "Welcome to NetHack.", |
| 496 | #ifdef AMIGA |
| 497 | "Only Amiga makes it possible.", |
| 498 | "CATS have all the answers.", |
| 499 | #endif |
| 500 | "This mail complies with the Yendorian Anti-Spam Act (YASA)", |
| 501 | "Please find enclosed a small token to represent your Owlbear", |
| 502 | "**FR33 P0T10N 0F FULL H34L1NG**", |
| 503 | "Please return to sender (Asmodeus)", |
| 504 | /* when enclosed by "It reads: \"...\"", this is too long |
| 505 | for an ordinary 80-column display so wraps to a second line |
| 506 | (suboptimal but works correctly); |
| 507 | dollar sign and fractional zorkmids are inappropriate within |
| 508 | nethack but are suitable for typical dysfunctional spam mail */ |
| 509 | ("Buy a potion of gain level for only $19.99! " |
| 510 | " Guaranteed to be blessed!"), |
| 511 | /* DEVTEAM_URL will be substituted for 2nd "%s"; |
| 512 | terminating punctuation (formerly "!") has deliberately been |
| 513 | omitted so that it can't be mistaken for part of the URL |
| 514 | (unfortunately that is still followed by a closing quote--in |
| 515 | the pline below, not the data here) */ |
| 516 | "%sInvitation: Visit the NetHack web site at %s%s" |
| 517 | }; |
| 518 | const char *const it_reads = "It reads: \""; |
| 519 | |
| 520 | i = rn2(SIZE(junk_templates)); |
| 521 | if (strchr(junk_templates[i], '%')) { |
| 522 | if (i == 0) { |
| 523 | recipient = DEVTEAM_EMAIL; |
| 524 | delivery = subst_delivery; |
| 525 | } else if (strstri(junk_templates[i], "web site")) { |
| 526 | recipient = DEVTEAM_URL; |
| 527 | delivery = subst_delivery; |
| 528 | } else { |
| 529 | impossible("fake mail #%d has undefined substitution", i); |
| 530 | delivery = faulty_delivery; |
| 531 | } |
| 532 | } |
| 533 | if (Blind) { |
| 534 | pline("Unfortunately you cannot see what it says."); |
| 535 | } else { |
| 536 | if (delivery == subst_delivery) |
| 537 | pline(junk_templates[i], it_reads, recipient, "\""); |
| 538 | else if (delivery == normal_delivery) |
| 539 | pline("%s%s\"", it_reads, junk_templates[i]); |
| 540 | } |
| 541 | } |
| 542 | |
| 543 | RESTORE_WARNING_FORMAT_NONLITERAL |
no test coverage detected