2

Code a relic

view story
linux-howto

http://forums.fedoraforum.org – Code of baul :) Code: /*  * Hanx [Proyecto Fedora Peru] wth Code  * crc.c - app  *  * This program is private version, for anti-educational purposes and without any  * explicit or implicit warranty; in no event shall the author or  * contributors be liable for any direct, indirect or incidetal damages  * arising in any way out of the use of this software.  */ #include <stdio.h> #include <string.h> char rot13(char x) {         char u[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";         char l[] = "abcdefghijklmnopqrstuvwxyz";         char *p;         if ((p = strchr(u, x)) != NULL)                 return u[((p-u) + 13) % 26];         else if ((p = strchr(l, x)) != NULL)                 return l[((p-l) + 13) % 26];         else                 return x; } int main(int argc, char *argv[]) {         FILE *OUT, *IN;         int x;         if(argv[1] == NULL || argv[2] == NULL)         {                 printf("\n[!] Incorrect parameter");                 printf("\n\t./crc <name file old> <name file new>\n\n");                 return 1;         }         else         {                 if((OUT = fopen(argv[1], "rt")) != NULL)                         if((IN = fopen(argv[2], "at")) != NULL)                                 while((x = fgetc(OUT)) != EOF)                                         fprintf(IN,"%c", rot13(x));                         else                         {                                 printf("\n[!] Error to create new file\n\n");                                 return 1;                         }                 else                 {                         printf("\n[!] Error to open old file\n\n");                         return 1;                 }                 printf("\n[+] Sucesfull!!!\n\n");         }         return 0; } (HowTos)