-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprogram.c
More file actions
60 lines (49 loc) · 998 Bytes
/
program.c
File metadata and controls
60 lines (49 loc) · 998 Bytes
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#include <stdio.h>
#include <string.h>
void secretFunction()
{
printf("Congratulations!\n");
printf("You have entered in the secret function!\n");
}
void FileCompress()
{
char buffer[20];
char exists[28] = "test -f ";
char zip[25] = "gzip ";
char cp[45] = "cp ";
char mv[45] = "mv ";
int status;
printf("Enter file name to compress:\n");
gets(buffer);
strcat(exists, buffer);
status = system(exists);
if (status == 256) {
printf("%s", "File not found, exiting");
return;
}
strcat(cp, buffer);
strcat(cp, " ");
strcat(cp, buffer);
strcat(cp, "1");
system(cp);
strcat(zip, buffer);
status = system(zip);
if (status == 256) {
printf("%s", "Gzip failed, exiting");
return;
}
else {
printf("%s has been zipped. \n", buffer);
}
strcat(mv, buffer);
strcat(mv, "1");
strcat(mv, " ");
strcat(mv, buffer);
system(mv);
return;
}
int main()
{
FileCompress();
return 0;
}