actually use macros
This commit is contained in:
parent
e1805936ef
commit
74e69d6c56
@ -47,8 +47,6 @@ static char alpha_upper[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLM";
|
|||||||
static char alpha_lower[] = "abcdefghijklmnopqrstuvwxyzabcdefghijklm";
|
static char alpha_lower[] = "abcdefghijklmnopqrstuvwxyzabcdefghijklm";
|
||||||
|
|
||||||
int main(int argc, char *argv[]){
|
int main(int argc, char *argv[]){
|
||||||
char *a; /* easier than doing freaky math */
|
|
||||||
CHARACTER c;
|
|
||||||
|
|
||||||
if(argc > 1){
|
if(argc > 1){
|
||||||
fprintf(stderr, "Usage: %s\n",
|
fprintf(stderr, "Usage: %s\n",
|
||||||
@ -57,12 +55,17 @@ int main(int argc, char *argv[]){
|
|||||||
return EX_USAGE;
|
return EX_USAGE;
|
||||||
}
|
}
|
||||||
|
|
||||||
while((c = getc(stdin)) != EOF)
|
{ /* rot13 */
|
||||||
if(isalpha(c)){
|
char *a; /* easier than doing freaky math */
|
||||||
a = isupper(c) ? alpha_upper : alpha_lower;
|
CHARACTER c;
|
||||||
putc(a[c - a[0] + 13], stdout);
|
|
||||||
}else
|
while((c = GETC(stdin)) != ENDOFFILE)
|
||||||
putc(c, stdout);
|
if(isalpha(c)){
|
||||||
|
a = isupper(c) ? alpha_upper : alpha_lower;
|
||||||
|
PUTC(a[c - a[0] + 13], stdout);
|
||||||
|
}else
|
||||||
|
PUTC(c, stdout);
|
||||||
|
}
|
||||||
|
|
||||||
return EX_OK;
|
return EX_OK;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user