Commit Graph

49 Commits

Author SHA1 Message Date
Karel Zak 7b20bb1acc scriptplay: fix time_t=long assumptions
Fixes: https://github.com/karelzak/util-linux/issues/1069
References: ce3355cc54
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-05-06 10:34:15 +02:00
Soumendra Ganguly 535e81ebba Change tcgetattr error handling. 2020-08-08 05:28:42 -05:00
Soumendra Ganguly cfc264d50b Add more elegant error handling. Avoid isatty. 2020-08-07 03:01:02 -05:00
Soumendra Ganguly 00a09d78ea scriptreplay: enable special character handling
Calling cfmakeraw disables terminal special character handling. For
example, Ctrl-C does not send SIGINT to scriptreplay. The following
fixes this.

 tattr.c_lflag |= ISIG;

where tattr is the struct termios with which we are working.
2020-07-23 12:23:56 +02:00
SOUMENDRA GANGULY edb088ffbe Make scriptreplay set terminal to raw mode 2020-07-23 12:23:56 +02:00
Yuri Chornoivan dc62fffc05
Fix minor typo: aliast -> alias 2020-01-08 18:43:22 +02:00
Sami Kerola ac407b1650
script: fix typos [codespell]
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2019-12-11 19:53:14 +00:00
Karel Zak eb78192211 scriptreplay: fix typo
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-11-25 12:49:41 +01:00
Karel Zak bdd4335706 lib/pty-session: make wait_child callback optional
Now the code is duplicate on many places, but all we usually need is to
remember child status. It seems good enough to have very simple
callback child_die() to inform application about a change.

The patch also add PID to all signal related callbacks.

Signed-off-by: Karel Zak <kzak@redhat.com>
2019-10-08 13:11:54 +02:00
Karel Zak d51f8ec129 scriptreplay: make data log file optional for --summary
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-10-08 13:11:54 +02:00
Karel Zak 263835e824 scriptlive: free resource at the and
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-10-08 13:11:54 +02:00
Karel Zak a33f1fc432 scriptreplay: add -T, --log-timing
Add alias to -t,--timing to make it easy to copy and past script(1)
comnand line to scriptlive(1) and scriptreplay(1) command lines.
For example:

record:
  $ script --log-timing tm --log-in in

print:
  $ scriptreplay --log-timing tm --log-in in

re-run:
  $ scriptlive --log-timing tm --log-in in

And command line is still the same.

Signed-off-by: Karel Zak <kzak@redhat.com>
2019-10-08 13:11:54 +02:00
Karel Zak b639c2a39b scriptreplay: use struct timeval for delay
* use timeval rather than double for delay
* use sys/time.h macros for wirk with timeval
* add delay normalization to script-playutils.c API

Signed-off-by: Karel Zak <kzak@redhat.com>
2019-10-08 13:11:54 +02:00
Karel Zak 12352c967c scriptreplay: move all utils to script-playutils.{c,h}
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-10-08 13:11:53 +02:00
Karel Zak 4a4f4a6260 scriptreplay: add --summary
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-10-08 13:11:53 +02:00
Karel Zak f923a59596 scriptreplay: check for EOF
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-10-08 13:11:53 +02:00
Karel Zak 7c4a374f63 scriptreplay: print info and signals
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-10-08 13:11:53 +02:00
Karel Zak 6646f9f896 scriptreplay: make sure timing file specified
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-10-08 13:11:53 +02:00
Karel Zak 88b8e9bffd scriptreplay: add --cr-mode
The stdin log does not contain line breaks as command line uses CR
between commands. This makes scriptreplay for stdin very
user-unfriendly, because it overwrites still the same line.

The new option --cr-mode provides opportunity to control this
behavior. The default for stdin logs is replace CR with line-break.

Signed-off-by: Karel Zak <kzak@redhat.com>
2019-10-08 13:11:53 +02:00
Karel Zak 4f4bac42d8 scriptreplay: fix error path
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-10-08 13:11:53 +02:00
Karel Zak 41ce6545d2 scriptreplay: add --stream
Let's allow to specify stream, default to entry type according to the
command line options.

