1 typedef	char *	caddr_t;
2 typedef unsigned Cursor;
3 typedef char *String;
4 typedef struct _WidgetRec *Widget;
5 typedef char		Boolean;
6 typedef unsigned int	Cardinal;
7 typedef struct _XedwListReturnStruct {
8   String   string;
9   int      xedwList_index;
10   struct _XedwListReturnStruct *next;
11 } XedwListReturnStruct;
12 static XedwListReturnStruct *return_list;
13 static String   srcdir, dstdir;
14 char *strcpy();
15   extern void setCursor(Cursor);
16   extern void query_dialog(String, Boolean);
17   extern Boolean directoryManagerNewDirectory(String);
trashQueryResult(Widget w,Boolean delete,caddr_t call_data)18 trashQueryResult(Widget w, Boolean delete, caddr_t call_data)
19 {
20   int  execute(String, String, String, Boolean);
21   extern void destroy_button_dialog(void);
22   extern void changestate(Boolean);
23 
24   extern Cursor busy, left_ptr;
25   extern String cwd;
26       	extern void freeReturnStruct(void);
27   String rmstring;
28   int status;
29   XedwListReturnStruct *tmp;
30   setCursor(busy);
31   destroy_button_dialog();
32   if (delete == 1) {
33     rmstring = (("rm -fr") != ((void *)0) ? (strcpy((char*)XtMalloc((unsigned)strlen("rm -fr") + 1), "rm -fr")) : ((void *)0));
34     tmp = return_list;
35     while (tmp != ((void *)0)) {
36       rmstring = (String) XtRealloc (rmstring, sizeof(char) *
37 				     (strlen(rmstring) +
38 				      strlen(tmp->string) + 5));
39       sprintf(rmstring, "%s '%s'", rmstring, tmp->string);
40       tmp = tmp->next;
41     }
42     if ((status = execute(((void *)0), "rm", rmstring, 1)) != 0) {
43       XBell(XtDisplay(w), 100);
44       query_dialog("Can't remove file", 0);
45     }
46     XtFree(rmstring);
47 
48     directoryManagerNewDirectory(cwd);
49   } else {
50     changestate(1);
51   }
52   setCursor(left_ptr);
53   freeReturnStruct();
54 }
55 
copyQueryResult(Widget w,Boolean copy,caddr_t call_data)56 copyQueryResult(Widget w, Boolean copy, caddr_t call_data)
57 {
58   extern void destroy_button_dialog();
59   extern void changestate(Boolean);
60   extern Cursor busy, left_ptr;
61   extern void freeReturnStruct(void);
62   int execute(String, String, String, Boolean);
63   extern String cwd;
64   String copystring;
65   int status;
66   Cardinal srclen, dstlen;
67   XedwListReturnStruct *tmp;
68   destroy_button_dialog();
69   setCursor(busy);
70   if (copy == 1) {
71     srclen = strlen(srcdir);
72     dstlen = strlen(dstdir);
73     copystring = (("cp -r") != ((void *)0) ? (strcpy((char*)XtMalloc((unsigned)strlen("cp -r") + 1), "cp -r")) : ((void *)0));
74     tmp = return_list;
75     while (tmp != ((void *)0)) {
76       copystring = (String) XtRealloc (copystring, sizeof(char) *
77 				       (strlen(copystring) +
78 					strlen(tmp->string) +
79 					srclen + 6));
80       sprintf(copystring, "%s '%s/%s'", copystring, srcdir, tmp->string);
81       tmp = tmp->next;
82     }
83     copystring = (String) XtRealloc (copystring, sizeof(char) *
84 				     (strlen(copystring) +
85 				      dstlen + 5));
86     sprintf(copystring, "%s '%s'", copystring, dstdir);
87     if ((status = execute(((void *)0), "cp", copystring, 1)) != 0) {
88       XBell(XtDisplay(w), 100);
89       query_dialog("Can't copy file!", 0);
90     }
91     XtFree(copystring);
92 
93     directoryManagerNewDirectory(cwd);
94   } else {
95     changestate(1);
96   }
97   XtFree(srcdir);
98   XtFree(dstdir);
99   setCursor(left_ptr);
100   freeReturnStruct();
101 }
102 
freeReturnStruct()103 void freeReturnStruct(){}
104