source: titan/plugins/scriptexec/scriptexec.h @ 15145

Last change on this file since 15145 was 15145, checked in by nit, 11 years ago

[titan] fix comp warnings

File size: 1.1 KB
Line 
1#ifndef SCRIPTEXEC_H
2#define SCRIPTEXEC_H
3
4void screenscriptexec()
5{
6        int dirrcret = 0;
7        char* tmpstr = NULL, *startdir = NULL;
8        char* file = NULL, *ret = NULL;
9
10
11start:
12        startdir = getconfig("scriptexecpath", NULL);
13
14        tmpstr = ostrcat(file, "", 1, 0); file = NULL;
15        file = screendir(startdir, "*.sh", basename(tmpstr), &dirrcret, NULL, _("BG-RUN"), getrcconfigint("rcred", NULL), NULL, 0, NULL, 0, NULL, 0, 90, 1, 90, 1, 2);
16        free(tmpstr); tmpstr = NULL;
17
18        if(file != NULL && (dirrcret == 0 || dirrcret == 1))
19        {
20                if(dirrcret == 0)
21                {
22                        tmpstr = ostrcat(file, " 2>&1", 0, 0);
23                        ret = command(tmpstr);
24                        free(tmpstr); tmpstr = NULL;
25                }
26                if(dirrcret == 1)
27                {
28                        tmpstr = ostrcat(file, " &", 0, 0);
29                        system(tmpstr);
30                        free(tmpstr); tmpstr = NULL;
31                }
32
33                if(ret == NULL) ret = ostrcat(_("Script has no output or started in background."), NULL, 0, 0);
34                textbox(_("Script execute"), ret, _("OK"), getrcconfigint("rcok", NULL), _("EXIT"), getrcconfigint("rcexit", NULL), NULL, 0, NULL, 0, 800, 600, 0, 0);
35                free(ret); ret = NULL;
36                goto start;
37        }
38
39        free(file);
40}
41
42#endif
Note: See TracBrowser for help on using the repository browser.