Commit Graph

36 Commits

Author SHA1 Message Date
Karel Zak c7da267442 ldattach: add __format__ attribute
Reported-by: Jan Pazdziora <jpazdziora@redhat.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-06-18 16:52:26 +02:00
Rosen Penev bd89499e07
[clang-tidy] do not return in void functions
Found with readability-redundant-control-flow

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2020-04-19 14:03:21 -07:00
Karel Zak 25b7045e5d misc: replaces atexit(close_stdout) with new close_stdout_atexit()
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-06-17 15:46:10 +02:00
Karel Zak 2c308875a7 misc: consolidate version printing and close_stdout()
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-04-16 15:14:13 +02:00
Khem Raj 963413a1ad ldattach: Check for value of _HAVE_STRUCT_TERMIOS_C_ISPEED
in glibc 2.29+ checking for just existence of _HAVE_STRUCT_TERMIOS_C_ISPEED
won't be enough, the value has to be checked

see
https://sourceware.org/git/?p=glibc.git;a=commit;h=e5a50db36eaa6e8c6427b3a971563240b633ca85

Signed-off-by: Khem Raj <raj.khem@gmail.com>
2019-01-04 22:38:25 -08:00
Sami Kerola 31f85fce55
ldattach: simplify debugging function when vwarnx(3) is available
The vwarnx(3) is probably not available in all libc implementations, in such
cases use the earlier printout as a fallback.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2017-07-15 22:02:53 +01:00
Ruediger Meier f45f3ec34a misc: consolidate macro style USAGE_HELP_OPTIONS
changed in include/c.h and applied via sed:

  sed -i 's/fprintf.*\(USAGE_MAN_TAIL.*\)/printf(\1/' $(git ls-files -- "*.c")
  sed -i 's/print_usage_help_options\(.*\);/printf(USAGE_HELP_OPTIONS\1);/' $(git ls-files -- "*.c")

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2017-06-29 16:54:33 +02:00
Ruediger Meier b1a294c448 misc: introduce print_usage_help_options()
Consolidate --help and --version descriptions. We are
now able to align them to the other options.

We changed include/c.h. The rest of this patch was
generated by sed, plus manually setting the right
alignment numbers. We do not change anything but
white spaces in the --help output.

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2017-06-27 12:26:19 +02:00
Ruediger Meier 5118d1be2a misc: never use usage(ERROR)
We are using better/shorter error messages and somtimes
also errtryhelp().

Here we fix all cases where the usage function took
an int argument for exit_code.

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2017-06-26 14:38:24 +02:00
Karel Zak 677ec86cef Use --help suggestion on invalid option
The current default is to print all usage() output. This is overkill
in many case.

Addresses: https://github.com/karelzak/util-linux/issues/338
Signed-off-by: Karel Zak <kzak@redhat.com>
2016-12-19 13:13:34 +01:00
Karel Zak 158e418241 ldattach: tiny coding style changes
Signed-off-by: Karel Zak <kzak@redhat.com>
2015-07-15 15:49:18 +02:00
Tilman Schmidt 58c1746094 ldattach: order line disciplines canonically
List line disciplines in numerical order and put official names
before convenience aliases.

Signed-off-by: Tilman Schmidt <tilman@imap.cc>
2015-07-15 15:46:18 +02:00
Tilman Schmidt 5687494ae0 ldattach: always set line speed and format for N_GIGASET_M101
The Gigaset M101 exhibits particularly awkward and confusing behaviour
when the serial line speed isn't set to what the device expects:
Configuration mode detects the used speed and works anyway, but data
mode silently fails. Troubleshooting this is enormously time-consuming.

Spare the users this trouble by setting the line speed and format to
these devices' factory default values as long as the command line
doesn't say otherwise.

Signed-off-by: Tilman Schmidt <tilman@imap.cc>
2015-07-15 15:46:17 +02:00
Tilman Schmidt b5225af344 ldattach: adapt print_table column width to widest entry
The hardcoded column width of 10 in print_table() is not enough, as
the currently longest table entry to be printed has 12 characters.

Signed-off-by: Tilman Schmidt <tilman@imap.cc>
2015-07-15 15:46:16 +02:00
Benno Schulenberg 451dbcfae1 textual: add a docstring to most of the utilities
This adds a concise description of a tool to its usage text.

