Mercurial > vim
comparison src/os_unix.c @ 15543:dd725a8ab112 v8.1.0779
patch 8.1.0779: argument for message functions is inconsistent
commit https://github.com/vim/vim/commit/32526b3c1846025f0e655f41efd4e5428da16b6c
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat Jan 19 17:43:09 2019 +0100
patch 8.1.0779: argument for message functions is inconsistent
Problem: Argument for message functions is inconsistent.
Solution: Make first argument to msg() "char *".
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sat, 19 Jan 2019 17:45:07 +0100 |
parents | 3ef31ce9d9f9 |
children | d89c5b339c2a |
comparison
equal
deleted
inserted
replaced
15542:5baedae7ca7a | 15543:dd725a8ab112 |
---|---|
1788 XFree((void *)text_prop.value); | 1788 XFree((void *)text_prop.value); |
1789 XSync(dpy, False); | 1789 XSync(dpy, False); |
1790 (void)XSetErrorHandler(old_handler); | 1790 (void)XSetErrorHandler(old_handler); |
1791 | 1791 |
1792 if (p_verbose > 0 && got_x_error) | 1792 if (p_verbose > 0 && got_x_error) |
1793 verb_msg((char_u *)_("Testing the X display failed")); | 1793 verb_msg(_("Testing the X display failed")); |
1794 | 1794 |
1795 return (got_x_error ? FAIL : OK); | 1795 return (got_x_error ? FAIL : OK); |
1796 } | 1796 } |
1797 #endif | 1797 #endif |
1798 | 1798 |
2658 if (fd >= 0) | 2658 if (fd >= 0) |
2659 { | 2659 { |
2660 if (p_verbose >= 5) | 2660 if (p_verbose >= 5) |
2661 { | 2661 { |
2662 verbose_enter(); | 2662 verbose_enter(); |
2663 MSG("fchdir() to previous dir"); | 2663 msg("fchdir() to previous dir"); |
2664 verbose_leave(); | 2664 verbose_leave(); |
2665 } | 2665 } |
2666 l = fchdir(fd); | 2666 l = fchdir(fd); |
2667 close(fd); | 2667 close(fd); |
2668 } | 2668 } |
2867 the original had no special security context and the | 2867 the original had no special security context and the |
2868 target cannot have one either. */ | 2868 target cannot have one either. */ |
2869 if (errno == EOPNOTSUPP) | 2869 if (errno == EOPNOTSUPP) |
2870 return; | 2870 return; |
2871 | 2871 |
2872 MSG_PUTS(_("\nCould not get security context for ")); | 2872 msg_puts(_("\nCould not get security context for ")); |
2873 msg_outtrans(from_file); | 2873 msg_outtrans(from_file); |
2874 msg_putchar('\n'); | 2874 msg_putchar('\n'); |
2875 return; | 2875 return; |
2876 } | 2876 } |
2877 if (getfilecon((char *)to_file, &to_context) < 0) | 2877 if (getfilecon((char *)to_file, &to_context) < 0) |
2878 { | 2878 { |
2879 MSG_PUTS(_("\nCould not get security context for ")); | 2879 msg_puts(_("\nCould not get security context for ")); |
2880 msg_outtrans(to_file); | 2880 msg_outtrans(to_file); |
2881 msg_putchar('\n'); | 2881 msg_putchar('\n'); |
2882 freecon (from_context); | 2882 freecon (from_context); |
2883 return ; | 2883 return ; |
2884 } | 2884 } |
2885 if (strcmp(from_context, to_context) != 0) | 2885 if (strcmp(from_context, to_context) != 0) |
2886 { | 2886 { |
2887 if (setfilecon((char *)to_file, from_context) < 0) | 2887 if (setfilecon((char *)to_file, from_context) < 0) |
2888 { | 2888 { |
2889 MSG_PUTS(_("\nCould not set security context for ")); | 2889 msg_puts(_("\nCould not set security context for ")); |
2890 msg_outtrans(to_file); | 2890 msg_outtrans(to_file); |
2891 msg_putchar('\n'); | 2891 msg_putchar('\n'); |
2892 } | 2892 } |
2893 } | 2893 } |
2894 freecon(to_context); | 2894 freecon(to_context); |
2955 default: | 2955 default: |
2956 /* no enough size OR unexpected error */ | 2956 /* no enough size OR unexpected error */ |
2957 vim_snprintf((char *)IObuff, IOSIZE, | 2957 vim_snprintf((char *)IObuff, IOSIZE, |
2958 _("Could not get security context %s for %s. Removing it!"), | 2958 _("Could not get security context %s for %s. Removing it!"), |
2959 name, from_file); | 2959 name, from_file); |
2960 msg_puts(IObuff); | 2960 msg_puts((char *)IObuff); |
2961 msg_putchar('\n'); | 2961 msg_putchar('\n'); |
2962 /* FALLTHROUGH to remove the attribute */ | 2962 /* FALLTHROUGH to remove the attribute */ |
2963 | 2963 |
2964 case ENODATA: | 2964 case ENODATA: |
2965 /* no attribute of this name */ | 2965 /* no attribute of this name */ |
4503 x = vms_sys_status(x); | 4503 x = vms_sys_status(x); |
4504 # endif | 4504 # endif |
4505 if (emsg_silent) | 4505 if (emsg_silent) |
4506 ; | 4506 ; |
4507 else if (x == 127) | 4507 else if (x == 127) |
4508 MSG_PUTS(_("\nCannot execute shell sh\n")); | 4508 msg_puts(_("\nCannot execute shell sh\n")); |
4509 else if (x && !(options & SHELL_SILENT)) | 4509 else if (x && !(options & SHELL_SILENT)) |
4510 { | 4510 { |
4511 MSG_PUTS(_("\nshell returned ")); | 4511 msg_puts(_("\nshell returned ")); |
4512 msg_outnum((long)x); | 4512 msg_outnum((long)x); |
4513 msg_putchar('\n'); | 4513 msg_putchar('\n'); |
4514 } | 4514 } |
4515 | 4515 |
4516 if (tmode == TMODE_RAW) | 4516 if (tmode == TMODE_RAW) |
4603 close(fd_toshell[1]); | 4603 close(fd_toshell[1]); |
4604 } | 4604 } |
4605 } | 4605 } |
4606 if (pipe_error) | 4606 if (pipe_error) |
4607 { | 4607 { |
4608 MSG_PUTS(_("\nCannot create pipes\n")); | 4608 msg_puts(_("\nCannot create pipes\n")); |
4609 out_flush(); | 4609 out_flush(); |
4610 } | 4610 } |
4611 } | 4611 } |
4612 } | 4612 } |
4613 | 4613 |
4623 pid = fork(); /* maybe we should use vfork() */ | 4623 pid = fork(); /* maybe we should use vfork() */ |
4624 if (pid == -1) | 4624 if (pid == -1) |
4625 { | 4625 { |
4626 UNBLOCK_SIGNALS(&curset); | 4626 UNBLOCK_SIGNALS(&curset); |
4627 | 4627 |
4628 MSG_PUTS(_("\nCannot fork\n")); | 4628 msg_puts(_("\nCannot fork\n")); |
4629 if ((options & (SHELL_READ|SHELL_WRITE)) | 4629 if ((options & (SHELL_READ|SHELL_WRITE)) |
4630 # ifdef FEAT_GUI | 4630 # ifdef FEAT_GUI |
4631 || (gui.in_use && show_shell_mess) | 4631 || (gui.in_use && show_shell_mess) |
4632 # endif | 4632 # endif |
4633 ) | 4633 ) |
4875 { | 4875 { |
4876 /* Fork a process that will write the lines to the | 4876 /* Fork a process that will write the lines to the |
4877 * external program. */ | 4877 * external program. */ |
4878 if ((wpid = fork()) == -1) | 4878 if ((wpid = fork()) == -1) |
4879 { | 4879 { |
4880 MSG_PUTS(_("\nCannot fork\n")); | 4880 msg_puts(_("\nCannot fork\n")); |
4881 } | 4881 } |
4882 else if (wpid == 0) /* child */ | 4882 else if (wpid == 0) /* child */ |
4883 { | 4883 { |
4884 linenr_T lnum = curbuf->b_op_start.lnum; | 4884 linenr_T lnum = curbuf->b_op_start.lnum; |
4885 int written = 0; | 4885 int written = 0; |
5164 continue; | 5164 continue; |
5165 } | 5165 } |
5166 } | 5166 } |
5167 c = *p; | 5167 c = *p; |
5168 *p = NUL; | 5168 *p = NUL; |
5169 msg_puts(buffer); | 5169 msg_puts((char *)buffer); |
5170 if (p < buffer + len) | 5170 if (p < buffer + len) |
5171 { | 5171 { |
5172 *p = c; | 5172 *p = c; |
5173 buffer_off = (buffer + len) - p; | 5173 buffer_off = (buffer + len) - p; |
5174 mch_memmove(buffer, p, buffer_off); | 5174 mch_memmove(buffer, p, buffer_off); |
5178 } | 5178 } |
5179 # endif /* FEAT_MBYTE */ | 5179 # endif /* FEAT_MBYTE */ |
5180 else | 5180 else |
5181 { | 5181 { |
5182 buffer[len] = NUL; | 5182 buffer[len] = NUL; |
5183 msg_puts(buffer); | 5183 msg_puts((char *)buffer); |
5184 } | 5184 } |
5185 | 5185 |
5186 windgoto(msg_row, msg_col); | 5186 windgoto(msg_row, msg_col); |
5187 cursor_on(); | 5187 cursor_on(); |
5188 out_flush(); | 5188 out_flush(); |
5358 retval = WEXITSTATUS(status); | 5358 retval = WEXITSTATUS(status); |
5359 if (retval != 0 && !emsg_silent) | 5359 if (retval != 0 && !emsg_silent) |
5360 { | 5360 { |
5361 if (retval == EXEC_FAILED) | 5361 if (retval == EXEC_FAILED) |
5362 { | 5362 { |
5363 MSG_PUTS(_("\nCannot execute shell ")); | 5363 msg_puts(_("\nCannot execute shell ")); |
5364 msg_outtrans(p_sh); | 5364 msg_outtrans(p_sh); |
5365 msg_putchar('\n'); | 5365 msg_putchar('\n'); |
5366 } | 5366 } |
5367 else if (!(options & SHELL_SILENT)) | 5367 else if (!(options & SHELL_SILENT)) |
5368 { | 5368 { |
5369 MSG_PUTS(_("\nshell returned ")); | 5369 msg_puts(_("\nshell returned ")); |
5370 msg_outnum((long)retval); | 5370 msg_outnum((long)retval); |
5371 msg_putchar('\n'); | 5371 msg_putchar('\n'); |
5372 } | 5372 } |
5373 } | 5373 } |
5374 } | 5374 } |
5375 else | 5375 else |
5376 MSG_PUTS(_("\nCommand terminated\n")); | 5376 msg_puts(_("\nCommand terminated\n")); |
5377 } | 5377 } |
5378 } | 5378 } |
5379 | 5379 |
5380 error: | 5380 error: |
5381 if (!did_settmode) | 5381 if (!did_settmode) |
6194 busy = FALSE; | 6194 busy = FALSE; |
6195 } | 6195 } |
6196 else if (fds[xsmp_idx].revents & POLLHUP) | 6196 else if (fds[xsmp_idx].revents & POLLHUP) |
6197 { | 6197 { |
6198 if (p_verbose > 0) | 6198 if (p_verbose > 0) |
6199 verb_msg((char_u *)_("XSMP lost ICE connection")); | 6199 verb_msg(_("XSMP lost ICE connection")); |
6200 xsmp_close(); | 6200 xsmp_close(); |
6201 } | 6201 } |
6202 if (--ret == 0) | 6202 if (--ret == 0) |
6203 finished = FALSE; /* Try again */ | 6203 finished = FALSE; /* Try again */ |
6204 } | 6204 } |
6352 if (ret > 0 && xsmp_icefd != -1) | 6352 if (ret > 0 && xsmp_icefd != -1) |
6353 { | 6353 { |
6354 if (FD_ISSET(xsmp_icefd, &efds)) | 6354 if (FD_ISSET(xsmp_icefd, &efds)) |
6355 { | 6355 { |
6356 if (p_verbose > 0) | 6356 if (p_verbose > 0) |
6357 verb_msg((char_u *)_("XSMP lost ICE connection")); | 6357 verb_msg(_("XSMP lost ICE connection")); |
6358 xsmp_close(); | 6358 xsmp_close(); |
6359 if (--ret == 0) | 6359 if (--ret == 0) |
6360 finished = FALSE; /* keep going if event was only one */ | 6360 finished = FALSE; /* keep going if event was only one */ |
6361 } | 6361 } |
6362 else if (FD_ISSET(xsmp_icefd, &rfds)) | 6362 else if (FD_ISSET(xsmp_icefd, &rfds)) |
6712 cmdline_row = Rows - 1; /* continue on last line */ | 6712 cmdline_row = Rows - 1; /* continue on last line */ |
6713 #ifdef USE_SYSTEM | 6713 #ifdef USE_SYSTEM |
6714 if (!(flags & EW_SILENT)) | 6714 if (!(flags & EW_SILENT)) |
6715 #endif | 6715 #endif |
6716 { | 6716 { |
6717 MSG(_(e_wildexpand)); | 6717 msg(_(e_wildexpand)); |
6718 msg_start(); /* don't overwrite this message */ | 6718 msg_start(); /* don't overwrite this message */ |
6719 } | 6719 } |
6720 } | 6720 } |
6721 /* If a `cmd` expansion failed, don't list `cmd` as a match, even when | 6721 /* If a `cmd` expansion failed, don't list `cmd` as a match, even when |
6722 * EW_NOTFOUND is given */ | 6722 * EW_NOTFOUND is given */ |
6732 if (fd == NULL) | 6732 if (fd == NULL) |
6733 { | 6733 { |
6734 /* Something went wrong, perhaps a file name with a special char. */ | 6734 /* Something went wrong, perhaps a file name with a special char. */ |
6735 if (!(flags & EW_SILENT)) | 6735 if (!(flags & EW_SILENT)) |
6736 { | 6736 { |
6737 MSG(_(e_wildexpand)); | 6737 msg(_(e_wildexpand)); |
6738 msg_start(); /* don't overwrite this message */ | 6738 msg_start(); /* don't overwrite this message */ |
6739 } | 6739 } |
6740 vim_free(tempname); | 6740 vim_free(tempname); |
6741 goto notfound; | 6741 goto notfound; |
6742 } | 6742 } |
7532 (void)XSetErrorHandler(oldhandler); | 7532 (void)XSetErrorHandler(oldhandler); |
7533 | 7533 |
7534 if (xterm_dpy == NULL) | 7534 if (xterm_dpy == NULL) |
7535 { | 7535 { |
7536 if (p_verbose > 0) | 7536 if (p_verbose > 0) |
7537 verb_msg((char_u *)_("Opening the X display failed")); | 7537 verb_msg(_("Opening the X display failed")); |
7538 return; | 7538 return; |
7539 } | 7539 } |
7540 | 7540 |
7541 /* Catch terminating error of the X server connection. */ | 7541 /* Catch terminating error of the X server connection. */ |
7542 (void)XSetIOErrorHandler(x_IOerror_handler); | 7542 (void)XSetIOErrorHandler(x_IOerror_handler); |
7870 /* First up, preserve all files */ | 7870 /* First up, preserve all files */ |
7871 out_flush(); | 7871 out_flush(); |
7872 ml_sync_all(FALSE, FALSE); /* preserve all swap files */ | 7872 ml_sync_all(FALSE, FALSE); /* preserve all swap files */ |
7873 | 7873 |
7874 if (p_verbose > 0) | 7874 if (p_verbose > 0) |
7875 verb_msg((char_u *)_("XSMP handling save-yourself request")); | 7875 verb_msg(_("XSMP handling save-yourself request")); |
7876 | 7876 |
7877 # if defined(FEAT_GUI) && defined(USE_XSMP_INTERACT) | 7877 # if defined(FEAT_GUI) && defined(USE_XSMP_INTERACT) |
7878 /* Now see if we can ask about unsaved files */ | 7878 /* Now see if we can ask about unsaved files */ |
7879 if (shutdown && !fast && gui.in_use) | 7879 if (shutdown && !fast && gui.in_use) |
7880 /* Need to interact with user, but need SM's permission */ | 7880 /* Need to interact with user, but need SM's permission */ |
7959 if (IceProcessMessages(xsmp.iceconn, NULL, &rep) | 7959 if (IceProcessMessages(xsmp.iceconn, NULL, &rep) |
7960 == IceProcessMessagesIOError) | 7960 == IceProcessMessagesIOError) |
7961 { | 7961 { |
7962 /* Lost ICE */ | 7962 /* Lost ICE */ |
7963 if (p_verbose > 0) | 7963 if (p_verbose > 0) |
7964 verb_msg((char_u *)_("XSMP lost ICE connection")); | 7964 verb_msg(_("XSMP lost ICE connection")); |
7965 xsmp_close(); | 7965 xsmp_close(); |
7966 return FAIL; | 7966 return FAIL; |
7967 } | 7967 } |
7968 else | 7968 else |
7969 return OK; | 7969 return OK; |
7982 SmProp smnameprop; | 7982 SmProp smnameprop; |
7983 SmProp *smprops[1]; | 7983 SmProp *smprops[1]; |
7984 #endif | 7984 #endif |
7985 | 7985 |
7986 if (p_verbose > 0) | 7986 if (p_verbose > 0) |
7987 verb_msg((char_u *)_("XSMP opening connection")); | 7987 verb_msg(_("XSMP opening connection")); |
7988 | 7988 |
7989 xsmp.save_yourself = xsmp.shutdown = False; | 7989 xsmp.save_yourself = xsmp.shutdown = False; |
7990 | 7990 |
7991 /* Set up SM callbacks - must have all, even if they're not used */ | 7991 /* Set up SM callbacks - must have all, even if they're not used */ |
7992 smcallbacks.save_yourself.callback = xsmp_handle_save_yourself; | 7992 smcallbacks.save_yourself.callback = xsmp_handle_save_yourself; |
8001 /* Set up a watch on ICE connection creations. The "dummy" argument is | 8001 /* Set up a watch on ICE connection creations. The "dummy" argument is |
8002 * apparently required for FreeBSD (we get a BUS error when using NULL). */ | 8002 * apparently required for FreeBSD (we get a BUS error when using NULL). */ |
8003 if (IceAddConnectionWatch(xsmp_ice_connection, &dummy) == 0) | 8003 if (IceAddConnectionWatch(xsmp_ice_connection, &dummy) == 0) |
8004 { | 8004 { |
8005 if (p_verbose > 0) | 8005 if (p_verbose > 0) |
8006 verb_msg((char_u *)_("XSMP ICE connection watch failed")); | 8006 verb_msg(_("XSMP ICE connection watch failed")); |
8007 return; | 8007 return; |
8008 } | 8008 } |
8009 | 8009 |
8010 /* Create an SM connection */ | 8010 /* Create an SM connection */ |
8011 xsmp.smcconn = SmcOpenConnection( | 8011 xsmp.smcconn = SmcOpenConnection( |
8026 | 8026 |
8027 if (p_verbose > 0) | 8027 if (p_verbose > 0) |
8028 { | 8028 { |
8029 vim_snprintf(errorreport, sizeof(errorreport), | 8029 vim_snprintf(errorreport, sizeof(errorreport), |
8030 _("XSMP SmcOpenConnection failed: %s"), errorstring); | 8030 _("XSMP SmcOpenConnection failed: %s"), errorstring); |
8031 verb_msg((char_u *)errorreport); | 8031 verb_msg(errorreport); |
8032 } | 8032 } |
8033 return; | 8033 return; |
8034 } | 8034 } |
8035 xsmp.iceconn = SmcGetIceConnection(xsmp.smcconn); | 8035 xsmp.iceconn = SmcGetIceConnection(xsmp.smcconn); |
8036 | 8036 |