comparison src/channel.c @ 8165:973686665238 v7.4.1376

commit https://github.com/vim/vim/commit/b6b5252bcde68b296858bc090cb424493635dfec Author: Bram Moolenaar <Bram@vim.org> Date: Sat Feb 20 23:30:07 2016 +0100 patch 7.4.1376 Problem: ch_setoptions() cannot set all options. Solution: Support more options.
author Christian Brabandt <cb@256bit.org>
date Sat, 20 Feb 2016 23:45:04 +0100
parents d0958e22d9ff
children db5c79d93eee
comparison
equal deleted inserted replaced
8164:9a197f537595 8165:973686665238
735 { 735 {
736 channel->ch_job = job; 736 channel->ch_job = job;
737 } 737 }
738 738
739 /* 739 /*
740 * Set various properties from an "options" argument. 740 * Set various properties from an "opt" argument.
741 */ 741 */
742 void 742 void
743 channel_set_options(channel_T *channel, jobopt_T *options) 743 channel_set_options(channel_T *channel, jobopt_T *opt)
744 { 744 {
745 int part; 745 int part;
746 746 char_u **cbp;
747 if (options->jo_set & JO_MODE) 747
748 if (opt->jo_set & JO_MODE)
748 for (part = PART_SOCK; part <= PART_IN; ++part) 749 for (part = PART_SOCK; part <= PART_IN; ++part)
749 channel->ch_part[part].ch_mode = options->jo_mode; 750 channel->ch_part[part].ch_mode = opt->jo_mode;
750 if (options->jo_set & JO_TIMEOUT) 751 if (opt->jo_set & JO_IN_MODE)
752 channel->ch_part[PART_IN].ch_mode = opt->jo_in_mode;
753 if (opt->jo_set & JO_OUT_MODE)
754 channel->ch_part[PART_OUT].ch_mode = opt->jo_out_mode;
755 if (opt->jo_set & JO_ERR_MODE)
756 channel->ch_part[PART_ERR].ch_mode = opt->jo_err_mode;
757
758 if (opt->jo_set & JO_TIMEOUT)
751 for (part = PART_SOCK; part <= PART_IN; ++part) 759 for (part = PART_SOCK; part <= PART_IN; ++part)
752 channel->ch_part[part].ch_timeout = options->jo_timeout; 760 channel->ch_part[part].ch_timeout = opt->jo_timeout;
753 761 if (opt->jo_set & JO_OUT_TIMEOUT)
754 if (options->jo_set & JO_CALLBACK) 762 channel->ch_part[PART_OUT].ch_timeout = opt->jo_out_timeout;
755 { 763 if (opt->jo_set & JO_ERR_TIMEOUT)
756 vim_free(channel->ch_callback); 764 channel->ch_part[PART_ERR].ch_timeout = opt->jo_err_timeout;
757 if (options->jo_callback != NULL && *options->jo_callback != NUL) 765
758 channel->ch_callback = vim_strsave(options->jo_callback); 766 if (opt->jo_set & JO_CALLBACK)
767 {
768 cbp = &channel->ch_callback;
769 vim_free(*cbp);
770 if (opt->jo_callback != NULL && *opt->jo_callback != NUL)
771 *cbp = vim_strsave(opt->jo_callback);
759 else 772 else
760 channel->ch_callback = NULL; 773 *cbp = NULL;
774 }
775 if (opt->jo_set & JO_OUT_CALLBACK)
776 {
777 cbp = &channel->ch_part[PART_OUT].ch_callback;
778 vim_free(*cbp);
779 if (opt->jo_out_cb != NULL && *opt->jo_out_cb != NUL)
780 *cbp = vim_strsave(opt->jo_out_cb);
781 else
782 *cbp = NULL;
783 }
784 if (opt->jo_set & JO_ERR_CALLBACK)
785 {
786 cbp = &channel->ch_part[PART_ERR].ch_callback;
787 vim_free(*cbp);
788 if (opt->jo_err_cb != NULL && *opt->jo_err_cb != NUL)
789 *cbp = vim_strsave(opt->jo_err_cb);
790 else
791 *cbp = NULL;
761 } 792 }
762 } 793 }
763 794
764 /* 795 /*
765 * Set the callback for "channel"/"part" for the response with "id". 796 * Set the callback for "channel"/"part" for the response with "id".