/* /////////////////////////////////////////////////////////////////////// // // // NADSAT v1.2 // // // // Original author: SKoT McDonald (v1.0, v1.1, v1.2) // // Date: 18.6.97 // // // // skot@cs.uwa.edu.au // // http://www.cs.uwa.edu/~skot // // // // Computer Music Group // // Department of Computer Science, // // University of Western Australia // // Perth, AUSTRALIA // // // // Three cheers to Anthony Burgess's "A Clockwork Orange"! // // This translation is mostly based on the glossary in the Penguin // // paper-back edition, ISBN 0 14 00.3219 3 (1972) // // // // Originally coded in Vis C, so excuse the C++ comments in what // // should be ansi-standard GCC compatible code. // // // /////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////// // If you wish to add to NADSAT, feel free to alter the code on // // a few conditions: // // // // 1) I remain acknowledged as original author, along with my email // // address, my web site address, and the quick blurb about my // // computer music project. (I use Nadsat to advertise! For some // // reason, a lot of Industrial music fans like A Clockwork Orange)// // Feel free to bump up the documentation as much as you like! // // // // 2) Any changes or improvements to the code are sent back to me // // so that I can incorporate them into the latest version being // // released. // // // // 3) The README file is distributed with the code / program - this // // is to minimise the number of people asking for basic help. // /////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////// // Suggestions for improvements: // // // // 1) Simple grammar capabilities to cope with common purals and 'ed'// // etc. (The original NADSAT v1.0 tried to add 'ed', 'ing' and 's'// // to any word where such equivalents were not in the list. This // // lead to spelling mistakes on occasion - so I opted for a brute // // force approach. Not pleasant at the best of times! // // // // 2) Ability to expand dictionary (or even read in a new one) from // // a file. // // // // 3) Command line option to expand the line buffer? // // // // 4) Ability to translate multiple files. // /////////////////////////////////////////////////////////////////////// */ #include #include #include #include /* /////////////////////////////////////////////////////////////////////// */ #ifndef BOOL #define BOOL int #endif #ifndef TRUE #define TRUE 1 #endif #ifndef FALSE #define FALSE 0 #endif /* /////////////////////////////////////////////////////////////////////// // The word list // // These are mainly from the glossary, with a few changes of tense and // similies of my own. A few other important phrases from the book I // have tried to squeeze in (like right right right). // // More needed! Send 'em in! /////////////////////////////////////////////////////////////////////// */ char* defList[][2] = { {"apology","appy polly loggy"}, {"apologise","appy polly loggy"}, {"old woman","baboochka"}, {"old women","baboochka"}, {"grandmother","baboochka"}, {"bad","baddiwad"}, {"evil","baddiwad"}, {"band","banda"}, {"mad","bezoomy"}, {"crazy","bezoomy"}, {"insane","bezoomy"}, {"library","biblio"}, {"libraries","biblioes"}, {"battle","bitva"}, {"war","bitva"}, {"god","bog"}, {"deity","bog"}, {"gods","bogs"}, {"sick","bolnoy"}, {"ill","bolnoy"}, {"big","bolshy"}, {"large","bolshy"}, {"great","bolshy"}, {"brother","bratty"}, {"sibling","brat"}, {"bastard","bratchny"}, {"bastards","bratchnies"}, {"razor","britva"}, {"razors","britvas"}, {"razored","britvaed"}, {"belly","brooko"}, {"bellies","brookos"}, {"tummy","brooko"}, {"tummies","brookos"}, {"throw","brosay"}, {"throwing","brosaying"}, {"chuck","brosay"}, {"chucking","brosaying"}, {"threw","brosayed"}, {"rich","bugatty"}, {"crap","cal"}, {"cigarette","cancer"}, {"ciggies","cancers"}, {"cigarettes","cancers"}, {"cigar","cancer"}, {"cigars","cancers"}, {"office","cantora"}, {"offices","cantoras"}, {"pocket","carman"}, {"pockets","carmans"}, {"tea","chai"}, {"chaplain","charlie"}, {"priest","charles"}, {"priests","charlies"}, {"cup","chasha"}, {"cups","chashas"}, {"guard","chasso"}, {"guarding","chassoing"}, {"guarded","chassoed"}, {"guards","chassos"}, {"warder","chasso"}, {"woman","cheena"}, {"women","cheenas"}, {"lady","cheena"}, {"ladies","cheenas"}, {"wash","cheest"}, {"washing","cheesting"}, {"washed","cheested"}, {"person","chelloveck"}, {"nonsense","chepooka"}, {"wonderful","choodessny"}, {"fantastic","choodessny"}, {"lovely","choodessny"}, {"mumble","chumble"}, {"mumbling","chumbling"}, {"mumbled","chumbling"}, {"mumbles","mumbles"}, {"knock","clop"}, {"knocking","clopping"}, {"knocked","clopped"}, {"bang","clop"}, {"banged","clopped"}, {"beak","cluve"}, /* as in judge, I think */ {"bell","collocoll"}, {"bells","collocolla"}, {"break","crack"}, {"broke","cracked"}, {"broken","cracked"}, {"howl","crark"}, {"howls","crarks"}, {"howling","crarking"}, {"howled","crarked"}, {"steal","crast"}, {"stole","crasted"}, {"stolen","crasted"}, {"stealing","crasting"}, {"scream","creech"}, {"screamed","creeched"}, {"screaming","creeching"}, {"money","cutter"}, {"lady","dama"}, {"ladies","damas"}, {"old man","ded"}, {"old men","deds"}, {"grandfather","ded"}, {"cash","deng"}, {"cashing","denging"}, {"cashed","denged"}, {"girl","devotchka"}, {"girls","devotchkas"}, {"good","dobby"}, {"ghost","dook"}, {"ghosts","dooks"}, {"trace","dook"}, {"house","domy"}, {"houses","domies"}, {"apartment","domy"}, {"apartments","domies"}, {"valuable","dorogoy"}, {"expensive","dorogoy"}, {"fighting","dratsing"}, {"fight","drat"}, {"fought","dratted"}, {"hashish","drencom"}, {"mull","drencom"}, {"marhijuana","drencom"}, {"friend","droog"}, {"friendly","droogy"}, {"friends","droogs"}, {"defecate","dung"}, {"shit","dung"}, {"poo","dung"}, {"faeces","dung"}, {"shat","dunged"}, {"shitted","dunged"}, {"shitting","dunging"}, {"two","dva"}, {"pair","dva"}, {"couple","dva"}, {"game","eegra"}, {"sport","eegra"}, {"sports","eegras"}, {"games","eegras"}, {"name","eemya"}, {"title","eemya"}, {"names","eemyas"}, {"egg","eggiweg"}, {"eggs","eggiwegs"}, {"play","filly"}, {"played","fillied"}, {"playing","fillying"}, {"plays","fillies"}, {"playful","fillyish"}, {"booze","firegold"}, {"vodka","firegold"}, {"brandy","firegold"}, {"whiskey","firegold"}, {"beer","firegold"}, {"wine","firegold"}, {"punch","fist"}, {"punched","fisted"}, {"punches","fists"}, {"punching","fisting"}, {"wild","flip"}, {"bezerk","flip"}, {"trout","forella"}, {"newspaper","gazetta"}, {"newspapers","gazettas"}, {"eye","glazz"}, {"eyes","glazzies"}, {"stupid","gloopy"}, {"dollar","golly"}, {"dollars","gollies"}, {"voice","goloss"}, {"voices","golosses"}, {"lip","goober"}, {"lips","goobers"}, {"walk","gooly"}, {"walks","goolies"}, {"walked","goolied"}, {"walking","goolying"}, {"walker","goolier"}, {"throat","gorlo"}, {"throats","gorlos"}, {"speak","govoreet"}, {"speaks","govoreets"}, {"speaking","govoreeting"}, {"spoke","govoreeted"}, {"spoked","govoreeted"}, {"dirty","grahzny"}, {"filthy","grahzny"}, {"soiled","grazzy"}, {"loud","gromky"}, {"louder","gromkier"}, {"loudest","gromkiest"}, {"breast","groody"}, {"boobs","groodies"}, {"tits","groodies"}, {"mammeries","groodies"}, {"tit","groody"}, {"group","gruppa"}, {"groups","gruppas"}, {"grouping","grupping"}, {"grouped","grupped"}, {"guffaw","guff"}, {"guffawed","guffed"}, {"chuckled","guffed"}, {"chuckle","guff"}, {"chuckling","guffing"}, {"head","gulliver"}, {"heads","gullivers"}, {"guts","guttiwuts"}, {"chickenfeed","hen-korm"}, {"shout","horn"}, {"shouted","horned"}, {"shouts","horns"}, {"shouting","horning"}, {"good","horrorshow"}, {"excellent","horrorshow"}, {"fashionable","horrorshow"}, {"trendy","horrorshow"}, {"fuck","in-out in-out"}, {"copulate","in-out in-out"}, {"interest","interessovat"}, {"interested","interessovatted"}, {"interesting","interessovating"}, {"go","itty"}, {"goes","itties"}, {"going","ittying"}, {"gone","ittied"}, {"jam","jammiwam"}, {"life","jeezny"}, {"lives","jeeznies"}, {"potato","kartoffel"}, {"potatoes","kartoffels"}, {"intestines","keeshkas"}, {"bread","kleb"}, {"key","klootch"}, {"keys","klootchies"}, {"button","knopka"}, {"buttons","knopkas"}, {"dig","kopat"}, /* to 'dig' */ {"cat","koshka"}, {"cats","koshkas"}, {"tomcat","kot"}, {"blood","krovvy"}, {"bleeding","krovvying"}, {"bleeds","krovvies"}, {"bled","krovvied"}, {"buy","kupet"}, {"purchase","kupet"}, {"buying","kupetting"}, {"purchasing","kupetting"}, {"bought","kupetted"}, {"purchased","kupetted"}, {"paw","lapa"}, {"paws","lapas"}, {"people","lewdies"}, {"crone","lighter"}, {"face","litso"}, {"faces","litsos"}, {"piece","lomtick"}, {"pieces","lomticks"}, {"bit","lomtick"}, {"bits","lomticks"}, {"part","lomtick"}, {"part","lomticks"}, {"catch","lovet"}, {"catches","lovets"}, {"catching","loveting"}, {"caught","loveted"}, {"making love","lubbilubbing"}, {"hair","luscious glory"}, {"boy","malchick"}, {"boys","malchicks"}, {"little","malenky"}, {"tiny","malenky"}, {"butter","maslo"}, {"margarine","maslo"}, {"filthy","merzky"}, {"thought","messel"}, {"fancy","messel"}, {"place","mesto"}, {"cop","millicent"}, {"police","millicents"}, {"minute","minoota"}, {"minutes","minootas"}, {"young","molodoy"}, {"younger","molodoya"}, {"milk","moloko"}, {"man","moodge"}, {"informer","mordor"}, {"snout","mordor"}, {"spy","mordor"}, {"snack","mounch"}, {"lunch","mounch"}, {"brain","mozg"}, {"brains","mozgs"}, {"begin","nachinat"}, {"beginning","nachinating"}, {"begins","nachinats"}, {"arrogant","nadmenny"}, {"teenage","nadsat"}, {"teenager","nadsat"}, {"teenagers","nadsats"}, {"naked","nagoy"}, {"idiot","nazz"}, {"underpants","neezhnies"}, {"singlet","neezhnies"}, {"panties","neezhnies"}, {"night","nochy"}, {"nights","nochies"}, {"foot","noga"}, {"leg","noga"}, {"feet","nogas"}, {"legs","nogas"}, {"knife","nozh"}, {"nuking","smelling"}, {"nukes","smells"}, {"nuked","smelt"}, {"lonesome","oddy knocky"}, {"alone","oddy knocky"}, {"one","odin"}, {"window","okno"}, {"kill","oobivat"}, {"killed","oobivated"}, {"killing","oobivatting"}, {"leave","ookadeet"}, {"ear","ooko"}, {"ears","ookos"}, {"clever","oomny"}, {"brainy","oomny"}, {"smart","oomny"}, {"terrible","oozhassny"}, {"chain","oozy"}, {"chains","oozies"}, {"chained","oozied"}, {"chaining","oozying"}, {"wipe","osoosh"}, {"wiping","osooshing"}, {"wiped","osooshed"}, {"eyeglasses","otchkies"}, {"spectacles","otchkies"}, {"erection","pan-handle"}, {"penis","pan-handle"}, {"parents","pee and em"}, {"drink","peet"}, {"drinks","peets"}, {"drank","peeted"}, {"drinking","peeting"}, {"food","pishcha"}, {"cry","platch"}, {"clothes","platties"}, {"shoulder","pletcho"}, {"shoulders","pletchoes"}, {"prisoner","plenny"}, {"prisoners","plennys"}, {"splashing","plesk"}, {"splash","plosh"}, {"body","plott"}, {"bodies","plotts"}, {"bodily","plottily"}, {"pillow","podooshka"}, {"pillows","podooshkas"}, {"sex","pol"}, {"gender","pol"}, {"useful","polezny"}, {"skeleton key","polyclef"}, {"understand","pony"}, {"comprehend","pony"}, {"frightened","poogly"}, {"cannon","pooshka"}, {"criminal","prestoopnik"}, {"criminals","prestoopniks"}, {"lead","privodeet"}, {"cash","pretty polly"}, {"produce","prod"}, {"produced","prodded"}, {"producing","prodding"}, {"babe","ptitsa"}, /* as in girl */ {"babes","ptitsas"}, {"girly","ptitsa"}, {"girlies","ptitsas"}, {"drunk","pyahnitsa"}, {"work","rabbit"}, {"worked","rabbited"}, {"works","rabbits"}, {"working","rabbiting"}, {"worker","rabbit"}, {"workers","rabbits"}, {"job","rabbit"}, {"joy","radosty"}, {"happy","radosty"}, {"story","raskazz"}, {"mind","rassoodock"}, {"time","raz"}, {"times","razzed"}, {"timed","razzed"}, {"timing","razzing"}, {"upset","razdraz"}, {"upsets","razdrazes"}, {"upsetting","razdrazzing"}, {"rip","razrez"}, {"rips","razrezes"}, {"ripping","razrezzing"}, {"ripped","razrezzed"}, {"hand","rooker"}, {"hands","rookers"}, {"arm","rook"}, {"arm","rooks"}, {"mouth","rot"}, {"mouthing","rotting"}, {"mouth","rots"}, {"policeman","rozz"}, {"shoe","sabog"}, {"shoes","sabogs"}, {"sugar","sakar"}, {"generous","sammy"}, {"sarcastic","sarky"}, {"cow","scoteena"}, {"gang","shaika"}, {"ganging","shaikaing"}, {"gangs","shaikas"}, {"ganged","shaikaed"}, {"female","sharp"}, {"females","sharps"}, {"bum","sharries"}, {"buttocks","sharries"}, {"barrier","shest"}, {"wall","shest"}, {"fence","shest"}, {"walls","shests"}, {"concern","shilarny"}, {"concerns","shilarnies"}, {"concerning","shilarnying"}, {"concerned","shilarnied"}, {"slice","shive"}, {"slices","shives"}, {"sliced","shived"}, {"slicing","shiving"}, {"neck","shiyah"}, {"necks","shiyahs"}, {"helmet","shlem"}, {"helmets","shlems"}, {"club","shalaga"}, {"clubed","shalagged"}, {"clubs","shalagas"}, {"clubing","shalagging"}, {"hat","shlapa"}, {"hats","shlapas"}, {"noise","shoom"}, {"noises","shooms"}, {"noisey","shoomy"}, {"twit","shoot"}, {"cinema","sinny"}, {"cinemas","sinnys"}, {"say","skazat"}, {"says","skazats"}, {"saying","skazatting"}, {"said","skazatted"}, {"school","skolliwoll"}, {"schools","skolliwolls"}, {"quick","skorry"}, {"quickly","skorry"}, {"fast","skorry"}, {"scratching","skriking"}, {"scratch","skrik"}, {"scratched","skriked"}, {"scratches","skriks"}, {"grab","skvat"}, {"grabbed","skvatted"}, {"grabs","skvats"}, {"grabbing","skvatting"}, {"sweet","sladky"}, {"happen","sloochat"}, {"listen","sloosh"}, {"listens","slooshes"}, {"listened","slooshed"}, {"listening","slooshing"}, {"hear","sloosh"}, {"heard","slooshed"}, {"hearing","slooshing"}, {"word","slovo"}, {"words","slovos"}, {"laugh","smeck"}, {"laughed","smecked"}, {"laughs","smecks"}, {"laughing","smecking"}, {"look","smot"}, {"looked","smotted"}, {"looks","smots"}, {"looking","smotting"}, {"dream","sneety"}, {"dreams","sneeties"}, {"dreaming","sneeting"}, {"dreamt","sneetied"}, {"tobacco","snoutie"}, {"die","snuff it"}, {"died","snuffed it"}, {"pick up","sobirat"}, {"fornicate","sod"}, {"fornicator","sod"}, {"bag","soomka"}, {"advice","soviet"}, {"advised","sovietted"}, {"order","soviet"}, {"sleep","spat"}, {"splattered","splodge"}, {"splashed","splosh"}, {"gaol","staja"}, {"prison","staja"}, {"prisons","stajas"}, {"jail","staja"}, {"jails","stajas"}, {"ancient","starry"}, {"ancients","starries"}, {"old","starry"}, {"oldies","starries"}, {"olds","starries"}, {"older","starrier"}, {"oldest","starriest"}, {"horror","strack"}, {"horrible","strackful"}, {"acid","synthemesc"}, {"waist","tally"}, {"handkerchief","tashtook"}, {"cup","tass"}, {"hit","tolchock"}, {"push","tolchock"}, {"pushed","tolchocked"}, {"slippers","toofles"}, {"three","tree"}, {"trio","tree"}, {"invent","vareet"}, /* to cook up */ {"invented","vareeted"}, {"fabricate","vareet"}, {"invents","vareets"}, {"washroom","vaysay"}, {"toilet","vaysay"}, {"loo","vaysay"}, {"guy","veck"}, {"guys","vecks"}, {"cocaine","vellocet"}, {"thing","veshch"}, {"things","veshches"}, {"see","viddy"}, {"sees","viddies"}, {"seen","viddied"}, {"seeing","viddying"}, {"saw","viddied"}, {"hair","voloss"}, {"smell","von"}, {"smelling","vonning"}, {"smelt","vonned"}, {"odour","von"}, {"perfume","von"}, {"perfumed","vonned"}, {"damage","vred"}, {"damaging","vredding"}, {"damages","vreds"}, {"damaged","vredded"}, {"harm","vred"}, {"harms","vreds"}, {"harmed","vredded"}, {"harming","vredding"}, {"hole","yahma"}, {"holes","yahmas"}, {"jews","yahoodies"}, {"jew","yahoody"}, {"jewish","yahoody"}, {"tongue","yahzick"}, {"tongues","yahzicks"}, {"balls","yarbles"}, {"testicles","yarbles"}, {"testicle","yarble"}, {"drive","yeckate"}, {"driving","yeckating"}, {"drove","yeckated"}, {"song","warble"}, {"sang","warbled"}, {"songs","warbles"}, {"sing","warble"}, {"singing","warbling"}, {"remarkable","zammechat"}, {"sleep","zasnoot"}, {"sleeping","zasnooting"}, {"sleeps","zasnoots"}, {"slept","zasnooted"}, {"wife","zheena"}, {"wives","zheenas"}, {"teeth","zoobies"}, {"tooth","zooby"}, {"toothy","zoobied"}, {"bellpull","zvonock"}, {"doorbell","zvonock"}, {"sound","zvook"}, {"sounds","zvooks"}, {"sounding","zvooking"}, {"undressed","untrussed"}, {"dressed","trussed"}, {"dressing","truss"}, {"ok","right right right"}, {"boring","gloomy"}, {"you","thou"}, {"burp","blerp"}, {"contents","guts"} }; /* /////////////////////////////////////////////////////////////////////// // Function Definitions /////////////////////////////////////////////////////////////////////// */ void ShowHelp (void); void ShowList (void); BOOL DoTranslation (char *fin, char *fout, BOOL bE2N); int main (int argc, char* argv[]); /* /////////////////////////////////////////////////////////////////////// // @ShowHelp() // // Last change: 18.6.97 /////////////////////////////////////////////////////////////////////// */ void ShowHelp (void) { printf("NADSAT v1.2 by SKoT McDonald, 18th June 1997\n\n"); printf("Options: -h or -? Show this help screen.\n"); printf(" -e Translate Nadsat to English.\n"); printf(" -n Translate English to Nadsat. (default)\n"); printf(" -l List internal vocabulary.\n"); printf("\nExample: NADSAT text1.eng text2.nad\n"); printf("This converts the english text in test1.eng to nadsat in text2.nad\n"); printf("\n"); /* Please ensure this contact section remains in the program */ printf("To contact SKoT: email skot@cs.uwa.edu.au\n"); printf(" Web: http://www.cs.uwa.edu.au/~skot\n"); printf("\n"); printf("Visit my website to get the most up-to-date version of NADSAT, or\n"); printf("to find out about my research in computer music: Machine perception\n"); printf("and composition of percussion. (Industrial especially!).\n"); } /* /////////////////////////////////////////////////////////////////////// // @ShowList() // // Last change: 18.6.97 /////////////////////////////////////////////////////////////////////// */ void ShowList (void) { long i; long nWords = sizeof(defList)/(sizeof(char**)*2); for (i = 0; i < nWords; i++) { printf("%20s = %-20s\n", defList[i][0], defList[i][1]); } printf("Number of word pairs = %li\n",nWords); printf("Send new pairs to: skot@cs.uwa.edu.au!\n"); printf("Quick incorporation (if they check out) guaranteed!\n"); } /* /////////////////////////////////////////////////////////////////////// // @DoTranslation() // // This will print to stdout if fout is NULL // or both filenames // // Last change: 18.6.97 /////////////////////////////////////////////////////////////////////// */ #define TRANSBUFFSIZE 256 BOOL DoTranslation (char *fin, char *fout, BOOL bE2N) { BOOL r = FALSE; FILE *fpin = NULL; FILE *fpout = NULL; long out, j; char *bufferin = NULL; char *bufferout = NULL; char *p = NULL; long nWords = sizeof(defList)/(sizeof(char**)*2); int source, target; if (bE2N) /* Not the most elegant way to reverse dir, but clear */ { source = 0; target = 1; } else { source = 1; target = 0; } if ((bufferin = (char*) malloc (TRANSBUFFSIZE)) == NULL) { printf("Error allocating in file buffer memory."); } else if ((bufferout = (char*) malloc (TRANSBUFFSIZE)) == NULL) { printf("Error allocating out file buffer memory."); } else if (fin != NULL && (fpin = fopen(fin,"r")) == NULL) { printf("Can't open input file %s for reading!\n",fin); } else if (fout != NULL && (fpout = fopen(fout,"w")) == NULL) { printf("Can't open output file %s for writing!\n",fout); } else { if (fpin == NULL) fpin = stdin; if (fout == NULL) fpout = stdout; while (fgets(bufferin,TRANSBUFFSIZE,fpin) != NULL) /* read loop */ { bufferout[0] = '\0'; p = bufferin; out = 0; while (*p != '\0') /* translation loop */ { if (!isalpha(*p)) { bufferout[out] = *p; p++; out++; bufferout[out] = '\0'; } else { for (j = 0; j < nWords; j++) /* nasty loop thru all word pairs */ { /* // NOTE! In some compilers, strncmp is case sensitive (Like in Visual C) // and so the strncmp() call should be replaced with strnicmp. */ if (!isalpha(p[strlen(defList[j][source])]) && (strncmp(p,defList[j][source], strlen(defList[j][source])) == 0)) { strcat(bufferout + out, defList[j][target]); if (isupper(*p)) bufferout[out] = toupper(bufferout[out]); out += strlen(defList[j][target]); p += strlen(defList[j][source]); } } while (isalpha(*p)) { bufferout[out] = *p; out++; p++; } } } bufferout[out] = '\0'; fputs(bufferout,fpout); /* dump translated line */ } r = TRUE; } if (fpin) fclose(fpin); if (fpout) fclose(fpout); return r; } /* /////////////////////////////////////////////////////////////////////// // @main() // // Last change: 18.6.97 /////////////////////////////////////////////////////////////////////// */ int main (int argc, char* argv[]) { int r = 0, i = 1; BOOL bE2N = TRUE, bList = FALSE, bHelp = FALSE; char *fin = NULL, *fout = NULL; while (i < argc) /* loop thru options */ { if (argv[i][0] == '-') /* options must be preceeded by a dash */ { switch (toupper(argv[i][1])) { case 'E': /* convert nadsat to english (priority = 3) */ bE2N = FALSE; break; case 'N': /* covert english to nadsat (priority = 4) */ bE2N = TRUE; break; case 'L': /* List vocab (priority = 2) */ bList= TRUE; break; case '?': case 'H': /* show help (priority = 1) */ bHelp = TRUE; break; default: printf("Unrecognised option: -%c.\n",argv[i][1]); r = -5; } } else /* read extra arguments as either input or output filenames */ { if (fin == NULL) fin = argv[i]; else if (fout == NULL) /* fin is already set */ fout = argv[i]; else { printf("Too many file names in command line!\n"); r = -1; } } i ++; } if (bHelp) ShowHelp(); else if (bList) ShowList(); else { if (r == 0) if (!DoTranslation (fin, fout, bE2N)) printf("Error in translation!\n"); r = -4; } return r; } /* /////////////////////////////////////////////////////////////////////// */