exec: fix compilation on OpenBSD

Looks like the variable name "stdout" is a problem on OpenBSD (macro?).
So "stdout" and "stderr" are renamed to "out" an "err".
This commit is contained in:
Sebastien Helleu 2014-03-15 15:56:58 +01:00
parent 4ee2ef584d
commit 112398ee62
2 changed files with 25 additions and 24 deletions

View File

@ -153,10 +153,10 @@ exec_add ()
new_exec_cmd->buffer_full_name = NULL; new_exec_cmd->buffer_full_name = NULL;
new_exec_cmd->line_numbers = 0; new_exec_cmd->line_numbers = 0;
new_exec_cmd->display_rc = 0; new_exec_cmd->display_rc = 0;
new_exec_cmd->stdout_size = 0; new_exec_cmd->out_size = 0;
new_exec_cmd->stdout = NULL; new_exec_cmd->out = NULL;
new_exec_cmd->stderr_size = 0; new_exec_cmd->err_size = 0;
new_exec_cmd->stderr = NULL; new_exec_cmd->err = NULL;
new_exec_cmd->return_code = -1; new_exec_cmd->return_code = -1;
exec_cmds_count++; exec_cmds_count++;
@ -220,13 +220,13 @@ exec_command_concat_output (int *size, char **output, const char *text)
void void
exec_command_display_output (struct t_exec_cmd *exec_cmd, exec_command_display_output (struct t_exec_cmd *exec_cmd,
struct t_gui_buffer *buffer, int stdout) struct t_gui_buffer *buffer, int out)
{ {
char *ptr_output, *ptr_line, *line, *line2, *pos; char *ptr_output, *ptr_line, *line, *line2, *pos;
char str_number[32], str_tags[1024]; char str_number[32], str_tags[1024];
int line_nb, length; int line_nb, length;
ptr_output = (stdout) ? exec_cmd->stdout : exec_cmd->stderr; ptr_output = (out) ? exec_cmd->out : exec_cmd->err;
if (!ptr_output) if (!ptr_output)
return; return;
@ -287,7 +287,7 @@ exec_command_display_output (struct t_exec_cmd *exec_cmd,
snprintf (str_number, sizeof (str_number), "%d", exec_cmd->number); snprintf (str_number, sizeof (str_number), "%d", exec_cmd->number);
snprintf (str_tags, sizeof (str_tags), snprintf (str_tags, sizeof (str_tags),
"exec_%s,exec_cmd_%s", "exec_%s,exec_cmd_%s",
(stdout) ? "stdout" : "stderr", (out) ? "stdout" : "stderr",
(exec_cmd->name) ? exec_cmd->name : str_number); (exec_cmd->name) ? exec_cmd->name : str_number);
snprintf (str_number, sizeof (str_number), "%d\t", line_nb); snprintf (str_number, sizeof (str_number), "%d\t", line_nb);
weechat_printf_tags (buffer, str_tags, weechat_printf_tags (buffer, str_tags,
@ -394,14 +394,14 @@ exec_process_cb (void *data, const char *command, int return_code,
if (out) if (out)
{ {
exec_command_concat_output (&ptr_exec_cmd->stdout_size, exec_command_concat_output (&ptr_exec_cmd->out_size,
&ptr_exec_cmd->stdout, &ptr_exec_cmd->out,
out); out);
} }
if (err) if (err)
{ {
exec_command_concat_output (&ptr_exec_cmd->stderr_size, exec_command_concat_output (&ptr_exec_cmd->err_size,
&ptr_exec_cmd->stderr, &ptr_exec_cmd->err,
err); err);
} }
@ -440,10 +440,10 @@ exec_free (struct t_exec_cmd *exec_cmd)
free (exec_cmd->command); free (exec_cmd->command);
if (exec_cmd->buffer_full_name) if (exec_cmd->buffer_full_name)
free (exec_cmd->buffer_full_name); free (exec_cmd->buffer_full_name);
if (exec_cmd->stdout) if (exec_cmd->out)
free (exec_cmd->stdout); free (exec_cmd->out);
if (exec_cmd->stderr) if (exec_cmd->err)
free (exec_cmd->stderr); free (exec_cmd->err);
free (exec_cmd); free (exec_cmd);
@ -489,10 +489,10 @@ exec_print_log ()
weechat_log_printf (" buffer_full_name. . . . : '%s'", ptr_exec_cmd->buffer_full_name); weechat_log_printf (" buffer_full_name. . . . : '%s'", ptr_exec_cmd->buffer_full_name);
weechat_log_printf (" line_numbers. . . . . . : %d", ptr_exec_cmd->line_numbers); weechat_log_printf (" line_numbers. . . . . . : %d", ptr_exec_cmd->line_numbers);
weechat_log_printf (" display_rc. . . . . . . : %d", ptr_exec_cmd->display_rc); weechat_log_printf (" display_rc. . . . . . . : %d", ptr_exec_cmd->display_rc);
weechat_log_printf (" stdout_size . . . . . . : %d", ptr_exec_cmd->stdout_size); weechat_log_printf (" out_size. . . . . . . . : %d", ptr_exec_cmd->out_size);
weechat_log_printf (" stdout. . . . . . . . . : '%s'", ptr_exec_cmd->stdout); weechat_log_printf (" out . . . . . . . . . . : '%s'", ptr_exec_cmd->out);
weechat_log_printf (" stderr_size . . . . . . : %d", ptr_exec_cmd->stderr_size); weechat_log_printf (" err_size. . . . . . . . : %d", ptr_exec_cmd->err_size);
weechat_log_printf (" stderr. . . . . . . . . : '%s'", ptr_exec_cmd->stderr); weechat_log_printf (" err . . . . . . . . . . : '%s'", ptr_exec_cmd->err);
weechat_log_printf (" return_code . . . . . . : %d", ptr_exec_cmd->return_code); weechat_log_printf (" return_code . . . . . . : %d", ptr_exec_cmd->return_code);
weechat_log_printf (" prev_cmd. . . . . . . . : 0x%lx", ptr_exec_cmd->prev_cmd); weechat_log_printf (" prev_cmd. . . . . . . . : 0x%lx", ptr_exec_cmd->prev_cmd);
weechat_log_printf (" next_cmd. . . . . . . . : 0x%lx", ptr_exec_cmd->next_cmd); weechat_log_printf (" next_cmd. . . . . . . . : 0x%lx", ptr_exec_cmd->next_cmd);

View File

@ -25,7 +25,8 @@
#define weechat_plugin weechat_exec_plugin #define weechat_plugin weechat_exec_plugin
#define EXEC_PLUGIN_NAME "exec" #define EXEC_PLUGIN_NAME "exec"
enum t_exec_color { enum t_exec_color
{
EXEC_COLOR_ANSI = 0, EXEC_COLOR_ANSI = 0,
EXEC_COLOR_DECODE, EXEC_COLOR_DECODE,
EXEC_COLOR_STRIP, EXEC_COLOR_STRIP,
@ -53,10 +54,10 @@ struct t_exec_cmd
int display_rc; /* 1 if return code is displayed */ int display_rc; /* 1 if return code is displayed */
/* command output */ /* command output */
int stdout_size; /* number of bytes in stdout */ int out_size; /* number of bytes in stdout */
char *stdout; /* stdout of command */ char *out; /* stdout of command */
int stderr_size; /* number of bytes in stderr */ int err_size; /* number of bytes in stderr */
char *stderr; /* stderr of command */ char *err; /* stderr of command */
int return_code; /* command return code */ int return_code; /* command return code */
struct t_exec_cmd *prev_cmd; /* link to previous command */ struct t_exec_cmd *prev_cmd; /* link to previous command */