History log of /freebsd-11-stable/usr.bin/units/units.c
Revision Date Author Comments
(<<< Hide modified files)
(Show modified files >>>)
# 330449 05-Mar-2018 eadler

MFC r326276:

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.


# 328244 22-Jan-2018 eadler

MFC r328008:

units(1) free savescr in error condition too

CID: 978392


# 327686 08-Jan-2018 eadler

MFC r327578:

units(1): add missing ':' for two short arguments

PR: 209850


# 302408 07-Jul-2016 gjb

Copy head@r302406 to stable/11 as part of the 11.0-RELEASE cycle.
Prune svn:mergeinfo from the new branch, as nothing has been merged
here.

Additional commits post-branch will follow.

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


/freebsd-11-stable/MAINTAINERS
/freebsd-11-stable/cddl
/freebsd-11-stable/cddl/contrib/opensolaris
/freebsd-11-stable/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/print
/freebsd-11-stable/cddl/contrib/opensolaris/cmd/zfs
/freebsd-11-stable/cddl/contrib/opensolaris/lib/libzfs
/freebsd-11-stable/contrib/amd
/freebsd-11-stable/contrib/apr
/freebsd-11-stable/contrib/apr-util
/freebsd-11-stable/contrib/atf
/freebsd-11-stable/contrib/binutils
/freebsd-11-stable/contrib/bmake
/freebsd-11-stable/contrib/byacc
/freebsd-11-stable/contrib/bzip2
/freebsd-11-stable/contrib/com_err
/freebsd-11-stable/contrib/compiler-rt
/freebsd-11-stable/contrib/dialog
/freebsd-11-stable/contrib/dma
/freebsd-11-stable/contrib/dtc
/freebsd-11-stable/contrib/ee
/freebsd-11-stable/contrib/elftoolchain
/freebsd-11-stable/contrib/elftoolchain/ar
/freebsd-11-stable/contrib/elftoolchain/brandelf
/freebsd-11-stable/contrib/elftoolchain/elfdump
/freebsd-11-stable/contrib/expat
/freebsd-11-stable/contrib/file
/freebsd-11-stable/contrib/gcc
/freebsd-11-stable/contrib/gcclibs/libgomp
/freebsd-11-stable/contrib/gdb
/freebsd-11-stable/contrib/gdtoa
/freebsd-11-stable/contrib/groff
/freebsd-11-stable/contrib/ipfilter
/freebsd-11-stable/contrib/ldns
/freebsd-11-stable/contrib/ldns-host
/freebsd-11-stable/contrib/less
/freebsd-11-stable/contrib/libarchive
/freebsd-11-stable/contrib/libarchive/cpio
/freebsd-11-stable/contrib/libarchive/libarchive
/freebsd-11-stable/contrib/libarchive/libarchive_fe
/freebsd-11-stable/contrib/libarchive/tar
/freebsd-11-stable/contrib/libc++
/freebsd-11-stable/contrib/libc-vis
/freebsd-11-stable/contrib/libcxxrt
/freebsd-11-stable/contrib/libexecinfo
/freebsd-11-stable/contrib/libpcap
/freebsd-11-stable/contrib/libstdc++
/freebsd-11-stable/contrib/libucl
/freebsd-11-stable/contrib/libxo
/freebsd-11-stable/contrib/llvm
/freebsd-11-stable/contrib/llvm/projects/libunwind
/freebsd-11-stable/contrib/llvm/tools/clang
/freebsd-11-stable/contrib/llvm/tools/lldb
/freebsd-11-stable/contrib/llvm/tools/llvm-dwarfdump
/freebsd-11-stable/contrib/llvm/tools/llvm-lto
/freebsd-11-stable/contrib/mdocml
/freebsd-11-stable/contrib/mtree
/freebsd-11-stable/contrib/ncurses
/freebsd-11-stable/contrib/netcat
/freebsd-11-stable/contrib/ntp
/freebsd-11-stable/contrib/nvi
/freebsd-11-stable/contrib/one-true-awk
/freebsd-11-stable/contrib/openbsm
/freebsd-11-stable/contrib/openpam
/freebsd-11-stable/contrib/openresolv
/freebsd-11-stable/contrib/pf
/freebsd-11-stable/contrib/sendmail
/freebsd-11-stable/contrib/serf
/freebsd-11-stable/contrib/sqlite3
/freebsd-11-stable/contrib/subversion
/freebsd-11-stable/contrib/tcpdump
/freebsd-11-stable/contrib/tcsh
/freebsd-11-stable/contrib/tnftp
/freebsd-11-stable/contrib/top
/freebsd-11-stable/contrib/top/install-sh
/freebsd-11-stable/contrib/tzcode/stdtime
/freebsd-11-stable/contrib/tzcode/zic
/freebsd-11-stable/contrib/tzdata
/freebsd-11-stable/contrib/unbound
/freebsd-11-stable/contrib/vis
/freebsd-11-stable/contrib/wpa
/freebsd-11-stable/contrib/xz
/freebsd-11-stable/crypto/heimdal
/freebsd-11-stable/crypto/openssh
/freebsd-11-stable/crypto/openssl
/freebsd-11-stable/gnu/lib
/freebsd-11-stable/gnu/usr.bin/binutils
/freebsd-11-stable/gnu/usr.bin/cc/cc_tools
/freebsd-11-stable/gnu/usr.bin/gdb
/freebsd-11-stable/lib/libc/locale/ascii.c
/freebsd-11-stable/sys/cddl/contrib/opensolaris
/freebsd-11-stable/sys/contrib/dev/acpica
/freebsd-11-stable/sys/contrib/ipfilter
/freebsd-11-stable/sys/contrib/libfdt
/freebsd-11-stable/sys/contrib/octeon-sdk
/freebsd-11-stable/sys/contrib/x86emu
/freebsd-11-stable/sys/contrib/xz-embedded
/freebsd-11-stable/usr.sbin/bhyve/atkbdc.h
/freebsd-11-stable/usr.sbin/bhyve/bhyvegc.c
/freebsd-11-stable/usr.sbin/bhyve/bhyvegc.h
/freebsd-11-stable/usr.sbin/bhyve/console.c
/freebsd-11-stable/usr.sbin/bhyve/console.h
/freebsd-11-stable/usr.sbin/bhyve/pci_fbuf.c
/freebsd-11-stable/usr.sbin/bhyve/pci_xhci.c
/freebsd-11-stable/usr.sbin/bhyve/pci_xhci.h
/freebsd-11-stable/usr.sbin/bhyve/ps2kbd.c
/freebsd-11-stable/usr.sbin/bhyve/ps2kbd.h
/freebsd-11-stable/usr.sbin/bhyve/ps2mouse.c
/freebsd-11-stable/usr.sbin/bhyve/ps2mouse.h
/freebsd-11-stable/usr.sbin/bhyve/rfb.c
/freebsd-11-stable/usr.sbin/bhyve/rfb.h
/freebsd-11-stable/usr.sbin/bhyve/sockstream.c
/freebsd-11-stable/usr.sbin/bhyve/sockstream.h
/freebsd-11-stable/usr.sbin/bhyve/usb_emul.c
/freebsd-11-stable/usr.sbin/bhyve/usb_emul.h
/freebsd-11-stable/usr.sbin/bhyve/usb_mouse.c
/freebsd-11-stable/usr.sbin/bhyve/vga.c
/freebsd-11-stable/usr.sbin/bhyve/vga.h
# 298388 21-Apr-2016 eadler

