bin/91101: update: /usr/src/usr.bin/whereis/whereis.c

Sokolov Alexey sokolhacker at mail.ru
Fri Dec 30 10:20:28 PST 2005


>Number:         91101
>Category:       bin
>Synopsis:       update: /usr/src/usr.bin/whereis/whereis.c
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          update
>Submitter-Id:   current-users
>Arrival-Date:   Fri Dec 30 18:20:03 GMT 2005
>Closed-Date:
>Last-Modified:
>Originator:     Sokolov Alexey
>Release:        6.0-STABLE
>Organization:
SokolSoft.org.ru
>Environment:
>Description:
The conclusion of a command whereis is not pleasant to me. 
Here an example: 

%whereis 
vim vim:/usr/local/bin/vim/usr/local/man/man1/vim.1.gz/usr/ports/editors/vim 

Well it is not readable! And if the file does not exist, in general messages on a mistake is not printed:

%whereis vim_

Has decided to modify a part of a source code (/usr/src/usr.bin/whereis/whereis.c):

/*begin*/
                if (!opt_q) {
                        /* printf("%s:", name); */
                                printed++;
                        printf ("%s:", name);
                }
                if (bin) {
                        /* if (printed++)
                                putchar(' ');
                        fputs(bin, stdout); */
                        printf ("\n %s", bin);
                }
                if (man) {
                        /* if (printed++)
                                putchar(' ');
                        fputs(man, stdout); */
                        printf ("\n %s", man);
                }
                if (src) {
                        /* if (printed++)
                                putchar(' ');
                        fputs(src, stdout); */
                        printf ("\n %s\n", src);
                }
                if (!printed)
                        putchar('\n');
                /* If files have not been found */
                if ((!bin) && (!man) && (!src))
                        printf (" not found!\n");
/*end*/

Now all is much more pleasant:

%whereis vim
vim:
 /usr/local/bin/vim
 /usr/local/man/man1/vim.1.gz
 /usr/ports/editors/vim

And in case of a mistake:

%whereis vim_
vim_: not found!
>How-To-Repeat:

>Fix:
                if (!opt_q) {
                        /* printf("%s:", name); */
                                printed++;
                        printf ("%s:", name);
                }
                if (bin) {
                        /* if (printed++)
                                putchar(' ');
                        fputs(bin, stdout); */
                        printf ("\n %s", bin);
                }
                if (man) {
                        /* if (printed++)
                                putchar(' ');
                        fputs(man, stdout); */
                        printf ("\n %s", man);
                }
                if (src) {
                        /* if (printed++)
                                putchar(' ');
                        fputs(src, stdout); */
                        printf ("\n %s\n", src);
                }
                if (!printed)
                        putchar('\n');
                /* If files have not been found */
                if ((!bin) && (!man) && (!src))
                        printf (" not found!\n");
>Release-Note:
>Audit-Trail:
>Unformatted:


More information about the freebsd-bugs mailing list