Signed-off-by: Karel Zak <kzak@redhat.com>
2019-10-08 13:11:53 +02:00
Karel Zak 0d955cd8ac scriptreplay: add --log-{in,out,io} options
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-10-08 13:11:53 +02:00
Karel Zak 02a51ce1e3 scriptreplay: cleanup usage()
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-10-08 13:11:53 +02:00
Karel Zak 167a485172 scriptreplay: skip unwanted steps
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-10-08 13:11:53 +02:00
Karel Zak fec06a063e scriptreplay: rewrite to support new timing file format
* add internal support for multiple log files
* add support for new timing file format (default is old format)

Signed-off-by: Karel Zak <kzak@redhat.com>
2019-10-08 13:11:53 +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
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 b305445495 misc: consolidate all --help option descriptions
Now we are always using the same text also for commands
which had still hardcoded descriptions or where we can't
use the standard print_usage_help_options macro.

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2017-06-27 12:28:36 +02:00
Ruediger Meier 86be6a32d3 misc: cosmetics, remove argument from usage(FILE*)
This patch is trivial and changes nothing, because
we were always using usage(stdout)

Now all our usage() functions look very similar. If wanted we
could auto-generate another big cosmetical patch to remove all
the useless "FILE *out" constants and use printf and puts
rather than their f* friends. Such patch could be automatically
synchronized with the translation project (newlines!) to not
make the translators sick.

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
Sami Kerola f0b3b904c7 scriptreplay: avoid re-implementing strtod_or_err()
And use isnan() to detect NaN.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2016-05-05 11:46:54 +02:00
Sami Kerola ba660b9911 scriptreplay: improve error message
Use human numbering for lines - that is start counting from 1.  And tell in
error message what the number means.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2016-05-05 11:46:54 +02:00
Filipe Brandenburger 94757eceb1 scriptreplay/newgrp: use signed int to store return of getopt_long
Signed-off-by: Filipe Brandenburger <filbranden@google.com>
2016-01-07 12:47:41 +01: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
Sami Kerola db433bf737 textual: use usage() text element macros
Translating these text elements should happen only once, which is
more likely when the text macros are used properly.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2014-10-01 12:33:26 +02:00
Sami Kerola a587cc5520 textual: use manual tail usage() macro
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2014-10-01 12:33:24 +02:00
Sami Kerola f627750083 textual: use version printing macro everywhere
Only mount, umount, and blkid remains not using the macro because they
are print also library references.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2014-10-01 12:33:23 +02:00
Wolfgang Richter a21f7ec91d scriptreplay: no need to skip first time value or last bytes fixes #58 2014-03-19 22:47:11 -04:00
Jesper Dahl Nyerup 7f1d483638 scriptreplay: Add --maxdelay option.
This option caps the delay between updates, to avoid long pauses in
transcript playback.

Signed-off-by: Jesper Dahl Nyerup <nyerup@one.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-02-10 19:24:28 +01:00
Karel Zak 5769a938b4 scriptreplay: fix compiler warning [-Wmissing-prototypes]
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-07-16 18:48:27 +02:00
Sami Kerola 289dcc9023 translation: unify file open error messages
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-07-16 18:18:22 +02:00
Sami Kerola 66fc066537 scriptreplay: fix compiler format warning
scriptreplay.c:210:3: warning: format '%zd' expects argument of type 'signed size_t *', but argument 4 has type 'size_t *' [-Wformat]

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-06-17 18:00:00 +02:00
Sami Kerola cdd2a8c360 term-utils: verify writing to streams was successful
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-04-04 19:46:25 +02:00
Karel Zak 14cc9ddafe scriptreplay: cleanup usage()
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-08-16 13:43:34 +02:00
Sami Kerola 739de07650 scriptreplay: fix buffer overflow
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-07-26 11:58:38 +02:00
Sami Kerola 0da871b50d scriptreplay: allow arguments as command line switches
The command line switches override old style arguments

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-04-12 14:21:36 +02:00
Sami Kerola 84adb5e65e scriptreplay: support long options
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-04-12 14:19:44 +02:00
Sami Kerola f004a02d80 scriptreplay: end printing with new line
Depending on opinion this is either modest bug fix or tiny
improvement.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2011-04-12 13:35:37 +02:00
Karel Zak c76d33bacc build-sys: move script and scriptreplay to term-utils/
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-03-02 14:06:23 +01:00