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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
|
typedef char * caddr_t;
typedef unsigned Cursor;
typedef char *String;
typedef struct _WidgetRec *Widget;
typedef char Boolean;
typedef unsigned int Cardinal;
typedef struct _XedwListReturnStruct {
String string;
int xedwList_index;
struct _XedwListReturnStruct *next;
} XedwListReturnStruct;
static XedwListReturnStruct *return_list;
static String srcdir, dstdir;
char *strcpy();
extern void setCursor(Cursor);
extern void query_dialog(String, Boolean);
extern Boolean directoryManagerNewDirectory(String);
trashQueryResult(Widget w, Boolean delete, caddr_t call_data)
{
int execute(String, String, String, Boolean);
extern void destroy_button_dialog(void);
extern void changestate(Boolean);
extern Cursor busy, left_ptr;
extern String cwd;
extern void freeReturnStruct(void);
String rmstring;
int status;
XedwListReturnStruct *tmp;
setCursor(busy);
destroy_button_dialog();
if (delete == 1) {
rmstring = (("rm -fr") != ((void *)0) ? (strcpy((char*)XtMalloc((unsigned)strlen("rm -fr") + 1), "rm -fr")) : ((void *)0));
tmp = return_list;
while (tmp != ((void *)0)) {
rmstring = (String) XtRealloc (rmstring, sizeof(char) *
(strlen(rmstring) +
strlen(tmp->string) + 5));
sprintf(rmstring, "%s '%s'", rmstring, tmp->string);
tmp = tmp->next;
}
if ((status = execute(((void *)0), "rm", rmstring, 1)) != 0) {
XBell(XtDisplay(w), 100);
query_dialog("Can't remove file", 0);
}
XtFree(rmstring);
directoryManagerNewDirectory(cwd);
} else {
changestate(1);
}
setCursor(left_ptr);
freeReturnStruct();
}
copyQueryResult(Widget w, Boolean copy, caddr_t call_data)
{
extern void destroy_button_dialog();
extern void changestate(Boolean);
extern Cursor busy, left_ptr;
extern void freeReturnStruct(void);
int execute(String, String, String, Boolean);
extern String cwd;
String copystring;
int status;
Cardinal srclen, dstlen;
XedwListReturnStruct *tmp;
destroy_button_dialog();
setCursor(busy);
if (copy == 1) {
srclen = strlen(srcdir);
dstlen = strlen(dstdir);
copystring = (("cp -r") != ((void *)0) ? (strcpy((char*)XtMalloc((unsigned)strlen("cp -r") + 1), "cp -r")) : ((void *)0));
tmp = return_list;
while (tmp != ((void *)0)) {
copystring = (String) XtRealloc (copystring, sizeof(char) *
(strlen(copystring) +
strlen(tmp->string) +
srclen + 6));
sprintf(copystring, "%s '%s/%s'", copystring, srcdir, tmp->string);
tmp = tmp->next;
}
copystring = (String) XtRealloc (copystring, sizeof(char) *
(strlen(copystring) +
dstlen + 5));
sprintf(copystring, "%s '%s'", copystring, dstdir);
if ((status = execute(((void *)0), "cp", copystring, 1)) != 0) {
XBell(XtDisplay(w), 100);
query_dialog("Can't copy file!", 0);
}
XtFree(copystring);
directoryManagerNewDirectory(cwd);
} else {
changestate(1);
}
XtFree(srcdir);
XtFree(dstdir);
setCursor(left_ptr);
freeReturnStruct();
}
freeReturnStruct(){}
|