home *** CD-ROM | disk | FTP | other *** search
- /*
-
- KlingNum, (C) 1994 by Sean Martin Newton.
-
- Hope you like this program; if you've got InterNet access, feel free to drop me
- piece of E-Mail. I like hearing from fellow Amigites, Amigans, whatever we're
- being called this time around. My E-Mail address is SMN8714CSCI@LYNX.APSU.EDU; it
- probably won't be on-line active during the summers, but the Spring and Fall
- semesters will probably find me on-line... I'm a student at Austin Peay State
- University (Computer Science, what else? Future Amiga programmers have to come
- from SOMEWHERE, right???), and the summer semester generally doesn't have any
- upper-division classes that necessitate VAX access. VAX accounts are only for the
- people who have classes that use the VAX or E-Mail. Go ahead and try contacting me
- whenever you want; the worst that could happen is that you might get an error-message
- bounce back.
-
- */
-
- #include <stdio.h>
- #include <stdlib.h>
-
- char *Numbers[] =
- {
- "pagh",
- "wa'",
- "cha'",
- "wej",
- "loS",
- "vagh",
- "jav",
- "Soch",
- "chorgh",
- "Hut",
- "wa'maH"
- };
-
- char *NumEls[] =
- {
- "",
- "maH",
- "vatlh",
- "SaD",
- "netlh",
- "bIp",
- "'uy'"
- };
-
- char *Message[] =
- {
- "",
- "KlingNum v1.1 by Sean Martin Newton",
- " No rights reserved; it's PD; do whatever you want with it!!!",
- "",
- "Usage: KlingNum <NUMBER>",
- " Where <NUMBER> is a regular number ranging from 0 to 9,999,999.",
- " Please, no punctuation, spaces, or alphabetic characters in the number!",
- "",
- " Distribute this program anywhere and everywhere; just please leave my",
- "name on it (although this is PD, so I can't MAKE you!), and I'll be happy.",
- "I've intentionally set up this program so that its output is unpolluted",
- "with formatting, etcetera. This is so that it can be used with scripts,",
- "Arexx variables, or whatever. Maybe BBSes can use this for some kind of",
- "weird Klingon fast-comprehension competition or something.",
- " Suggestions, flames, Star Trek (STNG, DS9, conventions... whatever)",
- "info, and bowls of gakh (serpent worms) can be sent to the E-Mail address",
- "SMN8714CSCI@LYNX.APSU.EDU . Be advised that I can't understand Klingon",
- "well enough to read entire messages in Klingon or anything like that, at.",
- "least not yet. So if you're part of the official Klingon fan club or",
- "something like that, please don't waste an all-Klingon message on me, as",
- "I'm currently too smooth-brow to understand.",
- "",
- NULL
- };
-
- int main (int argc, char *argv[])
- {
- int Counter, NumLength, UnPrinted=1;
- char *Text;
- if (argc!=2) UnPrinted=0;
- else
- {
- Text=argv[1];
- while(*Text>47&&*Text<58) Text++;
- if (*Text!=0) UnPrinted=0;
- }
-
- if (!UnPrinted)
- {
- for(Counter=0; Message[Counter]!=NULL; Counter++)
- puts(Message[Counter]);
- exit(5);
- }
- for (NumLength=0; argv[1][NumLength]; NumLength++)
- if(argv[1][NumLength]<48||argv[1][NumLength]>57)
- {
- printf("***Non-numeric characters in Number!!!!\n");
- exit(5);
- }
- else argv[1][NumLength]-=48;
- if(NumLength>7)
- {
- printf("***Number too large; can't translate.\n");
- exit(5);
- }
- else
- {
- for (Counter=0; Counter<=NumLength; Counter++)
- if(argv[1][Counter])
- {
- printf("%s%s ", Numbers[argv[1][Counter]], NumEls[NumLength-Counter-1]);
- UnPrinted=0;
- }
- }
- if (UnPrinted) printf("pagh");
- printf("\n");
- }