Commit graph

12 commits

Author SHA1 Message Date
Collin Funk 8268a31bcc which: Use size_t instead of ssize_t for pathlen
The "pathlen" variable is the return value of strlen(3) and is then
passed as an argument to malloc(3) and memcpy(3). The size_t type
matches the prototype for these functions. The size_t type is unsigned
so it can fit larger $PATH values than ssize_t. However, in practice
ssize_t should be larger enough so this change is just for clarity.

Signed-off-by: Collin Funk <collin.funk1@gmail.com>

MFC after:	1 week
Pull Request:	https://github.com/freebsd/freebsd-src/pull/1113
2024-04-05 14:30:31 -04:00
Warner Losh e5d258c9e5 Remove $FreeBSD$: two-line .c pattern
Remove /^#include\s+<sys/cdefs.h>.*$\n\s+__FBSDID\("\$FreeBSD\$"\);\n/
2023-08-16 11:54:34 -06:00
Pedro F. Giffuni 1de7b4b805 various: general adoption of SPDX licensing ID tags.
Mainly focus on files that use BSD 2-Clause license, however the tool I
was using misidentified many licenses so this was mostly a manual - error
prone - task.

The Software Package Data Exchange (SPDX) group provides a specification
to make it easier for automated tools to detect and summarize well known
opensource licenses. We are gradually adopting the specification, noting
that the tags are considered only advisory and do not, in any way,
superceed or replace the license texts.

No functional change intended.
2017-11-27 15:37:16 +00:00
Enji Cooper d481fdf224 which(1): sort #includes
No functional change [intended].

MFC after:	7 weeks
Sponsored by:	Dell EMC Isilon
2017-04-19 19:55:38 +00:00
Enji Cooper a6b1979b15 Clean up trailing whitespace
No functional changes

MFC after:	1 week
Sponsored by:	Dell EMC Isilon
2017-04-19 19:52:40 +00:00
Ed Schouten 94cd938578 Mark global functions and/or variables in which(1) static where possible.
This allows compilers and static analyzers to more thorough analysis.
2011-11-06 18:50:26 +00:00
Ruslan Ermilov b7a311f2b8 Require at least one argument. 2005-02-10 16:04:22 +00:00
Tim J. Robbins 721da592c4 Handle relative and absolute pathnames (anything with a `/' in it) in the same
way as execve(2), and the old perl which(1).

PR:		35718
2002-06-30 06:02:39 +00:00
Tim J. Robbins 8c821782f8 Treat empty PATH elements as "." for tradition and consistency with the
old Perl which(1) script.

PR:		35719
2002-06-30 05:48:50 +00:00
Wolfram Schneider f2c819bf2b Off by one error in checking max file name length. 2002-03-09 15:30:42 +00:00
Mark Murray 1c6cde4bb5 Use FBSDID(), WARNS=2 fix.
Mkaefile does not use WARNS=2 beacuse this will be made default.
2001-12-11 22:27:26 +00:00
Brian Feldman cc70d84c4a Use a C version of which(1).
Submitted by:	Dan Papasian <bugg@bugg.strangled.net>
Reviewed by:	jhb
2000-08-29 23:30:52 +00:00