Bring a little more compability with GNU units 2.12
- notionally support a 'history file' flag. This doesn't do much now,
but is there to prevent scripts written against GNU units from
breaking
- correctly gracefully quit rather than exit (this will make it easier
to support a history file in the future)
- remove the "t" flag from fopen which was there to support windows. We
have not supported windows since at the latest, the introduction of
capsicum.


# 298253 19-Apr-2016 eadler

Rename units.lib -> definitions.units
- this matches GNU units 2.12
add ISO country codes from units 2.12


# 298251 19-Apr-2016 eadler

Remove pathnames.h
- it only holds a single constant
- it doesn't exist in the GNU variant


# 286446 08-Aug-2015 trasz

Fix interaction between libedit initialization and Capsicum
in units(1). The most visible is the removal of libedit warnings
about being unable to open termcap database.

Reviewed by: eadler@
MFC after: 1 month
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D3322


# 284912 28-Jun-2015 jmmv

Only initialize libedit when necessary

The code path to support units conversions from the command line
need not initialize neither libedit nor the history. Therefore, only do
that when in interactive mode.

This hides the issue reported in PR bin/201167 whereby running commands
of the form 'echo "$(units ft in)"' would corrupt the terminal. The real
issue causing the corruption most likely still remains somewhere.

PR: bin/201167
Differential Revision: D2935
Reviewed by: eadler


# 268792 17-Jul-2014 eadler

units(1): Add support for output-format
Add support for the output-format argument. This also exposes subtle
rounding differences between GNU units and our units.


# 268282 05-Jul-2014 eadler

units(1): Clean up
Remove unused constant. Add 'static' where able.


# 268278 05-Jul-2014 eadler

