History log of /freebsd-10.3-release/usr.bin/locate/locate/util.c
Revision Date Author Comments
(<<< Hide modified files)
(Show modified files >>>)
# 296373 04-Mar-2016 marius

- Copy stable/10@296371 to releng/10.3 in preparation for 10.3-RC1
builds.
- Update newvers.sh to reflect RC1.
- Update __FreeBSD_version to reflect 10.3.
- Update default pkg(8) configuration to use the quarterly branch.

Approved by: re (implicit)

# 275034 25-Nov-2014 dim

MFC r274847:

Fix the following -Werror warnings from clang 3.5.0, while building
usr.bin/locate:

usr.bin/locate/locate/util.c:249:29: error: taking the absolute value of unsigned type 'unsigned int' has no effect [-Werror,-Wabsolute-value]
MAXPATHLEN, abs(i) < abs(htonl(i)) ? i : htonl(i));
^
usr.bin/locate/locate/util.c:249:29: note: remove the call to 'abs' since unsigned values cannot be negative
MAXPATHLEN, abs(i) < abs(htonl(i)) ? i : htonl(i));
^~~
usr.bin/locate/locate/util.c:274:32: error: taking the absolute value of unsigned type 'unsigned int' has no effect [-Werror,-Wabsolute-value]
MAXPATHLEN, abs(word) < abs(htonl(word)) ? word :
^
usr.bin/locate/locate/util.c:274:32: note: remove the call to 'abs' since unsigned values cannot be negative
MAXPATHLEN, abs(word) < abs(htonl(word)) ? word :
^~~

The problem is that ntohl() always returns an unsigned quantity. In
this case, it's expected to be cast back to a signed integer, but to
stop complaints about abs() we just store it into an integer, and don't
call ntohl() again.

Reviewed by: ngie
Differential Revision: https://reviews.freebsd.org/D1196


# 256281 10-Oct-2013 gjb

Copy head (r256279) to stable/10 as part of the 10.0-RELEASE cycle.

Approved by: re (implicit)
Sponsored by: The FreeBSD Foundation


# 229655 05-Jan-2012 uqs

Touch up some more small typos missed in the previous round.

Reported by: Ben Kaduk <minimarmot@gmail.com> et al.


# 229403 03-Jan-2012 ed

Replace index() and rindex() calls with strchr() and strrchr().

The index() and rindex() functions were marked LEGACY in the 2001
revision of POSIX and were subsequently removed from the 2008 revision.
The strchr() and strrchr() functions are part of the C standard.

This makes the source code a lot more consistent, as most of these C
files also call into other str*() routines. In fact, about a dozen
already perform strchr() calls.


# 228992 30-Dec-2011 uqs

Spelling fixes for usr.bin/


# 190657 02-Apr-2009 delphij

Signed/unsigned fixes, should be WARNS=2 clean now.


# 98751 24-Jun-2002 naddy

Fix unaligned access error.

Reviewed by: ticso


# 92920 22-Mar-2002 imp

remove __P


# 90868 18-Feb-2002 mike

o Move NTOHL() and associated macros into <sys/param.h>. These are
deprecated in favor of the POSIX-defined lowercase variants.
o Change all occurrences of NTOHL() and associated marcros in the
source tree to use the lowercase function variants.
o Add missing license bits to sparc64's <machine/endian.h>.
Approved by: jake
o Clean up <machine/endian.h> files.
o Remove unused __uint16_swap_uint32() from i386's <machine/endian.h>.
o Remove prototypes for non-existent bswapXX() functions.
o Include <machine/endian.h> in <arpa/inet.h> to define the
POSIX-required ntohl() family of functions.
o Do similar things to expose the ntohl() family in libstand, <netinet/in.h>,
and <sys/param.h>.
o Prepend underscores to the ntohl() family to help deal with
complexities associated with having MD (asm and inline) versions, and
having to prevent exposure of these functions in other headers that
happen to make use of endian-specific defines.
o Create weak aliases to the canonical function name to help deal with
third-party software forgetting to include an appropriate header.
o Remove some now unneeded pollution from <sys/types.h>.
o Add missing <arpa/inet.h> includes in userland.

Tested on: alpha, i386
Reviewed by: bde, jake, tmm


# 87759 12-Dec-2001 mikeh

Print the path with the shortest absolute length, rather than
arbitrarily selecting one.

PR: bin/14361
Approved by: wosch
MFC after: 1 week


# 50477 28-Aug-1999 peter

$Id$ -> $FreeBSD$


# 27574 21-Jul-1997 charnier

Use err(3). Use .Pa macro for filenames in man page.


# 23012 22-Feb-1997 peter

Revert $FreeBSD$ to $Id$


# 21673 14-Jan-1997 jkh

Make the long-awaited change from $Id$ to $FreeBSD$

This will make a number of things easier in the future, as well as (finally!)
avoiding the Id-smashing problem which has plagued developers for so long.

Boy, I'm glad we're not using sup anymore. This update would have been
insane otherwise.


# 18829 09-Oct-1996 wosch

Fix searching for shell quoting characters. I guess it was
broken since locate exists.

This works now

$ locate '*\['
$ locate '*i386-\**'
$ locate '*[C\[]'


# 17980 31-Aug-1996 wosch

optimized search algorithm
faster IO due mmap(2) [-m | -s]
better error check for damaged databases
support for databases in network byte order (SunOS/sparc)
optional case insensitve search [-i]
optional multiple databases
optional multiple pattern
new enviroment variable LOCATE_PATH for database(s)
[-S] print some statistic about the database
[-l number] limit output to number file names
[-c] suppress normal output; instead print a count of matching file names