| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: filecomplete.c,v 1.59 2019/10/08 19:17:57 christos Exp $ */ | | 1 | /* $NetBSD: filecomplete.c,v 1.60 2019/10/08 19:21:40 christos Exp $ */ |
2 | | | 2 | |
3 | /*- | | 3 | /*- |
4 | * Copyright (c) 1997 The NetBSD Foundation, Inc. | | 4 | * Copyright (c) 1997 The NetBSD Foundation, Inc. |
5 | * All rights reserved. | | 5 | * All rights reserved. |
6 | * | | 6 | * |
7 | * This code is derived from software contributed to The NetBSD Foundation | | 7 | * This code is derived from software contributed to The NetBSD Foundation |
8 | * by Jaromir Dolecek. | | 8 | * by Jaromir Dolecek. |
9 | * | | 9 | * |
10 | * Redistribution and use in source and binary forms, with or without | | 10 | * Redistribution and use in source and binary forms, with or without |
11 | * modification, are permitted provided that the following conditions | | 11 | * modification, are permitted provided that the following conditions |
12 | * are met: | | 12 | * are met: |
13 | * 1. Redistributions of source code must retain the above copyright | | 13 | * 1. Redistributions of source code must retain the above copyright |
14 | * notice, this list of conditions and the following disclaimer. | | 14 | * notice, this list of conditions and the following disclaimer. |
| @@ -21,27 +21,27 @@ | | | @@ -21,27 +21,27 @@ |
21 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | | 21 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
22 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS | | 22 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS |
23 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | | 23 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
24 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | | 24 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
25 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | | 25 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
26 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | | 26 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
27 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | | 27 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
28 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | | 28 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
29 | * POSSIBILITY OF SUCH DAMAGE. | | 29 | * POSSIBILITY OF SUCH DAMAGE. |
30 | */ | | 30 | */ |
31 | | | 31 | |
32 | #include "config.h" | | 32 | #include "config.h" |
33 | #if !defined(lint) && !defined(SCCSID) | | 33 | #if !defined(lint) && !defined(SCCSID) |
34 | __RCSID("$NetBSD: filecomplete.c,v 1.59 2019/10/08 19:17:57 christos Exp $"); | | 34 | __RCSID("$NetBSD: filecomplete.c,v 1.60 2019/10/08 19:21:40 christos Exp $"); |
35 | #endif /* not lint && not SCCSID */ | | 35 | #endif /* not lint && not SCCSID */ |
36 | | | 36 | |
37 | #include <sys/types.h> | | 37 | #include <sys/types.h> |
38 | #include <sys/stat.h> | | 38 | #include <sys/stat.h> |
39 | #include <dirent.h> | | 39 | #include <dirent.h> |
40 | #include <errno.h> | | 40 | #include <errno.h> |
41 | #include <fcntl.h> | | 41 | #include <fcntl.h> |
42 | #include <limits.h> | | 42 | #include <limits.h> |
43 | #include <pwd.h> | | 43 | #include <pwd.h> |
44 | #include <stdio.h> | | 44 | #include <stdio.h> |
45 | #include <stdlib.h> | | 45 | #include <stdlib.h> |
46 | #include <string.h> | | 46 | #include <string.h> |
47 | #include <unistd.h> | | 47 | #include <unistd.h> |
| @@ -452,27 +452,26 @@ append_char_function(const char *name) | | | @@ -452,27 +452,26 @@ append_char_function(const char *name) |
452 | if (S_ISDIR(stbuf.st_mode)) | | 452 | if (S_ISDIR(stbuf.st_mode)) |
453 | rs = "/"; | | 453 | rs = "/"; |
454 | out: | | 454 | out: |
455 | if (expname) | | 455 | if (expname) |
456 | el_free(expname); | | 456 | el_free(expname); |
457 | return rs; | | 457 | return rs; |
458 | } | | 458 | } |
459 | /* | | 459 | /* |
460 | * returns list of completions for text given | | 460 | * returns list of completions for text given |
461 | * non-static for readline. | | 461 | * non-static for readline. |
462 | */ | | 462 | */ |
463 | char ** completion_matches(const char *, char *(*)(const char *, int)); | | 463 | char ** completion_matches(const char *, char *(*)(const char *, int)); |
464 | char ** | | 464 | char ** |
465 | /*###467 [lint] completion_matches arg 1 declared inconsistently (pointer to const char != pointer to char) filecomplete.c(467) :: readline.c?(53)%%%*/ | | | |
466 | completion_matches(const char *text, char *(*genfunc)(const char *, int)) | | 465 | completion_matches(const char *text, char *(*genfunc)(const char *, int)) |
467 | { | | 466 | { |
468 | char **match_list = NULL, *retstr, *prevstr; | | 467 | char **match_list = NULL, *retstr, *prevstr; |
469 | size_t match_list_len, max_equal, which, i; | | 468 | size_t match_list_len, max_equal, which, i; |
470 | size_t matches; | | 469 | size_t matches; |
471 | | | 470 | |
472 | matches = 0; | | 471 | matches = 0; |
473 | match_list_len = 1; | | 472 | match_list_len = 1; |
474 | while ((retstr = (*genfunc) (text, (int)matches)) != NULL) { | | 473 | while ((retstr = (*genfunc) (text, (int)matches)) != NULL) { |
475 | /* allow for list terminator here */ | | 474 | /* allow for list terminator here */ |
476 | if (matches + 3 >= match_list_len) { | | 475 | if (matches + 3 >= match_list_len) { |
477 | char **nmatch_list; | | 476 | char **nmatch_list; |
478 | while (matches + 3 >= match_list_len) | | 477 | while (matches + 3 >= match_list_len) |