-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathHi.c.save.1
More file actions
71 lines (66 loc) · 1.36 KB
/
Hi.c.save.1
File metadata and controls
71 lines (66 loc) · 1.36 KB
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
61
62
63
64
65
66
67
68
69
70
71
#include<stdio.h>
#include<dirent.h>
#include<sys/types.h>
#include<errno.h>
#include<string.h>
int isFile(char* name){
DIR* directory = opendir(name);
if(directory != NULL){
closedir(directory);
return 0;
}
if(errno == ENOTDIR){
return 1;
}
return -1;
}
char getcaseless(char in){
char out;
if(out > 64&&out < 91) out = out + 32;
return out;
}
void DataFinder(char* sKey,char fPath[]){
printf("Got here");
FILE *domain;
domain = fopen(fPath,'r');
printf("Opened file.");
int length = sizeof(sKey);
printf("Found key length");
int backPointer;
char* stack = "";
for(int i = 0;i < length;i++){
stack += getcaseless(fgetc(domain));
}
printf("%s\n",stack);
fclose(domain);
}
void list(char* sKey){
DIR *dir;
char* name;
char directory[128];
struct dirent *ent;
if ((dir = opendir ("./data/")) != NULL) {
while ((ent = readdir (dir)) != NULL) {
name = ent->d_name;
printf("%s\n",name);
if(strcmp(name,".")&&strcmp(name,"..")){
strncpy(directory,"./data/",sizeof(directory));
strncat(directory, name, (sizeof(directory) - strlen(directory)) );
printf("%s\n", director
if(isFile(name) == 1){
printf("Hi");
DataFinder(sKey,directory);
}
}
}
closedir (dir);
} else {
return;
}
}
int main(int argc,char** argv){
char* sKey = argv[1];
printf("%s\n",sKey);
list(sKey);//,"./data/testrange.txt");
return 0;
}