annotate src/if_perlsfio.c @ 12098:bdeb41cb755a v8.0.0929

patch 8.0.0929: :term without argument does not work commit https://github.com/vim/vim/commit/2438ae3d678288c4726d2e393d1c66fd5cc52623 Author: Bram Moolenaar <Bram@vim.org> Date: Sun Aug 13 17:38:11 2017 +0200 patch 8.0.0929: :term without argument does not work Problem: :term without argument does not work. Solution: Use shell for empty command. (Yasuhiro Matsumoto, closes https://github.com/vim/vim/issues/1970)
author Christian Brabandt <cb@256bit.org>
date Sun, 13 Aug 2017 17:45:04 +0200
parents 4aead6a9b7a9
children ef00b6bc186b
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: 7823
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 *
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5 * Do ":help uganda" in Vim to read copying and usage conditions.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6 * Do ":help credits" in Vim to see a list of people who contributed.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7 * See README.txt for an overview of the Vim source code.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
10 * if_perlsfio.c: Special I/O functions for Perl interface.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
11 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
12
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
13 #define _memory_h /* avoid memset redeclaration */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
14 #define IN_PERL_FILE /* don't include if_perl.pro from prot.h */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
15
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
16 #include "vim.h"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
17
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
18 #if defined(USE_SFIO) || defined(PROTO)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
19
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
20 #ifndef USE_SFIO /* just generating prototypes */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
21 # define Sfio_t int
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
22 # define Sfdisc_t int
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
23 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
24
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
25 #define NIL(type) ((type)0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
26
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
27 static int
7823
bcef391c101c commit https://github.com/vim/vim/commit/68c2f638e65d914dc6e84eb7ce2624f08af525c0
Christian Brabandt <cb@256bit.org>
parents: 7
diff changeset
28 sfvimwrite(
bcef391c101c commit https://github.com/vim/vim/commit/68c2f638e65d914dc6e84eb7ce2624f08af525c0
Christian Brabandt <cb@256bit.org>
parents: 7
diff changeset
29 Sfio_t *f, /* stream involved */
bcef391c101c commit https://github.com/vim/vim/commit/68c2f638e65d914dc6e84eb7ce2624f08af525c0
Christian Brabandt <cb@256bit.org>
parents: 7
diff changeset
30 char *buf, /* buffer to read from */
bcef391c101c commit https://github.com/vim/vim/commit/68c2f638e65d914dc6e84eb7ce2624f08af525c0
Christian Brabandt <cb@256bit.org>
parents: 7
diff changeset
31 int n, /* number of bytes to write */
bcef391c101c commit https://github.com/vim/vim/commit/68c2f638e65d914dc6e84eb7ce2624f08af525c0
Christian Brabandt <cb@256bit.org>
parents: 7
diff changeset
32 Sfdisc_t *disc) /* discipline */
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
33 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
34 char_u *str;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
35
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
36 str = vim_strnsave((char_u *)buf, n);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
37 if (str == NULL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
38 return 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
39 msg_split((char *)str);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
40 vim_free(str);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
41
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
42 return n;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
43 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
44
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
45 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
46 * sfdcnewnvi --
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
47 * Create Vim discipline
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
48 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
49 Sfdisc_t *
7823
bcef391c101c commit https://github.com/vim/vim/commit/68c2f638e65d914dc6e84eb7ce2624f08af525c0
Christian Brabandt <cb@256bit.org>
parents: 7
diff changeset
50 sfdcnewvim(void)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
51 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
52 Sfdisc_t *disc;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
53
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
54 disc = (Sfdisc_t *)alloc((unsigned)sizeof(Sfdisc_t));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
55 if (disc == NULL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
56 return NULL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
57
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
58 disc->readf = (Sfread_f)NULL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
59 disc->writef = sfvimwrite;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
60 disc->seekf = (Sfseek_f)NULL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
61 disc->exceptf = (Sfexcept_f)NULL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
62
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
63 return disc;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
64 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
65
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
66 #endif /* USE_SFIO */