diff --git src/pextlib1.0/xinstall.c src/pextlib1.0/xinstall.c
index f28ec50e..0705e0b2 100644
|
|
InstallCmd(ClientData clientData UNUSED, Tcl_Interp *interp, int objc, Tcl_Obj * |
154 | 154 | char *curdir; |
155 | 155 | const char *group, *owner, *cp; |
156 | 156 | Tcl_Obj *to_name; |
157 | | int dodir = 0; |
| 157 | int dodir = 0, verbose = 0; |
158 | 158 | |
159 | 159 | suffix = BACKUP_SUFFIX; |
160 | 160 | mode = S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH; |
… |
… |
InstallCmd(ClientData clientData UNUSED, Tcl_Interp *interp, int objc, Tcl_Obj * |
177 | 177 | return TCL_ERROR; |
178 | 178 | } |
179 | 179 | suffix = Tcl_GetString(*(++objv)); |
| 180 | if (verbose) { |
| 181 | ui_debug(interp, "%s: suffix=%s", funcname, suffix); |
| 182 | } |
180 | 183 | objv++, objc -= 2; |
181 | 184 | /* FALLTHROUGH */ |
182 | 185 | case 'b': |
183 | 186 | dobackup = 1; |
| 187 | if (verbose) { |
| 188 | ui_debug(interp, "%s: backup=true", funcname); |
| 189 | } |
184 | 190 | objv++, objc--; |
185 | 191 | break; |
186 | 192 | case 'C': |
187 | 193 | docompare = 1; |
| 194 | if (verbose) { |
| 195 | ui_debug(interp, "%s: docompare=true", funcname); |
| 196 | } |
188 | 197 | objv++, objc--; |
189 | 198 | break; |
190 | 199 | case 'c': |
… |
… |
InstallCmd(ClientData clientData UNUSED, Tcl_Interp *interp, int objc, Tcl_Obj * |
206 | 215 | Tcl_SetResult(interp, "invalid flags for -f", TCL_STATIC); |
207 | 216 | return TCL_ERROR; |
208 | 217 | } |
| 218 | if (verbose) { |
| 219 | ui_debug(interp, "%s: flags=%s fset=0x%lx", funcname, flags, fset); |
| 220 | } |
209 | 221 | iflags |= SETFLAGS; |
210 | 222 | objv++, objc -= 2; |
211 | 223 | #endif |
… |
… |
InstallCmd(ClientData clientData UNUSED, Tcl_Interp *interp, int objc, Tcl_Obj * |
216 | 228 | return TCL_ERROR; |
217 | 229 | } |
218 | 230 | group = Tcl_GetString(*(++objv)); |
| 231 | if (verbose) { |
| 232 | ui_debug(interp, "%s: group=%s", funcname, group); |
| 233 | } |
219 | 234 | objv++, objc -= 2; |
220 | 235 | break; |
221 | 236 | case 'M': |
222 | 237 | nommap = 1; |
223 | 238 | objv++, objc--; |
224 | 239 | break; |
225 | | case 'm': |
| 240 | case 'm': { |
226 | 241 | if (!objc) { |
227 | 242 | Tcl_WrongNumArgs(interp, 1, objv, "-m"); |
228 | 243 | return TCL_ERROR; |
229 | 244 | } |
230 | | if (!(set = setmode(Tcl_GetString(*(++objv))))) { |
| 245 | const char *modeString = Tcl_GetString(*(++objv)); |
| 246 | if (!(set = setmode(modeString))) { |
231 | 247 | char errmsg[255]; |
232 | 248 | |
233 | 249 | snprintf(errmsg, sizeof errmsg, "%s: Invalid file mode: %s", |
234 | | funcname, Tcl_GetString(*objv)); |
| 250 | funcname, modeString); |
235 | 251 | Tcl_SetResult(interp, errmsg, TCL_VOLATILE); |
236 | 252 | return TCL_ERROR; |
237 | 253 | } |
238 | 254 | mode = getmode(set, 0); |
| 255 | if (verbose) { |
| 256 | ui_debug(interp, "%s: mode=%s umask=0%o", funcname, modeString, mode); |
| 257 | } |
239 | 258 | free(set); |
240 | 259 | objv++, objc -= 2; |
241 | 260 | break; |
| 261 | } |
242 | 262 | case 'o': |
243 | 263 | if (!objc) { |
244 | 264 | Tcl_WrongNumArgs(interp, 1, objv, "-o"); |
245 | 265 | return TCL_ERROR; |
246 | 266 | } |
247 | 267 | owner = Tcl_GetString(*(++objv)); |
| 268 | if (verbose) { |
| 269 | ui_debug(interp, "%s: owner=%s", funcname, owner); |
| 270 | } |
248 | 271 | objv++, objc -= 2; |
249 | 272 | break; |
250 | 273 | case 'p': |
… |
… |
InstallCmd(ClientData clientData UNUSED, Tcl_Interp *interp, int objc, Tcl_Obj * |
261 | 284 | break; |
262 | 285 | case 'v': |
263 | 286 | /* provided only for compatibility with install(1) */ |
| 287 | verbose += 1; |
264 | 288 | objv++, objc--; |
265 | 289 | break; |
266 | 290 | case 'W': |
… |
… |
InstallCmd(ClientData clientData UNUSED, Tcl_Interp *interp, int objc, Tcl_Obj * |
269 | 293 | return TCL_ERROR; |
270 | 294 | } |
271 | 295 | curdir = Tcl_GetString(*(++objv)); |
| 296 | if (verbose) { |
| 297 | ui_debug(interp, "%s: workingdir=%s", funcname, curdir); |
| 298 | } |
272 | 299 | objv++, objc -= 2; |
273 | 300 | break; |
274 | 301 | case '?': |
… |
… |
install_dir(Tcl_Interp *interp, char *path) |
1074 | 1101 | if ((gid != (gid_t)-1 || uid != (uid_t)-1) && chown(path, uid, gid)) |
1075 | 1102 | { /* Don't bother to warn */ }; |
1076 | 1103 | if (chmod(path, mode)) |
1077 | | { /* Don't bother to warn */ }; |
| 1104 | { |
| 1105 | char errmsg[255]; |
| 1106 | |
| 1107 | snprintf(errmsg, sizeof errmsg, "%s: chmod(%s,0%o), %s", |
| 1108 | funcname, path, mode, strerror(errno)); |
| 1109 | Tcl_SetResult(interp, errmsg, TCL_VOLATILE); |
| 1110 | return TCL_ERROR; |
| 1111 | } |
1078 | 1112 | return TCL_OK; |
1079 | 1113 | } |
1080 | 1114 | |