summaryrefslogtreecommitdiff
path: root/wrapper-icon/wrapper.c
blob: 5ea19f8c0216bf657d58eb992724b61b3c1ba93f (plain)
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>   // printf
#include <stdlib.h>  // exit
#include <string.h>
#include <unistd.h>  // sleep  access

/*
char * current(char * name){
    char *file;

    if (!getenv("CD")) {
        printf ("Zmienna srodowiskowa \"CD\" nie istnieje !\n");   
        exit (1);
    }
	file=malloc(strlen(getenv("CD")+strlen(name)+1));
	strcpy(file, getenv("CD"));
	strcat(file, name);

    return file;
}
*/

char * file_exist(){
    char * name = (char *)".\\config.txt";
	//char *file = current(name);
	char *file = name;

	if (access(file, F_OK)==0){
		printf("PLIK istnieje %s\n",file);
		free(file);
		return file;
	}
	printf("PLIK nie istnieje %s\n",file);
	free(file);
	return NULL;
}



void load(){
	
    char * file = file_exist();
    char bufor1[128];
    char bufor2[128];
    char bufor3[128];
    char run[384];

    if (!file) exit(1);

	FILE * f = fopen(file, "r");
	fscanf(f, "%s %s %s", bufor1,bufor2,bufor3);
	fclose(f);
    strcpy(run, bufor1);
    strcat(run, " ");
    strcat(run, bufor2);
    strcat(run, " ");
    strcat(run, bufor3);
    printf("Uruchamiam %s \n",run);
    free(file);
    
    system(run);
	

	

}

int main (){
    load();

    return 0;
}