Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • functions.c

    r8b293ea r7c80ea42  
    1414#include "filterproc.h"
    1515
    16 G_GNUC_WARN_UNUSED_RESULT char *owl_function_command(const char *cmdbuff)
     16char *owl_function_command(const char *cmdbuff)
    1717{
    1818  owl_function_debugmsg("executing command: %s", cmdbuff);
     
    2121}
    2222
    23 G_GNUC_WARN_UNUSED_RESULT char *owl_function_command_argv(const char *const *argv, int argc)
     23char *owl_function_command_argv(const char *const *argv, int argc)
    2424{
    2525  return owl_cmddict_execute_argv(owl_global_get_cmddict(&g),
     
    9595}
    9696
    97 G_GNUC_WARN_UNUSED_RESULT char *owl_function_style_describe(const char *name)
    98 {
     97char *owl_function_style_describe(const char *name) {
    9998  const char *desc;
    10099  char *s;
     
    112111}
    113112
    114 G_GNUC_WARN_UNUSED_RESULT char *owl_function_cmd_describe(const char *name)
     113char *owl_function_cmd_describe(const char *name)
    115114{
    116115  const owl_cmd *cmd = owl_cmddict_find(owl_global_get_cmddict(&g), name);
     
    250249 * owl_global_messagequeue_addmsg() for that.
    251250 */
    252 G_GNUC_WARN_UNUSED_RESULT owl_message *owl_function_make_outgoing_aim(const char *body, const char *to)
     251owl_message *owl_function_make_outgoing_aim(const char *body, const char *to)
    253252{
    254253  owl_message *m;
     
    271270 * owl_global_messagequeue_addmsg() for that.
    272271 */
    273 G_GNUC_WARN_UNUSED_RESULT owl_message *owl_function_make_outgoing_loopback(const char *body)
     272owl_message *owl_function_make_outgoing_loopback(const char *body)
    274273{
    275274  owl_message *m;
     
    12281227}
    12291228
    1230 static void _dirty_everything(gpointer data, gpointer user_data) {
    1231   owl_window *w = data;
     1229static void _dirty_everything(owl_window *w) {
    12321230  if (!owl_window_is_realized(w))
    12331231    return;
    12341232  owl_window_dirty(w);
    1235   owl_window_children_foreach(w, _dirty_everything, NULL);
     1233  owl_window_children_foreach(w, (GFunc)_dirty_everything, NULL);
    12361234}
    12371235
     
    12391237{
    12401238  /* Ask every widget to redraw itself. */
    1241   _dirty_everything(owl_window_get_screen(), NULL);
     1239  _dirty_everything(owl_window_get_screen());
    12421240  /* Force ncurses to redisplay everything. */
    12431241  clearok(stdscr, TRUE);
     
    18411839    if (enter) {
    18421840      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);
    18451842      owl_function_command_norv(buff);
    18461843    } else {
     
    19011898}
    19021899
    1903 G_GNUC_WARN_UNUSED_RESULT owl_editwin *owl_function_start_question(const char *line)
     1900owl_editwin *owl_function_start_question(const char *line)
    19041901{
    19051902  owl_editwin *tw;
     
    19161913}
    19171914
    1918 G_GNUC_WARN_UNUSED_RESULT owl_editwin *owl_function_start_password(const char *line)
     1915owl_editwin *owl_function_start_password(const char *line)
    19191916{
    19201917  owl_editwin *tw;
     
    19331930}
    19341931
    1935 G_GNUC_WARN_UNUSED_RESULT char *owl_function_exec(int argc, const char *const *argv, const char *buff, int type)
     1932char *owl_function_exec(int argc, const char *const *argv, const char *buff, int type)
    19361933{
    19371934  /* if type == 1 display in a popup
     
    19761973}
    19771974
    1978 G_GNUC_WARN_UNUSED_RESULT char *owl_function_perl(int argc, const char *const *argv, const char *buff, int type)
     1975char *owl_function_perl(int argc, const char *const *argv, const char *buff, int type)
    19791976{
    19801977  /* if type == 1 display in a popup
     
    21462143 * Returns the name of the negated filter, which the caller must free.
    21472144 */
    2148 G_GNUC_WARN_UNUSED_RESULT char *owl_function_create_negative_filter(const char *filtername)
     2145char *owl_function_create_negative_filter(const char *filtername)
    21492146{
    21502147  char *newname;
     
    22432240 * If 'related' is nonzero, encompass unclasses and .d classes as well.
    22442241 */
    2245 G_GNUC_WARN_UNUSED_RESULT char *owl_function_classinstfilt(const char *c, const char *i, int related)
     2242char *owl_function_classinstfilt(const char *c, const char *i, int related)
    22462243{
    22472244  owl_filter *f;
     
    23302327 * the filter, which the caller must free.
    23312328 */
    2332 G_GNUC_WARN_UNUSED_RESULT char *owl_function_zuserfilt(const char *longuser)
     2329char *owl_function_zuserfilt(const char *longuser)
    23332330{
    23342331  owl_filter *f;
     
    23762373 * Returns the name of the filter, which the caller must free.
    23772374 */
    2378 G_GNUC_WARN_UNUSED_RESULT char *owl_function_aimuserfilt(const char *user)
     2375char *owl_function_aimuserfilt(const char *user)
    23792376{
    23802377  owl_filter *f;
     
    24142411}
    24152412
    2416 G_GNUC_WARN_UNUSED_RESULT char *owl_function_typefilt(const char *type)
     2413char *owl_function_typefilt(const char *type)
    24172414{
    24182415  owl_filter *f;
     
    24702467}
    24712468
    2472 static G_GNUC_WARN_UNUSED_RESULT char *owl_function_smartfilter_cc(const owl_message *m)
    2473 {
     2469static char *owl_function_smartfilter_cc(const owl_message *m) {
    24742470  const char *ccs;
    24752471  char *ccs_quoted;
     
    25222518 *    name to the AIM conversation with that user
    25232519 */
    2524 G_GNUC_WARN_UNUSED_RESULT char *owl_function_smartfilter(int type, int invert_related)
     2520char *owl_function_smartfilter(int type, int invert_related)
    25252521{
    25262522  const owl_view *v;
     
    28612857}
    28622858
    2863 G_GNUC_WARN_UNUSED_RESULT char *owl_function_keymap_summary(const char *name)
     2859char *owl_function_keymap_summary(const char *name)
    28642860{
    28652861  const owl_keymap *km
     
    29752971/* strips formatting from ztext and returns the unformatted text.
    29762972 * caller is responsible for freeing. */
    2977 G_GNUC_WARN_UNUSED_RESULT char *owl_function_ztext_stylestrip(const char *zt)
     2973char *owl_function_ztext_stylestrip(const char *zt)
    29782974{
    29792975  owl_fmtext fm;
     
    31563152    }
    31573153   
    3158     /* if it exited, spawn a new one */
     3154    /* if it exited, fork & exec a new one */
    31593155    if (owl_global_get_newmsgproc_pid(&g)==0) {
     3156      pid_t i;
    31603157      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);
    31803182      }
    3181       g_strfreev(argv);
    31823183    }
    31833184  }
Note: See TracChangeset for help on using the changeset viewer.