1 /* search files related to print (still in development)
3 This program is free software: you can
4 redistribute it and/or modify it under the
5 terms of the GNU General Public License as
6 published by the Free Software Foundation;
7 either version 3 of the License, or (at your
8 option) any later version.
10 This program is distributed in the hope that it
11 will be useful, but WITHOUT ANY WARRANTY;
12 without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR
14 PURPOSE. See the GNU General Public License for
17 You should have received a copy of the GNU
18 General Public License along with this
19 program. If not, see http://www.gnu.org/licenses/.
35 int main(int argc
, char *argv
[]) {
40 char *sword
= "file.c"; /* testing */
42 struct passwd
*pw
= getpwuid(getuid());
44 char *homedir
= pw
->pw_dir
;
45 const char *plocation
= "/.trueprint/files";
46 /* printf("%s\n",homedir); */
47 const char *npath
= strcat(homedir
,plocation
);
48 int value
= chdir(npath
);
49 DIR *opendirp
= opendir(npath
);
51 while ((d
= readdir(opendirp
)) != NULL
)
52 /* for (i=0;i<=5;i++) */
54 sfile
=fopen(d
->d_name
,"r");
55 while (!found
&& (fgets(buffer
, sizeof(buffer
), sfile
) != 0))
57 found
= strstr(buffer
,sword
);
59 /* printf("%d\n",found); */
61 printf("found in: %s\n",d
->d_name
);
64 /* printf("%d %d\n",value,errno); */
65 /* printf("%s\n",d->d_name); */