| File euclid-menu.c changed (mode: 100644) (index 0ed2310..ddffc4f) |
| ... |
... |
void draw_win () { |
| 133 |
133 |
}; |
}; |
| 134 |
134 |
XSync(dpy,false); |
XSync(dpy,false); |
| 135 |
135 |
|
|
| 136 |
|
}; |
|
|
136 |
|
} |
| 137 |
137 |
|
|
| 138 |
138 |
inline char* trim_name(char* file) { |
inline char* trim_name(char* file) { |
| 139 |
139 |
char * ret[32]; |
char * ret[32]; |
| |
| ... |
... |
inline char* trim_name(char* file) { |
| 147 |
147 |
// printf("%s\n",ret); |
// printf("%s\n",ret); |
| 148 |
148 |
return(ret); |
return(ret); |
| 149 |
149 |
|
|
| 150 |
|
}; |
|
|
150 |
|
} |
|
151 |
|
|
| 151 |
152 |
void load_handlers() { |
void load_handlers() { |
| 152 |
153 |
//find xdg_config_home |
//find xdg_config_home |
| 153 |
154 |
/*char *xdgconf = getenv("XDG_CONFIG_HOME"); |
/*char *xdgconf = getenv("XDG_CONFIG_HOME"); |
| |
| ... |
... |
void load_handlers() { |
| 208 |
209 |
//read all files |
//read all files |
| 209 |
210 |
//store the names of all that are executable in a linked list |
//store the names of all that are executable in a linked list |
| 210 |
211 |
chdir(getenv("HOME")); //so when we run a program it isn't in a config dir. |
chdir(getenv("HOME")); //so when we run a program it isn't in a config dir. |
| 211 |
|
}; |
|
|
212 |
|
} |
| 212 |
213 |
|
|
| 213 |
214 |
inline char* find_handler() { |
inline char* find_handler() { |
| 214 |
215 |
//read buf use an aray to pick the appropriate file handler and return the command |
//read buf use an aray to pick the appropriate file handler and return the command |
| 215 |
216 |
//what is here now is a bit simple, we need to also check the end of the line to see whether the returned command is prompting for another handler (e.g., if the command takes a filename or a URL as an argument |
//what is here now is a bit simple, we need to also check the end of the line to see whether the returned command is prompting for another handler (e.g., if the command takes a filename or a URL as an argument |
| 216 |
|
if (buf[0] == '!') { |
|
|
217 |
|
if (buf[0] == ':') { |
| 217 |
218 |
if (buf[1] != '\0') { |
if (buf[1] != '\0') { |
| 218 |
219 |
//find match: |
//find match: |
| 219 |
220 |
int i = 0; |
int i = 0; |
| |
| ... |
... |
inline char* find_handler() { |
| 241 |
242 |
results[i] = (char *) malloc(strlen(handlers_trimmed[i] + 5)); |
results[i] = (char *) malloc(strlen(handlers_trimmed[i] + 5)); |
| 242 |
243 |
}; |
}; |
| 243 |
244 |
if (strlen(handlers_trimmed[i]) +1 <= strlen(results[i])) { |
if (strlen(handlers_trimmed[i]) +1 <= strlen(results[i])) { |
| 244 |
|
strcpy(results[i],"!"); |
|
|
245 |
|
strcpy(results[i],":"); |
| 245 |
246 |
strcat(results[i],handlers_trimmed[i]); |
strcat(results[i],handlers_trimmed[i]); |
| 246 |
247 |
|
|
| 247 |
248 |
} else { |
} else { |
| 248 |
249 |
results[i] = realloc(results[i],strlen(handlers_trimmed[i]) + 1); |
results[i] = realloc(results[i],strlen(handlers_trimmed[i]) + 1); |
| 249 |
250 |
|
|
| 250 |
251 |
result_size[i] = strlen(handlers_trimmed[i]) + 1; |
result_size[i] = strlen(handlers_trimmed[i]) + 1; |
| 251 |
|
strcpy(results[i],"!"); |
|
|
252 |
|
strcpy(results[i],":"); |
| 252 |
253 |
strcat(results[i],handlers_trimmed[i]); |
strcat(results[i],handlers_trimmed[i]); |
| 253 |
254 |
}; |
}; |
| 254 |
255 |
//printf("%s\n",results[i]); |
//printf("%s\n",results[i]); |
| |
| ... |
... |
inline char* find_handler() { |
| 282 |
283 |
}; |
}; |
| 283 |
284 |
return(handlers[i]); //could be null; |
return(handlers[i]); //could be null; |
| 284 |
285 |
}; |
}; |
| 285 |
|
}; |
|
|
286 |
|
} |
| 286 |
287 |
|
|
| 287 |
288 |
|
|
| 288 |
289 |
void setup_pipes(char *cmd) { |
void setup_pipes(char *cmd) { |
| |
| ... |
... |
void update_options() { |
| 385 |
386 |
if (fout) { |
if (fout) { |
| 386 |
387 |
//printf("out is open\n"); |
//printf("out is open\n"); |
| 387 |
388 |
int i = 1; |
int i = 1; |
| 388 |
|
if (buf[0] == '!') { //trim handler name |
|
|
389 |
|
if (buf[0] == ':') { //trim handler name |
| 389 |
390 |
while (buf[i] != '\0' && buf[i-1] !=' ') { |
while (buf[i] != '\0' && buf[i-1] !=' ') { |
| 390 |
391 |
i++; |
i++; |
| 391 |
392 |
}; |
}; |
| |
| ... |
... |
char* loop () { |
| 607 |
608 |
if (buf[0] == '\0' && strcmp(handler,"default")) { |
if (buf[0] == '\0' && strcmp(handler,"default")) { |
| 608 |
609 |
//handler should be default, but isn't |
//handler should be default, but isn't |
| 609 |
610 |
handler = NULL; |
handler = NULL; |
| 610 |
|
} else if (buf[0] == '!' && buf[1] == '\0' ) { |
|
|
611 |
|
} else if (buf[0] == ':' && buf[1] == '\0' ) { |
| 611 |
612 |
handler = NULL; |
handler = NULL; |
| 612 |
|
} else if (buf[0] == '!') { |
|
|
613 |
|
} else if (buf[0] == ':') { |
| 613 |
614 |
int i = 0; |
int i = 0; |
| 614 |
615 |
while (buf[i+1] != '\0' && handler[i] != '\0') { |
while (buf[i+1] != '\0' && handler[i] != '\0') { |
| 615 |
616 |
if (buf[i+1] != handler[i] && buf[i+1] != ' ') { |
if (buf[i+1] != handler[i] && buf[i+1] != ' ') { |
| |
| ... |
... |
char* loop () { |
| 636 |
637 |
} while (XPending(dpy)); |
} while (XPending(dpy)); |
| 637 |
638 |
}; |
}; |
| 638 |
639 |
return (t_exec); |
return (t_exec); |
| 639 |
|
}; |
|
|
640 |
|
} |
| 640 |
641 |
|
|
| 641 |
642 |
void clean_up() { |
void clean_up() { |
| 642 |
643 |
XFreeFontSet(dpy,xfs); |
XFreeFontSet(dpy,xfs); |
| |
| ... |
... |
int main (int argc, char *argv[] ) { |
| 781 |
782 |
return 0; |
return 0; |
| 782 |
783 |
}; |
}; |
| 783 |
784 |
|
|
| 784 |
|
}; |
|
|
785 |
|
} |