Mercurial > vim
comparison src/os_vms.c @ 18810:44b855153d8e v8.1.2393
patch 8.1.2393: using old C style comments
Commit: https://github.com/vim/vim/commit/0f8737355d291679659579a48db1861b88970293
Author: Bram Moolenaar <Bram@vim.org>
Date: Thu Dec 5 20:28:46 2019 +0100
patch 8.1.2393: using old C style comments
Problem: Using old C style comments.
Solution: Use // comments where appropriate.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Thu, 05 Dec 2019 20:30:04 +0100 |
parents | 1130f8309f67 |
children | d4b2a8675b78 |
comparison
equal
deleted
inserted
replaced
18809:8c6177fec9cb | 18810:44b855153d8e |
---|---|
9 * See README.txt for an overview of the Vim source code. | 9 * See README.txt for an overview of the Vim source code. |
10 */ | 10 */ |
11 | 11 |
12 #include "vim.h" | 12 #include "vim.h" |
13 | 13 |
14 /* define _generic_64 for use in time functions */ | 14 // define _generic_64 for use in time functions |
15 #if !defined(VAX) && !defined(PROTO) | 15 #if !defined(VAX) && !defined(PROTO) |
16 # include <gen64def.h> | 16 # include <gen64def.h> |
17 #else | 17 #else |
18 /* based on Alpha's gen64def.h; the file is absent on VAX */ | 18 // based on Alpha's gen64def.h; the file is absent on VAX |
19 typedef struct _generic_64 { | 19 typedef struct _generic_64 { |
20 # pragma __nomember_alignment | 20 # pragma __nomember_alignment |
21 __union { /* You can treat me as... */ | 21 __union { // You can treat me as... |
22 /* long long is not available on VAXen */ | 22 // long long is not available on VAXen |
23 /* unsigned __int64 gen64$q_quadword; ...a single 64-bit value, or */ | 23 // unsigned __int64 gen64$q_quadword; ...a single 64-bit value, or |
24 | 24 |
25 unsigned int gen64$l_longword [2]; /* ...two 32-bit values, or */ | 25 unsigned int gen64$l_longword [2]; // ...two 32-bit values, or |
26 unsigned short int gen64$w_word [4]; /* ...four 16-bit values */ | 26 unsigned short int gen64$w_word [4]; // ...four 16-bit values |
27 } gen64$r_quad_overlay; | 27 } gen64$r_quad_overlay; |
28 } GENERIC_64; | 28 } GENERIC_64; |
29 #endif | 29 #endif |
30 | 30 |
31 typedef struct | 31 typedef struct |
65 ITEM string; | 65 ITEM string; |
66 int nul; | 66 int nul; |
67 } ITMLST2; | 67 } ITMLST2; |
68 | 68 |
69 static TT_MODE orgmode; | 69 static TT_MODE orgmode; |
70 static short iochan; /* TTY I/O channel */ | 70 static short iochan; // TTY I/O channel |
71 static short iosb[4]; /* IO status block */ | 71 static short iosb[4]; // IO status block |
72 | 72 |
73 static int vms_match_num = 0; | 73 static int vms_match_num = 0; |
74 static int vms_match_free = 0; | 74 static int vms_match_free = 0; |
75 static char_u **vms_fmatch = NULL; | 75 static char_u **vms_fmatch = NULL; |
76 static char *Fspec_Rms; /* rms file spec, passed implicitly between routines */ | 76 static char *Fspec_Rms; // rms file spec, passed implicitly between routines |
77 | 77 |
78 | 78 |
79 | 79 |
80 static TT_MODE get_tty(void); | 80 static TT_MODE get_tty(void); |
81 static void set_tty(int row, int col); | 81 static void set_tty(int row, int col); |
137 | 137 |
138 static void | 138 static void |
139 set_tty(int row, int col) | 139 set_tty(int row, int col) |
140 { | 140 { |
141 int status; | 141 int status; |
142 TT_MODE newmode; /* New TTY mode bits */ | 142 TT_MODE newmode; // New TTY mode bits |
143 static short first_time = TRUE; | 143 static short first_time = TRUE; |
144 | 144 |
145 if (first_time) | 145 if (first_time) |
146 { | 146 { |
147 orgmode = get_tty(); | 147 orgmode = get_tty(); |
163 | 163 |
164 static TT_MODE | 164 static TT_MODE |
165 get_tty(void) | 165 get_tty(void) |
166 { | 166 { |
167 | 167 |
168 static $DESCRIPTOR(odsc,"SYS$OUTPUT"); /* output descriptor */ | 168 static $DESCRIPTOR(odsc,"SYS$OUTPUT"); // output descriptor |
169 | 169 |
170 int status; | 170 int status; |
171 TT_MODE tt_mode; | 171 TT_MODE tt_mode; |
172 | 172 |
173 if (!iochan) | 173 if (!iochan) |
193 int | 193 int |
194 mch_get_shellsize(void) | 194 mch_get_shellsize(void) |
195 { | 195 { |
196 TT_MODE tmode; | 196 TT_MODE tmode; |
197 | 197 |
198 tmode = get_tty(); /* get size from VMS */ | 198 tmode = get_tty(); // get size from VMS |
199 Columns = tmode.width; | 199 Columns = tmode.width; |
200 Rows = tmode.x.y.length; | 200 Rows = tmode.x.y.length; |
201 return OK; | 201 return OK; |
202 } | 202 } |
203 | 203 |
260 int | 260 int |
261 mch_setenv(char *var, char *value, int x) | 261 mch_setenv(char *var, char *value, int x) |
262 { | 262 { |
263 int res, dum; | 263 int res, dum; |
264 long attrib = 0L; | 264 long attrib = 0L; |
265 char acmode = PSL$C_SUPER; /* needs SYSNAM privilege */ | 265 char acmode = PSL$C_SUPER; // needs SYSNAM privilege |
266 DESC tabnam, lognam; | 266 DESC tabnam, lognam; |
267 ITMLST1 itmlst; | 267 ITMLST1 itmlst; |
268 | 268 |
269 vul_desc(&tabnam, "LNM$JOB"); | 269 vul_desc(&tabnam, "LNM$JOB"); |
270 vul_desc(&lognam, var); | 270 vul_desc(&lognam, var); |
286 if (out) | 286 if (out) |
287 vul_desc(&odsc, out); | 287 vul_desc(&odsc, out); |
288 if (inp) | 288 if (inp) |
289 vul_desc(&idsc, inp); | 289 vul_desc(&idsc, inp); |
290 | 290 |
291 lib$spawn(cmd ? &cdsc : NULL, /* command string */ | 291 lib$spawn(cmd ? &cdsc : NULL, // command string |
292 inp ? &idsc : NULL, /* input file */ | 292 inp ? &idsc : NULL, // input file |
293 out ? &odsc : NULL, /* output file */ | 293 out ? &odsc : NULL, // output file |
294 0, 0, 0, &status, 0, 0, 0, 0, 0, 0); | 294 0, 0, 0, &status, 0, 0, 0, 0, 0, 0); |
295 return status; | 295 return status; |
296 } | 296 } |
297 | 297 |
298 /* | 298 /* |
312 */ | 312 */ |
313 int | 313 int |
314 vms_sys_status(int status) | 314 vms_sys_status(int status) |
315 { | 315 { |
316 if (status != SS$_NORMAL && (status & STS$M_SUCCESS) == 0) | 316 if (status != SS$_NORMAL && (status & STS$M_SUCCESS) == 0) |
317 return status; /* Command failed. */ | 317 return status; // Command failed. |
318 return 0; | 318 return 0; |
319 } | 319 } |
320 | 320 |
321 /* | 321 /* |
322 * vms_read() | 322 * vms_read() |
327 int | 327 int |
328 vms_read(char *inbuf, size_t nbytes) | 328 vms_read(char *inbuf, size_t nbytes) |
329 { | 329 { |
330 int status, function, len; | 330 int status, function, len; |
331 TT_MODE tt_mode; | 331 TT_MODE tt_mode; |
332 ITEM itmlst[2]; /* terminates on everything */ | 332 ITEM itmlst[2]; // terminates on everything |
333 static long trm_mask[8] = {-1, -1, -1, -1, -1, -1, -1, -1}; | 333 static long trm_mask[8] = {-1, -1, -1, -1, -1, -1, -1, -1}; |
334 | 334 |
335 /* whatever happened earlier we need an iochan here */ | 335 // whatever happened earlier we need an iochan here |
336 if (!iochan) | 336 if (!iochan) |
337 tt_mode = get_tty(); | 337 tt_mode = get_tty(); |
338 | 338 |
339 /* important: clean the inbuf */ | 339 // important: clean the inbuf |
340 memset(inbuf, 0, nbytes); | 340 memset(inbuf, 0, nbytes); |
341 | 341 |
342 /* set up the itemlist for the first read */ | 342 // set up the itemlist for the first read |
343 vul_item(&itmlst[0], 0, TRM$_MODIFIERS, | 343 vul_item(&itmlst[0], 0, TRM$_MODIFIERS, |
344 (char *)( TRM$M_TM_NOECHO | TRM$M_TM_NOEDIT | | 344 (char *)( TRM$M_TM_NOECHO | TRM$M_TM_NOEDIT | |
345 TRM$M_TM_NOFILTR | TRM$M_TM_TRMNOECHO | | 345 TRM$M_TM_NOFILTR | TRM$M_TM_TRMNOECHO | |
346 TRM$M_TM_NORECALL) , 0); | 346 TRM$M_TM_NORECALL) , 0); |
347 vul_item(&itmlst[1], sizeof(trm_mask), TRM$_TERM, (char *)&trm_mask, 0); | 347 vul_item(&itmlst[1], sizeof(trm_mask), TRM$_TERM, (char *)&trm_mask, 0); |
348 | 348 |
349 /* wait forever for a char */ | 349 // wait forever for a char |
350 function = (IO$_READLBLK | IO$M_EXTEND); | 350 function = (IO$_READLBLK | IO$M_EXTEND); |
351 status = sys$qiow(0, iochan, function, &iosb, 0, 0, | 351 status = sys$qiow(0, iochan, function, &iosb, 0, 0, |
352 inbuf, nbytes-1, 0, 0, &itmlst, sizeof(itmlst)); | 352 inbuf, nbytes-1, 0, 0, &itmlst, sizeof(itmlst)); |
353 len = strlen(inbuf); /* how many chars we got? */ | 353 len = strlen(inbuf); // how many chars we got? |
354 | 354 |
355 /* read immediately the rest in the IO queue */ | 355 // read immediately the rest in the IO queue |
356 function = (IO$_READLBLK | IO$M_TIMED | IO$M_ESCAPE | IO$M_NOECHO | IO$M_NOFILTR); | 356 function = (IO$_READLBLK | IO$M_TIMED | IO$M_ESCAPE | IO$M_NOECHO | IO$M_NOFILTR); |
357 status = sys$qiow(0, iochan, function, &iosb, 0, 0, | 357 status = sys$qiow(0, iochan, function, &iosb, 0, 0, |
358 inbuf+len, nbytes-1-len, 0, 0, 0, 0); | 358 inbuf+len, nbytes-1-len, 0, 0, 0, 0); |
359 | 359 |
360 len = strlen(inbuf); /* return the total length */ | 360 len = strlen(inbuf); // return the total length |
361 | 361 |
362 return len; | 362 return len; |
363 } | 363 } |
364 | 364 |
365 /* | 365 /* |
373 vms_wproc(char *name, int val) | 373 vms_wproc(char *name, int val) |
374 { | 374 { |
375 int i; | 375 int i; |
376 static int vms_match_alloced = 0; | 376 static int vms_match_alloced = 0; |
377 | 377 |
378 if (val == DECC$K_FOREIGN ) /* foreign non VMS files are not counting */ | 378 if (val == DECC$K_FOREIGN ) // foreign non VMS files are not counting |
379 return 1; | 379 return 1; |
380 | 380 |
381 /* accept all DECC$K_FILE and DECC$K_DIRECTORY */ | 381 // accept all DECC$K_FILE and DECC$K_DIRECTORY |
382 if (vms_match_num == 0) { | 382 if (vms_match_num == 0) { |
383 /* first time through, setup some things */ | 383 // first time through, setup some things |
384 if (NULL == vms_fmatch) { | 384 if (NULL == vms_fmatch) { |
385 vms_fmatch = ALLOC_MULT(char_u *, EXPL_ALLOC_INC); | 385 vms_fmatch = ALLOC_MULT(char_u *, EXPL_ALLOC_INC); |
386 if (!vms_fmatch) | 386 if (!vms_fmatch) |
387 return 0; | 387 return 0; |
388 vms_match_alloced = EXPL_ALLOC_INC; | 388 vms_match_alloced = EXPL_ALLOC_INC; |
389 vms_match_free = EXPL_ALLOC_INC; | 389 vms_match_free = EXPL_ALLOC_INC; |
390 } | 390 } |
391 else { | 391 else { |
392 /* re-use existing space */ | 392 // re-use existing space |
393 vms_match_free = vms_match_alloced; | 393 vms_match_free = vms_match_alloced; |
394 } | 394 } |
395 } | 395 } |
396 | 396 |
397 /* make matches look uniform */ | 397 // make matches look uniform |
398 vms_remove_version(name); | 398 vms_remove_version(name); |
399 name=vms_tolower(name); | 399 name=vms_tolower(name); |
400 | 400 |
401 /* if name already exists, don't add it */ | 401 // if name already exists, don't add it |
402 for (i = 0; i<vms_match_num; i++) { | 402 for (i = 0; i<vms_match_num; i++) { |
403 if (0 == STRCMP((char_u *)name,vms_fmatch[i])) | 403 if (0 == STRCMP((char_u *)name,vms_fmatch[i])) |
404 return 1; | 404 return 1; |
405 } | 405 } |
406 if (--vms_match_free == 0) { | 406 if (--vms_match_free == 0) { |
407 char_u **old_vms_fmatch = vms_fmatch; | 407 char_u **old_vms_fmatch = vms_fmatch; |
408 | 408 |
409 /* add more space to store matches */ | 409 // add more space to store matches |
410 vms_match_alloced += EXPL_ALLOC_INC; | 410 vms_match_alloced += EXPL_ALLOC_INC; |
411 vms_fmatch = vim_realloc(old_vms_fmatch, | 411 vms_fmatch = vim_realloc(old_vms_fmatch, |
412 sizeof(char **) * vms_match_alloced); | 412 sizeof(char **) * vms_match_alloced); |
413 if (!vms_fmatch) | 413 if (!vms_fmatch) |
414 { | 414 { |
443 char_u buf[MAXPATHL]; | 443 char_u buf[MAXPATHL]; |
444 char *result; | 444 char *result; |
445 int dir; | 445 int dir; |
446 int files_alloced, files_free; | 446 int files_alloced, files_free; |
447 | 447 |
448 *num_file = 0; /* default: no files found */ | 448 *num_file = 0; // default: no files found |
449 files_alloced = EXPL_ALLOC_INC; | 449 files_alloced = EXPL_ALLOC_INC; |
450 files_free = EXPL_ALLOC_INC; | 450 files_free = EXPL_ALLOC_INC; |
451 *file = ALLOC_MULT(char_u *, files_alloced); | 451 *file = ALLOC_MULT(char_u *, files_alloced); |
452 if (*file == NULL) | 452 if (*file == NULL) |
453 { | 453 { |
454 *num_file = 0; | 454 *num_file = 0; |
455 return FAIL; | 455 return FAIL; |
456 } | 456 } |
457 for (i = 0; i < num_pat; i++) | 457 for (i = 0; i < num_pat; i++) |
458 { | 458 { |
459 /* expand environment var or home dir */ | 459 // expand environment var or home dir |
460 if (vim_strchr(pat[i],'$') || vim_strchr(pat[i],'~')) | 460 if (vim_strchr(pat[i],'$') || vim_strchr(pat[i],'~')) |
461 expand_env(pat[i],buf,MAXPATHL); | 461 expand_env(pat[i],buf,MAXPATHL); |
462 else | 462 else |
463 STRCPY(buf,pat[i]); | 463 STRCPY(buf,pat[i]); |
464 | 464 |
465 vms_match_num = 0; /* reset collection counter */ | 465 vms_match_num = 0; // reset collection counter |
466 result = decc$translate_vms(vms_fixfilename(buf)); | 466 result = decc$translate_vms(vms_fixfilename(buf)); |
467 if ( (int) result == 0 || (int) result == -1 ) { | 467 if ( (int) result == 0 || (int) result == -1 ) { |
468 cnt = 0; | 468 cnt = 0; |
469 } else { | 469 } else { |
470 cnt = decc$to_vms(result, vms_wproc, 1 /*allow wild*/ , (flags & EW_DIR ? 0:1 ) /*allow directory*/) ; | 470 cnt = decc$to_vms(result, vms_wproc, 1 /*allow wild*/ , (flags & EW_DIR ? 0:1 ) /*allow directory*/) ; |
475 if (cnt < 1) | 475 if (cnt < 1) |
476 continue; | 476 continue; |
477 | 477 |
478 for (i = 0; i < cnt; i++) | 478 for (i = 0; i < cnt; i++) |
479 { | 479 { |
480 /* files should exist if expanding interactively */ | 480 // files should exist if expanding interactively |
481 if (!(flags & EW_NOTFOUND) && mch_getperm(vms_fmatch[i]) < 0) | 481 if (!(flags & EW_NOTFOUND) && mch_getperm(vms_fmatch[i]) < 0) |
482 continue; | 482 continue; |
483 | 483 |
484 /* do not include directories */ | 484 // do not include directories |
485 dir = (mch_isdir(vms_fmatch[i])); | 485 dir = (mch_isdir(vms_fmatch[i])); |
486 if (( dir && !(flags & EW_DIR)) || (!dir && !(flags & EW_FILE))) | 486 if (( dir && !(flags & EW_DIR)) || (!dir && !(flags & EW_FILE))) |
487 continue; | 487 continue; |
488 | 488 |
489 /* Skip files that are not executable if we check for that. */ | 489 // Skip files that are not executable if we check for that. |
490 if (!dir && (flags & EW_EXEC) | 490 if (!dir && (flags & EW_EXEC) |
491 && !mch_can_exe(vms_fmatch[i], NULL, !(flags & EW_SHELLCMD))) | 491 && !mch_can_exe(vms_fmatch[i], NULL, !(flags & EW_SHELLCMD))) |
492 continue; | 492 continue; |
493 | 493 |
494 /* allocate memory for pointers */ | 494 // allocate memory for pointers |
495 if (--files_free < 1) | 495 if (--files_free < 1) |
496 { | 496 { |
497 char_u **old_file = *file; | 497 char_u **old_file = *file; |
498 | 498 |
499 files_alloced += EXPL_ALLOC_INC; | 499 files_alloced += EXPL_ALLOC_INC; |
519 { | 519 { |
520 int i,cnt = 0; | 520 int i,cnt = 0; |
521 char *result; | 521 char *result; |
522 | 522 |
523 vms_match_num = 0; | 523 vms_match_num = 0; |
524 /* the result from the decc$translate_vms needs to be handled */ | 524 // the result from the decc$translate_vms needs to be handled |
525 /* otherwise it might create ACCVIO error in decc$to_vms */ | 525 // otherwise it might create ACCVIO error in decc$to_vms |
526 result = decc$translate_vms(vms_fixfilename(path)); | 526 result = decc$translate_vms(vms_fixfilename(path)); |
527 if ( (int) result == 0 || (int) result == -1 ) { | 527 if ( (int) result == 0 || (int) result == -1 ) { |
528 cnt = 0; | 528 cnt = 0; |
529 } else { | 529 } else { |
530 cnt = decc$to_vms(result, vms_wproc, 1 /*allow_wild*/, (flags & EW_DIR ? 0:1 ) /*allow directory*/); | 530 cnt = decc$to_vms(result, vms_wproc, 1 /*allow_wild*/, (flags & EW_DIR ? 0:1 ) /*allow directory*/); |
531 } | 531 } |
532 if (cnt > 0) | 532 if (cnt > 0) |
533 cnt = vms_match_num; | 533 cnt = vms_match_num; |
534 for (i = 0; i < cnt; i++) | 534 for (i = 0; i < cnt; i++) |
535 { | 535 { |
536 if (mch_getperm(vms_fmatch[i]) >= 0) /* add existing file */ | 536 if (mch_getperm(vms_fmatch[i]) >= 0) // add existing file |
537 addfile(gap, vms_fmatch[i], flags); | 537 addfile(gap, vms_fmatch[i], flags); |
538 } | 538 } |
539 return cnt; | 539 return cnt; |
540 } | 540 } |
541 | 541 |
549 char *end_of_dir; | 549 char *end_of_dir; |
550 char ch; | 550 char ch; |
551 int len; | 551 int len; |
552 char *out_str=out; | 552 char *out_str=out; |
553 | 553 |
554 /* copy vms filename portion up to last colon | 554 // copy vms filename portion up to last colon |
555 * (node and/or disk) | 555 // (node and/or disk) |
556 */ | 556 lastcolon = strrchr(in, ':'); // find last colon |
557 lastcolon = strrchr(in, ':'); /* find last colon */ | |
558 if (lastcolon != NULL) { | 557 if (lastcolon != NULL) { |
559 len = lastcolon - in + 1; | 558 len = lastcolon - in + 1; |
560 strncpy(out, in, len); | 559 strncpy(out, in, len); |
561 out += len; | 560 out += len; |
562 in += len; | 561 in += len; |
563 } | 562 } |
564 | 563 |
565 end_of_dir = NULL; /* default: no directory */ | 564 end_of_dir = NULL; // default: no directory |
566 | 565 |
567 /* start of directory portion */ | 566 // start of directory portion |
568 ch = *in; | 567 ch = *in; |
569 if ((ch == '[') || (ch == '/') || (ch == '<')) { /* start of directory(s) ? */ | 568 if ((ch == '[') || (ch == '/') || (ch == '<')) { // start of directory(s) ? |
570 ch = '['; | 569 ch = '['; |
571 SKIP_FOLLOWING_SLASHES(in); | 570 SKIP_FOLLOWING_SLASHES(in); |
572 } else if (EQN(in, "../", 3)) { /* Unix parent directory? */ | 571 } else if (EQN(in, "../", 3)) { // Unix parent directory? |
573 *out++ = '['; | 572 *out++ = '['; |
574 *out++ = '-'; | 573 *out++ = '-'; |
575 end_of_dir = out; | 574 end_of_dir = out; |
576 ch = '.'; | 575 ch = '.'; |
577 in += 2; | 576 in += 2; |
578 SKIP_FOLLOWING_SLASHES(in); | 577 SKIP_FOLLOWING_SLASHES(in); |
579 } else { /* not a special character */ | 578 } else { // not a special character |
580 while (EQN(in, "./", 2)) { /* Ignore Unix "current dir" */ | 579 while (EQN(in, "./", 2)) { // Ignore Unix "current dir" |
581 in += 2; | 580 in += 2; |
582 SKIP_FOLLOWING_SLASHES(in); | 581 SKIP_FOLLOWING_SLASHES(in); |
583 } | 582 } |
584 if (strchr(in, '/') == NULL) { /* any more Unix directories ? */ | 583 if (strchr(in, '/') == NULL) { // any more Unix directories ? |
585 strcpy(out, in); /* No - get rest of the spec */ | 584 strcpy(out, in); // No - get rest of the spec |
586 return; | 585 return; |
587 } else { | 586 } else { |
588 *out++ = '['; /* Yes, denote a Vms subdirectory */ | 587 *out++ = '['; // Yes, denote a Vms subdirectory |
589 ch = '.'; | 588 ch = '.'; |
590 --in; | 589 --in; |
591 } | 590 } |
592 } | 591 } |
593 | 592 |
594 /* if we get here, there is a directory part of the filename */ | 593 // if we get here, there is a directory part of the filename |
595 | 594 |
596 /* initialize output file spec */ | 595 // initialize output file spec |
597 *out++ = ch; | 596 *out++ = ch; |
598 ++in; | 597 ++in; |
599 | 598 |
600 while (*in != '\0') { | 599 while (*in != '\0') { |
601 ch = *in; | 600 ch = *in; |
602 if ((ch == ']') || (ch == '/') || (ch == '>') ) { /* end of (sub)directory ? */ | 601 if ((ch == ']') || (ch == '/') || (ch == '>') ) { // end of (sub)directory ? |
603 end_of_dir = out; | 602 end_of_dir = out; |
604 ch = '.'; | 603 ch = '.'; |
605 SKIP_FOLLOWING_SLASHES(in); | 604 SKIP_FOLLOWING_SLASHES(in); |
606 } | 605 } |
607 else if (EQN(in, "../", 3)) { /* Unix parent directory? */ | 606 else if (EQN(in, "../", 3)) { // Unix parent directory? |
608 *out++ = '-'; | 607 *out++ = '-'; |
609 end_of_dir = out; | 608 end_of_dir = out; |
610 ch = '.'; | 609 ch = '.'; |
611 in += 2; | 610 in += 2; |
612 SKIP_FOLLOWING_SLASHES(in); | 611 SKIP_FOLLOWING_SLASHES(in); |
613 } | 612 } |
614 else { | 613 else { |
615 while (EQN(in, "./", 2)) { /* Ignore Unix "current dir" */ | 614 while (EQN(in, "./", 2)) { // Ignore Unix "current dir" |
616 end_of_dir = out; | 615 end_of_dir = out; |
617 in += 2; | 616 in += 2; |
618 SKIP_FOLLOWING_SLASHES(in); | 617 SKIP_FOLLOWING_SLASHES(in); |
619 ch = *in; | 618 ch = *in; |
620 } | 619 } |
621 } | 620 } |
622 | 621 |
623 /* Place next character into output file spec */ | 622 // Place next character into output file spec |
624 *out++ = ch; | 623 *out++ = ch; |
625 ++in; | 624 ++in; |
626 } | 625 } |
627 | 626 |
628 *out = '\0'; /* Terminate output file spec */ | 627 *out = '\0'; // Terminate output file spec |
629 | 628 |
630 if (end_of_dir != NULL) /* Terminate directory portion */ | 629 if (end_of_dir != NULL) // Terminate directory portion |
631 *end_of_dir = ']'; | 630 *end_of_dir = ']'; |
632 } | 631 } |
633 | 632 |
634 /* | 633 /* |
635 * for decc$to_vms in vms_fixfilename | 634 * for decc$to_vms in vms_fixfilename |
649 { | 648 { |
650 static char *buf = NULL; | 649 static char *buf = NULL; |
651 static size_t buflen = 0; | 650 static size_t buflen = 0; |
652 size_t len; | 651 size_t len; |
653 | 652 |
654 /* get a big-enough buffer */ | 653 // get a big-enough buffer |
655 len = strlen(instring) + 1; | 654 len = strlen(instring) + 1; |
656 if (len > buflen) | 655 if (len > buflen) |
657 { | 656 { |
658 buflen = len + 128; | 657 buflen = len + 128; |
659 buf = vim_realloc(buf, buflen * sizeof(char)); | 658 buf = vim_realloc(buf, buflen * sizeof(char)); |
663 char *tmpbuf = NULL; | 662 char *tmpbuf = NULL; |
664 tmpbuf = ALLOC_MULT(char, buflen); | 663 tmpbuf = ALLOC_MULT(char, buflen); |
665 strcpy(tmpbuf, instring); | 664 strcpy(tmpbuf, instring); |
666 #endif | 665 #endif |
667 | 666 |
668 Fspec_Rms = buf; /* for decc$to_vms */ | 667 Fspec_Rms = buf; // for decc$to_vms |
669 | 668 |
670 if (strchr(instring,'/') == NULL) | 669 if (strchr(instring,'/') == NULL) |
671 /* It is already a VMS file spec */ | 670 // It is already a VMS file spec |
672 strcpy(buf, instring); | 671 strcpy(buf, instring); |
673 else if (strchr(instring,'"') == NULL) /* password in the path? */ | 672 else if (strchr(instring,'"') == NULL) // password in the path? |
674 { | 673 { |
675 /* Seems it is a regular file, let guess that it is pure Unix fspec */ | 674 // Seems it is a regular file, let guess that it is pure Unix fspec |
676 if (decc$to_vms(instring, vms_fspec_proc, 0, 0) <= 0) | 675 if (decc$to_vms(instring, vms_fspec_proc, 0, 0) <= 0) |
677 /* No... it must be mixed */ | 676 // No... it must be mixed |
678 vms_unix_mixed_filespec(instring, buf); | 677 vms_unix_mixed_filespec(instring, buf); |
679 } | 678 } |
680 else | 679 else |
681 /* we have a password in the path */ | 680 // we have a password in the path |
682 /* decc$ functions can not handle */ | 681 // decc$ functions can not handle |
683 /* this is our only hope to resolv */ | 682 // this is our only hope to resolv |
684 vms_unix_mixed_filespec(instring, buf); | 683 vms_unix_mixed_filespec(instring, buf); |
685 | 684 |
686 return buf; | 685 return buf; |
687 } | 686 } |
688 | 687 |
695 vms_remove_version(void * fname) | 694 vms_remove_version(void * fname) |
696 { | 695 { |
697 char_u *cp; | 696 char_u *cp; |
698 char_u *fp; | 697 char_u *fp; |
699 | 698 |
700 if ((cp = vim_strchr( fname, ';')) != NULL) /* remove version */ | 699 if ((cp = vim_strchr( fname, ';')) != NULL) // remove version |
701 *cp = '\0'; | 700 *cp = '\0'; |
702 else if ((cp = vim_strrchr( fname, '.')) != NULL ) | 701 else if ((cp = vim_strrchr( fname, '.')) != NULL ) |
703 { | 702 { |
704 if ((fp = vim_strrchr( fname, ']')) != NULL ) {;} | 703 if ((fp = vim_strrchr( fname, ']')) != NULL ) {;} |
705 else if ((fp = vim_strrchr( fname, '>')) != NULL ) {;} | 704 else if ((fp = vim_strrchr( fname, '>')) != NULL ) {;} |
724 * "msec" == 0 will check for characters once. | 723 * "msec" == 0 will check for characters once. |
725 * "msec" == -1 will block until a character is available. | 724 * "msec" == -1 will block until a character is available. |
726 */ | 725 */ |
727 int | 726 int |
728 RealWaitForChar( | 727 RealWaitForChar( |
729 int fd UNUSED, /* always read from iochan */ | 728 int fd UNUSED, // always read from iochan |
730 long msec, | 729 long msec, |
731 int *check_for_gpm UNUSED, | 730 int *check_for_gpm UNUSED, |
732 int *interrupted) | 731 int *interrupted) |
733 { | 732 { |
734 int status; | 733 int status; |
736 struct _generic_64 time_diff; | 735 struct _generic_64 time_diff; |
737 struct _generic_64 time_out; | 736 struct _generic_64 time_out; |
738 unsigned int convert_operation = LIB$K_DELTA_SECONDS_F; | 737 unsigned int convert_operation = LIB$K_DELTA_SECONDS_F; |
739 float sec =(float) msec/1000; | 738 float sec =(float) msec/1000; |
740 | 739 |
741 /* make sure the iochan is set */ | 740 // make sure the iochan is set |
742 if (!iochan) | 741 if (!iochan) |
743 get_tty(); | 742 get_tty(); |
744 | 743 |
745 if (sec > 0) { | 744 if (sec > 0) { |
746 /* time-out specified; convert it to absolute time */ | 745 // time-out specified; convert it to absolute time |
747 /* sec>0 requirement of lib$cvtf_to_internal_time()*/ | 746 // sec>0 requirement of lib$cvtf_to_internal_time() |
748 | 747 |
749 /* get current time (number of 100ns ticks since the VMS Epoch) */ | 748 // get current time (number of 100ns ticks since the VMS Epoch) |
750 status = sys$gettim(&time_curr); | 749 status = sys$gettim(&time_curr); |
751 if (status != SS$_NORMAL) | 750 if (status != SS$_NORMAL) |
752 return 0; /* error */ | 751 return 0; // error |
753 /* construct the delta time */ | 752 // construct the delta time |
754 #if __G_FLOAT==0 | 753 #if __G_FLOAT==0 |
755 # ifndef VAX | 754 # ifndef VAX |
756 /* IEEE is default on IA64, but can be used on Alpha too - but not on VAX */ | 755 // IEEE is default on IA64, but can be used on Alpha too - but not on VAX |
757 status = lib$cvts_to_internal_time( | 756 status = lib$cvts_to_internal_time( |
758 &convert_operation, &sec, &time_diff); | 757 &convert_operation, &sec, &time_diff); |
759 # endif | 758 # endif |
760 #else /* default on Alpha and VAX */ | 759 #else // default on Alpha and VAX |
761 status = lib$cvtf_to_internal_time( | 760 status = lib$cvtf_to_internal_time( |
762 &convert_operation, &sec, &time_diff); | 761 &convert_operation, &sec, &time_diff); |
763 #endif | 762 #endif |
764 if (status != LIB$_NORMAL) | 763 if (status != LIB$_NORMAL) |
765 return 0; /* error */ | 764 return 0; // error |
766 /* add them up */ | 765 // add them up |
767 status = lib$add_times( | 766 status = lib$add_times( |
768 &time_curr, | 767 &time_curr, |
769 &time_diff, | 768 &time_diff, |
770 &time_out); | 769 &time_out); |
771 if (status != LIB$_NORMAL) | 770 if (status != LIB$_NORMAL) |
772 return 0; /* error */ | 771 return 0; // error |
773 } | 772 } |
774 | 773 |
775 while (TRUE) { | 774 while (TRUE) { |
776 /* select() */ | 775 // select() |
777 status = sys$qiow(0, iochan, IO$_SENSEMODE | IO$M_TYPEAHDCNT, iosb, | 776 status = sys$qiow(0, iochan, IO$_SENSEMODE | IO$M_TYPEAHDCNT, iosb, |
778 0, 0, &typeahead, 8, 0, 0, 0, 0); | 777 0, 0, &typeahead, 8, 0, 0, 0, 0); |
779 if (status != SS$_NORMAL || (iosb[0] & 0xFFFF) != SS$_NORMAL) | 778 if (status != SS$_NORMAL || (iosb[0] & 0xFFFF) != SS$_NORMAL) |
780 return 0; /* error */ | 779 return 0; // error |
781 | 780 |
782 if (typeahead.numchars) | 781 if (typeahead.numchars) |
783 return 1; /* ready to read */ | 782 return 1; // ready to read |
784 | 783 |
785 /* there's nothing to read; what now? */ | 784 // there's nothing to read; what now? |
786 if (msec == 0) { | 785 if (msec == 0) { |
787 /* immediate time-out; return impatiently */ | 786 // immediate time-out; return impatiently |
788 return 0; | 787 return 0; |
789 } else if (msec < 0) { | 788 } else if (msec < 0) { |
790 /* no time-out; wait on indefinitely */ | 789 // no time-out; wait on indefinitely |
791 return 1; /* fakeout to force a wait in vms_read() */ | 790 return 1; // fakeout to force a wait in vms_read() |
792 } else { | 791 } else { |
793 /* time-out needs to be checked */ | 792 // time-out needs to be checked |
794 status = sys$gettim(&time_curr); | 793 status = sys$gettim(&time_curr); |
795 if (status != SS$_NORMAL) | 794 if (status != SS$_NORMAL) |
796 return 0; /* error */ | 795 return 0; // error |
797 | 796 |
798 status = lib$sub_times( | 797 status = lib$sub_times( |
799 &time_out, | 798 &time_out, |
800 &time_curr, | 799 &time_curr, |
801 &time_diff); | 800 &time_diff); |
802 if (status != LIB$_NORMAL) | 801 if (status != LIB$_NORMAL) |
803 return 0; /* error, incl. time_diff < 0 (i.e. time-out) */ | 802 return 0; // error, incl. time_diff < 0 (i.e. time-out) |
804 | 803 |
805 /* otherwise wait some more */ | 804 // otherwise wait some more |
806 } | 805 } |
807 } | 806 } |
808 } | 807 } |