Mercurial > vim
annotate src/installman.sh @ 31184:6b218e595d9f v9.0.0926
patch 9.0.0926: Coverity warns for not using return value of dict_add()
Commit: https://github.com/vim/vim/commit/bc222152d8dea252aa5f1fa24b5536ed269feb92
Author: Bram Moolenaar <Bram@vim.org>
Date: Wed Nov 23 11:34:01 2022 +0000
patch 9.0.0926: Coverity warns for not using return value of dict_add()
Problem: Coverity warns for not using return value of dict_add().
Solution: When dict_add() fails then don't call hash_remove().
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Wed, 23 Nov 2022 12:45:04 +0100 |
parents | a7b8f78dd868 |
children |
rev | line source |
---|---|
40 | 1 #! /bin/sh |
2 # installman.sh --- install or uninstall manpages for Vim | |
3 # | |
4 # arguments: | |
5 # 1 what: "install", "uninstall" or "xxd" | |
856 | 6 # 2 target directory e.g., "/usr/local/man/it/man1" |
40 | 7 # 3 language addition e.g., "" or "-it" |
8 # 4 vim location as used in manual pages e.g., "/usr/local/share/vim" | |
16378
3d6b282e2d6e
patch 8.1.1194: typos and small problems in source files
Bram Moolenaar <Bram@vim.org>
parents:
14415
diff
changeset
|
9 # 5 runtime dir for menu.vim et al. e.g., "/usr/local/share/vim/vim81" |
856 | 10 # 6 runtime dir for global vimrc file e.g., "/usr/local/share/vim" |
11 # 7 source dir for help files e.g., "../runtime/doc" | |
12 # 8 mode bits for manpages e.g., "644" | |
13 # 9 vim exe name e.g., "vim" | |
14 # 10 name of vimdiff exe e.g., "vimdiff" | |
15 # 11 name of evim exe e.g., "evim" | |
40 | 16 |
17 errstatus=0 | |
18 | |
19 what=$1 | |
20 destdir=$2 | |
21 langadd=$3 | |
22 vimloc=$4 | |
23 scriptloc=$5 | |
24 vimrcloc=$6 | |
25 helpsource=$7 | |
26 manmod=$8 | |
27 exename=$9 | |
819 | 28 # older shells don't support ${10} |
29 shift | |
30 vimdiffname=$9 | |
31 shift | |
32 evimname=$9 | |
40 | 33 |
34 helpsubloc=$scriptloc/doc | |
1698 | 35 printsubloc=$scriptloc/print |
40 | 36 synsubloc=$scriptloc/syntax |
37 tutorsubloc=$scriptloc/tutor | |
38 | |
39 if test $what = "install" -o $what = "xxd"; then | |
40 if test ! -d $destdir; then | |
41 echo creating $destdir | |
11382
3f399c28e4af
patch 8.0.0576: can't build when configure choses "install-sh"
Christian Brabandt <cb@256bit.org>
parents:
5999
diff
changeset
|
42 /bin/sh install-sh -c -d $destdir |
27790
a7b8f78dd868
patch 8.2.4421: some installed files and directories have wrong permissions
Bram Moolenaar <Bram@vim.org>
parents:
16378
diff
changeset
|
43 chmod 755 $destdir |
40 | 44 fi |
45 fi | |
46 | |
5999 | 47 # Note: setting LC_ALL to C is required to avoid illegal byte errors from sed |
48 # on some systems. | |
49 | |
40 | 50 if test $what = "install"; then |
51 # vim.1 | |
14415
3d2bae2e6b80
patch 8.1.0222: errors are reported for "make install"
Christian Brabandt <cb@256bit.org>
parents:
11382
diff
changeset
|
52 if test -r $helpsource/vim$langadd.1; then |
3d2bae2e6b80
patch 8.1.0222: errors are reported for "make install"
Christian Brabandt <cb@256bit.org>
parents:
11382
diff
changeset
|
53 echo installing $destdir/$exename.1 |
3d2bae2e6b80
patch 8.1.0222: errors are reported for "make install"
Christian Brabandt <cb@256bit.org>
parents:
11382
diff
changeset
|
54 LC_ALL=C sed -e s+/usr/local/lib/vim+$vimloc+ \ |
3d2bae2e6b80
patch 8.1.0222: errors are reported for "make install"
Christian Brabandt <cb@256bit.org>
parents:
11382
diff
changeset
|
55 -e s+$vimloc/doc+$helpsubloc+ \ |
3d2bae2e6b80
patch 8.1.0222: errors are reported for "make install"
Christian Brabandt <cb@256bit.org>
parents:
11382
diff
changeset
|
56 -e s+$vimloc/print+$printsubloc+ \ |
3d2bae2e6b80
patch 8.1.0222: errors are reported for "make install"
Christian Brabandt <cb@256bit.org>
parents:
11382
diff
changeset
|
57 -e s+$vimloc/syntax+$synsubloc+ \ |
3d2bae2e6b80
patch 8.1.0222: errors are reported for "make install"
Christian Brabandt <cb@256bit.org>
parents:
11382
diff
changeset
|
58 -e s+$vimloc/tutor+$tutorsubloc+ \ |
3d2bae2e6b80
patch 8.1.0222: errors are reported for "make install"
Christian Brabandt <cb@256bit.org>
parents:
11382
diff
changeset
|
59 -e s+$vimloc/vimrc+$vimrcloc/vimrc+ \ |
3d2bae2e6b80
patch 8.1.0222: errors are reported for "make install"
Christian Brabandt <cb@256bit.org>
parents:
11382
diff
changeset
|
60 -e s+$vimloc/gvimrc+$vimrcloc/gvimrc+ \ |
3d2bae2e6b80
patch 8.1.0222: errors are reported for "make install"
Christian Brabandt <cb@256bit.org>
parents:
11382
diff
changeset
|
61 -e s+$vimloc/menu.vim+$scriptloc/menu.vim+ \ |
3d2bae2e6b80
patch 8.1.0222: errors are reported for "make install"
Christian Brabandt <cb@256bit.org>
parents:
11382
diff
changeset
|
62 -e s+$vimloc/bugreport.vim+$scriptloc/bugreport.vim+ \ |
3d2bae2e6b80
patch 8.1.0222: errors are reported for "make install"
Christian Brabandt <cb@256bit.org>
parents:
11382
diff
changeset
|
63 -e s+$vimloc/filetype.vim+$scriptloc/filetype.vim+ \ |
3d2bae2e6b80
patch 8.1.0222: errors are reported for "make install"
Christian Brabandt <cb@256bit.org>
parents:
11382
diff
changeset
|
64 -e s+$vimloc/scripts.vim+$scriptloc/scripts.vim+ \ |
3d2bae2e6b80
patch 8.1.0222: errors are reported for "make install"
Christian Brabandt <cb@256bit.org>
parents:
11382
diff
changeset
|
65 -e s+$vimloc/optwin.vim+$scriptloc/optwin.vim+ \ |
3d2bae2e6b80
patch 8.1.0222: errors are reported for "make install"
Christian Brabandt <cb@256bit.org>
parents:
11382
diff
changeset
|
66 -e 's+$vimloc/\*.ps+$scriptloc/\*.ps+' \ |
3d2bae2e6b80
patch 8.1.0222: errors are reported for "make install"
Christian Brabandt <cb@256bit.org>
parents:
11382
diff
changeset
|
67 $helpsource/vim$langadd.1 > $destdir/$exename.1 |
3d2bae2e6b80
patch 8.1.0222: errors are reported for "make install"
Christian Brabandt <cb@256bit.org>
parents:
11382
diff
changeset
|
68 chmod $manmod $destdir/$exename.1 |
3d2bae2e6b80
patch 8.1.0222: errors are reported for "make install"
Christian Brabandt <cb@256bit.org>
parents:
11382
diff
changeset
|
69 fi |
40 | 70 |
71 # vimtutor.1 | |
14415
3d2bae2e6b80
patch 8.1.0222: errors are reported for "make install"
Christian Brabandt <cb@256bit.org>
parents:
11382
diff
changeset
|
72 if test -r $helpsource/vimtutor$langadd.1; then |
3d2bae2e6b80
patch 8.1.0222: errors are reported for "make install"
Christian Brabandt <cb@256bit.org>
parents:
11382
diff
changeset
|
73 echo installing $destdir/$exename""tutor.1 |
3d2bae2e6b80
patch 8.1.0222: errors are reported for "make install"
Christian Brabandt <cb@256bit.org>
parents:
11382
diff
changeset
|
74 LC_ALL=C sed -e s+/usr/local/lib/vim+$vimloc+ \ |
3d2bae2e6b80
patch 8.1.0222: errors are reported for "make install"
Christian Brabandt <cb@256bit.org>
parents:
11382
diff
changeset
|
75 -e s+$vimloc/tutor+$tutorsubloc+ \ |
3d2bae2e6b80
patch 8.1.0222: errors are reported for "make install"
Christian Brabandt <cb@256bit.org>
parents:
11382
diff
changeset
|
76 $helpsource/vimtutor$langadd.1 > $destdir/$exename""tutor.1 |
3d2bae2e6b80
patch 8.1.0222: errors are reported for "make install"
Christian Brabandt <cb@256bit.org>
parents:
11382
diff
changeset
|
77 chmod $manmod $destdir/$exename""tutor.1 |
3d2bae2e6b80
patch 8.1.0222: errors are reported for "make install"
Christian Brabandt <cb@256bit.org>
parents:
11382
diff
changeset
|
78 fi |
40 | 79 |
80 # vimdiff.1 | |
14415
3d2bae2e6b80
patch 8.1.0222: errors are reported for "make install"
Christian Brabandt <cb@256bit.org>
parents:
11382
diff
changeset
|
81 if test -r $helpsource/vimdiff$langadd.1; then |
3d2bae2e6b80
patch 8.1.0222: errors are reported for "make install"
Christian Brabandt <cb@256bit.org>
parents:
11382
diff
changeset
|
82 echo installing $destdir/$vimdiffname.1 |
3d2bae2e6b80
patch 8.1.0222: errors are reported for "make install"
Christian Brabandt <cb@256bit.org>
parents:
11382
diff
changeset
|
83 cp $helpsource/vimdiff$langadd.1 $destdir/$vimdiffname.1 |
3d2bae2e6b80
patch 8.1.0222: errors are reported for "make install"
Christian Brabandt <cb@256bit.org>
parents:
11382
diff
changeset
|
84 chmod $manmod $destdir/$vimdiffname.1 |
3d2bae2e6b80
patch 8.1.0222: errors are reported for "make install"
Christian Brabandt <cb@256bit.org>
parents:
11382
diff
changeset
|
85 fi |
40 | 86 |
87 # evim.1 | |
14415
3d2bae2e6b80
patch 8.1.0222: errors are reported for "make install"
Christian Brabandt <cb@256bit.org>
parents:
11382
diff
changeset
|
88 if test -r $helpsource/evim$langadd.1; then |
3d2bae2e6b80
patch 8.1.0222: errors are reported for "make install"
Christian Brabandt <cb@256bit.org>
parents:
11382
diff
changeset
|
89 echo installing $destdir/$evimname.1 |
3d2bae2e6b80
patch 8.1.0222: errors are reported for "make install"
Christian Brabandt <cb@256bit.org>
parents:
11382
diff
changeset
|
90 LC_ALL=C sed -e s+/usr/local/lib/vim+$vimloc+ \ |
3d2bae2e6b80
patch 8.1.0222: errors are reported for "make install"
Christian Brabandt <cb@256bit.org>
parents:
11382
diff
changeset
|
91 -e s+$vimloc/evim.vim+$scriptloc/evim.vim+ \ |
3d2bae2e6b80
patch 8.1.0222: errors are reported for "make install"
Christian Brabandt <cb@256bit.org>
parents:
11382
diff
changeset
|
92 $helpsource/evim$langadd.1 > $destdir/$evimname.1 |
3d2bae2e6b80
patch 8.1.0222: errors are reported for "make install"
Christian Brabandt <cb@256bit.org>
parents:
11382
diff
changeset
|
93 chmod $manmod $destdir/$evimname.1 |
3d2bae2e6b80
patch 8.1.0222: errors are reported for "make install"
Christian Brabandt <cb@256bit.org>
parents:
11382
diff
changeset
|
94 fi |
40 | 95 fi |
96 | |
97 if test $what = "uninstall"; then | |
98 echo Checking for Vim manual pages in $destdir... | |
99 if test -r $destdir/$exename.1; then | |
100 echo deleting $destdir/$exename.1 | |
101 rm -f $destdir/$exename.1 | |
102 fi | |
103 if test -r $destdir/$exename""tutor.1; then | |
104 echo deleting $destdir/$exename""tutor.1 | |
105 rm -f $destdir/$exename""tutor.1 | |
106 fi | |
107 if test -r $destdir/$vimdiffname.1; then | |
108 echo deleting $destdir/$vimdiffname.1 | |
109 rm -f $destdir/$vimdiffname.1 | |
110 fi | |
111 if test -r $destdir/$evimname.1; then | |
112 echo deleting $destdir/$evimname.1 | |
113 rm -f $destdir/$evimname.1 | |
114 fi | |
115 fi | |
116 | |
14415
3d2bae2e6b80
patch 8.1.0222: errors are reported for "make install"
Christian Brabandt <cb@256bit.org>
parents:
11382
diff
changeset
|
117 if test $what = "xxd" -a -r "$helpsource/xxd${langadd}.1"; then |
40 | 118 echo installing $destdir/xxd.1 |
119 cp $helpsource/xxd$langadd.1 $destdir/xxd.1 | |
120 chmod $manmod $destdir/xxd.1 | |
121 fi | |
122 | |
123 exit $errstatus | |
124 | |
201 | 125 # vim: set sw=3 sts=3 : |