annotate Jttt/wrapper-icon/wrapper.c @ 14:49dd434149cd

README.md immposiblerush
author prymula <prymula76@outlook.com>
date Sat, 10 Feb 2024 20:40:34 +0100
parents 2787f5e749ae
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
prymula <prymula76@outlook.com>
parents:
diff changeset
1 #include <stdio.h> // printf
prymula <prymula76@outlook.com>
parents:
diff changeset
2 #include <stdlib.h> // exit
prymula <prymula76@outlook.com>
parents:
diff changeset
3 #include <string.h>
prymula <prymula76@outlook.com>
parents:
diff changeset
4 #include <unistd.h> // sleep access
prymula <prymula76@outlook.com>
parents:
diff changeset
5
prymula <prymula76@outlook.com>
parents:
diff changeset
6 /*
prymula <prymula76@outlook.com>
parents:
diff changeset
7 char * current(char * name){
prymula <prymula76@outlook.com>
parents:
diff changeset
8 char *file;
prymula <prymula76@outlook.com>
parents:
diff changeset
9
prymula <prymula76@outlook.com>
parents:
diff changeset
10 if (!getenv("CD")) {
prymula <prymula76@outlook.com>
parents:
diff changeset
11 printf ("Zmienna srodowiskowa \"CD\" nie istnieje !\n");
prymula <prymula76@outlook.com>
parents:
diff changeset
12 exit (1);
prymula <prymula76@outlook.com>
parents:
diff changeset
13 }
prymula <prymula76@outlook.com>
parents:
diff changeset
14 file=malloc(strlen(getenv("CD")+strlen(name)+1));
prymula <prymula76@outlook.com>
parents:
diff changeset
15 strcpy(file, getenv("CD"));
prymula <prymula76@outlook.com>
parents:
diff changeset
16 strcat(file, name);
prymula <prymula76@outlook.com>
parents:
diff changeset
17
prymula <prymula76@outlook.com>
parents:
diff changeset
18 return file;
prymula <prymula76@outlook.com>
parents:
diff changeset
19 }
prymula <prymula76@outlook.com>
parents:
diff changeset
20 */
prymula <prymula76@outlook.com>
parents:
diff changeset
21
prymula <prymula76@outlook.com>
parents:
diff changeset
22 char * file_exist(){
prymula <prymula76@outlook.com>
parents:
diff changeset
23 char * name = (char *)".\\config.txt";
prymula <prymula76@outlook.com>
parents:
diff changeset
24 //char *file = current(name);
prymula <prymula76@outlook.com>
parents:
diff changeset
25 char *file = name;
prymula <prymula76@outlook.com>
parents:
diff changeset
26
prymula <prymula76@outlook.com>
parents:
diff changeset
27 if (access(file, F_OK)==0){
prymula <prymula76@outlook.com>
parents:
diff changeset
28 printf("PLIK istnieje %s\n",file);
prymula <prymula76@outlook.com>
parents:
diff changeset
29 free(file);
prymula <prymula76@outlook.com>
parents:
diff changeset
30 return file;
prymula <prymula76@outlook.com>
parents:
diff changeset
31 }
prymula <prymula76@outlook.com>
parents:
diff changeset
32 printf("PLIK nie istnieje %s\n",file);
prymula <prymula76@outlook.com>
parents:
diff changeset
33 free(file);
prymula <prymula76@outlook.com>
parents:
diff changeset
34 return NULL;
prymula <prymula76@outlook.com>
parents:
diff changeset
35 }
prymula <prymula76@outlook.com>
parents:
diff changeset
36
prymula <prymula76@outlook.com>
parents:
diff changeset
37
prymula <prymula76@outlook.com>
parents:
diff changeset
38
prymula <prymula76@outlook.com>
parents:
diff changeset
39 void load(){
prymula <prymula76@outlook.com>
parents:
diff changeset
40
prymula <prymula76@outlook.com>
parents:
diff changeset
41 char * file = file_exist();
prymula <prymula76@outlook.com>
parents:
diff changeset
42 char bufor1[128];
prymula <prymula76@outlook.com>
parents:
diff changeset
43 char bufor2[128];
prymula <prymula76@outlook.com>
parents:
diff changeset
44 char bufor3[128];
prymula <prymula76@outlook.com>
parents:
diff changeset
45 char run[384];
prymula <prymula76@outlook.com>
parents:
diff changeset
46
prymula <prymula76@outlook.com>
parents:
diff changeset
47 if (!file) exit(1);
prymula <prymula76@outlook.com>
parents:
diff changeset
48
prymula <prymula76@outlook.com>
parents:
diff changeset
49 FILE * f = fopen(file, "r");
prymula <prymula76@outlook.com>
parents:
diff changeset
50 fscanf(f, "%s %s %s", bufor1,bufor2,bufor3);
prymula <prymula76@outlook.com>
parents:
diff changeset
51 fclose(f);
prymula <prymula76@outlook.com>
parents:
diff changeset
52 strcpy(run, bufor1);
prymula <prymula76@outlook.com>
parents:
diff changeset
53 strcat(run, " ");
prymula <prymula76@outlook.com>
parents:
diff changeset
54 strcat(run, bufor2);
prymula <prymula76@outlook.com>
parents:
diff changeset
55 strcat(run, " ");
prymula <prymula76@outlook.com>
parents:
diff changeset
56 strcat(run, bufor3);
prymula <prymula76@outlook.com>
parents:
diff changeset
57 printf("Uruchamiam %s \n",run);
prymula <prymula76@outlook.com>
parents:
diff changeset
58 free(file);
prymula <prymula76@outlook.com>
parents:
diff changeset
59
prymula <prymula76@outlook.com>
parents:
diff changeset
60 system(run);
prymula <prymula76@outlook.com>
parents:
diff changeset
61
prymula <prymula76@outlook.com>
parents:
diff changeset
62
prymula <prymula76@outlook.com>
parents:
diff changeset
63
prymula <prymula76@outlook.com>
parents:
diff changeset
64
prymula <prymula76@outlook.com>
parents:
diff changeset
65 }
prymula <prymula76@outlook.com>
parents:
diff changeset
66
prymula <prymula76@outlook.com>
parents:
diff changeset
67 int main (){
prymula <prymula76@outlook.com>
parents:
diff changeset
68 load();
prymula <prymula76@outlook.com>
parents:
diff changeset
69
prymula <prymula76@outlook.com>
parents:
diff changeset
70 return 0;
prymula <prymula76@outlook.com>
parents:
diff changeset
71 }