Mercurial > vim
comparison src/os_unix.h @ 18753:6e3dc2d630c2 v8.1.2366
patch 8.1.2366: using old C style comments
Commit: https://github.com/vim/vim/commit/9bf703d46a79fbffeb829246ea5ce385bddc4166
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat Nov 30 19:44:38 2019 +0100
patch 8.1.2366: using old C style comments
Problem: Using old C style comments.
Solution: Use // comments where appropriate.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sat, 30 Nov 2019 19:45:03 +0100 |
parents | 673f4603d979 |
children | 22f0dda71638 |
comparison
equal
deleted
inserted
replaced
18752:9ec3c9cb4533 | 18753:6e3dc2d630c2 |
---|---|
32 #ifdef HAVE_STDLIB_H | 32 #ifdef HAVE_STDLIB_H |
33 # include <stdlib.h> | 33 # include <stdlib.h> |
34 #endif | 34 #endif |
35 | 35 |
36 #ifdef __CYGWIN__ | 36 #ifdef __CYGWIN__ |
37 # define WIN32UNIX /* Compiling for Win32 using Unix files. */ | 37 # define WIN32UNIX // Compiling for Win32 using Unix files. |
38 # define BINARY_FILE_IO | 38 # define BINARY_FILE_IO |
39 | 39 |
40 # define CASE_INSENSITIVE_FILENAME | 40 # define CASE_INSENSITIVE_FILENAME |
41 # define USE_FNAME_CASE /* Fix filename case differences. */ | 41 # define USE_FNAME_CASE // Fix filename case differences. |
42 #endif | 42 #endif |
43 | 43 |
44 /* On AIX 4.2 there is a conflicting prototype for ioctl() in stropts.h and | 44 // On AIX 4.2 there is a conflicting prototype for ioctl() in stropts.h and |
45 * unistd.h. This hack should fix that (suggested by Jeff George). | 45 // unistd.h. This hack should fix that (suggested by Jeff George). |
46 * But on AIX 4.3 it's alright (suggested by Jake Hamby). */ | 46 // But on AIX 4.3 it's alright (suggested by Jake Hamby). |
47 #if defined(FEAT_GUI) && defined(_AIX) && !defined(_AIX43) && !defined(_NO_PROTO) | 47 #if defined(FEAT_GUI) && defined(_AIX) && !defined(_AIX43) && !defined(_NO_PROTO) |
48 # define _NO_PROTO | 48 # define _NO_PROTO |
49 #endif | 49 #endif |
50 | 50 |
51 #ifdef HAVE_UNISTD_H | 51 #ifdef HAVE_UNISTD_H |
52 # include <unistd.h> | 52 # include <unistd.h> |
53 #endif | 53 #endif |
54 | 54 |
55 #ifdef HAVE_LIBC_H | 55 #ifdef HAVE_LIBC_H |
56 # include <libc.h> /* for NeXT */ | 56 # include <libc.h> // for NeXT |
57 #endif | 57 #endif |
58 | 58 |
59 #ifdef HAVE_SYS_PARAM_H | 59 #ifdef HAVE_SYS_PARAM_H |
60 # include <sys/param.h> /* defines BSD, if it's a BSD system */ | 60 # include <sys/param.h> // defines BSD, if it's a BSD system |
61 #endif | 61 #endif |
62 | 62 |
63 /* | 63 /* |
64 * Using getcwd() is preferred, because it checks for a buffer overflow. | 64 * Using getcwd() is preferred, because it checks for a buffer overflow. |
65 * Don't use getcwd() on systems do use system("sh -c pwd"). There is an | 65 * Don't use getcwd() on systems do use system("sh -c pwd"). There is an |
68 */ | 68 */ |
69 #if defined(HAVE_GETCWD) && !(defined(BAD_GETCWD) && defined(HAVE_GETWD)) | 69 #if defined(HAVE_GETCWD) && !(defined(BAD_GETCWD) && defined(HAVE_GETWD)) |
70 # define USE_GETCWD | 70 # define USE_GETCWD |
71 #endif | 71 #endif |
72 | 72 |
73 /* always use unlink() to remove files */ | 73 // always use unlink() to remove files |
74 #ifndef PROTO | 74 #ifndef PROTO |
75 # ifdef VMS | 75 # ifdef VMS |
76 # define mch_remove(x) delete((char *)(x)) | 76 # define mch_remove(x) delete((char *)(x)) |
77 # define vim_mkdir(x, y) mkdir((char *)(x), y) | 77 # define vim_mkdir(x, y) mkdir((char *)(x), y) |
78 # else | 78 # else |
80 # define mch_rmdir(x) rmdir((char *)(x)) | 80 # define mch_rmdir(x) rmdir((char *)(x)) |
81 # define mch_remove(x) unlink((char *)(x)) | 81 # define mch_remove(x) unlink((char *)(x)) |
82 # endif | 82 # endif |
83 #endif | 83 #endif |
84 | 84 |
85 /* The number of arguments to a signal handler is configured here. */ | 85 // The number of arguments to a signal handler is configured here. |
86 /* It used to be a long list of almost all systems. Any system that doesn't | 86 // It used to be a long list of almost all systems. Any system that doesn't |
87 * have an argument??? */ | 87 // have an argument??? |
88 #define SIGHASARG | 88 #define SIGHASARG |
89 | 89 |
90 /* List 3 arg systems here. I guess __sgi, please test and correct me. jw. */ | 90 // List 3 arg systems here. I guess __sgi, please test and correct me. jw. |
91 #if defined(__sgi) && defined(HAVE_SIGCONTEXT) | 91 #if defined(__sgi) && defined(HAVE_SIGCONTEXT) |
92 # define SIGHAS3ARGS | 92 # define SIGHAS3ARGS |
93 #endif | 93 #endif |
94 | 94 |
95 #ifdef SIGHASARG | 95 #ifdef SIGHASARG |
140 #if defined(DIRSIZ) && !defined(MAXNAMLEN) | 140 #if defined(DIRSIZ) && !defined(MAXNAMLEN) |
141 # define MAXNAMLEN DIRSIZ | 141 # define MAXNAMLEN DIRSIZ |
142 #endif | 142 #endif |
143 | 143 |
144 #if defined(UFS_MAXNAMLEN) && !defined(MAXNAMLEN) | 144 #if defined(UFS_MAXNAMLEN) && !defined(MAXNAMLEN) |
145 # define MAXNAMLEN UFS_MAXNAMLEN /* for dynix/ptx */ | 145 # define MAXNAMLEN UFS_MAXNAMLEN // for dynix/ptx |
146 #endif | 146 #endif |
147 | 147 |
148 #if defined(NAME_MAX) && !defined(MAXNAMLEN) | 148 #if defined(NAME_MAX) && !defined(MAXNAMLEN) |
149 # define MAXNAMLEN NAME_MAX /* for Linux before .99p3 */ | 149 # define MAXNAMLEN NAME_MAX // for Linux before .99p3 |
150 #endif | 150 #endif |
151 | 151 |
152 /* | 152 /* |
153 * Note: if MAXNAMLEN has the wrong value, you will get error messages | 153 * Note: if MAXNAMLEN has the wrong value, you will get error messages |
154 * for not being able to open the swap file. | 154 * for not being able to open the swap file. |
155 */ | 155 */ |
156 #if !defined(MAXNAMLEN) | 156 #if !defined(MAXNAMLEN) |
157 # define MAXNAMLEN 512 /* for all other Unix */ | 157 # define MAXNAMLEN 512 // for all other Unix |
158 #endif | 158 #endif |
159 | 159 |
160 #define BASENAMELEN (MAXNAMLEN - 5) | 160 #define BASENAMELEN (MAXNAMLEN - 5) |
161 | 161 |
162 #ifdef HAVE_PWD_H | 162 #ifdef HAVE_PWD_H |
202 # ifdef FEAT_GUI_GTK | 202 # ifdef FEAT_GUI_GTK |
203 # include "gui_gtk_vms.h" | 203 # include "gui_gtk_vms.h" |
204 # endif | 204 # endif |
205 #endif | 205 #endif |
206 | 206 |
207 #endif /* PROTO */ | 207 #endif // PROTO |
208 | 208 |
209 #ifdef VMS | 209 #ifdef VMS |
210 typedef struct dsc$descriptor DESC; | 210 typedef struct dsc$descriptor DESC; |
211 #endif | 211 #endif |
212 | 212 |
340 | 340 |
341 #ifndef DFLT_BDIR | 341 #ifndef DFLT_BDIR |
342 # ifdef VMS | 342 # ifdef VMS |
343 # define DFLT_BDIR "./,sys$login:,tmp:" | 343 # define DFLT_BDIR "./,sys$login:,tmp:" |
344 # else | 344 # else |
345 # define DFLT_BDIR ".,~/tmp,~/" /* default for 'backupdir' */ | 345 # define DFLT_BDIR ".,~/tmp,~/" // default for 'backupdir' |
346 # endif | 346 # endif |
347 #endif | 347 #endif |
348 | 348 |
349 #ifndef DFLT_DIR | 349 #ifndef DFLT_DIR |
350 # ifdef VMS | 350 # ifdef VMS |
351 # define DFLT_DIR "./,sys$login:,tmp:" | 351 # define DFLT_DIR "./,sys$login:,tmp:" |
352 # else | 352 # else |
353 # define DFLT_DIR ".,~/tmp,/var/tmp,/tmp" /* default for 'directory' */ | 353 # define DFLT_DIR ".,~/tmp,/var/tmp,/tmp" // default for 'directory' |
354 # endif | 354 # endif |
355 #endif | 355 #endif |
356 | 356 |
357 #ifndef DFLT_VDIR | 357 #ifndef DFLT_VDIR |
358 # ifdef VMS | 358 # ifdef VMS |
359 # define DFLT_VDIR "sys$login:vimfiles/view" | 359 # define DFLT_VDIR "sys$login:vimfiles/view" |
360 # else | 360 # else |
361 # define DFLT_VDIR "$HOME/.vim/view" /* default for 'viewdir' */ | 361 # define DFLT_VDIR "$HOME/.vim/view" // default for 'viewdir' |
362 # endif | 362 # endif |
363 #endif | 363 #endif |
364 | 364 |
365 #define DFLT_ERRORFILE "errors.err" | 365 #define DFLT_ERRORFILE "errors.err" |
366 | 366 |
382 # endif | 382 # endif |
383 #endif | 383 #endif |
384 | 384 |
385 #ifdef VMS | 385 #ifdef VMS |
386 # ifndef VAX | 386 # ifndef VAX |
387 # define VMS_TEMPNAM /* to fix default .LIS extension */ | 387 # define VMS_TEMPNAM // to fix default .LIS extension |
388 # endif | 388 # endif |
389 # define TEMPNAME "TMP:v?XXXXXX.txt" | 389 # define TEMPNAME "TMP:v?XXXXXX.txt" |
390 # define TEMPNAMELEN 28 | 390 # define TEMPNAMELEN 28 |
391 #else | 391 #else |
392 /* Try several directories to put the temp files. */ | 392 // Try several directories to put the temp files. |
393 # define TEMPDIRNAMES "$TMPDIR", "/tmp", ".", "$HOME" | 393 # define TEMPDIRNAMES "$TMPDIR", "/tmp", ".", "$HOME" |
394 # define TEMPNAMELEN 256 | 394 # define TEMPNAMELEN 256 |
395 #endif | 395 #endif |
396 | 396 |
397 /* Special wildcards that need to be handled by the shell */ | 397 // Special wildcards that need to be handled by the shell |
398 #define SPECIAL_WILDCHAR "`'{" | 398 #define SPECIAL_WILDCHAR "`'{" |
399 | 399 |
400 /* | 400 /* |
401 * Unix has plenty of memory, use large buffers | 401 * Unix has plenty of memory, use large buffers |
402 */ | 402 */ |
403 #define CMDBUFFSIZE 1024 /* size of the command processing buffer */ | 403 #define CMDBUFFSIZE 1024 // size of the command processing buffer |
404 | 404 |
405 /* Use the system path length if it makes sense. */ | 405 // Use the system path length if it makes sense. |
406 #if defined(PATH_MAX) && (PATH_MAX > 1000) | 406 #if defined(PATH_MAX) && (PATH_MAX > 1000) |
407 # define MAXPATHL PATH_MAX | 407 # define MAXPATHL PATH_MAX |
408 #else | 408 #else |
409 # define MAXPATHL 1024 | 409 # define MAXPATHL 1024 |
410 #endif | 410 #endif |
411 | 411 |
412 #define CHECK_INODE /* used when checking if a swap file already | 412 #define CHECK_INODE // used when checking if a swap file already |
413 exists for a file */ | 413 // exists for a file |
414 #ifdef VMS /* Use less memory because of older systems */ | 414 #ifdef VMS // Use less memory because of older systems |
415 # ifndef DFLT_MAXMEM | 415 # ifndef DFLT_MAXMEM |
416 # define DFLT_MAXMEM (2*1024) | 416 # define DFLT_MAXMEM (2*1024) |
417 # endif | 417 # endif |
418 # ifndef DFLT_MAXMEMTOT | 418 # ifndef DFLT_MAXMEMTOT |
419 # define DFLT_MAXMEMTOT (5*1024) | 419 # define DFLT_MAXMEMTOT (5*1024) |
420 # endif | 420 # endif |
421 #else | 421 #else |
422 # ifndef DFLT_MAXMEM | 422 # ifndef DFLT_MAXMEM |
423 # define DFLT_MAXMEM (5*1024) /* use up to 5 Mbyte for a buffer */ | 423 # define DFLT_MAXMEM (5*1024) // use up to 5 Mbyte for a buffer |
424 # endif | 424 # endif |
425 # ifndef DFLT_MAXMEMTOT | 425 # ifndef DFLT_MAXMEMTOT |
426 # define DFLT_MAXMEMTOT (10*1024) /* use up to 10 Mbyte for Vim */ | 426 # define DFLT_MAXMEMTOT (10*1024) // use up to 10 Mbyte for Vim |
427 # endif | 427 # endif |
428 #endif | 428 #endif |
429 | 429 |
430 /* memmove() is not present on all systems, use memmove, bcopy or memcpy. | 430 // memmove() is not present on all systems, use memmove, bcopy or memcpy. |
431 * Some systems have (void *) arguments, some (char *). If we use (char *) it | 431 // Some systems have (void *) arguments, some (char *). If we use (char *) it |
432 * works for all */ | 432 // works for all |
433 #if defined(USEMEMMOVE) || (!defined(USEBCOPY) && !defined(USEMEMCPY)) | 433 #if defined(USEMEMMOVE) || (!defined(USEBCOPY) && !defined(USEMEMCPY)) |
434 # define mch_memmove(to, from, len) memmove((char *)(to), (char *)(from), len) | 434 # define mch_memmove(to, from, len) memmove((char *)(to), (char *)(from), len) |
435 #else | 435 #else |
436 # ifdef USEBCOPY | 436 # ifdef USEBCOPY |
437 # define mch_memmove(to, from, len) bcopy((char *)(from), (char *)(to), len) | 437 # define mch_memmove(to, from, len) bcopy((char *)(from), (char *)(to), len) |
438 # else | 438 # else |
439 /* ifdef USEMEMCPY */ | 439 // ifdef USEMEMCPY |
440 # define mch_memmove(to, from, len) memcpy((char *)(to), (char *)(from), len) | 440 # define mch_memmove(to, from, len) memcpy((char *)(to), (char *)(from), len) |
441 # endif | 441 # endif |
442 #endif | 442 #endif |
443 | 443 |
444 #ifndef PROTO | 444 #ifndef PROTO |
447 # else | 447 # else |
448 int mch_rename(const char *src, const char *dest); | 448 int mch_rename(const char *src, const char *dest); |
449 # endif | 449 # endif |
450 # ifndef VMS | 450 # ifndef VMS |
451 # ifdef __MVS__ | 451 # ifdef __MVS__ |
452 /* on OS390 Unix getenv() doesn't return a pointer to persistent | 452 // on OS390 Unix getenv() doesn't return a pointer to persistent |
453 * storage -> use __getenv() */ | 453 // storage -> use __getenv() |
454 # define mch_getenv(x) (char_u *)__getenv((char *)(x)) | 454 # define mch_getenv(x) (char_u *)__getenv((char *)(x)) |
455 # else | 455 # else |
456 # define mch_getenv(x) (char_u *)getenv((char *)(x)) | 456 # define mch_getenv(x) (char_u *)getenv((char *)(x)) |
457 # endif | 457 # endif |
458 # define mch_setenv(name, val, x) setenv(name, val, x) | 458 # define mch_setenv(name, val, x) setenv(name, val, x) |
459 # endif | 459 # endif |
460 #endif | 460 #endif |
461 | 461 |
462 /* Note: Some systems need both string.h and strings.h (Savage). However, | 462 // Note: Some systems need both string.h and strings.h (Savage). However, |
463 * some systems can't handle both, only use string.h in that case. */ | 463 // some systems can't handle both, only use string.h in that case. |
464 #ifdef HAVE_STRING_H | 464 #ifdef HAVE_STRING_H |
465 # include <string.h> | 465 # include <string.h> |
466 #endif | 466 #endif |
467 #if defined(HAVE_STRINGS_H) && !defined(NO_STRINGS_WITH_STRING_H) | 467 #if defined(HAVE_STRINGS_H) && !defined(NO_STRINGS_WITH_STRING_H) |
468 # include <strings.h> | 468 # include <strings.h> |
480 # define LONGJMP longjmp | 480 # define LONGJMP longjmp |
481 # endif | 481 # endif |
482 #endif | 482 #endif |
483 | 483 |
484 #ifndef HAVE_DUP | 484 #ifndef HAVE_DUP |
485 # define HAVE_DUP /* have dup() */ | 485 # define HAVE_DUP // have dup() |
486 #endif | 486 #endif |
487 #define HAVE_ST_MODE /* have stat.st_mode */ | 487 #define HAVE_ST_MODE // have stat.st_mode |
488 | 488 |
489 /* We have three kinds of ACL support. */ | 489 // We have three kinds of ACL support. |
490 #define HAVE_ACL (HAVE_POSIX_ACL || HAVE_SOLARIS_ACL || HAVE_AIX_ACL) | 490 #define HAVE_ACL (HAVE_POSIX_ACL || HAVE_SOLARIS_ACL || HAVE_AIX_ACL) |