diff options
-rw-r--r-- | comsat/action.c | 24 | ||||
-rw-r--r-- | include/mailutils/stream.h | 18 | ||||
-rw-r--r-- | libmailutils/stream/logstream.c | 12 |
3 files changed, 42 insertions, 12 deletions
diff --git a/comsat/action.c b/comsat/action.c index 28ac348e2..2d9aa3979 100644 --- a/comsat/action.c +++ b/comsat/action.c @@ -522,12 +522,12 @@ eval_biffrc (struct biffrc_environ *env) ws.ws_comment = "#"; wsflags = MU_WRDSF_DEFFLAGS | MU_WRDSF_COMMENT; + mu_stream_ioctl (mu_strerr, MU_IOCTL_LOGSTREAM, + MU_IOCTL_LOGSTREAM_SET_LOCUS, &env->locus); + mu_stream_ioctl (env->logstr, MU_IOCTL_LOGSTREAM, + MU_IOCTL_LOGSTREAM_SET_LOCUS, &env->locus); while (mu_stream_getline (env->input, &stmt, &size, &n) == 0 && n > 0) { - mu_stream_ioctl (mu_strerr, MU_IOCTL_LOGSTREAM, - MU_IOCTL_LOGSTREAM_SET_LOCUS, &env->locus); - mu_stream_ioctl (env->logstr, MU_IOCTL_LOGSTREAM, - MU_IOCTL_LOGSTREAM_SET_LOCUS, &env->locus); if (strncmp (stmt, "#line ", 6) == 0) { char *p; @@ -540,9 +540,11 @@ eval_biffrc (struct biffrc_environ *env) else { mu_stream_ioctl (mu_strerr, MU_IOCTL_LOGSTREAM, - MU_IOCTL_LOGSTREAM_SET_LOCUS, &env->locus); + MU_IOCTL_LOGSTREAM_SET_LOCUS_LINE, + &env->locus.mu_line); mu_stream_ioctl (env->logstr, MU_IOCTL_LOGSTREAM, - MU_IOCTL_LOGSTREAM_SET_LOCUS, &env->locus); + MU_IOCTL_LOGSTREAM_SET_LOCUS_LINE, + &env->locus.mu_line); } continue; } @@ -553,7 +555,10 @@ eval_biffrc (struct biffrc_environ *env) if (ws.ws_wordc == 0) { - env->locus.mu_line++; + mu_stream_ioctl (mu_strerr, MU_IOCTL_LOGSTREAM, + MU_IOCTL_LOGSTREAM_ADVANCE_LOCUS_LINE, NULL); + mu_stream_ioctl (env->logstr, MU_IOCTL_LOGSTREAM, + MU_IOCTL_LOGSTREAM_ADVANCE_LOCUS_LINE, NULL); continue; } @@ -591,7 +596,10 @@ eval_biffrc (struct biffrc_environ *env) report_error (env, "%s", mu_wordsplit_strerror (&ws)); wsflags |= MU_WRDSF_REUSE; - env->locus.mu_line++; + mu_stream_ioctl (mu_strerr, MU_IOCTL_LOGSTREAM, + MU_IOCTL_LOGSTREAM_ADVANCE_LOCUS_LINE, NULL); + mu_stream_ioctl (env->logstr, MU_IOCTL_LOGSTREAM, + MU_IOCTL_LOGSTREAM_ADVANCE_LOCUS_LINE, NULL); } free (stmt); mu_wordsplit_free (&ws); diff --git a/include/mailutils/stream.h b/include/mailutils/stream.h index 407b45a0e..9b880977c 100644 --- a/include/mailutils/stream.h +++ b/include/mailutils/stream.h @@ -108,26 +108,36 @@ enum mu_buffer_type #define MU_IOCTL_LOGSTREAM_GET_MODE 4 #define MU_IOCTL_LOGSTREAM_SET_MODE 5 + /* Set locus line. + Arg: unsigned * + */ +#define MU_IOCTL_LOGSTREAM_SET_LOCUS_LINE 6 + /* Set locus column. + Arg: unsigned * + */ +#define MU_IOCTL_LOGSTREAM_SET_LOCUS_COL 7 + /* Advance locus line. Arg: NULL (increment by 1) int * */ -#define MU_IOCTL_LOGSTREAM_ADVANCE_LOCUS_LINE 6 +#define MU_IOCTL_LOGSTREAM_ADVANCE_LOCUS_LINE 8 /* Advance locus column. Arg: NULL (increment by 1) int * */ -#define MU_IOCTL_LOGSTREAM_ADVANCE_LOCUS_COL 7 + +#define MU_IOCTL_LOGSTREAM_ADVANCE_LOCUS_COL 9 /* Suppress output of messages having severity lower than the given threshold. Arg: int * */ -#define MU_IOCTL_LOGSTREAM_SUPPRESS_SEVERITY 8 +#define MU_IOCTL_LOGSTREAM_SUPPRESS_SEVERITY 10 /* Same as above, but: Arg: const char * */ -#define MU_IOCTL_LOGSTREAM_SUPPRESS_SEVERITY_NAME 9 +#define MU_IOCTL_LOGSTREAM_SUPPRESS_SEVERITY_NAME 11 /* Opcodes for MU_IOCTL_XSCRIPTSTREAM */ /* Swap transcript levels. diff --git a/libmailutils/stream/logstream.c b/libmailutils/stream/logstream.c index aa4a7d0fe..d8cf6dff6 100644 --- a/libmailutils/stream/logstream.c +++ b/libmailutils/stream/logstream.c @@ -378,6 +378,18 @@ _log_ctl (struct _mu_stream *str, int code, int opcode, void *arg) break; } + case MU_IOCTL_LOGSTREAM_SET_LOCUS_LINE: + if (!arg) + return EINVAL; + sp->locus.mu_line = *(unsigned*)arg; + break; + + case MU_IOCTL_LOGSTREAM_SET_LOCUS_COL: + if (!arg) + return EINVAL; + sp->locus.mu_col = *(unsigned*)arg; + break; + case MU_IOCTL_LOGSTREAM_ADVANCE_LOCUS_LINE: if (!arg) sp->locus.mu_line++; |