annotate src/os_vms.c @ 31972:4e59c4260d84 v9.0.1318

patch 9.0.1318: code style test fails Commit: https://github.com/vim/vim/commit/f2017f255ddceaad88a951adc6a2c190d3a18ebf Author: Bram Moolenaar <Bram@vim.org> Date: Fri Feb 17 21:29:57 2023 +0000 patch 9.0.1318: code style test fails Problem: Code style test fails. Solution: Remove trailing white space.
author Bram Moolenaar <Bram@vim.org>
date Fri, 17 Feb 2023 22:45:03 +0100
parents 50555279168b
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
10042
4aead6a9b7a9 commit https://github.com/vim/vim/commit/edf3f97ae2af024708ebb4ac614227327033ca47
Christian Brabandt <cb@256bit.org>
parents: 7833
diff changeset
1 /* vi:set ts=8 sts=4 sw=4 noet:
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2 *
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3 * VIM - Vi IMproved by Bram Moolenaar
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4 * VMS port by Henk Elbers
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5 * VMS deport by Zoltan Arpadffy
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6 *
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7 * Do ":help uganda" in Vim to read copying and usage conditions.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8 * Do ":help credits" in Vim to see a list of people who contributed.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9 * See README.txt for an overview of the Vim source code.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
10 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
11
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
12 #include "vim.h"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
13
18810
44b855153d8e patch 8.1.2393: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 18765
diff changeset
14 // define _generic_64 for use in time functions
6359
9f9058aeba0d updated for version 7.4.512
Bram Moolenaar <bram@vim.org>
parents: 5782
diff changeset
15 #if !defined(VAX) && !defined(PROTO)
5541
2f99966971b0 updated for version 7.4.119
Bram Moolenaar <bram@vim.org>
parents: 2278
diff changeset
16 # include <gen64def.h>
2f99966971b0 updated for version 7.4.119
Bram Moolenaar <bram@vim.org>
parents: 2278
diff changeset
17 #else
18810
44b855153d8e patch 8.1.2393: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 18765
diff changeset
18 // based on Alpha's gen64def.h; the file is absent on VAX
5541
2f99966971b0 updated for version 7.4.119
Bram Moolenaar <bram@vim.org>
parents: 2278
diff changeset
19 typedef struct _generic_64 {
2f99966971b0 updated for version 7.4.119
Bram Moolenaar <bram@vim.org>
parents: 2278
diff changeset
20 # pragma __nomember_alignment
18810
44b855153d8e patch 8.1.2393: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 18765
diff changeset
21 __union { // You can treat me as...
44b855153d8e patch 8.1.2393: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 18765
diff changeset
22 // long long is not available on VAXen
44b855153d8e patch 8.1.2393: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 18765
diff changeset
23 // unsigned __int64 gen64$q_quadword; ...a single 64-bit value, or
5541
2f99966971b0 updated for version 7.4.119
Bram Moolenaar <bram@vim.org>
parents: 2278
diff changeset
24
18810
44b855153d8e patch 8.1.2393: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 18765
diff changeset
25 unsigned int gen64$l_longword [2]; // ...two 32-bit values, or
44b855153d8e patch 8.1.2393: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 18765
diff changeset
26 unsigned short int gen64$w_word [4]; // ...four 16-bit values
5541
2f99966971b0 updated for version 7.4.119
Bram Moolenaar <bram@vim.org>
parents: 2278
diff changeset
27 } gen64$r_quad_overlay;
2f99966971b0 updated for version 7.4.119
Bram Moolenaar <bram@vim.org>
parents: 2278
diff changeset
28 } GENERIC_64;
2f99966971b0 updated for version 7.4.119
Bram Moolenaar <bram@vim.org>
parents: 2278
diff changeset
29 #endif
2f99966971b0 updated for version 7.4.119
Bram Moolenaar <bram@vim.org>
parents: 2278
diff changeset
30
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
31 typedef struct
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
32 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
33 char class;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
34 char type;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
35 short width;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
36 union
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
37 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
38 struct
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
39 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
40 char _basic[3];
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
41 char length;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
42 } y;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
43 int basic;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
44 } x;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
45 int extended;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
46 } TT_MODE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
47
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
48 typedef struct
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
49 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
50 short buflen;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
51 short itemcode;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
52 char *bufadrs;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
53 int *retlen;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
54 } ITEM;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
55
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
56 typedef struct
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
57 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
58 ITEM equ;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
59 int nul;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
60 } ITMLST1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
61
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
62 typedef struct
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
63 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
64 ITEM index;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
65 ITEM string;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
66 int nul;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
67 } ITMLST2;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
68
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
69 static TT_MODE orgmode;
18810
44b855153d8e patch 8.1.2393: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 18765
diff changeset
70 static short iochan; // TTY I/O channel
44b855153d8e patch 8.1.2393: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 18765
diff changeset
71 static short iosb[4]; // IO status block
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
72
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
73 static int vms_match_num = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
74 static int vms_match_free = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
75 static char_u **vms_fmatch = NULL;
18810
44b855153d8e patch 8.1.2393: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 18765
diff changeset
76 static char *Fspec_Rms; // rms file spec, passed implicitly between routines
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
77
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
78
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
79
7805
0b6c37dd858d commit https://github.com/vim/vim/commit/baaa7e9ec7398a813e21285c272fa99792642077
Christian Brabandt <cb@256bit.org>
parents: 6695
diff changeset
80 static TT_MODE get_tty(void);
0b6c37dd858d commit https://github.com/vim/vim/commit/baaa7e9ec7398a813e21285c272fa99792642077
Christian Brabandt <cb@256bit.org>
parents: 6695
diff changeset
81 static void set_tty(int row, int col);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
82
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
83 #define EXPL_ALLOC_INC 64
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
84
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
85 #define EQN(S1,S2,LN) (strncmp(S1,S2,LN) == 0)
13632
cec5137d5332 patch 8.0.1688: some macros are used without a semicolon
Christian Brabandt <cb@256bit.org>
parents: 13353
diff changeset
86 #define SKIP_FOLLOWING_SLASHES(Str) do { while (Str[1] == '/') ++Str; } while (0)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
87
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
88
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
89 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
90 * vul_desc vult een descriptor met een string en de lengte
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
91 * hier van.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
92 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
93 static void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
94 vul_desc(DESC *des, char *str)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
95 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
96 des->dsc$b_dtype = DSC$K_DTYPE_T;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
97 des->dsc$b_class = DSC$K_CLASS_S;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
98 des->dsc$a_pointer = str;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
99 des->dsc$w_length = str ? strlen(str) : 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
100 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
101
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
102 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
103 * vul_item vult een item met een aantal waarden
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
104 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
105 static void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
106 vul_item(ITEM *itm, short len, short cod, char *adr, int *ret)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
107 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
108 itm->buflen = len;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
109 itm->itemcode = cod;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
110 itm->bufadrs = adr;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
111 itm->retlen = ret;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
112 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
113
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
114 void
20439
d4b2a8675b78 patch 8.2.0774: t_TI and t_TE are output when using 'visualbell'
Bram Moolenaar <Bram@vim.org>
parents: 18810
diff changeset
115 mch_settmode(tmode_T tmode)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
116 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
117 int status;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
118
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
119 if ( tmode == TMODE_RAW )
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
120 set_tty(0, 0);
31804
50555279168b patch 9.0.1234: the code style has to be checked manually
Bram Moolenaar <Bram@vim.org>
parents: 28844
diff changeset
121 else
50555279168b patch 9.0.1234: the code style has to be checked manually
Bram Moolenaar <Bram@vim.org>
parents: 28844
diff changeset
122 {
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
123 switch (orgmode.width)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
124 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
125 case 132: OUT_STR_NF((char_u *)"\033[?3h\033>"); break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
126 case 80: OUT_STR_NF((char_u *)"\033[?3l\033>"); break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
127 default: break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
128 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
129 out_flush();
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
130 status = sys$qiow(0, iochan, IO$_SETMODE, iosb, 0, 0,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
131 &orgmode, sizeof(TT_MODE), 0,0,0,0);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
132 if (status!=SS$_NORMAL || (iosb[0]&0xFFFF)!=SS$_NORMAL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
133 return;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
134 (void)sys$dassgn(iochan);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
135 iochan = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
136 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
137 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
138
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
139 static void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
140 set_tty(int row, int col)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
141 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
142 int status;
18810
44b855153d8e patch 8.1.2393: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 18765
diff changeset
143 TT_MODE newmode; // New TTY mode bits
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
144 static short first_time = TRUE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
145
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
146 if (first_time)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
147 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
148 orgmode = get_tty();
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
149 first_time = FALSE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
150 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
151 newmode = get_tty();
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
152 if (col)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
153 newmode.width = col;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
154 if (row)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
155 newmode.x.y.length = row;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
156 newmode.x.basic |= (TT$M_NOECHO | TT$M_HOSTSYNC);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
157 newmode.x.basic &= ~TT$M_TTSYNC;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
158 newmode.extended |= TT2$M_PASTHRU;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
159 status = sys$qiow(0, iochan, IO$_SETMODE, iosb, 0, 0,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
160 &newmode, sizeof(newmode), 0, 0, 0, 0);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
161 if (status!=SS$_NORMAL || (iosb[0]&0xFFFF)!=SS$_NORMAL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
162 return;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
163 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
164
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
165 static TT_MODE
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
166 get_tty(void)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
167 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
168
18810
44b855153d8e patch 8.1.2393: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 18765
diff changeset
169 static $DESCRIPTOR(odsc,"SYS$OUTPUT"); // output descriptor
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
170
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
171 int status;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
172 TT_MODE tt_mode;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
173
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
174 if (!iochan)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
175 status = sys$assign(&odsc,&iochan,0,0);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
176
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
177 status = sys$qiow(0, iochan, IO$_SENSEMODE, iosb, 0, 0,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
178 &tt_mode, sizeof(tt_mode), 0, 0, 0, 0);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
179 if (status != SS$_NORMAL || (iosb[0] & 0xFFFF) != SS$_NORMAL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
180 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
181 tt_mode.width = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
182 tt_mode.type = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
183 tt_mode.class = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
184 tt_mode.x.basic = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
185 tt_mode.x.y.length = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
186 tt_mode.extended = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
187 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
188 return(tt_mode);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
189 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
190
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
191 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
192 * Get the current window size in Rows and Columns.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
193 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
194 int
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
195 mch_get_shellsize(void)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
196 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
197 TT_MODE tmode;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
198
18810
44b855153d8e patch 8.1.2393: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 18765
diff changeset
199 tmode = get_tty(); // get size from VMS
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
200 Columns = tmode.width;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
201 Rows = tmode.x.y.length;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
202 return OK;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
203 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
204
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
205 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
206 * Try to set the window size to Rows and new_Columns.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
207 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
208 void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
209 mch_set_shellsize(void)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
210 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
211 set_tty(Rows, Columns);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
212 switch (Columns)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
213 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
214 case 132: OUT_STR_NF((char_u *)"\033[?3h\033>"); break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
215 case 80: OUT_STR_NF((char_u *)"\033[?3l\033>"); break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
216 default: break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
217 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
218 out_flush();
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
219 screen_start();
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
220 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
221
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
222 char_u *
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
223 mch_getenv(char_u *lognam)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
224 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
225 DESC d_file_dev, d_lognam ;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
226 static char buffer[LNM$C_NAMLENGTH+1];
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
227 char_u *cp = NULL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
228 unsigned long attrib;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
229 int lengte = 0, dum = 0, idx = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
230 ITMLST2 itmlst;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
231 char *sbuf = NULL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
232
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
233 vul_desc(&d_lognam, (char *)lognam);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
234 vul_desc(&d_file_dev, "LNM$FILE_DEV");
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
235 attrib = LNM$M_CASE_BLIND;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
236 vul_item(&itmlst.index, sizeof(int), LNM$_INDEX, (char *)&idx, &dum);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
237 vul_item(&itmlst.string, LNM$C_NAMLENGTH, LNM$_STRING, buffer, &lengte);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
238 itmlst.nul = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
239 if (sys$trnlnm(&attrib, &d_file_dev, &d_lognam, NULL,&itmlst) == SS$_NORMAL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
240 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
241 buffer[lengte] = '\0';
16825
ce04ebdf26b8 patch 8.1.1414: alloc() returning "char_u *" causes a lot of type casts
Bram Moolenaar <Bram@vim.org>
parents: 16782
diff changeset
242 if (cp = alloc(lengte + 1))
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
243 strcpy((char *)cp, buffer);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
244 return(cp);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
245 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
246 else if ((sbuf = getenv((char *)lognam)))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
247 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
248 lengte = strlen(sbuf) + 1;
16825
ce04ebdf26b8 patch 8.1.1414: alloc() returning "char_u *" causes a lot of type casts
Bram Moolenaar <Bram@vim.org>
parents: 16782
diff changeset
249 cp = alloc(lengte);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
250 if (cp)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
251 strcpy((char *)cp, sbuf);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
252 return cp;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
253 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
254 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
255 return(NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
256 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
257
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
258 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
259 * mch_setenv VMS version of setenv()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
260 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
261 int
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
262 mch_setenv(char *var, char *value, int x)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
263 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
264 int res, dum;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
265 long attrib = 0L;
18810
44b855153d8e patch 8.1.2393: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 18765
diff changeset
266 char acmode = PSL$C_SUPER; // needs SYSNAM privilege
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
267 DESC tabnam, lognam;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
268 ITMLST1 itmlst;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
269
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
270 vul_desc(&tabnam, "LNM$JOB");
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
271 vul_desc(&lognam, var);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
272 vul_item(&itmlst.equ, value ? strlen(value) : 0, value ? LNM$_STRING : 0,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
273 value, &dum);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
274 itmlst.nul = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
275 res = sys$crelnm(&attrib, &tabnam, &lognam, &acmode, &itmlst);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
276 return((res == 1) ? 0 : -1);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
277 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
278
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
279 int
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
280 vms_sys(char *cmd, char *out, char *inp)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
281 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
282 DESC cdsc, odsc, idsc;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
283 long status;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
284
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
285 if (cmd)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
286 vul_desc(&cdsc, cmd);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
287 if (out)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
288 vul_desc(&odsc, out);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
289 if (inp)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
290 vul_desc(&idsc, inp);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
291
18810
44b855153d8e patch 8.1.2393: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 18765
diff changeset
292 lib$spawn(cmd ? &cdsc : NULL, // command string
44b855153d8e patch 8.1.2393: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 18765
diff changeset
293 inp ? &idsc : NULL, // input file
44b855153d8e patch 8.1.2393: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 18765
diff changeset
294 out ? &odsc : NULL, // output file
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
295 0, 0, 0, &status, 0, 0, 0, 0, 0, 0);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
296 return status;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
297 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
298
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
299 /*
5704
47a673b20e49 updated for version 7.4.197
Bram Moolenaar <bram@vim.org>
parents: 5541
diff changeset
300 * Convert string to lowercase - most often filename
47a673b20e49 updated for version 7.4.197
Bram Moolenaar <bram@vim.org>
parents: 5541
diff changeset
301 */
47a673b20e49 updated for version 7.4.197
Bram Moolenaar <bram@vim.org>
parents: 5541
diff changeset
302 char *
47a673b20e49 updated for version 7.4.197
Bram Moolenaar <bram@vim.org>
parents: 5541
diff changeset
303 vms_tolower( char *name )
47a673b20e49 updated for version 7.4.197
Bram Moolenaar <bram@vim.org>
parents: 5541
diff changeset
304 {
47a673b20e49 updated for version 7.4.197
Bram Moolenaar <bram@vim.org>
parents: 5541
diff changeset
305 int i,nlen = strlen(name);
47a673b20e49 updated for version 7.4.197
Bram Moolenaar <bram@vim.org>
parents: 5541
diff changeset
306 for (i = 0; i < nlen; i++)
47a673b20e49 updated for version 7.4.197
Bram Moolenaar <bram@vim.org>
parents: 5541
diff changeset
307 name[i] = TOLOWER_ASC(name[i]);
47a673b20e49 updated for version 7.4.197
Bram Moolenaar <bram@vim.org>
parents: 5541
diff changeset
308 return name;
47a673b20e49 updated for version 7.4.197
Bram Moolenaar <bram@vim.org>
parents: 5541
diff changeset
309 }
47a673b20e49 updated for version 7.4.197
Bram Moolenaar <bram@vim.org>
parents: 5541
diff changeset
310
47a673b20e49 updated for version 7.4.197
Bram Moolenaar <bram@vim.org>
parents: 5541
diff changeset
311 /*
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
312 * Convert VMS system() or lib$spawn() return code to Unix-like exit value.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
313 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
314 int
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
315 vms_sys_status(int status)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
316 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
317 if (status != SS$_NORMAL && (status & STS$M_SUCCESS) == 0)
18810
44b855153d8e patch 8.1.2393: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 18765
diff changeset
318 return status; // Command failed.
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
319 return 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
320 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
321
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
322 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
323 * vms_read()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
324 * function for low level char input
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
325 *
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
326 * Returns: input length
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
327 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
328 int
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
329 vms_read(char *inbuf, size_t nbytes)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
330 {
775
f04f56979d84 updated for version 7.0227
vimboss
parents: 715
diff changeset
331 int status, function, len;
f04f56979d84 updated for version 7.0227
vimboss
parents: 715
diff changeset
332 TT_MODE tt_mode;
18810
44b855153d8e patch 8.1.2393: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 18765
diff changeset
333 ITEM itmlst[2]; // terminates on everything
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
334 static long trm_mask[8] = {-1, -1, -1, -1, -1, -1, -1, -1};
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
335
18810
44b855153d8e patch 8.1.2393: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 18765
diff changeset
336 // whatever happened earlier we need an iochan here
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
337 if (!iochan)
775
f04f56979d84 updated for version 7.0227
vimboss
parents: 715
diff changeset
338 tt_mode = get_tty();
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
339
18810
44b855153d8e patch 8.1.2393: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 18765
diff changeset
340 // important: clean the inbuf
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
341 memset(inbuf, 0, nbytes);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
342
18810
44b855153d8e patch 8.1.2393: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 18765
diff changeset
343 // set up the itemlist for the first read
694
07d199fe02ed updated for version 7.0209
vimboss
parents: 406
diff changeset
344 vul_item(&itmlst[0], 0, TRM$_MODIFIERS,
775
f04f56979d84 updated for version 7.0227
vimboss
parents: 715
diff changeset
345 (char *)( TRM$M_TM_NOECHO | TRM$M_TM_NOEDIT |
f04f56979d84 updated for version 7.0227
vimboss
parents: 715
diff changeset
346 TRM$M_TM_NOFILTR | TRM$M_TM_TRMNOECHO |
f04f56979d84 updated for version 7.0227
vimboss
parents: 715
diff changeset
347 TRM$M_TM_NORECALL) , 0);
694
07d199fe02ed updated for version 7.0209
vimboss
parents: 406
diff changeset
348 vul_item(&itmlst[1], sizeof(trm_mask), TRM$_TERM, (char *)&trm_mask, 0);
07d199fe02ed updated for version 7.0209
vimboss
parents: 406
diff changeset
349
18810
44b855153d8e patch 8.1.2393: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 18765
diff changeset
350 // wait forever for a char
694
07d199fe02ed updated for version 7.0209
vimboss
parents: 406
diff changeset
351 function = (IO$_READLBLK | IO$M_EXTEND);
07d199fe02ed updated for version 7.0209
vimboss
parents: 406
diff changeset
352 status = sys$qiow(0, iochan, function, &iosb, 0, 0,
775
f04f56979d84 updated for version 7.0227
vimboss
parents: 715
diff changeset
353 inbuf, nbytes-1, 0, 0, &itmlst, sizeof(itmlst));
18810
44b855153d8e patch 8.1.2393: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 18765
diff changeset
354 len = strlen(inbuf); // how many chars we got?
694
07d199fe02ed updated for version 7.0209
vimboss
parents: 406
diff changeset
355
18810
44b855153d8e patch 8.1.2393: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 18765
diff changeset
356 // read immediately the rest in the IO queue
694
07d199fe02ed updated for version 7.0209
vimboss
parents: 406
diff changeset
357 function = (IO$_READLBLK | IO$M_TIMED | IO$M_ESCAPE | IO$M_NOECHO | IO$M_NOFILTR);
07d199fe02ed updated for version 7.0209
vimboss
parents: 406
diff changeset
358 status = sys$qiow(0, iochan, function, &iosb, 0, 0,
775
f04f56979d84 updated for version 7.0227
vimboss
parents: 715
diff changeset
359 inbuf+len, nbytes-1-len, 0, 0, 0, 0);
694
07d199fe02ed updated for version 7.0209
vimboss
parents: 406
diff changeset
360
18810
44b855153d8e patch 8.1.2393: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 18765
diff changeset
361 len = strlen(inbuf); // return the total length
694
07d199fe02ed updated for version 7.0209
vimboss
parents: 406
diff changeset
362
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
363 return len;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
364 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
365
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
366 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
367 * vms_wproc() is called for each matching filename by decc$to_vms().
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
368 * We want to save each match for later retrieval.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
369 *
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
370 * Returns: 1 - continue finding matches
1197
b7ad1c609161 updated for version 7.1b
vimboss
parents: 1121
diff changeset
371 * 0 - stop trying to find any further matches
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
372 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
373 static int
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
374 vms_wproc(char *name, int val)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
375 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
376 int i;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
377 static int vms_match_alloced = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
378
18810
44b855153d8e patch 8.1.2393: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 18765
diff changeset
379 if (val == DECC$K_FOREIGN ) // foreign non VMS files are not counting
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
380 return 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
381
18810
44b855153d8e patch 8.1.2393: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 18765
diff changeset
382 // accept all DECC$K_FILE and DECC$K_DIRECTORY
31804
50555279168b patch 9.0.1234: the code style has to be checked manually
Bram Moolenaar <Bram@vim.org>
parents: 28844
diff changeset
383 if (vms_match_num == 0)
50555279168b patch 9.0.1234: the code style has to be checked manually
Bram Moolenaar <Bram@vim.org>
parents: 28844
diff changeset
384 {
18810
44b855153d8e patch 8.1.2393: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 18765
diff changeset
385 // first time through, setup some things
31804
50555279168b patch 9.0.1234: the code style has to be checked manually
Bram Moolenaar <Bram@vim.org>
parents: 28844
diff changeset
386 if (NULL == vms_fmatch)
50555279168b patch 9.0.1234: the code style has to be checked manually
Bram Moolenaar <Bram@vim.org>
parents: 28844
diff changeset
387 {
18761
e3785af3ba0f patch 8.1.2370: build problems on VMS
Bram Moolenaar <Bram@vim.org>
parents: 16825
diff changeset
388 vms_fmatch = ALLOC_MULT(char_u *, EXPL_ALLOC_INC);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
389 if (!vms_fmatch)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
390 return 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
391 vms_match_alloced = EXPL_ALLOC_INC;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
392 vms_match_free = EXPL_ALLOC_INC;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
393 }
31804
50555279168b patch 9.0.1234: the code style has to be checked manually
Bram Moolenaar <Bram@vim.org>
parents: 28844
diff changeset
394 else
50555279168b patch 9.0.1234: the code style has to be checked manually
Bram Moolenaar <Bram@vim.org>
parents: 28844
diff changeset
395 {
18810
44b855153d8e patch 8.1.2393: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 18765
diff changeset
396 // re-use existing space
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
397 vms_match_free = vms_match_alloced;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
398 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
399 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
400
18810
44b855153d8e patch 8.1.2393: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 18765
diff changeset
401 // make matches look uniform
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
402 vms_remove_version(name);
5704
47a673b20e49 updated for version 7.4.197
Bram Moolenaar <bram@vim.org>
parents: 5541
diff changeset
403 name=vms_tolower(name);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
404
18810
44b855153d8e patch 8.1.2393: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 18765
diff changeset
405 // if name already exists, don't add it
31804
50555279168b patch 9.0.1234: the code style has to be checked manually
Bram Moolenaar <Bram@vim.org>
parents: 28844
diff changeset
406 for (i = 0; i<vms_match_num; i++)
50555279168b patch 9.0.1234: the code style has to be checked manually
Bram Moolenaar <Bram@vim.org>
parents: 28844
diff changeset
407 {
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
408 if (0 == STRCMP((char_u *)name,vms_fmatch[i]))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
409 return 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
410 }
31804
50555279168b patch 9.0.1234: the code style has to be checked manually
Bram Moolenaar <Bram@vim.org>
parents: 28844
diff changeset
411 if (--vms_match_free == 0)
50555279168b patch 9.0.1234: the code style has to be checked manually
Bram Moolenaar <Bram@vim.org>
parents: 28844
diff changeset
412 {
18765
1130f8309f67 patch 8.1.2372: VMS: failing realloc leaks memory
Bram Moolenaar <Bram@vim.org>
parents: 18761
diff changeset
413 char_u **old_vms_fmatch = vms_fmatch;
1130f8309f67 patch 8.1.2372: VMS: failing realloc leaks memory
Bram Moolenaar <Bram@vim.org>
parents: 18761
diff changeset
414
18810
44b855153d8e patch 8.1.2393: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 18765
diff changeset
415 // add more space to store matches
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
416 vms_match_alloced += EXPL_ALLOC_INC;
18765
1130f8309f67 patch 8.1.2372: VMS: failing realloc leaks memory
Bram Moolenaar <Bram@vim.org>
parents: 18761
diff changeset
417 vms_fmatch = vim_realloc(old_vms_fmatch,
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
418 sizeof(char **) * vms_match_alloced);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
419 if (!vms_fmatch)
18765
1130f8309f67 patch 8.1.2372: VMS: failing realloc leaks memory
Bram Moolenaar <Bram@vim.org>
parents: 18761
diff changeset
420 {
1130f8309f67 patch 8.1.2372: VMS: failing realloc leaks memory
Bram Moolenaar <Bram@vim.org>
parents: 18761
diff changeset
421 vim_free(old_vms_fmatch);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
422 return 0;
18765
1130f8309f67 patch 8.1.2372: VMS: failing realloc leaks memory
Bram Moolenaar <Bram@vim.org>
parents: 18761
diff changeset
423 }
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
424 vms_match_free = EXPL_ALLOC_INC;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
425 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
426 vms_fmatch[vms_match_num] = vim_strsave((char_u *)name);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
427
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
428 ++vms_match_num;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
429 return 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
430 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
431
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
432 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
433 * mch_expand_wildcards this code does wild-card pattern
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
434 * matching NOT using the shell
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
435 *
1698
f4f8014d516e updated for version 7.2c-000
vimboss
parents: 1197
diff changeset
436 * return OK for success, FAIL for error (you may lose some
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
437 * memory) and put an error message in *file.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
438 *
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
439 * num_pat number of input patterns
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
440 * pat array of pointers to input patterns
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
441 * num_file pointer to number of matched file names
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
442 * file pointer to array of pointers to matched file names
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
443 *
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
444 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
445 int
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
446 mch_expand_wildcards(int num_pat, char_u **pat, int *num_file, char_u ***file, int flags)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
447 {
2278
0b3be97064e5 Various small fixes from Dominique Pelle.
Bram Moolenaar <bram@vim.org>
parents: 1738
diff changeset
448 int i, cnt = 0;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
449 char_u buf[MAXPATHL];
5704
47a673b20e49 updated for version 7.4.197
Bram Moolenaar <bram@vim.org>
parents: 5541
diff changeset
450 char *result;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
451 int dir;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
452 int files_alloced, files_free;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
453
18810
44b855153d8e patch 8.1.2393: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 18765
diff changeset
454 *num_file = 0; // default: no files found
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
455 files_alloced = EXPL_ALLOC_INC;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
456 files_free = EXPL_ALLOC_INC;
18761
e3785af3ba0f patch 8.1.2370: build problems on VMS
Bram Moolenaar <Bram@vim.org>
parents: 16825
diff changeset
457 *file = ALLOC_MULT(char_u *, files_alloced);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
458 if (*file == NULL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
459 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
460 *num_file = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
461 return FAIL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
462 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
463 for (i = 0; i < num_pat; i++)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
464 {
18810
44b855153d8e patch 8.1.2393: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 18765
diff changeset
465 // expand environment var or home dir
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
466 if (vim_strchr(pat[i],'$') || vim_strchr(pat[i],'~'))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
467 expand_env(pat[i],buf,MAXPATHL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
468 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
469 STRCPY(buf,pat[i]);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
470
18810
44b855153d8e patch 8.1.2393: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 18765
diff changeset
471 vms_match_num = 0; // reset collection counter
5704
47a673b20e49 updated for version 7.4.197
Bram Moolenaar <bram@vim.org>
parents: 5541
diff changeset
472 result = decc$translate_vms(vms_fixfilename(buf));
31804
50555279168b patch 9.0.1234: the code style has to be checked manually
Bram Moolenaar <Bram@vim.org>
parents: 28844
diff changeset
473 if ( (int) result == 0 || (int) result == -1 )
50555279168b patch 9.0.1234: the code style has to be checked manually
Bram Moolenaar <Bram@vim.org>
parents: 28844
diff changeset
474 {
5704
47a673b20e49 updated for version 7.4.197
Bram Moolenaar <bram@vim.org>
parents: 5541
diff changeset
475 cnt = 0;
31804
50555279168b patch 9.0.1234: the code style has to be checked manually
Bram Moolenaar <Bram@vim.org>
parents: 28844
diff changeset
476 }
50555279168b patch 9.0.1234: the code style has to be checked manually
Bram Moolenaar <Bram@vim.org>
parents: 28844
diff changeset
477 else
50555279168b patch 9.0.1234: the code style has to be checked manually
Bram Moolenaar <Bram@vim.org>
parents: 28844
diff changeset
478 {
5704
47a673b20e49 updated for version 7.4.197
Bram Moolenaar <bram@vim.org>
parents: 5541
diff changeset
479 cnt = decc$to_vms(result, vms_wproc, 1 /*allow wild*/ , (flags & EW_DIR ? 0:1 ) /*allow directory*/) ;
47a673b20e49 updated for version 7.4.197
Bram Moolenaar <bram@vim.org>
parents: 5541
diff changeset
480 }
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
481 if (cnt > 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
482 cnt = vms_match_num;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
483
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
484 if (cnt < 1)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
485 continue;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
486
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
487 for (i = 0; i < cnt; i++)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
488 {
18810
44b855153d8e patch 8.1.2393: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 18765
diff changeset
489 // files should exist if expanding interactively
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
490 if (!(flags & EW_NOTFOUND) && mch_getperm(vms_fmatch[i]) < 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
491 continue;
715
b526e10493b1 updated for version 7.0217
vimboss
parents: 694
diff changeset
492
18810
44b855153d8e patch 8.1.2393: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 18765
diff changeset
493 // do not include directories
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
494 dir = (mch_isdir(vms_fmatch[i]));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
495 if (( dir && !(flags & EW_DIR)) || (!dir && !(flags & EW_FILE)))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
496 continue;
715
b526e10493b1 updated for version 7.0217
vimboss
parents: 694
diff changeset
497
18810
44b855153d8e patch 8.1.2393: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 18765
diff changeset
498 // Skip files that are not executable if we check for that.
6695
6529590f6c43 updated for version 7.4.672
Bram Moolenaar <bram@vim.org>
parents: 6359
diff changeset
499 if (!dir && (flags & EW_EXEC)
6529590f6c43 updated for version 7.4.672
Bram Moolenaar <bram@vim.org>
parents: 6359
diff changeset
500 && !mch_can_exe(vms_fmatch[i], NULL, !(flags & EW_SHELLCMD)))
715
b526e10493b1 updated for version 7.0217
vimboss
parents: 694
diff changeset
501 continue;
b526e10493b1 updated for version 7.0217
vimboss
parents: 694
diff changeset
502
18810
44b855153d8e patch 8.1.2393: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 18765
diff changeset
503 // allocate memory for pointers
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
504 if (--files_free < 1)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
505 {
18765
1130f8309f67 patch 8.1.2372: VMS: failing realloc leaks memory
Bram Moolenaar <Bram@vim.org>
parents: 18761
diff changeset
506 char_u **old_file = *file;
1130f8309f67 patch 8.1.2372: VMS: failing realloc leaks memory
Bram Moolenaar <Bram@vim.org>
parents: 18761
diff changeset
507
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
508 files_alloced += EXPL_ALLOC_INC;
18765
1130f8309f67 patch 8.1.2372: VMS: failing realloc leaks memory
Bram Moolenaar <Bram@vim.org>
parents: 18761
diff changeset
509 *file = vim_realloc(old_file, sizeof(char_u **) * files_alloced);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
510 if (*file == NULL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
511 {
18765
1130f8309f67 patch 8.1.2372: VMS: failing realloc leaks memory
Bram Moolenaar <Bram@vim.org>
parents: 18761
diff changeset
512 vim_free(old_file);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
513 *file = (char_u **)"";
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
514 *num_file = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
515 return(FAIL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
516 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
517 files_free = EXPL_ALLOC_INC;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
518 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
519
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
520 (*file)[*num_file++] = vms_fmatch[i];
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
521 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
522 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
523 return OK;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
524 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
525
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
526 int
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
527 mch_expandpath(garray_T *gap, char_u *path, int flags)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
528 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
529 int i,cnt = 0;
5704
47a673b20e49 updated for version 7.4.197
Bram Moolenaar <bram@vim.org>
parents: 5541
diff changeset
530 char *result;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
531
5704
47a673b20e49 updated for version 7.4.197
Bram Moolenaar <bram@vim.org>
parents: 5541
diff changeset
532 vms_match_num = 0;
18810
44b855153d8e patch 8.1.2393: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 18765
diff changeset
533 // the result from the decc$translate_vms needs to be handled
44b855153d8e patch 8.1.2393: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 18765
diff changeset
534 // otherwise it might create ACCVIO error in decc$to_vms
5704
47a673b20e49 updated for version 7.4.197
Bram Moolenaar <bram@vim.org>
parents: 5541
diff changeset
535 result = decc$translate_vms(vms_fixfilename(path));
31804
50555279168b patch 9.0.1234: the code style has to be checked manually
Bram Moolenaar <Bram@vim.org>
parents: 28844
diff changeset
536 if ( (int) result == 0 || (int) result == -1 )
50555279168b patch 9.0.1234: the code style has to be checked manually
Bram Moolenaar <Bram@vim.org>
parents: 28844
diff changeset
537 {
13353
8412df1479a3 patch 8.0.1550: various small problems in source files
Christian Brabandt <cb@256bit.org>
parents: 10328
diff changeset
538 cnt = 0;
31804
50555279168b patch 9.0.1234: the code style has to be checked manually
Bram Moolenaar <Bram@vim.org>
parents: 28844
diff changeset
539 }
50555279168b patch 9.0.1234: the code style has to be checked manually
Bram Moolenaar <Bram@vim.org>
parents: 28844
diff changeset
540 else
50555279168b patch 9.0.1234: the code style has to be checked manually
Bram Moolenaar <Bram@vim.org>
parents: 28844
diff changeset
541 {
13353
8412df1479a3 patch 8.0.1550: various small problems in source files
Christian Brabandt <cb@256bit.org>
parents: 10328
diff changeset
542 cnt = decc$to_vms(result, vms_wproc, 1 /*allow_wild*/, (flags & EW_DIR ? 0:1 ) /*allow directory*/);
5704
47a673b20e49 updated for version 7.4.197
Bram Moolenaar <bram@vim.org>
parents: 5541
diff changeset
543 }
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
544 if (cnt > 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
545 cnt = vms_match_num;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
546 for (i = 0; i < cnt; i++)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
547 {
18810
44b855153d8e patch 8.1.2393: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 18765
diff changeset
548 if (mch_getperm(vms_fmatch[i]) >= 0) // add existing file
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
549 addfile(gap, vms_fmatch[i], flags);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
550 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
551 return cnt;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
552 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
553
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
554 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
555 * attempt to translate a mixed unix-vms file specification to pure vms
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
556 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
557 static void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
558 vms_unix_mixed_filespec(char *in, char *out)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
559 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
560 char *lastcolon;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
561 char *end_of_dir;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
562 char ch;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
563 int len;
5704
47a673b20e49 updated for version 7.4.197
Bram Moolenaar <bram@vim.org>
parents: 5541
diff changeset
564 char *out_str=out;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
565
18810
44b855153d8e patch 8.1.2393: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 18765
diff changeset
566 // copy vms filename portion up to last colon
44b855153d8e patch 8.1.2393: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 18765
diff changeset
567 // (node and/or disk)
44b855153d8e patch 8.1.2393: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 18765
diff changeset
568 lastcolon = strrchr(in, ':'); // find last colon
31804
50555279168b patch 9.0.1234: the code style has to be checked manually
Bram Moolenaar <Bram@vim.org>
parents: 28844
diff changeset
569 if (lastcolon != NULL)
50555279168b patch 9.0.1234: the code style has to be checked manually
Bram Moolenaar <Bram@vim.org>
parents: 28844
diff changeset
570 {
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
571 len = lastcolon - in + 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
572 strncpy(out, in, len);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
573 out += len;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
574 in += len;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
575 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
576
18810
44b855153d8e patch 8.1.2393: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 18765
diff changeset
577 end_of_dir = NULL; // default: no directory
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
578
18810
44b855153d8e patch 8.1.2393: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 18765
diff changeset
579 // start of directory portion
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
580 ch = *in;
31804
50555279168b patch 9.0.1234: the code style has to be checked manually
Bram Moolenaar <Bram@vim.org>
parents: 28844
diff changeset
581 if ((ch == '[') || (ch == '/') || (ch == '<')) // start of directory(s) ?
50555279168b patch 9.0.1234: the code style has to be checked manually
Bram Moolenaar <Bram@vim.org>
parents: 28844
diff changeset
582 {
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
583 ch = '[';
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
584 SKIP_FOLLOWING_SLASHES(in);
31804
50555279168b patch 9.0.1234: the code style has to be checked manually
Bram Moolenaar <Bram@vim.org>
parents: 28844
diff changeset
585 }
50555279168b patch 9.0.1234: the code style has to be checked manually
Bram Moolenaar <Bram@vim.org>
parents: 28844
diff changeset
586 else if (EQN(in, "../", 3)) // Unix parent directory?
50555279168b patch 9.0.1234: the code style has to be checked manually
Bram Moolenaar <Bram@vim.org>
parents: 28844
diff changeset
587 {
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
588 *out++ = '[';
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
589 *out++ = '-';
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
590 end_of_dir = out;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
591 ch = '.';
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
592 in += 2;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
593 SKIP_FOLLOWING_SLASHES(in);
31804
50555279168b patch 9.0.1234: the code style has to be checked manually
Bram Moolenaar <Bram@vim.org>
parents: 28844
diff changeset
594 }
50555279168b patch 9.0.1234: the code style has to be checked manually
Bram Moolenaar <Bram@vim.org>
parents: 28844
diff changeset
595 else
50555279168b patch 9.0.1234: the code style has to be checked manually
Bram Moolenaar <Bram@vim.org>
parents: 28844
diff changeset
596 { // not a special character
50555279168b patch 9.0.1234: the code style has to be checked manually
Bram Moolenaar <Bram@vim.org>
parents: 28844
diff changeset
597 while (EQN(in, "./", 2)) // Ignore Unix "current dir"
50555279168b patch 9.0.1234: the code style has to be checked manually
Bram Moolenaar <Bram@vim.org>
parents: 28844
diff changeset
598 {
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
599 in += 2;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
600 SKIP_FOLLOWING_SLASHES(in);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
601 }
31804
50555279168b patch 9.0.1234: the code style has to be checked manually
Bram Moolenaar <Bram@vim.org>
parents: 28844
diff changeset
602 if (strchr(in, '/') == NULL) // any more Unix directories ?
50555279168b patch 9.0.1234: the code style has to be checked manually
Bram Moolenaar <Bram@vim.org>
parents: 28844
diff changeset
603 {
18810
44b855153d8e patch 8.1.2393: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 18765
diff changeset
604 strcpy(out, in); // No - get rest of the spec
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
605 return;
31804
50555279168b patch 9.0.1234: the code style has to be checked manually
Bram Moolenaar <Bram@vim.org>
parents: 28844
diff changeset
606 }
50555279168b patch 9.0.1234: the code style has to be checked manually
Bram Moolenaar <Bram@vim.org>
parents: 28844
diff changeset
607 else
50555279168b patch 9.0.1234: the code style has to be checked manually
Bram Moolenaar <Bram@vim.org>
parents: 28844
diff changeset
608 {
18810
44b855153d8e patch 8.1.2393: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 18765
diff changeset
609 *out++ = '['; // Yes, denote a Vms subdirectory
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
610 ch = '.';
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
611 --in;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
612 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
613 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
614
18810
44b855153d8e patch 8.1.2393: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 18765
diff changeset
615 // if we get here, there is a directory part of the filename
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
616
18810
44b855153d8e patch 8.1.2393: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 18765
diff changeset
617 // initialize output file spec
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
618 *out++ = ch;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
619 ++in;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
620
31804
50555279168b patch 9.0.1234: the code style has to be checked manually
Bram Moolenaar <Bram@vim.org>
parents: 28844
diff changeset
621 while (*in != '\0')
50555279168b patch 9.0.1234: the code style has to be checked manually
Bram Moolenaar <Bram@vim.org>
parents: 28844
diff changeset
622 {
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
623 ch = *in;
31804
50555279168b patch 9.0.1234: the code style has to be checked manually
Bram Moolenaar <Bram@vim.org>
parents: 28844
diff changeset
624 if ((ch == ']') || (ch == '/') || (ch == '>') ) // end of (sub)directory ?
50555279168b patch 9.0.1234: the code style has to be checked manually
Bram Moolenaar <Bram@vim.org>
parents: 28844
diff changeset
625 {
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
626 end_of_dir = out;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
627 ch = '.';
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
628 SKIP_FOLLOWING_SLASHES(in);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
629 }
31804
50555279168b patch 9.0.1234: the code style has to be checked manually
Bram Moolenaar <Bram@vim.org>
parents: 28844
diff changeset
630 else if (EQN(in, "../", 3)) // Unix parent directory?
50555279168b patch 9.0.1234: the code style has to be checked manually
Bram Moolenaar <Bram@vim.org>
parents: 28844
diff changeset
631 {
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
632 *out++ = '-';
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
633 end_of_dir = out;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
634 ch = '.';
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
635 in += 2;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
636 SKIP_FOLLOWING_SLASHES(in);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
637 }
31804
50555279168b patch 9.0.1234: the code style has to be checked manually
Bram Moolenaar <Bram@vim.org>
parents: 28844
diff changeset
638 else
50555279168b patch 9.0.1234: the code style has to be checked manually
Bram Moolenaar <Bram@vim.org>
parents: 28844
diff changeset
639 {
50555279168b patch 9.0.1234: the code style has to be checked manually
Bram Moolenaar <Bram@vim.org>
parents: 28844
diff changeset
640 while (EQN(in, "./", 2)) // Ignore Unix "current dir"
50555279168b patch 9.0.1234: the code style has to be checked manually
Bram Moolenaar <Bram@vim.org>
parents: 28844
diff changeset
641 {
50555279168b patch 9.0.1234: the code style has to be checked manually
Bram Moolenaar <Bram@vim.org>
parents: 28844
diff changeset
642 end_of_dir = out;
50555279168b patch 9.0.1234: the code style has to be checked manually
Bram Moolenaar <Bram@vim.org>
parents: 28844
diff changeset
643 in += 2;
50555279168b patch 9.0.1234: the code style has to be checked manually
Bram Moolenaar <Bram@vim.org>
parents: 28844
diff changeset
644 SKIP_FOLLOWING_SLASHES(in);
50555279168b patch 9.0.1234: the code style has to be checked manually
Bram Moolenaar <Bram@vim.org>
parents: 28844
diff changeset
645 ch = *in;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
646 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
647 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
648
18810
44b855153d8e patch 8.1.2393: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 18765
diff changeset
649 // Place next character into output file spec
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
650 *out++ = ch;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
651 ++in;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
652 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
653
18810
44b855153d8e patch 8.1.2393: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 18765
diff changeset
654 *out = '\0'; // Terminate output file spec
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
655
18810
44b855153d8e patch 8.1.2393: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 18765
diff changeset
656 if (end_of_dir != NULL) // Terminate directory portion
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
657 *end_of_dir = ']';
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
658 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
659
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
660 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
661 * for decc$to_vms in vms_fixfilename
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
662 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
663 static int
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
664 vms_fspec_proc(char *fil, int val)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
665 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
666 strcpy(Fspec_Rms,fil);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
667 return(1);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
668 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
669
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
670 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
671 * change unix and mixed filenames to VMS
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
672 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
673 void *
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
674 vms_fixfilename(void *instring)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
675 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
676 static char *buf = NULL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
677 static size_t buflen = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
678 size_t len;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
679
18810
44b855153d8e patch 8.1.2393: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 18765
diff changeset
680 // get a big-enough buffer
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
681 len = strlen(instring) + 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
682 if (len > buflen)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
683 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
684 buflen = len + 128;
16825
ce04ebdf26b8 patch 8.1.1414: alloc() returning "char_u *" causes a lot of type casts
Bram Moolenaar <Bram@vim.org>
parents: 16782
diff changeset
685 buf = vim_realloc(buf, buflen * sizeof(char));
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
686 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
687
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
688 #ifdef DEBUG
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
689 char *tmpbuf = NULL;
16825
ce04ebdf26b8 patch 8.1.1414: alloc() returning "char_u *" causes a lot of type casts
Bram Moolenaar <Bram@vim.org>
parents: 16782
diff changeset
690 tmpbuf = ALLOC_MULT(char, buflen);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
691 strcpy(tmpbuf, instring);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
692 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
693
18810
44b855153d8e patch 8.1.2393: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 18765
diff changeset
694 Fspec_Rms = buf; // for decc$to_vms
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
695
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 775
diff changeset
696 if (strchr(instring,'/') == NULL)
18810
44b855153d8e patch 8.1.2393: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 18765
diff changeset
697 // It is already a VMS file spec
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
698 strcpy(buf, instring);
18810
44b855153d8e patch 8.1.2393: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 18765
diff changeset
699 else if (strchr(instring,'"') == NULL) // password in the path?
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 775
diff changeset
700 {
18810
44b855153d8e patch 8.1.2393: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 18765
diff changeset
701 // Seems it is a regular file, let guess that it is pure Unix fspec
28844
c0403cd5ca06 patch 8.2.4945: inconsistent use of white space
Bram Moolenaar <Bram@vim.org>
parents: 23503
diff changeset
702 if ( (strchr(instring,'[') == NULL) && (strchr(instring,'<') == NULL) &&
23503
49d866e9b439 patch 8.2.2294: VMS: a few remaining problems
Bram Moolenaar <Bram@vim.org>
parents: 20439
diff changeset
703 (strchr(instring,']') == NULL) && (strchr(instring,'>') == NULL) &&
49d866e9b439 patch 8.2.2294: VMS: a few remaining problems
Bram Moolenaar <Bram@vim.org>
parents: 20439
diff changeset
704 (strchr(instring,':') == NULL) )
49d866e9b439 patch 8.2.2294: VMS: a few remaining problems
Bram Moolenaar <Bram@vim.org>
parents: 20439
diff changeset
705 {
49d866e9b439 patch 8.2.2294: VMS: a few remaining problems
Bram Moolenaar <Bram@vim.org>
parents: 20439
diff changeset
706 // It must be a truly unix fspec
49d866e9b439 patch 8.2.2294: VMS: a few remaining problems
Bram Moolenaar <Bram@vim.org>
parents: 20439
diff changeset
707 decc$to_vms(instring, vms_fspec_proc, 0, 0);
49d866e9b439 patch 8.2.2294: VMS: a few remaining problems
Bram Moolenaar <Bram@vim.org>
parents: 20439
diff changeset
708 }
49d866e9b439 patch 8.2.2294: VMS: a few remaining problems
Bram Moolenaar <Bram@vim.org>
parents: 20439
diff changeset
709 else
49d866e9b439 patch 8.2.2294: VMS: a few remaining problems
Bram Moolenaar <Bram@vim.org>
parents: 20439
diff changeset
710 {
49d866e9b439 patch 8.2.2294: VMS: a few remaining problems
Bram Moolenaar <Bram@vim.org>
parents: 20439
diff changeset
711 // It is a mixed fspec
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
712 vms_unix_mixed_filespec(instring, buf);
23503
49d866e9b439 patch 8.2.2294: VMS: a few remaining problems
Bram Moolenaar <Bram@vim.org>
parents: 20439
diff changeset
713 }
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
714 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
715 else
18810
44b855153d8e patch 8.1.2393: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 18765
diff changeset
716 // we have a password in the path
44b855153d8e patch 8.1.2393: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 18765
diff changeset
717 // decc$ functions can not handle
44b855153d8e patch 8.1.2393: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 18765
diff changeset
718 // this is our only hope to resolv
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
719 vms_unix_mixed_filespec(instring, buf);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
720
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
721 return buf;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
722 }
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 775
diff changeset
723
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
724 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
725 * Remove version number from file name
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
726 * we need it in some special cases as:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
727 * creating swap file name and writing new file
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
728 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
729 void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
730 vms_remove_version(void * fname)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
731 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
732 char_u *cp;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
733 char_u *fp;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
734
18810
44b855153d8e patch 8.1.2393: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 18765
diff changeset
735 if ((cp = vim_strchr( fname, ';')) != NULL) // remove version
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
736 *cp = '\0';
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
737 else if ((cp = vim_strrchr( fname, '.')) != NULL )
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
738 {
31804
50555279168b patch 9.0.1234: the code style has to be checked manually
Bram Moolenaar <Bram@vim.org>
parents: 28844
diff changeset
739 if ((fp = vim_strrchr( fname, ']')) != NULL )
50555279168b patch 9.0.1234: the code style has to be checked manually
Bram Moolenaar <Bram@vim.org>
parents: 28844
diff changeset
740 {;}
50555279168b patch 9.0.1234: the code style has to be checked manually
Bram Moolenaar <Bram@vim.org>
parents: 28844
diff changeset
741 else if ((fp = vim_strrchr( fname, '>')) != NULL )
50555279168b patch 9.0.1234: the code style has to be checked manually
Bram Moolenaar <Bram@vim.org>
parents: 28844
diff changeset
742 {;}
50555279168b patch 9.0.1234: the code style has to be checked manually
Bram Moolenaar <Bram@vim.org>
parents: 28844
diff changeset
743 else
50555279168b patch 9.0.1234: the code style has to be checked manually
Bram Moolenaar <Bram@vim.org>
parents: 28844
diff changeset
744 fp = fname;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
745
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
746 while ( *fp != '\0' && fp < cp )
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
747 if ( *fp++ == '.' )
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
748 *cp = '\0';
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
749 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
750 return ;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
751 }
5541
2f99966971b0 updated for version 7.4.119
Bram Moolenaar <bram@vim.org>
parents: 2278
diff changeset
752
2f99966971b0 updated for version 7.4.119
Bram Moolenaar <bram@vim.org>
parents: 2278
diff changeset
753 struct typeahead_st {
2f99966971b0 updated for version 7.4.119
Bram Moolenaar <bram@vim.org>
parents: 2278
diff changeset
754 unsigned short numchars;
2f99966971b0 updated for version 7.4.119
Bram Moolenaar <bram@vim.org>
parents: 2278
diff changeset
755 unsigned char firstchar;
2f99966971b0 updated for version 7.4.119
Bram Moolenaar <bram@vim.org>
parents: 2278
diff changeset
756 unsigned char reserved0;
2f99966971b0 updated for version 7.4.119
Bram Moolenaar <bram@vim.org>
parents: 2278
diff changeset
757 unsigned long reserved1;
2f99966971b0 updated for version 7.4.119
Bram Moolenaar <bram@vim.org>
parents: 2278
diff changeset
758 } typeahead;
2f99966971b0 updated for version 7.4.119
Bram Moolenaar <bram@vim.org>
parents: 2278
diff changeset
759
2f99966971b0 updated for version 7.4.119
Bram Moolenaar <bram@vim.org>
parents: 2278
diff changeset
760 /*
2f99966971b0 updated for version 7.4.119
Bram Moolenaar <bram@vim.org>
parents: 2278
diff changeset
761 * Wait "msec" msec until a character is available from file descriptor "fd".
2f99966971b0 updated for version 7.4.119
Bram Moolenaar <bram@vim.org>
parents: 2278
diff changeset
762 * "msec" == 0 will check for characters once.
2f99966971b0 updated for version 7.4.119
Bram Moolenaar <bram@vim.org>
parents: 2278
diff changeset
763 * "msec" == -1 will block until a character is available.
2f99966971b0 updated for version 7.4.119
Bram Moolenaar <bram@vim.org>
parents: 2278
diff changeset
764 */
2f99966971b0 updated for version 7.4.119
Bram Moolenaar <bram@vim.org>
parents: 2278
diff changeset
765 int
7833
c079097365f3 commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents: 7805
diff changeset
766 RealWaitForChar(
18810
44b855153d8e patch 8.1.2393: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 18765
diff changeset
767 int fd UNUSED, // always read from iochan
7833
c079097365f3 commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents: 7805
diff changeset
768 long msec,
10328
299f1669c20e commit https://github.com/vim/vim/commit/de5e2c219b99895445fb75ae3541ee69282a5846
Christian Brabandt <cb@256bit.org>
parents: 10042
diff changeset
769 int *check_for_gpm UNUSED,
299f1669c20e commit https://github.com/vim/vim/commit/de5e2c219b99895445fb75ae3541ee69282a5846
Christian Brabandt <cb@256bit.org>
parents: 10042
diff changeset
770 int *interrupted)
5541
2f99966971b0 updated for version 7.4.119
Bram Moolenaar <bram@vim.org>
parents: 2278
diff changeset
771 {
2f99966971b0 updated for version 7.4.119
Bram Moolenaar <bram@vim.org>
parents: 2278
diff changeset
772 int status;
2f99966971b0 updated for version 7.4.119
Bram Moolenaar <bram@vim.org>
parents: 2278
diff changeset
773 struct _generic_64 time_curr;
2f99966971b0 updated for version 7.4.119
Bram Moolenaar <bram@vim.org>
parents: 2278
diff changeset
774 struct _generic_64 time_diff;
2f99966971b0 updated for version 7.4.119
Bram Moolenaar <bram@vim.org>
parents: 2278
diff changeset
775 struct _generic_64 time_out;
2f99966971b0 updated for version 7.4.119
Bram Moolenaar <bram@vim.org>
parents: 2278
diff changeset
776 unsigned int convert_operation = LIB$K_DELTA_SECONDS_F;
5704
47a673b20e49 updated for version 7.4.197
Bram Moolenaar <bram@vim.org>
parents: 5541
diff changeset
777 float sec =(float) msec/1000;
5541
2f99966971b0 updated for version 7.4.119
Bram Moolenaar <bram@vim.org>
parents: 2278
diff changeset
778
18810
44b855153d8e patch 8.1.2393: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 18765
diff changeset
779 // make sure the iochan is set
5541
2f99966971b0 updated for version 7.4.119
Bram Moolenaar <bram@vim.org>
parents: 2278
diff changeset
780 if (!iochan)
2f99966971b0 updated for version 7.4.119
Bram Moolenaar <bram@vim.org>
parents: 2278
diff changeset
781 get_tty();
2f99966971b0 updated for version 7.4.119
Bram Moolenaar <bram@vim.org>
parents: 2278
diff changeset
782
31804
50555279168b patch 9.0.1234: the code style has to be checked manually
Bram Moolenaar <Bram@vim.org>
parents: 28844
diff changeset
783 if (sec > 0)
50555279168b patch 9.0.1234: the code style has to be checked manually
Bram Moolenaar <Bram@vim.org>
parents: 28844
diff changeset
784 {
18810
44b855153d8e patch 8.1.2393: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 18765
diff changeset
785 // time-out specified; convert it to absolute time
44b855153d8e patch 8.1.2393: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 18765
diff changeset
786 // sec>0 requirement of lib$cvtf_to_internal_time()
5541
2f99966971b0 updated for version 7.4.119
Bram Moolenaar <bram@vim.org>
parents: 2278
diff changeset
787
18810
44b855153d8e patch 8.1.2393: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 18765
diff changeset
788 // get current time (number of 100ns ticks since the VMS Epoch)
13353
8412df1479a3 patch 8.0.1550: various small problems in source files
Christian Brabandt <cb@256bit.org>
parents: 10328
diff changeset
789 status = sys$gettim(&time_curr);
8412df1479a3 patch 8.0.1550: various small problems in source files
Christian Brabandt <cb@256bit.org>
parents: 10328
diff changeset
790 if (status != SS$_NORMAL)
18810
44b855153d8e patch 8.1.2393: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 18765
diff changeset
791 return 0; // error
44b855153d8e patch 8.1.2393: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 18765
diff changeset
792 // construct the delta time
5704
47a673b20e49 updated for version 7.4.197
Bram Moolenaar <bram@vim.org>
parents: 5541
diff changeset
793 #if __G_FLOAT==0
47a673b20e49 updated for version 7.4.197
Bram Moolenaar <bram@vim.org>
parents: 5541
diff changeset
794 # ifndef VAX
18810
44b855153d8e patch 8.1.2393: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 18765
diff changeset
795 // IEEE is default on IA64, but can be used on Alpha too - but not on VAX
13353
8412df1479a3 patch 8.0.1550: various small problems in source files
Christian Brabandt <cb@256bit.org>
parents: 10328
diff changeset
796 status = lib$cvts_to_internal_time(
8412df1479a3 patch 8.0.1550: various small problems in source files
Christian Brabandt <cb@256bit.org>
parents: 10328
diff changeset
797 &convert_operation, &sec, &time_diff);
5704
47a673b20e49 updated for version 7.4.197
Bram Moolenaar <bram@vim.org>
parents: 5541
diff changeset
798 # endif
18810
44b855153d8e patch 8.1.2393: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 18765
diff changeset
799 #else // default on Alpha and VAX
13353
8412df1479a3 patch 8.0.1550: various small problems in source files
Christian Brabandt <cb@256bit.org>
parents: 10328
diff changeset
800 status = lib$cvtf_to_internal_time(
5704
47a673b20e49 updated for version 7.4.197
Bram Moolenaar <bram@vim.org>
parents: 5541
diff changeset
801 &convert_operation, &sec, &time_diff);
47a673b20e49 updated for version 7.4.197
Bram Moolenaar <bram@vim.org>
parents: 5541
diff changeset
802 #endif
13353
8412df1479a3 patch 8.0.1550: various small problems in source files
Christian Brabandt <cb@256bit.org>
parents: 10328
diff changeset
803 if (status != LIB$_NORMAL)
18810
44b855153d8e patch 8.1.2393: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 18765
diff changeset
804 return 0; // error
44b855153d8e patch 8.1.2393: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 18765
diff changeset
805 // add them up
13353
8412df1479a3 patch 8.0.1550: various small problems in source files
Christian Brabandt <cb@256bit.org>
parents: 10328
diff changeset
806 status = lib$add_times(
8412df1479a3 patch 8.0.1550: various small problems in source files
Christian Brabandt <cb@256bit.org>
parents: 10328
diff changeset
807 &time_curr,
8412df1479a3 patch 8.0.1550: various small problems in source files
Christian Brabandt <cb@256bit.org>
parents: 10328
diff changeset
808 &time_diff,
8412df1479a3 patch 8.0.1550: various small problems in source files
Christian Brabandt <cb@256bit.org>
parents: 10328
diff changeset
809 &time_out);
8412df1479a3 patch 8.0.1550: various small problems in source files
Christian Brabandt <cb@256bit.org>
parents: 10328
diff changeset
810 if (status != LIB$_NORMAL)
18810
44b855153d8e patch 8.1.2393: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 18765
diff changeset
811 return 0; // error
5541
2f99966971b0 updated for version 7.4.119
Bram Moolenaar <bram@vim.org>
parents: 2278
diff changeset
812 }
2f99966971b0 updated for version 7.4.119
Bram Moolenaar <bram@vim.org>
parents: 2278
diff changeset
813
31804
50555279168b patch 9.0.1234: the code style has to be checked manually
Bram Moolenaar <Bram@vim.org>
parents: 28844
diff changeset
814 while (TRUE)
50555279168b patch 9.0.1234: the code style has to be checked manually
Bram Moolenaar <Bram@vim.org>
parents: 28844
diff changeset
815 {
18810
44b855153d8e patch 8.1.2393: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 18765
diff changeset
816 // select()
13353
8412df1479a3 patch 8.0.1550: various small problems in source files
Christian Brabandt <cb@256bit.org>
parents: 10328
diff changeset
817 status = sys$qiow(0, iochan, IO$_SENSEMODE | IO$M_TYPEAHDCNT, iosb,
8412df1479a3 patch 8.0.1550: various small problems in source files
Christian Brabandt <cb@256bit.org>
parents: 10328
diff changeset
818 0, 0, &typeahead, 8, 0, 0, 0, 0);
5541
2f99966971b0 updated for version 7.4.119
Bram Moolenaar <bram@vim.org>
parents: 2278
diff changeset
819 if (status != SS$_NORMAL || (iosb[0] & 0xFFFF) != SS$_NORMAL)
18810
44b855153d8e patch 8.1.2393: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 18765
diff changeset
820 return 0; // error
5541
2f99966971b0 updated for version 7.4.119
Bram Moolenaar <bram@vim.org>
parents: 2278
diff changeset
821
13353
8412df1479a3 patch 8.0.1550: various small problems in source files
Christian Brabandt <cb@256bit.org>
parents: 10328
diff changeset
822 if (typeahead.numchars)
18810
44b855153d8e patch 8.1.2393: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 18765
diff changeset
823 return 1; // ready to read
5541
2f99966971b0 updated for version 7.4.119
Bram Moolenaar <bram@vim.org>
parents: 2278
diff changeset
824
18810
44b855153d8e patch 8.1.2393: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 18765
diff changeset
825 // there's nothing to read; what now?
31804
50555279168b patch 9.0.1234: the code style has to be checked manually
Bram Moolenaar <Bram@vim.org>
parents: 28844
diff changeset
826 if (msec == 0)
50555279168b patch 9.0.1234: the code style has to be checked manually
Bram Moolenaar <Bram@vim.org>
parents: 28844
diff changeset
827 {
18810
44b855153d8e patch 8.1.2393: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 18765
diff changeset
828 // immediate time-out; return impatiently
13353
8412df1479a3 patch 8.0.1550: various small problems in source files
Christian Brabandt <cb@256bit.org>
parents: 10328
diff changeset
829 return 0;
31804
50555279168b patch 9.0.1234: the code style has to be checked manually
Bram Moolenaar <Bram@vim.org>
parents: 28844
diff changeset
830 }
50555279168b patch 9.0.1234: the code style has to be checked manually
Bram Moolenaar <Bram@vim.org>
parents: 28844
diff changeset
831 else if (msec < 0)
50555279168b patch 9.0.1234: the code style has to be checked manually
Bram Moolenaar <Bram@vim.org>
parents: 28844
diff changeset
832 {
18810
44b855153d8e patch 8.1.2393: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 18765
diff changeset
833 // no time-out; wait on indefinitely
44b855153d8e patch 8.1.2393: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 18765
diff changeset
834 return 1; // fakeout to force a wait in vms_read()
31804
50555279168b patch 9.0.1234: the code style has to be checked manually
Bram Moolenaar <Bram@vim.org>
parents: 28844
diff changeset
835 }
50555279168b patch 9.0.1234: the code style has to be checked manually
Bram Moolenaar <Bram@vim.org>
parents: 28844
diff changeset
836 else
50555279168b patch 9.0.1234: the code style has to be checked manually
Bram Moolenaar <Bram@vim.org>
parents: 28844
diff changeset
837 {
18810
44b855153d8e patch 8.1.2393: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 18765
diff changeset
838 // time-out needs to be checked
13353
8412df1479a3 patch 8.0.1550: various small problems in source files
Christian Brabandt <cb@256bit.org>
parents: 10328
diff changeset
839 status = sys$gettim(&time_curr);
8412df1479a3 patch 8.0.1550: various small problems in source files
Christian Brabandt <cb@256bit.org>
parents: 10328
diff changeset
840 if (status != SS$_NORMAL)
18810
44b855153d8e patch 8.1.2393: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 18765
diff changeset
841 return 0; // error
5541
2f99966971b0 updated for version 7.4.119
Bram Moolenaar <bram@vim.org>
parents: 2278
diff changeset
842
13353
8412df1479a3 patch 8.0.1550: various small problems in source files
Christian Brabandt <cb@256bit.org>
parents: 10328
diff changeset
843 status = lib$sub_times(
8412df1479a3 patch 8.0.1550: various small problems in source files
Christian Brabandt <cb@256bit.org>
parents: 10328
diff changeset
844 &time_out,
8412df1479a3 patch 8.0.1550: various small problems in source files
Christian Brabandt <cb@256bit.org>
parents: 10328
diff changeset
845 &time_curr,
8412df1479a3 patch 8.0.1550: various small problems in source files
Christian Brabandt <cb@256bit.org>
parents: 10328
diff changeset
846 &time_diff);
8412df1479a3 patch 8.0.1550: various small problems in source files
Christian Brabandt <cb@256bit.org>
parents: 10328
diff changeset
847 if (status != LIB$_NORMAL)
18810
44b855153d8e patch 8.1.2393: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 18765
diff changeset
848 return 0; // error, incl. time_diff < 0 (i.e. time-out)
5541
2f99966971b0 updated for version 7.4.119
Bram Moolenaar <bram@vim.org>
parents: 2278
diff changeset
849
18810
44b855153d8e patch 8.1.2393: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 18765
diff changeset
850 // otherwise wait some more
13353
8412df1479a3 patch 8.0.1550: various small problems in source files
Christian Brabandt <cb@256bit.org>
parents: 10328
diff changeset
851 }
5541
2f99966971b0 updated for version 7.4.119
Bram Moolenaar <bram@vim.org>
parents: 2278
diff changeset
852 }
2f99966971b0 updated for version 7.4.119
Bram Moolenaar <bram@vim.org>
parents: 2278
diff changeset
853 }