From e82cb6b0ac984f321e006a819de177c6822963e6 Mon Sep 17 00:00:00 2001 From: Sascha Wildner Date: Sat, 23 May 2009 03:59:12 +0200 Subject: [PATCH] Adjust objformat.1 and getobjformat.3 to the current state of affairs. --- lib/libc/gen/getobjformat.3 | 81 +++++++---------------------------- usr.bin/objformat/objformat.1 | 76 ++++++++++++++++++++------------ 2 files changed, 64 insertions(+), 93 deletions(-) diff --git a/lib/libc/gen/getobjformat.3 b/lib/libc/gen/getobjformat.3 index d3d29c4186..187897df52 100644 --- a/lib/libc/gen/getobjformat.3 +++ b/lib/libc/gen/getobjformat.3 @@ -25,7 +25,7 @@ .\" $FreeBSD: src/lib/libc/gen/getobjformat.3,v 1.3.2.6 2003/03/13 18:05:37 trhodes Exp $ .\" $DragonFly: src/lib/libc/gen/getobjformat.3,v 1.2 2003/06/17 04:26:42 dillon Exp $ .\" -.Dd September 7, 1998 +.Dd May 23, 2009 .Dt GETOBJFORMAT 3 .Os .Sh NAME @@ -36,67 +36,30 @@ .Sh SYNOPSIS .In objformat.h .Ft int -.Fn getobjformat "char *buf" "size_t bufsize" "int *argcp" "char **argv" +.Fn getobjformat "char *buf" "size_t bufsize" "int *argcp __unused" "char **argv __unused" .Sh DESCRIPTION The .Fn getobjformat -function -queries several sources to determine the preferred object file -format, and copies its name into a buffer provided by the caller. -.Pp -The object file format is determined as follows. If -.Va argv -is -.No non- Ns Ev NULL -and an explicit command line argument such as -.Fl aout -or -.Fl elf -is present, then that determines the object file format. -.Pp -Otherwise, if the variable -.Ev OBJFORMAT -is set in the environment, the object file format is taken from its -value. -.Pp -Otherwise, if the file -.Pa /etc/objformat -is readable and contains a line of the form -.Ql OBJFORMAT=xxx , -the object file format is taken from there. -.Pp -Otherwise, a built-in system default object file format is returned. +function copies the name of the preferred object file format +.Dq ( elf ) +into a buffer provided by the caller. +The function is currently provided only for backward compatibility. .Pp .Va buf points to a user-supplied buffer into which the name of the object file format is copied. .Va bufsize -gives the size of the buffer in bytes. The string placed in +gives the size of the buffer in bytes. +The string placed in .Va buf -is always null-terminated. It is an error if the buffer is too -small to hold the null-terminated name. +is always null-terminated. +It is an error if the buffer is too small to hold the null-terminated name. .Pp .Va argv -points to a -.Dv NULL Ns -terminated -argument vector to be scanned for object -format options. -.Va argv -may be -.Dv NULL , -in which case the argument vector is not scanned. -.Pp -If -.Va argcp -is non-NULL, any object format options are deleted from the -argument vector, and the updated argument count is stored into -the integer referenced by -.Va argcp . -If +and .Va argcp -is -.Dv NULL , -the argument vector is left unchanged. +are unused and new applications should set them to +.Dv NULL . .Sh RETURN VALUES On success, .Fn getobjformat @@ -105,23 +68,9 @@ null terminator. If the supplied buffer is too small to hold the object file format and its null terminator, .Fn getobjformat -returns -1. In that case, the contents of the buffer and argument +returns -1. +In that case, the contents of the buffer and argument vector supplied by the caller are indeterminate. -.Sh ENVIRONMENT -.Bl -tag -width OBJFORMAT -.It Ev OBJFORMAT -If the environment variable -.Ev OBJFORMAT -is set, it overrides the default object file format. -.Ev OBJFORMAT takes precedence over -.Pa /etc/objformat . -.El -.Sh FILES -.Bl -tag -width /etc/objformat -compact -.It Pa /etc/objformat -If present, specifies the object file format to use. Syntax is -.Ql OBJFORMAT=xxx . -.El .Sh SEE ALSO .Xr objformat 1 .Sh HISTORY diff --git a/usr.bin/objformat/objformat.1 b/usr.bin/objformat/objformat.1 index bcf037397d..6c557d48e5 100644 --- a/usr.bin/objformat/objformat.1 +++ b/usr.bin/objformat/objformat.1 @@ -26,7 +26,7 @@ .\" $FreeBSD: src/usr.bin/objformat/objformat.1,v 1.3.2.4 2002/06/21 15:28:32 charnier Exp $ .\" $DragonFly: src/usr.bin/objformat/objformat.1,v 1.3 2006/02/17 19:39:10 swildner Exp $ .\" -.Dd October 25, 1998 +.Dd May 23, 2009 .Os .Dt OBJFORMAT 1 .Sh NAME @@ -38,38 +38,62 @@ .Sh DESCRIPTION If run as .Nm -the default object file format is reported. The two different object file -formats are -.Ar aout -and +the default object file format is reported. +The only supported object file format is .Ar elf . .Pp -If invoked by any other name, +If invoked by any other name, the path of the +.Nm prog +that will be executed is determined as follows: +.Pp +If .Nm prog -is expanded to -.Pa /usr/libexec//prog +is a binutil (such as +.Xr as 1 +and +.Xr ld 1 ) , +it is expanded to +.Pa /usr/libexec//elf/ Ns Nm prog and executed. +.Dq +defaults to the current binutils version used by +.Dx +and can be overridden using the +.Ev BINUTILSVER +environment variable. +.Pp +If +.Nm prog +is a compiler (such as +.Xr gcc 1 ) , +it is expanded to +.Pa /usr/libexec// Ns Nm prog +and executed. +.Dq +defaults to the current compiler used by +.Dx +and can be overridden using the +.Ev CCVER +environment variable. .Sh ENVIRONMENT .Bl -tag -width OBJFORMAT_PATH -.It Ev OBJFORMAT -If the environment variable -.Ev OBJFORMAT -is set, it overrides the default object file format. -.Ev OBJFORMAT takes precedence over -.Pa /etc/objformat . +.It Ev BINUTILSVER +The +.Dq +component to be used for binutils paths. +.It Ev CCVER +The +.Dq +component to be used for compiler paths. .It Ev OBJFORMAT_PATH -If the environment variable +If .Ev OBJFORMAT_PATH -is set, its value is used as the base path to -.Nm prog . -The default is -.Pa /usr/libexec . -.El -.Sh FILES -.Bl -tag -width /etc/objformat -compact -.It Pa /etc/objformat -If present, specifies the object file format to use. Syntax is -.Ql OBJFORMAT=xxx . +is set, its value is prepended to the path name determined by the +.Nm +rules. +If it is a sequence of colon separated paths, each of +.Ev OBJFORMAT_PATH Ap s +elements is prepended to the path name until execution succeeds. .El .Sh DIAGNOSTICS The @@ -81,7 +105,6 @@ could not be executed. .Sh SEE ALSO .Xr file 1 , .Xr getobjformat 3 -.\" .Sh STANDARDS .Sh HISTORY The .Nm @@ -95,4 +118,3 @@ utility was written by .An Peter Wemm Aq peter@netplex.com.au . This manual page was written by .An David O'Brien Aq obrien@NUXI.com . -.\" .Sh BUGS -- 2.41.0