units: Support start of line comments with '#'
Modern GNU units(1) supports comments anywhere with '#' but take the easy route for now and at least support start of line # comments.


# 268277 05-Jul-2014 eadler

units(1): Add 'terse' support
terse output is used when calling units from another script.


# 268271 04-Jul-2014 eadler

units(1): Add 'help' flag
- Add support for --help for compatibility
- Make usage() static


# 268269 04-Jul-2014 eadler

units(1): add long options
Things brings additional compatibility with units 2.10

Discussed with: wblock (man page)


# 266117 15-May-2014 eadler

units(1): Fix minor typos

Obtained From: DragonflyBSD


# 265907 12-May-2014 eadler

units(1): call el_end()

Add missing el_end() call


# 265904 12-May-2014 eadler

units(1): unbreak -f option, fix some style, increase compatibility.

- Unbreak the -f option: it was missing a ':'
- gunits -V spits out more information than just its version: attempt to do so
as well.


# 265903 12-May-2014 eadler

units(1): use common functions

No need to replicate strdup


# 264475 14-Apr-2014 eadler

units(1): don't compare pointers with 0

For better readability, don't compare pointers with 0 or assign 0
to them. Use NULL instead.

Inspired by: DragonflyBSD


# 264474 14-Apr-2014 eadler

units(1): Add 'static' and sort list.

Inspired by: DragonflyBSD


# 264470 14-Apr-2014 eadler

units(1): Add v option: verbose

For increased compatibility with GNU units: support a -v option which
produces more verbose output when spitting out the answer.
GNU -v does additional work in the version, information, and check output which
we do not (yet?) replicate.


# 264463 14-Apr-2014 eadler

units(1): Add U option

For increased compatibility with GNU units: support a -U option which tests for the
existence of the default units file and prints it to the screen.


# 264462 14-Apr-2014 eadler

units(1): support reading multiple units files

GNU units(1) supports reading up to 25 -f options. We support an arbitrary
number.


# 264459 14-Apr-2014 eadler

units(1): parse config file after setting defaults

Parse the config file after setting the defaults to permit the user to change
things (e.g., editing mode)


# 264458 14-Apr-2014 eadler

units(1): add libedit support

Add line editing and history support to units(1) via libedit.

Reviewed by: bdrewery


# 264216 07-Apr-2014 eadler

units(1): make -V print version instead of -v

The units program is likely little used. It is even less likely that a script
will want the units program to print out its version number by passing -v.

GNU units uses -V for version and -v for verbosity.

Increase compatibility between these two versions (written by the same author)
by switching our flag as well.

Take this opportunity to remove bogus information about the version number and
just call it 'FreeBSD units'.

Discussed with: cperciva, rwatson


# 263940 30-Mar-2014 eadler

add capsicum to units(1)


# 227194 06-Nov-2011 ed

Add missing static keywords to units(1)


# 181786 16-Aug-2008 dwmalone

Add limited support for units that are related by affine rather
than linear relations. We can now convert degC to degF.

586 units, 56 prefixes
You have: 24 degC
You want: degF
75.2
You have: degC
You want: K
(-> x*1 +273.15)
(<- y*1 -273.15)


# 100826 28-Jul-2002 dwmalone

Add enough consts to keep everyone happy.


# 78698 24-Jun-2001 dwmalone

Add prototypes and turn on WARNS=?2.


# 73229 28-Feb-2001 dwmalone

Give units a bit of a cleanup:

1) Fix a bug where the recursion on prefixes where if recusrion failed
then the next attempt started too far along the string.
2) Up some internal limits that we were about to hit off.
3) Change the constness and signedness of some things and complete missing
prototypes.
4) Remove the readerror function 'cos it could print out the wrong
wrong file name. Replace it with more useful error messages.
5) Use sizeof when passing buffers to fgets.
6) Warn about empty prefix definitions.

Reviewed by: iedowse


# 64053 31-Jul-2000 kris

Don't segv when trying to add a 0-length unit name.
Some string-related cleanups inspired by OpenBSD.

Reviewed by: asmodai


# 50477 27-Aug-1999 peter

$Id$ -> $FreeBSD$


# 28502 21-Aug-1997 charnier

Use err(3). Cosmetic in usage(). Rewrote man page in mdoc format.


# 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.


# 16190 08-Jun-1996 alex

Fix exit code when used in non-interactive mode.
Remove ';' typo attached to if statement.


# 16187 08-Jun-1996 alex

This commit was generated by cvs2svn to compensate for changes in r16186,
which included commits to RCS files with non-trunk default branches.


# 16186 08-Jun-1996 alex

Units conversion utility courtesy of NetBSD.

Submitted by: Jeremy Prior
Obtained from: NetBSD