A first form of this patch was proposed by Steven Honeyman
(see http://www.spinics.net/lists/util-linux-ng/msg09994.html).

Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
2015-01-06 11:27:38 +01:00
Karel Zak 41525ce062 ldattach: add fallback for N_GSM0710
Addresses: https://github.com/karelzak/util-linux/issues/133
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-11-21 13:57:14 +01:00
Karel Zak 8596f63914 ldattach: GSM0710 support, add intro modem command
Patch add:
 --intro-command string  : send command to modem
 --pause value           : define delay between intro command and ldattach

Based on patch from Martin Schmid <scm@aps-systems.ch>

Signed-off-by: Karel Zak <kzak@redhat.com>
2014-11-18 13:49:42 +01:00
Sami Kerola d0ed8dc2b9 blkid, hwclock, ldattach: use program_invocation_short_name
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2013-04-26 13:25:57 +02:00
Karel Zak d91757a0f9 ldattach: fix compiler warning [-Wmissing-prototypes]
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-07-16 18:53:11 +02:00
Karel Zak 20a3998222 sys-utils: cleanup strtoxx_or_err()
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-05-15 17:45:17 +02:00
Sami Kerola efb8854f4c sys-utils: verify writing to streams was successful
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-04-04 19:49:40 +02:00
Sami Kerola ba64bbd224 ldattach: add default case to switches
The warnings bellow are about impossible case, so makign abort() as
default seems correct.

ldattach.c:305:2: warning: switch missing default case [-Wswitch-default]
ldattach.c:313:2: warning: switch missing default case [-Wswitch-default]
ldattach.c:321:2: warning: switch missing default case [-Wswitch-default]

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2011-11-02 19:26:15 +01:00
Sami Kerola 3a13401204 ldattach: convert debug macro to function
warning: ISO C does not permit named variadic macros

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2011-11-02 19:10:24 +01:00
Sami Kerola 7b2d3de475 ldattach: check numeric user inputs with strtol_or_err
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2011-11-02 19:10:12 +01:00
Sami Kerola a8023b9aec ldattach: align with howto-usage-function.txt
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2011-11-02 18:41:57 +01:00
Sami Kerola 28e91b8395 ldattach: fix coding style
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2011-11-02 18:41:57 +01:00
Karel Zak 5ff204235d ldattach: cleanup usage()
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-08-16 13:30:26 +02:00
Fabian Groffen eb76ca98b0 build-sys: provide alternatives for err, errx, warn and warnx
Solaris lacks err, errx, warn and warnx.  This also means the err.h header
doesn't exist.  Removed err.h include from all files, and included err.h from
c.h instead if it exists, otherwise alternatives are provided.

Signed-off-by: Fabian Groffen <grobian@gentoo.org>
2011-02-14 17:45:24 +01:00
Karel Zak b5b28b435e ldattach: prints help to stdout
Signed-off-by: Karel Zak <kzak@redhat.com>
2010-03-01 10:51:12 +01:00
Tilman Schmidt b091b880f9 ldattach: add --iflag command line option
Add a command line option '-i' / '--iflag' for setting or clearing
input flags on the serial device before attaching the line discipline.

[kzak@redhat.com: - use generic functions for work with iflags table
                  - add list of iflags to usage/help output
                  - move iflags parsing to separate function]

Impact: added functionality
Signed-off-by: Tilman Schmidt <tilman@imap.cc>
Signed-off-by: Karel Zak <kzak@redhat.com>
2010-03-01 10:45:47 +01:00
Karel Zak 7b549aff71 ldattach: create a generic functions for name=value tables
Signed-off-by: Karel Zak <kzak@redhat.com>
2010-03-01 10:25:55 +01:00
Karel Zak becc79d5b6 ldattach: use c.h
Signed-off-by: Karel Zak <kzak@redhat.com>
2009-10-16 01:00:27 +02:00
Tilman Schmidt d5f36dec92 ldattach: add N_PPS support
Add support for a line discipline name "PPS" selecting the
Pulse Per Second line discipline N_PPS (18). The number has been
reserved since kernel release 2.6.28, and the implementation is
finally going to be submitted for kernel release 2.6.31.

Signed-off-by: Tilman Schmidt <tilman@imap.cc>
2009-06-29 22:31:15 +02:00
Karel Zak f8132752db ldattach: use glibc termios
Signed-off-by: Karel Zak <kzak@redhat.com>
2008-04-09 11:48:24 +02:00
Karel Zak fcba457783 ldattach: add NLS support
Signed-off-by: Karel Zak <kzak@redhat.com>
2008-03-25 22:59:47 +01:00
Tilman Schmidt 1e8d11c459 ldattach: new command
Add an ldattach(8) utility program similar to the one in OpenBSD.

Signed-off-by: Tilman Schmidt <tilman@imap.cc>
2008-03-10 14:20:26 +01:00