-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathdecrypt.l
41 lines (40 loc) · 847 Bytes
/
decrypt.l
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
%{
#include<string.h>
FILE *out;
int key = 1;
char line[10000];
char store[1];
int charasint;
%}
%%
[\n] fprintf(out, "%s\n", line); strcpy(line, ""); line[0]= '\0';
. charasint=yytext[0]; store[0]= charasint-key; strcat(line, store);
%%
int main(int argc, char** argv)
{
char* output_file_name;
if (argc < 2 || argc > 4){
printf("Usage:\t %s FolderToCopy [WhereToCopy] [cryptkey]\n", argv[0]);
return 1;
}
yyin=fopen(argv[1],"r");
out=fopen(argv[2], "w");
if (argc==4) {
key=atoi(argv[3]);
}
if (yyin==NULL){
printf("Cannont open <%s>.\n", argv[1]);
return 2;
}
if (out==NULL){
printf("Cannont create or open <%s>.\n", argv[2]);
return 3;
}
yylex();
printf("\n");
return 0;
}
int yywrap()
{
return 1;
}