Commit Graph

26 Commits

Author SHA1 Message Date
Érico Nogueira
67eddacfc9 c: print strerror() instead of error code.
This changes error() behavior to match what glibc already does.
2021-06-16 20:01:46 +10:00
simonis
45591f4f85 Build fails if not done from the source root directory (#105) 2018-08-08 19:55:02 +10:00
Dr. Werner Fink
4ed44ab58e misc: fix strtod_nol_err tests
A better way of implementing the string to double
conversion and a better way of testing it.

Signed-off-by: Craig Small <csmall@enc.com.au>
2016-07-13 20:08:51 +10:00
Craig Small
32e1b2e297 A locale-independent strtod
There is a need in some utilities to have a way of accepting both
types of decimal points "." and ",". The only way seems to be to
rebuild strtod().

This new function will accept "123.456" and "123,456" as 123.456
and considers them the same number. It means we lose thousands
separator, but this is rarely used.

test scripts are added to check the function returns the proper
values. There was simpler predecessor that got stuck on negative
0 or -0.123 which these tests flushed out.

References:
2016-03-03 21:24:08 +11:00
Michael Forney
007c438148 Also emulate error_at_line if not present 2014-08-28 13:54:24 +02:00
Jim Warner
e2242cb943 build-sys: fix the fatal 'make dist' error for nsutils
While a 'make dist' appeared to work fine without this
patch, the nsutils.h file was missing from the include
subdirectory. Thus the tarball could not support make.

Reference(s):
http://gitorious.org/procps/procps/merge_requests/13
commit dd6f24dbed

Signed-off-by: Jim Warner <james.warner@comcast.net>
2013-09-12 06:52:42 +10:00
Craig Small
dd6f24dbed Merge commit 'refs/merge-requests/13' of git://gitorious.org/procps/procps into merge-requests/13
Conflicts:
	pgrep.c
	ps/output.c
	ps/ps.1
2013-09-11 21:34:05 +10:00
Aristeu Rozanski
de7b3b9222 pgrep: introduce support for namespaces
A PID should be specified with --ns:
	$ pgrep --ns 12345
which will only match the processes which belong to to the same 6
namespaces. It is also possible to specify which namespaces to test:
	$ pgrep --ns 12345 --nslist mnt,net,ipc
which will match processes that belong to the same mount, network and
IPC namespaces as PID 12345.

Signed-off-by: Aristeu Rozanski <arozansk@redhat.com>
2013-04-16 15:05:31 -04:00
Rainer Müller
838e5d8941 configure: Check for error.h
For portability, check for error.h during configure and define
HAVE_ERROR_H accordingly.

If this header is not available, emulate the functionality of error()
from glibc with an inline wrapper in include/c.h.
2013-03-20 16:32:06 +01:00
Jim Warner
fe75e26ab6 miscellaneous: clean up trailing whitespace throughout
The entire tree's polluted with inappropriate trailing
whitespace. This commit rids our environment of all of
those useless keystrokes. Unfortunately, it sure ain't
a permanent solution and requires every contributor to
instruct their editor(s) to prevent or eliminate them.

Plus it's strongly recommended we all insert something
like what's shown below to our '.gitconfig' file so as
to provide at least some warnings when we try to apply
any patches (git am) that do contain the #@!%& things!

References(s):
~/.gitconfig excerpt ---------------------------------
[core]
  whitespace = trailing-space, space-before-tab, blank-at-eof
[apply]
  whitespace = warn
--------------------------------- ~/.gitconfig excerpt

Signed-off-by: Jim Warner <james.warner@comcast.net>
2013-03-14 12:36:47 +01:00
Sami Kerola
43d4aac43f build-sys: add fileutils.h to dist package
The 'make distcheck' failed with.

../../ps/display.c:39:34: fatal error: ../include/fileutils.h: No such file or directory

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-04-18 10:26:20 +02:00
Sami Kerola
34344de979 build-sys: uClibc does not have rpmatch()
Add simple replacement with hardcoded y/n responses to allow
compilation on systems without rpmatch().

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-04-18 10:03:55 +02:00
Sami Kerola
c7cf98b0e0 lib: add fileutils file with stream error checking facility
The close_stream() is copied from GNU lib. Inspiration to do this
is talk by Jim Meyering - Goodbye World! The perils of relying on
output streams in C.

Reference: http://www.irill.org/events/ghm-gnu-hackers-meeting/videos/jim-meyering-goodbye-world-the-perils-of-relying-on-output-streams-in-c
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-03-23 15:57:41 +01:00
Sami Kerola
5d04a5a75c c.h: fix macro definition warning
../include/c.h:106:18: warning: ISO C does not permit named variadic macros [-Wvariadic-macros]
../include/c.h:107:19: warning: ISO C does not permit named variadic macros [-Wvariadic-macros]
../include/c.h:108:25: warning: ISO C does not permit named variadic macros [-Wvariadic-macros]
../include/c.h:109:26: warning: ISO C does not permit named variadic macros [-Wvariadic-macros]

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-03-03 18:32:40 +11:00
Mike Frysinger
afaf698896 use helpers from c.h
A few files still use the C library helpers from err.h, so migrate
them to the local c.h helpers.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2012-01-24 08:55:05 +01:00
Mike Frysinger
af61809a18 include error.h for error() and friends
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2012-01-24 08:55:05 +01:00
Craig Small
fb11e1fe0a Changed the err and warns to macros
err and warn are BSD format but they are not recommended by library
developers.  However their consiseness is useful!

The solution is to use some macros that create xerr etc which then
just map to the error() function.  The next problem is error() uses
program_invocation_name so we set this to program_invovation_short_name

This is a global set but seems to be the convention (or at least errors
are on the short name only) used everywhere else.
2012-01-03 18:48:43 +11:00
Jim Warner
131f935c49 build-sys: re-enable 'dist' build
The 'build-sys: re-enable out of tree build' commit
failed to also address the 'dist' target errors.
2012-01-02 16:27:18 +11:00
Sami Kerola
c0e7e96c1a lib: add strtod_or_err()
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2011-12-20 17:30:54 +01:00
Sami Kerola
7b6084451d other: tell what was taken from util-linux package
Reference: http://www.freelists.org/post/procps/backporting,1
Reported-by: Jim Warner <james.warner@comcast.net>
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2011-12-20 17:30:53 +01:00
Sami Kerola
b260b11a3b lib: add strtol into utility library
The utility library is for functions which are shared in commands,
but that does not belong to libproc-ng.  The first function is a
wrapper for strtol that performs error checking, and exists if such
happen.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2011-12-20 17:30:52 +01:00
Jim Warner
692dcb531c build-sys: added config.h include to nls.h (for PACKAGE str) 2011-12-20 17:30:52 +01:00
Sami Kerola
ab3ff3cdab build-sys: add missing files to distribution
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2011-12-20 17:30:51 +01:00
Sami Kerola
1ef14f4bf9 includes: add xalloc.h to unify memory allocations
The xalloc.h provides necessary error checking.

Signed-off-by: Jim Warner <james.warner@comcast.net>
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2011-12-20 17:30:50 +01:00
Sami Kerola
43318fd0c2 build-sys: add c.h with fundamental C definitions
This file contains various preprocessor directed definitions, and
other definitions, which most programs need.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2011-12-20 17:17:03 +01:00
Sami Kerola
a220ba6770 build-sys: add NLS support
Add GNU gettext internationalization and localization support.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2011-12-20 17:17:03 +01:00