Changes in functions.c [8b293ea:7c80ea42]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
functions.c
r8b293ea r7c80ea42 14 14 #include "filterproc.h" 15 15 16 G_GNUC_WARN_UNUSED_RESULTchar *owl_function_command(const char *cmdbuff)16 char *owl_function_command(const char *cmdbuff) 17 17 { 18 18 owl_function_debugmsg("executing command: %s", cmdbuff); … … 21 21 } 22 22 23 G_GNUC_WARN_UNUSED_RESULTchar *owl_function_command_argv(const char *const *argv, int argc)23 char *owl_function_command_argv(const char *const *argv, int argc) 24 24 { 25 25 return owl_cmddict_execute_argv(owl_global_get_cmddict(&g), … … 95 95 } 96 96 97 G_GNUC_WARN_UNUSED_RESULT char *owl_function_style_describe(const char *name) 98 { 97 char *owl_function_style_describe(const char *name) { 99 98 const char *desc; 100 99 char *s; … … 112 111 } 113 112 114 G_GNUC_WARN_UNUSED_RESULTchar *owl_function_cmd_describe(const char *name)113 char *owl_function_cmd_describe(const char *name) 115 114 { 116 115 const owl_cmd *cmd = owl_cmddict_find(owl_global_get_cmddict(&g), name); … … 250 249 * owl_global_messagequeue_addmsg() for that. 251 250 */ 252 G_GNUC_WARN_UNUSED_RESULTowl_message *owl_function_make_outgoing_aim(const char *body, const char *to)251 owl_message *owl_function_make_outgoing_aim(const char *body, const char *to) 253 252 { 254 253 owl_message *m; … … 271 270 * owl_global_messagequeue_addmsg() for that. 272 271 */ 273 G_GNUC_WARN_UNUSED_RESULTowl_message *owl_function_make_outgoing_loopback(const char *body)272 owl_message *owl_function_make_outgoing_loopback(const char *body) 274 273 { 275 274 owl_message *m; … … 1228 1227 } 1229 1228 1230 static void _dirty_everything(gpointer data, gpointer user_data) { 1231 owl_window *w = data; 1229 static void _dirty_everything(owl_window *w) { 1232 1230 if (!owl_window_is_realized(w)) 1233 1231 return; 1234 1232 owl_window_dirty(w); 1235 owl_window_children_foreach(w, _dirty_everything, NULL);1233 owl_window_children_foreach(w, (GFunc)_dirty_everything, NULL); 1236 1234 } 1237 1235 … … 1239 1237 { 1240 1238 /* Ask every widget to redraw itself. */ 1241 _dirty_everything(owl_window_get_screen() , NULL);1239 _dirty_everything(owl_window_get_screen()); 1242 1240 /* Force ncurses to redisplay everything. */ 1243 1241 clearok(stdscr, TRUE); … … 1841 1839 if (enter) { 1842 1840 owl_history *hist = owl_global_get_cmd_history(&g); 1843 owl_history_store(hist, buff); 1844 owl_history_reset(hist); 1841 owl_history_store(hist, buff, false); 1845 1842 owl_function_command_norv(buff); 1846 1843 } else { … … 1901 1898 } 1902 1899 1903 G_GNUC_WARN_UNUSED_RESULTowl_editwin *owl_function_start_question(const char *line)1900 owl_editwin *owl_function_start_question(const char *line) 1904 1901 { 1905 1902 owl_editwin *tw; … … 1916 1913 } 1917 1914 1918 G_GNUC_WARN_UNUSED_RESULTowl_editwin *owl_function_start_password(const char *line)1915 owl_editwin *owl_function_start_password(const char *line) 1919 1916 { 1920 1917 owl_editwin *tw; … … 1933 1930 } 1934 1931 1935 G_GNUC_WARN_UNUSED_RESULTchar *owl_function_exec(int argc, const char *const *argv, const char *buff, int type)1932 char *owl_function_exec(int argc, const char *const *argv, const char *buff, int type) 1936 1933 { 1937 1934 /* if type == 1 display in a popup … … 1976 1973 } 1977 1974 1978 G_GNUC_WARN_UNUSED_RESULTchar *owl_function_perl(int argc, const char *const *argv, const char *buff, int type)1975 char *owl_function_perl(int argc, const char *const *argv, const char *buff, int type) 1979 1976 { 1980 1977 /* if type == 1 display in a popup … … 2146 2143 * Returns the name of the negated filter, which the caller must free. 2147 2144 */ 2148 G_GNUC_WARN_UNUSED_RESULTchar *owl_function_create_negative_filter(const char *filtername)2145 char *owl_function_create_negative_filter(const char *filtername) 2149 2146 { 2150 2147 char *newname; … … 2243 2240 * If 'related' is nonzero, encompass unclasses and .d classes as well. 2244 2241 */ 2245 G_GNUC_WARN_UNUSED_RESULTchar *owl_function_classinstfilt(const char *c, const char *i, int related)2242 char *owl_function_classinstfilt(const char *c, const char *i, int related) 2246 2243 { 2247 2244 owl_filter *f; … … 2330 2327 * the filter, which the caller must free. 2331 2328 */ 2332 G_GNUC_WARN_UNUSED_RESULTchar *owl_function_zuserfilt(const char *longuser)2329 char *owl_function_zuserfilt(const char *longuser) 2333 2330 { 2334 2331 owl_filter *f; … … 2376 2373 * Returns the name of the filter, which the caller must free. 2377 2374 */ 2378 G_GNUC_WARN_UNUSED_RESULTchar *owl_function_aimuserfilt(const char *user)2375 char *owl_function_aimuserfilt(const char *user) 2379 2376 { 2380 2377 owl_filter *f; … … 2414 2411 } 2415 2412 2416 G_GNUC_WARN_UNUSED_RESULTchar *owl_function_typefilt(const char *type)2413 char *owl_function_typefilt(const char *type) 2417 2414 { 2418 2415 owl_filter *f; … … 2470 2467 } 2471 2468 2472 static G_GNUC_WARN_UNUSED_RESULT char *owl_function_smartfilter_cc(const owl_message *m) 2473 { 2469 static char *owl_function_smartfilter_cc(const owl_message *m) { 2474 2470 const char *ccs; 2475 2471 char *ccs_quoted; … … 2522 2518 * name to the AIM conversation with that user 2523 2519 */ 2524 G_GNUC_WARN_UNUSED_RESULTchar *owl_function_smartfilter(int type, int invert_related)2520 char *owl_function_smartfilter(int type, int invert_related) 2525 2521 { 2526 2522 const owl_view *v; … … 2861 2857 } 2862 2858 2863 G_GNUC_WARN_UNUSED_RESULTchar *owl_function_keymap_summary(const char *name)2859 char *owl_function_keymap_summary(const char *name) 2864 2860 { 2865 2861 const owl_keymap *km … … 2975 2971 /* strips formatting from ztext and returns the unformatted text. 2976 2972 * caller is responsible for freeing. */ 2977 G_GNUC_WARN_UNUSED_RESULTchar *owl_function_ztext_stylestrip(const char *zt)2973 char *owl_function_ztext_stylestrip(const char *zt) 2978 2974 { 2979 2975 owl_fmtext fm; … … 3156 3152 } 3157 3153 3158 /* if it exited, spawna new one */3154 /* if it exited, fork & exec a new one */ 3159 3155 if (owl_global_get_newmsgproc_pid(&g)==0) { 3156 pid_t i; 3160 3157 int myargc; 3161 char **argv = owl_parseline(owl_global_get_newmsgproc(&g), &myargc); 3162 if (myargc < 0) { 3163 owl_function_debugmsg("Could not parse newmsgproc '%s': unbalanced quotes?", 3164 owl_global_get_newmsgproc(&g)); 3165 } else if (myargc > 0) { 3166 /* Spawn the child. */ 3167 pid_t pid; 3168 GError *error = NULL; 3169 owl_function_debugmsg("About to exec \"%s\" with %d arguments", argv[0], myargc); 3170 if (g_spawn_async(NULL, argv, NULL, 3171 G_SPAWN_SEARCH_PATH | G_SPAWN_DO_NOT_REAP_CHILD, 3172 NULL, NULL, &pid, &error)) { 3173 owl_global_set_newmsgproc_pid(&g, pid); 3174 owl_function_debugmsg("I'm the parent and I started a new newmsgproc with pid %i", pid); 3175 } else { 3176 owl_function_debugmsg("Cannot run newmsgproc '%s': %s", 3177 owl_global_get_newmsgproc(&g), error->message); 3178 g_error_free(error); 3179 } 3158 i=fork(); 3159 if (i) { 3160 /* parent set the child's pid */ 3161 owl_global_set_newmsgproc_pid(&g, i); 3162 owl_function_debugmsg("I'm the parent and I started a new newmsgproc with pid %i", i); 3163 } else { 3164 /* child exec's the program */ 3165 char **parsed; 3166 parsed=owl_parseline(owl_global_get_newmsgproc(&g), &myargc); 3167 if (myargc < 0) { 3168 owl_function_debugmsg("Could not parse newmsgproc '%s': unbalanced quotes?", owl_global_get_newmsgproc(&g)); 3169 } 3170 if (myargc <= 0) { 3171 _exit(127); 3172 } 3173 owl_function_debugmsg("About to exec \"%s\" with %d arguments", parsed[0], myargc); 3174 3175 execvp(parsed[0], parsed); 3176 3177 3178 /* was there an error exec'ing? */ 3179 owl_function_debugmsg("Cannot run newmsgproc '%s': cannot exec '%s': %s", 3180 owl_global_get_newmsgproc(&g), parsed[0], strerror(errno)); 3181 _exit(127); 3180 3182 } 3181 g_strfreev(argv);3182 3183 } 3183 3184 }
Note: See TracChangeset
for help on using the changeset viewer.