1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
|
To: vim_dev@googlegroups.com
Subject: Patch 8.1.0314
Fcc: outbox
From: Bram Moolenaar <Bram@moolenaar.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
------------
Patch 8.1.0314 (after 8.1.0313)
Problem: Build failure without the +eval feature. (Brenton Horne)
Solution: Add #ifdef. Also add the "dirty" item.
Files: src/memline.c, runtime/doc/eval.txt, src/testdir/test_swap.vim
*** ../vim-8.1.0313/src/memline.c 2018-08-21 20:28:49.888006612 +0200
--- src/memline.c 2018-08-21 21:07:08.927388911 +0200
***************
*** 2041,2046 ****
--- 2041,2047 ----
static int process_still_running;
#endif
+ #if defined(FEAT_EVAL) || defined(PROTO)
/*
* Return information found in swapfile "fname" in dictionary "d".
* This is used by the swapinfo() function.
***************
*** 2055,2065 ****
{
if (read_eintr(fd, &b0, sizeof(b0)) == sizeof(b0))
{
! if (b0_magic_wrong(&b0))
! {
dict_add_string(d, "error",
! vim_strsave((char_u *)"magic number mismatch"));
! }
else
{
/* we have swap information */
--- 2056,2067 ----
{
if (read_eintr(fd, &b0, sizeof(b0)) == sizeof(b0))
{
! if (ml_check_b0_id(&b0) == FAIL)
dict_add_string(d, "error",
! vim_strsave((char_u *)"Not a swap file"));
! else if (b0_magic_wrong(&b0))
! dict_add_string(d, "error",
! vim_strsave((char_u *)"Magic number mismatch"));
else
{
/* we have swap information */
***************
*** 2070,2078 ****
dict_add_number(d, "pid", char_to_long(b0.b0_pid));
dict_add_number(d, "mtime", char_to_long(b0.b0_mtime));
! #ifdef CHECK_INODE
dict_add_number(d, "inode", char_to_long(b0.b0_ino));
! #endif
}
}
else
--- 2072,2081 ----
dict_add_number(d, "pid", char_to_long(b0.b0_pid));
dict_add_number(d, "mtime", char_to_long(b0.b0_mtime));
! dict_add_number(d, "dirty", b0.b0_dirty ? 1 : 0);
! # ifdef CHECK_INODE
dict_add_number(d, "inode", char_to_long(b0.b0_ino));
! # endif
}
}
else
***************
*** 2083,2088 ****
--- 2086,2092 ----
else
dict_add_string(d, "error", vim_strsave((char_u *)"Cannot open file"));
}
+ #endif
/*
* Give information about an existing swap file.
*** ../vim-8.1.0313/runtime/doc/eval.txt 2018-08-21 20:28:49.884006638 +0200
--- runtime/doc/eval.txt 2018-08-21 21:06:33.431590332 +0200
***************
*** 8011,8020 ****
file
mtime last modification time in seconds
inode Optional: INODE number of the file
In case of failure an "error" item is added with the reason:
Cannot open file: file not found or in accessible
Cannot read file: cannot read first block
! magic number mismatch: info in first block is invalid
synID({lnum}, {col}, {trans}) *synID()*
The result is a Number, which is the syntax ID at the position
--- 8020,8031 ----
file
mtime last modification time in seconds
inode Optional: INODE number of the file
+ dirty 1 if file was modified, 0 if not
In case of failure an "error" item is added with the reason:
Cannot open file: file not found or in accessible
Cannot read file: cannot read first block
! Not a swap file: does not contain correct block ID
! Magic number mismatch: Info in first block is invalid
synID({lnum}, {col}, {trans}) *synID()*
The result is a Number, which is the syntax ID at the position
*** ../vim-8.1.0313/src/testdir/test_swap.vim 2018-08-21 20:28:49.892006588 +0200
--- src/testdir/test_swap.vim 2018-08-21 21:07:26.571288544 +0200
***************
*** 109,114 ****
--- 109,115 ----
call assert_match('\w', info.user)
call assert_equal(hostname(), info.host)
call assert_match('Xswapinfo', info.fname)
+ call assert_match(0, info.dirty)
call assert_equal(getpid(), info.pid)
call assert_match('^\d*$', info.mtime)
if has_key(info, 'inode')
***************
*** 128,133 ****
call writefile([repeat('x', 10000)], 'Xnotaswapfile')
let info = swapinfo('Xnotaswapfile')
! call assert_equal('magic number mismatch', info.error)
call delete('Xnotaswapfile')
endfunc
--- 129,134 ----
call writefile([repeat('x', 10000)], 'Xnotaswapfile')
let info = swapinfo('Xnotaswapfile')
! call assert_equal('Not a swap file', info.error)
call delete('Xnotaswapfile')
endfunc
*** ../vim-8.1.0313/src/version.c 2018-08-21 20:28:49.892006588 +0200
--- src/version.c 2018-08-21 21:08:05.951063970 +0200
***************
*** 796,797 ****
--- 796,799 ----
{ /* Add new patch number below this line */
+ /**/
+ 314,
/**/
--
DENNIS: You can't expect to wield supreme executive power just 'cause some
watery tart threw a sword at you!
"Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD
/// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language -- http://www.Zimbu.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
|