diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-27 13:18:03 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-27 13:18:03 +0000 |
commit | afce081b90c1e2c50c3507758c7558a0dfa1f33e (patch) | |
tree | 3fb840f0bd9de41b463443ddf17131a0ad77f226 /src/os_vms_mms.c | |
parent | Initial commit. (diff) | |
download | vim-upstream.tar.xz vim-upstream.zip |
Adding upstream version 2:8.2.2434.upstream/2%8.2.2434upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/os_vms_mms.c')
-rw-r--r-- | src/os_vms_mms.c | 77 |
1 files changed, 77 insertions, 0 deletions
diff --git a/src/os_vms_mms.c b/src/os_vms_mms.c new file mode 100644 index 0000000..4da7b1a --- /dev/null +++ b/src/os_vms_mms.c @@ -0,0 +1,77 @@ +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <unixio.h> +#include "vim.h" +int main(int argc, char *argv[]) +{ + FILE *fpi, *fpo; + char cmd[132], buf[BUFSIZ], *argp, *error_file, target[132], *mms; + int err = 0, err_line = 0; + + mms = "mms"; + argc--; + argv++; + while (argc-- > 0) + { + argp = *argv++; + if (*argp == '-') + { + switch (*++argp) + { + case 'm': + mms = ++argp; + break; + case 'e': + if (!*(error_file = ++argp)) + { + error_file = *argv++; + argc--; + } + break; + default: + break; + } + } + else + { + if (*target) + strcat(target, " "); + strcat(target, argp); + } + } + vim_snprintf(cmd, sizeof(cmd), "%s/output=tmp:errors.vim_tmp %s", + mms, target); + system(cmd); + fpi = fopen("tmp:errors.vim_tmp", "r"); + fpo = fopen(error_file, "w"); + while (fgets(buf, BUFSIZ, fpi)) + { + if (!memcmp(buf, "%CC-", 4)) + { + err_line++; + buf[strlen(buf)-1] = '\0'; + err++; + } + else + { + if (err_line) + { + if (strstr(buf, _("At line"))) + { + err_line = 0; + fprintf(fpo, "@"); + } + else + buf[strlen(buf)-1] = '\0'; + } + } + fprintf(fpo, "%s", buf); + } + fclose(fpi); + fclose(fpo); + while (!delete("tmp:errors.vim_tmp")) + /*nop*/; + exit(err ? 44 : 1); + return(0); +} |