1: /*
   2:  *   This program will read its standard input (a C program) and write it
   3:  * back out to the standard output translating words found in C strings in
   4:  * that input via the following translation table (trans).  If a word is not
   5:  * found in the translation table, it will be passed on unchanged.
   6:  *
   7:  *  Note that `words' are considered to be delimited by any non-alphabetic
   8:  * character or the beginning or end of the string in which it resides.
   9:  *
  10:  *   Example:  "aid" is matched in the string "Do you need aid?" but not in
  11:  * the string "I'll send in the maid".
  12:  *
  13:  *   Example:  "are not" is found in the string "You are not right!"
  14:  */
  15: 
  16: #include  <stdio.h>
  17: #include  <ctype.h>
  18: 
  19: typedef  struct  { char  *word, *crypt;
  20:                  }
  21:   trans;
  22: 
  23: 
  24: trans  trtab[] =
  25:   { "You can't reach the floor!",
  26:     "You can't reach the floor.",   /* xstr */
  27: 
  28:     "You turn to stone ...",
  29:     "You turn to stone.",       /* xstr */
  30: 
  31:     "fatal mistake ...",
  32:     "fatal mistake.",       /* xstr */
  33: 
  34:     "Cannot open %s .",
  35:     "Cannot open %s.",      /* xstr */
  36: 
  37:     "A mysterious force prevents you from going %s.",   "%s?",
  38:     "Probably someone removed it.",         "rmvd?",
  39:     "Strange... I didnt know you had that ring.",   "rng?",
  40:     "Something is written in a very strange way.",  "bd eng?",
  41:     "No used-up objects on the shopping bill.", "invnt?",
  42:     "Strange, this map is not as I remember it.",   "map?",
  43:     "Somebody is trying some trickery here ...",    "tilt!",
  44:     "This game is void ...",            "barf!",
  45:     "What a funny potion! (%u)",            "potion(%u)?",
  46:     "onbill: paid obj on bill?",            "bill?",
  47:     "onbill: unpaid obj not on bill?",      "bill?",
  48:     "obfree: not on bill??",            "bill?",
  49:     "splitbill: not on bill?",          "bill?",
  50:     "Negative quantity on bill??",          "bill?",
  51:     "Zero quantity on bill??",          "bill?",
  52:     "doinvbill: no shopkeeper?",            "bill?",
  53:     "Unknown direction",                "dir",
  54:     "Steal fails!",                 "steal?",
  55:     "Tried to steal a strange worn thing.",     "steal?",
  56:     "How come you are carrying that chain?",    "steal?",
  57:     "You hit a trap of type %u",            "trap(%u)?",
  58:     "Some monster encountered a strange trap.", "trap?",
  59:     "Where are your chain and ball??",      "trap?",
  60:     "Not a single corridor on this level??",    "vault?",
  61:     "Where is the guard?",              "vault?",
  62:     "fakecorr overflow",                "vault?",
  63:     "Do_oname: cannot find obj.",           "Do_name?",
  64:     "Perhaps there is an old record_lock around",   "ld rclk",
  65:     "Waiting for access to record file",        "Wtng",
  66:     "Cannot open record file!",         "opn?",
  67:     "Cannot write record file",         "wrt?",
  68:     "Cannot find any entries for",          "Ct fnd",
  69:     "Error in del_engr",                "del_engr",
  70:     "error in freeobj",             "freeobj?",
  71:     "error in freegold",                "freegold?",
  72:     "Read %d instead of %u bytes",          "rd %d != %u",
  73:     "Error restoring old game.",            "rstr gm?",
  74:     "Error reading level file.",            "lvl fl?",
  75:     "DOORMAX exceeded",             "D*MAX",
  76:     "rooms not closed by -1",           "cls rms",
  77:     "Not enough gems",              "Gms",
  78:     "WARNING: prefix too short.",           "prfx?",
  79:     "Cannot open data file!",           "data?",
  80:     "sh: cannot execute.",              "sh?",
  81:     "Fork failed. Try again.",          "Fork!",
  82:     "Cannot open %s.",              "%s?",
  83:     "Cannot open save file. (Continue or Quit)",    "bd fl",
  84:     "Error while saving: cannot read %s.",      "%s?",
  85:     "Saved game was not yours.",            "Nt urs",
  86:     "Cannot open temp file %s!",            "%s?",
  87:     "Cannot find the iron chain?",          "chain?",
  88:     "Cannot find the iron ball?",           "ball?",
  89:     "Cannot find the monster ustuck.",      "ustuck?",
  90:     "Restobjchn: error reading objchn.",        "objchn?",
  91:     "Restmonchn: error reading monchn.",        "monchn?",
  92:     "Shopkeeper administration out of order.",  "Shpkpr?",
  93:     "Error in shopkeeper administration.",      "Shpkpr?",
  94:     "Bad shopkeeper administration.",       "Shpkpr?",
  95:     "Can't get TERM.",              "TERM?",
  96:     "Unknown terminal type: %s.",           "%s?",
  97:     "Hack needs a screen of size at least %d by %d.",   "bad term!",
  98:     "Terminal must backspace.",         "bad term!",
  99:     "Hack needs CL.",               "bad term!",
 100:     "Hack can't have OS.",              "bad term!",
 101:     "Hack needs CM or UP or HO.",           "bad term!",
 102:     "Playing hack on terminals without cm is suspect...",   "bad term!",
 103:     "TERMCAP entry too big...",         "bad term!",
 104:     "Cannot get status of %s.",         "%s?",
 105:     "Cannot get status of saved level?",        "lvl fl?",
 106:     "Saved levels out of date.",            "lvl fl?",
 107:     "Cannot link %s to %s",             "%s-%s?",
 108:     "Perhaps there is no (empty) file %s ?",    "%s?",
 109:     "It seems you don't have write permission here.",   "wrt?",
 110:     "(Try again or remove %s.)",            "%s?",
 111:     "I don't know what is wrong.",          "?",
 112:     "Cannot open %s",               "%s?",
 113:     "Too many hacks running now.",          "#?",
 114:     "There is a game in progress under your name.", "In progress!",
 115:     "Cannot unlink %s.",                "%s?",
 116:     "cannot creat lock file.",          "lock?",
 117:     "cannot write lock",                "lock?",
 118:     "cannot close lock",                "lock?",
 119:     "Not a single corridor on this level??",    "corr?",
 120:     "Cannot find worm segment",         "worm?",
 121:     "Cannot reallocate %d bytes",           "realloc %d?",
 122: 
 123:     "a funny",                  "an odd",
 124:     "a peculiar",                   "an odd",
 125:     "a strange",                    "an odd",
 126: 
 127:     "Be seeing you",                "Bcnu",
 128:     "Restoring old save file",          "uncB",
 129:     "Worthless piece of",               "Worthless",
 130: 
 131:     "Are",          "R",
 132:     "are",          "r",
 133:     "Can",          "Cn",
 134:     "can",          "cn",
 135:     "Not",          "Nt",
 136:     "not",          "nt",
 137:     "You",          "U",
 138:     "you",          "u",
 139: 
 140:     "Aren't",       "Nt",
 141:     "aren't",       "rnt",
 142:     "R nt",         "Rnt",
 143:     "r nt",         "rnt",
 144:     "Cannot",       "Ct",
 145:     "cannot",       "ct",
 146:     "Cn nt",        "Ct",
 147:     "cn nt",        "ct",
 148:     "Cn't",         "Ct",
 149:     "cn't",         "ct",
 150: 
 151:     "U r",          "U'r",
 152:     "u r",          "u'r",
 153:     "U're",         "U'r",
 154:     "u're",         "u'r",
 155:     "U rnt",        "U'rnt",
 156:     "u rnt",        "u'rnt",
 157:     "U'r nt",       "U'rnt",
 158:     "u'r nt",       "u'rnt",
 159:     "have",         "hv",
 160:     "having",       "hvng",
 161:     "hv nt",        "hvnt",
 162:     "haven't",      "hvnt",
 163:     "I hv",         "Iv",
 164:     "I've",         "Iv",
 165:     "U hv",         "Uv",
 166:     "u hv",         "uv",
 167:     "U've",         "Uv",
 168:     "u've",         "uv",
 169:     "Your",         "Ur",
 170:     "your",         "ur",
 171:     "yourself",     "urslf",
 172: 
 173:     "Did nt",       "Dt",
 174:     "did nt",       "dt",
 175:     "Didn't",       "Dt",
 176:     "didn't",       "dt",
 177:     "didnt",        "dt",
 178:     "Do",           "D",
 179:     "do",           "d",
 180:     "D nt",         "Dt",
 181:     "d nt",         "dt",
 182:     "Don't",        "Dt",
 183:     "don't",        "dt",
 184:     "Does nt",      "Dsnt",
 185:     "does nt",      "dsnt",
 186:     "Doesn't",      "Dsnt",
 187:     "doesn't",      "dsnt",
 188: 
 189:     "I am",         "Im",
 190:     "It is",        "Ts",
 191:     "it is",        "ts",
 192:     "There is",     "Trs",
 193:     "there is",     "trs",
 194:     "Will nt",      "Wnt",
 195:     "will nt",      "wnt",
 196:     "Won't",        "Wnt",
 197:     "won't",        "wnt",
 198: 
 199:     "U'rnt",        "Nt",
 200:     "U cnt",        "Ct",
 201:     "U dnt",        "Dt",
 202:     "Uv nt",        "Uvnt",
 203:     "uv nt",        "uvnt",
 204:     "U hvnt",       "Uvnt",
 205:     "u hvnt",       "uvnt",
 206:     "U dropped",        "Dropped",
 207:     "U finished ur",    "Finished",
 208:     "U finished",       "Finished",
 209:     "U'r already",      "Already",
 210:     "U'r carrying",     "Carrying",
 211: 
 212:     "able",         "abl",
 213:     "aborted",      "abrtd",
 214:     "about",        "abt",
 215:     "above",        "abv",
 216:     "accepts",      "acpts",
 217:     "administration",   "admn",
 218:     "affect",       "fct",
 219:     "affected",     "fctd",
 220:     "against",      "gnst",
 221:     "again",        "gn",
 222:     "allowed",      "llwd",
 223:     "almost",       "lmst",
 224:     "Already",      "Lrdy",
 225:     "already",      "lrdy",
 226:     "And",          "N",
 227:     "and",          "n",
 228:     "anymore",      "ymr",
 229:     "any",          "y",
 230:     "Anything",     "Yth",
 231:     "anything",     "yth",
 232:     "appears",      "sms",
 233:     "armor",        "rmr",
 234:     "around",       "rnd",
 235:     "assorted",     "ass",
 236:     "At",           "@",
 237:     "at",           "@",
 238:     "ate",          "8",
 239:     "awake",        "wk",
 240:     "awakens",      "wkns",
 241:     "away",         "awy",
 242:     "Bad",          "Bd",
 243:     "bad",          "bd",
 244:     "back",         "bk",
 245:     "backpack",     "bkpk",
 246:     "backspace",        "bksp",
 247:     "ball",         "bl",
 248:     "be",           "b",
 249:     "because",      "bcs",
 250:     "becomes",      "bcms",
 251:     "been",         "bn",
 252:     "before",       "bfr",
 253:     "begin",        "bgn",
 254:     "beginning",        "bgng",
 255:     "behind",       "bhnd",
 256:     "Being",        "Bng",
 257:     "being",        "bng",
 258:     "better",       "btr",
 259:     "between",      "btwn",
 260:     "beautiful",        "cute",
 261:     "befalls",      "bfls",
 262:     "blast",        "blst",
 263:     "blinded",      "blndd",
 264:     "blind",        "blnd",
 265:     "blob",         "blb",
 266:     "blown",        "blwn",
 267:     "bolt",         "blt",
 268:     "boolean",      "bool",
 269:     "bottle",       "btl",
 270:     "breaks",       "brks",
 271:     "burn",         "brn",
 272:     "burned",       "brnd",
 273:     "burning",      "brng",
 274:     "But",          "Bt",
 275:     "but",          "bt",
 276:     "cadaver",      "bdy",
 277:     "Carrying",     "Crryng",
 278:     "carrying",     "crryng",
 279:     "carry",        "crry",
 280:     "ceiling",      "clng",
 281:     "chain",        "chn",
 282:     "choose",       "pck",
 283:     "climb",        "clmb",
 284:     "closed",       "clsd",
 285:     "closes",       "clses",
 286:     "close",        "cls",
 287:     "cold",         "cld",
 288:     "coloured",     "clrd",
 289:     "command",      "cmd",
 290:     "confused",     "cnfsd",
 291:     "confuse",      "cnfs",
 292:     "confusion",        "cnfsn",
 293:     "contains",     "hlds",
 294:     "Continue",     "Cont",
 295:     "continue",     "cont",
 296:     "contribution",     "gft",
 297:     "control",      "ctl",
 298:     "corridor",     "corr",
 299:     "course",       "crse",
 300:     "crashes",      "crshs",
 301:     "darker",       "drkr",
 302:     "darkness",     "drknss",
 303:     "dark",         "drk",
 304:     "dead",         "dd",
 305:     "defend",       "dfnd",
 306:     "delicatessen",     "deli",
 307:     "description",      "dscr",
 308:     "detection",        "dt",
 309:     "device",       "dv",
 310:     "digging",      "dgng",
 311:     "dig",          "dg",
 312:     "direction",        "dir",
 313:     "directory",        "drctry",
 314:     "disappears",       "dsprs",
 315:     "discovered",       "dscvrd",
 316:     "distance",     "dist",
 317:     "disturbed",        "dstrbd",
 318:     "door",         "dr",
 319:     "downward",     "dnwrd",
 320:     "down",         "dn",
 321:     "drop",         "drp",
 322:     "Dropped",      "Drpd",
 323:     "dropped",      "drpd",
 324:     "dungeon",      "dngn",
 325:     "effort",       "eff",
 326:     "else",         "els",
 327:     "empty",        "mt",
 328:     "enchant",      "ncht",
 329:     "enormous",     "bg",
 330:     "enough",       "nf",
 331:     "enters",       "ntrs",
 332:     "Error",        "Er",
 333:     "error",        "er",
 334:     "escaped",      "escpd",
 335:     "escape",       "escp",
 336:     "evaporate",        "dry",
 337:     "evaporates",       "drys",
 338:     "Everything",       "Evrth",
 339:     "everything",       "evrth",
 340:     "example",      "xmpl",
 341:     "exist",        "xst",
 342:     "expences",     "xpncs",
 343:     "experienced",      "xprncd",
 344:     "experience",       "xprnc",
 345:     "Falling",      "Fllng",
 346:     "falling",      "fllng",
 347:     "falls",        "flls",
 348:     "fall",         "fll",
 349:     "feeling",      "flng",
 350:     "feels",        "fls",
 351:     "feel",         "fl",
 352:     "feet",         "ft",
 353:     "File",         "Fl",
 354:     "file",         "fl",
 355:     "finds",        "fnds",
 356:     "find",         "fnd",
 357:     "fingers",      "fngrs",
 358:     "fingertips",       "fngrtps",
 359:     "finger",       "fngr",
 360:     "Finished",     "Fnshd",
 361:     "finished",     "fnshd",
 362:     "first",        "1st",
 363:     "flash",        "flsh",
 364:     "flask",        "flsk",
 365:     "float",        "flt",
 366:     "floating",     "fltng",
 367:     "floor",        "flr",
 368:     "followed",     "fllwd",
 369:     "follow",       "fllw",
 370:     "food",         "fd",
 371:     "Fortunately",      "4tntly",
 372:     "For",          "4",
 373:     "for",          "4",
 374:     "from",         "fr",
 375:     "frozen",       "frzn",
 376:     "funny",        "odd",
 377:     "gets",         "gts",
 378:     "get",          "gt",
 379:     "gift",         "gft",
 380:     "give",         "gv",
 381:     "gladly",       "gldly",
 382:     "glass",        "glss",
 383:     "gloves",       "glvs",
 384:     "glowing",      "glwng",
 385:     "glows",        "glws",
 386:     "glow",         "glw",
 387:     "gold",         "gld",
 388:     "great",        "grt",
 389:     "greedy",       "grdy",
 390:     "guards",       "grds",
 391:     "guard",        "grd",
 392:     "had",          "hd",
 393:     "half",         "hlf",
 394:     "handed",       "hndd",
 395:     "hands",        "hnds",
 396:     "hand",         "hnd",
 397:     "Happens",      "Hpns",
 398:     "happens",      "hpns",
 399:     "hard",         "hrd",
 400:     "has",          "hs",
 401:     "head",         "hd",
 402:     "heavier",      "hvyr",
 403:     "heavy",        "hvy",
 404:     "%sheavy",      "%shvy",
 405:     "held",         "hld",
 406:     "Hello",        "Hi",
 407:     "helmet",       "hlmt",
 408:     "helping",      "hlpng",
 409:     "helps",        "hlps",
 410:     "Here",         "Hr",
 411:     "here",         "hr",
 412:     "hidden",       "hddn",
 413:     "Hit",          "Ht",
 414:     "hit",          "ht",
 415:     "hits",         "hts",
 416:     "holding",      "hldng",
 417:     "However",      "Hwvr",
 418:     "How",          "Hw",
 419:     "how",          "hw",
 420:     "In",           "N",
 421:     "in",           "n",
 422:     "incantation",      "spl",
 423:     "individual",       "indiv",
 424:     "initialization",   "ini",
 425:     "inside",       "nsd",
 426:     "instructions",     "instrs",
 427:     "interested",       "hep",
 428:     "Interesting...",   "Hmm...",
 429:     "interesting",      "fun",
 430:     "into",         "n2",
 431:     "inventory",        "nvnt",
 432:     "Is",           "S",
 433:     "is",           "s",
 434:     "items",        "itms",
 435:     "itself",       "itslf",
 436:     "kind",         "knd",
 437:     "know",         "kn",
 438:     "labeled",      "lbld",
 439:     "label",        "lbl",
 440:     "language",     "lang",
 441:     "large",        "lrg",
 442:     "leave",        "lv",
 443:     "leaving",      "lvng",
 444:     "Left",         "Lft",
 445:     "left",         "lft",
 446:     "leg",          "lg",
 447:     "legs",         "lgs",
 448:     "Level",        "Lvl",
 449:     "level",        "lvl",
 450:     "lift",         "lft",
 451:     "lifting",      "lftng",
 452:     "likely",       "lkly",
 453:     "like",         "lk",
 454:     "list",         "lst",
 455:     "little",       "ltl",
 456:     "liquid",       "lqd",
 457:     "liquor",       "lqr",
 458:     "load",         "ld",
 459:     "look",         "lk",
 460:     "looking",      "lkng",
 461:     "looks",        "lks",
 462:     "longer",       "lngr",
 463:     "Long",         "Lng",
 464:     "long",         "lng",
 465:     "made",         "md",
 466:     "make",         "mk",
 467:     "makes",        "mks",
 468:     "many",         "mny",
 469:     "message",      "msg",
 470:     "missed",       "msd",
 471:     "misses",       "mses",
 472:     "miss",         "ms",
 473:     "mistake",      "mstk",
 474:     "moment",       "mmnt",
 475:     "money",        "bux",
 476:     "monsters",     "mons",
 477:     "monster",      "mon",
 478:     "Moreover",     "Mrvr",
 479:     "Most",         "Mst",
 480:     "moving",       "mvng",
 481:     "move",         "mv",
 482:     "much",         "mch",
 483:     "must",         "mst",
 484:     "Name",         "Nm",
 485:     "named",        "nmd",
 486:     "nearby",       "nrby",
 487:     "needs",        "nds",
 488:     "Negative",     "Ng",
 489:     "never",        "nvr",
 490:     "nobody",       "nbdy",
 491:     "Nothing",      "Nth",
 492:     "nothing",      "nth",
 493:     "Not",          "Nt",
 494:     "not",          "nt",
 495:     "notice",       "c",
 496:     "Now",          "Nw",
 497:     "now",          "nw",
 498:     "Number",       "#",
 499:     "number",       "#",
 500:     "objects",      "objs",
 501:     "object",       "obj",
 502:     "of",           "f",
 503:     "off",          "ff",
 504:     "one",          "1",
 505:     "only",         "nly",
 506:     "open",         "opn",
 507:     "opener",       "opnr",
 508:     "Opening",      "Opng",
 509:     "opening",      "opng",
 510:     "opens",        "opns",
 511:     "options",      "opts",
 512:     "option",       "opt",
 513:     "order",        "ordr",
 514:     "Outside",      "Otsd",
 515:     "outside",      "otsd",
 516:     "out",          "ot",
 517:     "overflow",     "vrfl",
 518:     "over",         "ovr",
 519:     "Paid",         "Pd",
 520:     "paid",         "pd",
 521:     "pair",         "pr",
 522:     "partially",        "prtly",
 523:     "parts",        "prts",
 524:     "part",         "prt",
 525:     "patterns",     "ptrns",
 526:     "pay",          "py",
 527:     "paying",       "pyng",
 528:     "payment",      "pymnt",
 529:     "peculiarly",       "odly",
 530:     "peculiar",     "od",
 531:     "Perhaps",      "Prhps",
 532:     "perhaps",      "prhps",
 533:     "Pick",         "Pk",
 534:     "pick",         "pk",
 535:     "picture",      "pc",
 536:     "pieces",       "pcs",
 537:     "piece",        "pc",
 538:     "place",        "plc",
 539:     "Please",       "Pls",
 540:     "please",       "pls",
 541:     "plundered",        "plndrd",
 542:     "points",       "pnts",
 543:     "poison",       "poisn",
 544:     "poisoned",     "poisnd",
 545:     "poisoning",        "poisng",
 546:     "poisonous",        "poisns",
 547:     "presence",     "prsnc",
 548:     "present",      "prsnt",
 549:     "Probably",     "Prb",
 550:     "probably",     "prb",
 551:     "pulls",        "pls",
 552:     "pull",         "pl",
 553:     "punished",     "pnshd",
 554:     "purse",        "prs",
 555:     "push",         "psh",
 556:     "put",          "pt",
 557:     "quantity",     "qan",
 558:     "quickly",      "qckly",
 559:     "Readonly",     "Rdnly",
 560:     "Read",         "Rd",
 561:     "reading",      "rdng",
 562:     "reads",        "rds",
 563:     "read",         "rd",
 564:     "really",       "rly",
 565:     "recently",     "rcntly",
 566:     "record_lock",      "rclk",
 567:     "refrigerate",      "frig",
 568:     "remove",       "rmv",
 569:     "removed",      "rmvd",
 570:     "renamed",      "rnmd",
 571:     "Right",        "Rt",
 572:     "right",        "rt",
 573:     "rings",        "rngs",
 574:     "ring",         "rng",
 575:     "rock",         "rk",
 576:     "rooms",        "rms",
 577:     "room",         "rm",
 578:     "safelock",     "sflk",
 579:     "satisfied",        "satsfied",
 580:     "scroll",       "scrl",
 581:     "scrolls",      "scrls",
 582:     "seems",        "sms",
 583:     "seem",         "sm",
 584:     "see",          "c",
 585:     "sense",        "sns",
 586:     "several",      "svrl",
 587:     "Shopkeeper",       "Shpkpr",
 588:     "shopkeeper",       "shpkpr",
 589:     "shopping",     "shpng",
 590:     "shop",         "shp",
 591:     "short",        "shrt",
 592:     "snatches",     "sntchs",
 593:     "Somebody",     "Smbdy",
 594:     "somebody",     "smbdy",
 595:     "Somehow",      "Smhw",
 596:     "Someone",      "Sm1",
 597:     "someone",      "sm1",
 598:     "Something",        "Sth",
 599:     "something",        "sth",
 600:     "somewhat",     "smwt",
 601:     "Some",         "Sm",
 602:     "some",         "sm",
 603:     "sound",        "snd",
 604:     "spins",        "spns",
 605:     "splashed",     "splshd",
 606:     "squeeze",      "sqz",
 607:     "start",        "strt",
 608:     "still",        "stl",
 609:     "stomach",      "gut",
 610:     "stone",        "stn",
 611:     "stranger",     "strgr",
 612:     "Strange",      "Od",
 613:     "strange",      "od",
 614:     "stuff",        "stf",
 615:     "Suddenly",     "Sdnly",
 616:     "suddenly",     "sdnly",
 617:     "sudden",       "sdn",
 618:     "sword",        "swd",
 619:     "takes",        "tks",
 620:     "take",         "tk",
 621:     "taking",       "tkng",
 622:     "teleported",       "tprtd",
 623:     "teleportation",    "tprtn",
 624:     "teleport",     "tprt",
 625:     "terminal",     "term",
 626:     "terminals",        "terms",
 627:     "Thank",        "Thnk",
 628:     "That",         "Th",
 629:     "that",         "th",
 630:     "them",         "tm",
 631:     "themselves",       "tmslvs",
 632:     "then",         "tn",
 633:     "There",        "Tr",
 634:     "there",        "tr",
 635:     "These",        "Tse",
 636:     "these",        "tse",
 637:     "The",          "T",
 638:     "the",          "t",
 639:     "Things",       "Tgs",
 640:     "things",       "tgs",
 641:     "thing",        "tg",
 642:     "Thinking",     "Thnkng",
 643:     "think",        "thnk",
 644:     "thin",         "thn",
 645:     "This",         "Ths",
 646:     "this",         "ths",
 647:     "thousand",     "1k",
 648:     "To",           "2",
 649:     "to",           "2",
 650:     "top",          "tp",
 651:     "Too",          "2",
 652:     "too",          "2",
 653:     "trap",         "trp",
 654:     "turned",       "trnd",
 655:     "turns",        "trns",
 656:     "turn",         "trn",
 657:     "two",          "2",
 658:     "Type",         "Typ",
 659:     "type",         "typ",
 660:     "under",        "ndr",
 661:     "Unfortunately",    "N4tntly",
 662:     "Unknown",      "Nkn",
 663:     "unknown",      "nkn",
 664:     "Unpaid",       "Npd",
 665:     "unpaid",       "npd",
 666:     "very",         "vry",
 667:     "wall",         "wl",
 668:     "want",         "wnt",
 669:     "Was",          "Ws",
 670:     "was",          "ws",
 671:     "water",        "h2o",
 672:     "way",          "wy",
 673:     "weapon",       "wpn",
 674:     "wear",         "wr",
 675:     "wearing",      "wrng",
 676:     "Welcome",      "Wlcm",
 677:     "welcome",      "wlcm",
 678:     "were",         "wr",
 679:     "What",         "Wt",
 680:     "what",         "wt",
 681:     "when",         "wn",
 682:     "Where",        "Wr",
 683:     "where",        "wr",
 684:     "while",        "wl",
 685:     "whistle",      "wstl",
 686:     "whistling",        "wstlng",
 687:     "why",          "y",
 688:     "Will",         "Wll",
 689:     "Will",         "Wll",
 690:     "will",         "wll",
 691:     "wipe",         "wp",
 692:     "wiped",        "wpd",
 693:     "without",      "w/o",
 694:     "With",         "Wth",
 695:     "with",         "/w",
 696:     "words",        "wrds",
 697:     "world",        "wrld",
 698:     "worth",        "wrth",
 699:     "worthless",        "wrthlss",
 700:     "write",        "wrt",
 701:     "writing",      "wrtng",
 702:     "written",      "wrtn",
 703:     "Zorkmids",     "Bux",
 704:     "zorkmids",     "bux",
 705:     0,          0
 706:   };
 707: 
 708: 
 709: main ()
 710: 
 711:   { register int   incomment   = 0,
 712:                    incharacter = 0;
 713:     register char  lastc       = '\0',
 714:                    c;
 715: 
 716:     while  ((c = getchar ()) != EOF)
 717:     {  putchar (c);
 718: 
 719:       if  (incomment)
 720:         incomment = !(lastc == '*'  &&  c == '/');
 721:       else
 722:       if  (incharacter)
 723:         if  (lastc == '\\'  &&  c == '\\')
 724:           c = '\0';    /* don't let '\\' fool us ... */
 725:         else
 726:           incharacter = !(lastc != '\\' &&  c == '\'');
 727:       else
 728:       if  (lastc == '/'  &&  c == '*')
 729:       { incomment = 1;
 730:         c         = '\0';    /* don't let `/ * / ...' fool us */
 731:       }
 732:       else if  (c == '\'')
 733:         incharacter = 1;
 734:       else
 735:         if  (c == '"')
 736:           dostring ();
 737: 
 738:       lastc = c;
 739:     }
 740: 
 741:     exit (0);
 742: }
 743: 
 744: 
 745: dostring ()
 746: 
 747:   { char            string[BUFSIZ];
 748:     register char   *cp;
 749:     register trans  *tp;
 750: 
 751:     getstring (string);
 752:     for  (tp = trtab;  tp->word;  tp++)
 753:       scanstring (string, tp->word, tp->crypt);
 754:     fputs (string, stdout);
 755:     putchar ('"');
 756:   }
 757: 
 758: 
 759: getstring (string)
 760:   register char  *string;
 761: 
 762:   { register char  lastc = '"',
 763:                    c;
 764: 
 765:     while  ((c = getchar ()) != EOF  &&  !(lastc != '\\'  &&  c == '"'))
 766:     { if  (lastc == '\\'  &&  c == '\n')
 767:         c     = getchar ();
 768:       *string++ = c;
 769:       if  (lastc == '\\'  &&  c == '\\')
 770:         c = '\0';    /* don't let `"...\\"' fool us */
 771:       lastc     = c;
 772:     }
 773:     *string = '\0';
 774:   }
 775: 
 776: 
 777: scanstring (string, word, crypt)
 778:   char  *string, *word, *crypt;
 779: 
 780:   { register int   wlen = strlen (word),
 781:                    clen = strlen (crypt);
 782:     register char  *cp  = string,
 783:                    *end;
 784: 
 785:     end = string + strlen (string) - wlen;
 786:     while  (cp <= end)
 787:       if  (    strncmp (cp, word, wlen) == 0
 788:            &&  (cp == string  ||  !isalpha (cp[-1]))
 789:            &&  (cp == end     ||  !isalpha (cp[wlen])))
 790:       { strncpy (cp, crypt, clen);
 791:         strcpy  (cp + clen, cp + wlen);
 792:         cp  += clen;
 793:         end -= wlen-clen;
 794:       }
 795:       else
 796:         cp++;
 797:   }

Defined functions

dostring defined in line 745; used 1 times
getstring defined in line 759; used 1 times
main defined in line 709; never used
scanstring defined in line 777; used 1 times
Last modified: 1986-05-06
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 2341
Valid CSS Valid XHTML 1.0 Strict