xref: /freebsd/contrib/elftoolchain/libelftc/elftc_version.3 (revision d0b2dbfa0ecf2bbc9709efc5e20baf8e4b44bbbf)
1.\" Copyright (c) 2011,2012 Joseph Koshy.  All rights reserved.
2.\"
3.\" Redistribution and use in source and binary forms, with or without
4.\" modification, are permitted provided that the following conditions
5.\" are met:
6.\" 1. Redistributions of source code must retain the above copyright
7.\"    notice, this list of conditions and the following disclaimer.
8.\" 2. Redistributions in binary form must reproduce the above copyright
9.\"    notice, this list of conditions and the following disclaimer in the
10.\"    documentation and/or other materials provided with the distribution.
11.\"
12.\" This software is provided by Joseph Koshy ``as is'' and
13.\" any express or implied warranties, including, but not limited to, the
14.\" implied warranties of merchantability and fitness for a particular purpose
15.\" are disclaimed.  in no event shall Joseph Koshy be liable
16.\" for any direct, indirect, incidental, special, exemplary, or consequential
17.\" damages (including, but not limited to, procurement of substitute goods
18.\" or services; loss of use, data, or profits; or business interruption)
19.\" however caused and on any theory of liability, whether in contract, strict
20.\" liability, or tort (including negligence or otherwise) arising in any way
21.\" out of the use of this software, even if advised of the possibility of
22.\" such damage.
23.\"
24.\" $Id: elftc_version.3 3645 2018-10-15 20:17:14Z jkoshy $
25.\"
26.Dd December 30, 2012
27.Dt ELFTC_VERSION 3
28.Os
29.Sh NAME
30.Nm elftc_version
31.Nd return a project-wide version identifier string
32.Sh LIBRARY
33.Lb libelftc
34.Sh SYNOPSIS
35.In libelftc.h
36.Ft const char *
37.Fn elftc_version void
38.Sh DESCRIPTION
39Function
40.Fn elftc_version
41returns a project-wide identifier string that encodes the source
42revision of the project source tree.
43.Pp
44The returned identifier has four space-separated fields:
45.Bl -tag -width ".Em Project Branch"
46.It Em "Project-Name"
47This is always
48.Dq elftoolchain .
49.It Em "Project-Branch"
50The branch name for the project source tree.
51.It Em "Build-OS"
52The operating system that the tool chain was compiled for.
53.It Em "Version-Number"
54A tree-wide version number extracted from the version control
55system in use.
56.El
57.Sh RETURN VALUES
58Function
59.Fn elftc_program_version
60returns a pointer to an internal character buffer.
61.Sh EXAMPLES
62To retrieve and print the current toolchain version identifier, use:
63.Bd -literal -offset indent
64#include <sys/types.h>
65#include <libelftc.h>
66
67(void) printf("%s\en", elftc_version());
68.Ed
69.Pp
70On the HEAD branch of the project's sources, when checked out using
71Subversion and compiled on a
72.Nx
73host, this would print:
74.D1 Dq elftoolchain HEAD NetBSD svn: Ns Em REVINFO
75where
76.Em REVINFO
77would be the current revision information for the project source tree.
78.Sh ERRORS
79Function
80.Fn elftc_program_version
81always succeeds.
82