Jakub Wilk <jwilk@jwilk.net>
Martin Hundeboll <martin@hundeboll.net>
Nick Østergaard <oe.nick@gmail.com>
+Adam Borowski <kilobyte@angband.pl>
Thanks to everyone who has contributed to this project.
-=== tio v1.20 ===
+=== tio v1.24 ===
+
+
+Changes since tio v1.23:
+
+ * Optimize clear screen command
+
+ Replaced system call with inline ANSI/VT100 clear screen code sequence
+
+ * Fix bash completion installation
+
+ Fixed the configure script to avoid that the bash completion script gets
+ installed outside of the prefix location. The default install location
+ is now $prefix/share/bash-completion/completions.
+
+ Use the configure option '--with-bash-completion-dir=PATH' if you need
+ to install the bash completion script elsewhere.
+
+Jakub Wilk:
+
+ * Add missing commas in conditional sentences
+
+
+
+Changes since tio v1.22:
+
+ * Update copyright headers
+
+Jakub Wilk:
+
+ * Fix typos
+
+
+Changes since tio v1.21:
+
+ * Update man page date
+
+ * Update copyright year
+
+ * Code cleanup
+
+ * Update README and man page
+
+
+
+Changes since tio v1.20:
+
+ * Add support for hexadecimal mode
+
+ A new key command 'ctrl-t h' is introduced which toggles between
+ hexadecimal mode and normal mode. When in hexadecimal mode data received
+ will be printed in hexadecimal.
+
+ * Do not distribute src/bash_completion/tio
+
+ Since the bash completion tio script is now autogenerated from tio.in it
+ should not be distributed in the tarball.
+
+ * Add missing forward flag
+
+ * Update AUTHORS file
+
+Adam Borowski:
+
+ * 'ctrl-t b' to send serial break.
+
+Jakub Wilk:
+
+ * Removed git commit references from ChangeLog
+
+ ChangeLog is primary useful for users who don't have the git repository
+ at hand.
+
+ Replace git commit references with version numbers; or if the change
+ only cleans up another change with no release in between, remove the
+ changelog item completely.
+
+
Changes since tio v1.19:
* Revert "Added support for non-standard baud rates"
- This reverts commit deec83a4eeddd5c3b2d4df041aede2bceb8867da.
+ This reverts a change made in v1.18.
Reverting because supporting non-standard or arbitrary baud rates is
troublesome because the c library provides no means of doing so and even
* Include config.h before standard headers
- This makes use of 8d6d202 (Enable large file support) for real.
-
-Jakub Wilk:
-
- * Fixed printf directives for tx/rx counters
-
- In 9a66de0affda, types of tx/rx counters were changed from "long" to
- "unsigned long", but their printf directives remained "%ld".
- Change them to "%lu" to match the actual types.
+ Large file support was meant to be enabled in v1.11.
+ This change enables it for real.
* Completed the ^g to ^t transition
- In 72a287f18995 the escape key was changed from ^g to ^t, but some
+ In v1.7 the escape key was changed from ^g to ^t, but some
code and comments still referred to the old key.
* Used HTTPS for tio.github.io
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
-BASH_COMPLETION_CFLAGS = @BASH_COMPLETION_CFLAGS@
BASH_COMPLETION_DIR = @BASH_COMPLETION_DIR@
-BASH_COMPLETION_LIBS = @BASH_COMPLETION_LIBS@
BAUDRATES = @BAUDRATES@
BAUDRATE_CASES = @BAUDRATE_CASES@
CC = @CC@
-=== tio - a simple TTY terminal I/O application ===
+################################################################################
+################# tio - a simple TTY terminal I/O application ##################
+################################################################################
1. Introduction
--no-autoconnect option.
By default tio automatically connects to the provided device if present.
- If the device is not present it will wait for it to appear and then
- connect. If the connection is lost (eg. device disconnects) it will wait
+ If the device is not present, it will wait for it to appear and then
+ connect. If the connection is lost (eg. device disconnects), it will wait
for the device to reappear and then reconnect.
- However, if the --no-autoconnect option is provided tio will exit if the
- device is not present or exit if an established connection is lost.
+ However, if the --no-autoconnect option is provided, tio will exit if the
+ device is not present or an established connection is lost.
Tio features full bash autocompletion support.
+ Tio also supports various key commands. Press ctrl-t ? to list the
+ available key commands.
+
+ See the tio man page for more details.
-3. Download
- Find the latest release tarball at https://tio.github.io
+3. Download
- The latest source is available on GitHub: https://github.com/tio/tio
+ The latest release tarball is available at https://tio.github.io
4. Installation
- Install steps:
+ Installation steps (from source):
$ ./configure
$ make
$ make install
- See INSTALL file for installation details.
+ See INSTALL file for more installation details.
+
+
+ Installation steps (binary package):
+
+ Tio comes prepackaged for various GNU/Linux distributions. Visit
+ https://tio.github.io to see package installation details.
5. Contributing
Tio is open source. Any contributions (bug fixes, doc, ideas, etc.) are
- welcome.
+ welcome. Visit the tio GitHub page to access latest source code, create
+ pull requests, add issues etc..
+
+ GitHub: https://github.com/tio/tio
6. Support
- Submit bug reports on GitHub: https://github.com/tio/tio/issues
+ Submit bug reports via GitHub: https://github.com/tio/tio/issues
7. License
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.69 for tio 1.20.
+# Generated by GNU Autoconf 2.69 for tio 1.24.
#
#
# Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc.
# Identity of this package.
PACKAGE_NAME='tio'
PACKAGE_TARNAME='tio'
-PACKAGE_VERSION='1.20'
-PACKAGE_STRING='tio 1.20'
+PACKAGE_VERSION='1.24'
+PACKAGE_STRING='tio 1.24'
PACKAGE_BUGREPORT=''
PACKAGE_URL='https://tio.github.io'
ENABLE_BASH_COMPLETION_FALSE
ENABLE_BASH_COMPLETION_TRUE
BASH_COMPLETION_DIR
-BASH_COMPLETION_LIBS
-BASH_COMPLETION_CFLAGS
PKG_CONFIG_LIBDIR
PKG_CONFIG_PATH
PKG_CONFIG
CPPFLAGS
PKG_CONFIG
PKG_CONFIG_PATH
-PKG_CONFIG_LIBDIR
-BASH_COMPLETION_CFLAGS
-BASH_COMPLETION_LIBS'
+PKG_CONFIG_LIBDIR'
# Initialize some variables set by options.
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
-\`configure' configures tio 1.20 to adapt to many kinds of systems.
+\`configure' configures tio 1.24 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
if test -n "$ac_init_help"; then
case $ac_init_help in
- short | recursive ) echo "Configuration of tio 1.20:";;
+ short | recursive ) echo "Configuration of tio 1.24:";;
esac
cat <<\_ACEOF
directories to add to pkg-config's search path
PKG_CONFIG_LIBDIR
path overriding pkg-config's built-in search path
- BASH_COMPLETION_CFLAGS
- C compiler flags for BASH_COMPLETION, overriding pkg-config
- BASH_COMPLETION_LIBS
- linker flags for BASH_COMPLETION, overriding pkg-config
Use these variables to override the choices made by `configure' or to help
it to find libraries and programs with nonstandard names/locations.
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
-tio configure 1.20
+tio configure 1.24
generated by GNU Autoconf 2.69
Copyright (C) 2012 Free Software Foundation, Inc.
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
-It was created by tio $as_me 1.20, which was
+It was created by tio $as_me 1.24, which was
generated by GNU Autoconf 2.69. Invocation command line was
$ $0 $@
# Define the identity of the package.
PACKAGE='tio'
- VERSION='1.20'
+ VERSION='1.24'
cat >>confdefs.h <<_ACEOF
if test "x$with_bash_completion_dir" = "xyes"; then
-
-pkg_failed=no
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for BASH_COMPLETION" >&5
-$as_echo_n "checking for BASH_COMPLETION... " >&6; }
-
-if test -n "$BASH_COMPLETION_CFLAGS"; then
- pkg_cv_BASH_COMPLETION_CFLAGS="$BASH_COMPLETION_CFLAGS"
- elif test -n "$PKG_CONFIG"; then
- if test -n "$PKG_CONFIG" && \
- { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"bash-completion >= 2.0\""; } >&5
- ($PKG_CONFIG --exists --print-errors "bash-completion >= 2.0") 2>&5
- ac_status=$?
- $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
- test $ac_status = 0; }; then
- pkg_cv_BASH_COMPLETION_CFLAGS=`$PKG_CONFIG --cflags "bash-completion >= 2.0" 2>/dev/null`
- test "x$?" != "x0" && pkg_failed=yes
-else
- pkg_failed=yes
-fi
- else
- pkg_failed=untried
-fi
-if test -n "$BASH_COMPLETION_LIBS"; then
- pkg_cv_BASH_COMPLETION_LIBS="$BASH_COMPLETION_LIBS"
- elif test -n "$PKG_CONFIG"; then
- if test -n "$PKG_CONFIG" && \
- { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"bash-completion >= 2.0\""; } >&5
- ($PKG_CONFIG --exists --print-errors "bash-completion >= 2.0") 2>&5
- ac_status=$?
- $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
- test $ac_status = 0; }; then
- pkg_cv_BASH_COMPLETION_LIBS=`$PKG_CONFIG --libs "bash-completion >= 2.0" 2>/dev/null`
- test "x$?" != "x0" && pkg_failed=yes
-else
- pkg_failed=yes
-fi
- else
- pkg_failed=untried
-fi
-
-
-
-if test $pkg_failed = yes; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-
-if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
- _pkg_short_errors_supported=yes
-else
- _pkg_short_errors_supported=no
-fi
- if test $_pkg_short_errors_supported = yes; then
- BASH_COMPLETION_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "bash-completion >= 2.0" 2>&1`
- else
- BASH_COMPLETION_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "bash-completion >= 2.0" 2>&1`
- fi
- # Put the nasty error message in config.log where it belongs
- echo "$BASH_COMPLETION_PKG_ERRORS" >&5
-
- BASH_COMPLETION_DIR="${sysconfdir}/bash_completion.d"
-elif test $pkg_failed = untried; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
- BASH_COMPLETION_DIR="${sysconfdir}/bash_completion.d"
-else
- BASH_COMPLETION_CFLAGS=$pkg_cv_BASH_COMPLETION_CFLAGS
- BASH_COMPLETION_LIBS=$pkg_cv_BASH_COMPLETION_LIBS
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
- BASH_COMPLETION_DIR="`pkg-config --variable=completionsdir bash-completion`"
-fi
+ BASH_COMPLETION_DIR="${datadir}/bash-completion/completions"
else
BASH_COMPLETION_DIR="$with_bash_completion_dir"
fi
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
-This file was extended by tio $as_me 1.20, which was
+This file was extended by tio $as_me 1.24, which was
generated by GNU Autoconf 2.69. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\
-tio config.status 1.20
+tio config.status 1.24
configured by $0, generated by GNU Autoconf 2.69,
with options \\"\$ac_cs_config\\"
AC_PREREQ([2.68])
-AC_INIT([tio], [1.20], [], [tio], [https://tio.github.io])
+AC_INIT([tio], [1.24], [], [tio], [https://tio.github.io])
AC_CONFIG_HEADERS([src/include/config.h])
AM_INIT_AUTOMAKE([1.11 foreign dist-xz no-dist-gzip -Wall -Werror])
AM_SILENT_RULES([yes])
[with_bash_completion_dir=yes])
if test "x$with_bash_completion_dir" = "xyes"; then
- PKG_CHECK_MODULES([BASH_COMPLETION], [bash-completion >= 2.0],
- [BASH_COMPLETION_DIR="`pkg-config --variable=completionsdir bash-completion`"],
- [BASH_COMPLETION_DIR="${sysconfdir}/bash_completion.d"])
+ BASH_COMPLETION_DIR="${datadir}/bash-completion/completions"
else
BASH_COMPLETION_DIR="$with_bash_completion_dir"
fi
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
-BASH_COMPLETION_CFLAGS = @BASH_COMPLETION_CFLAGS@
BASH_COMPLETION_DIR = @BASH_COMPLETION_DIR@
-BASH_COMPLETION_LIBS = @BASH_COMPLETION_LIBS@
BAUDRATES = @BAUDRATES@
BAUDRATE_CASES = @BAUDRATE_CASES@
CC = @CC@
-.TH "tio" "1" "29 June 2016"
+.TH "tio" "1" "September 2017"
.SH "NAME"
tio \- a simple TTY terminal I/O application
Disable automatic connect.
-By default tio automatically connects to the provided device if present. If the device is not present it will wait for it to appear and then connect. If the connection is lost (eg. device disconnects) it will wait for the device to reappear and then reconnect.
+By default tio automatically connects to the provided device if present. If the device is not present, it will wait for it to appear and then connect. If the connection is lost (eg. device disconnects), it will wait for the device to reappear and then reconnect.
However, if the
.B \-\-no\-autoconnect
-option is provided tio will exit if the device is not present or exit if an established connection is lost.
+option is provided, tio will exit if the device is not present or an established connection is lost.
.TP
.BR \-l ", " "\-\-log " \fI<filename>
In session, the following key sequences are intercepted as tio commands:
.IP "\fBctrl-t ?"
List available key commands
+.IP "\fBctrl-t b"
+Send serial break (triggers SysRq on Linux, etc.)
.IP "\fBctrl-t c"
Show configuration (baudrate, databits, etc.)
+.IP "\fBctrl-t h"
+Toggle hexadecimal mode
.IP "\fBctrl-t l"
Clear screen
.IP "\fBctrl-t q"
include/tio/error.h
if ENABLE_BASH_COMPLETION
-
bashcompletiondir=@BASH_COMPLETION_DIR@
-dist_bashcompletion_DATA=bash-completion/tio
-
+bashcompletion_DATA=bash-completion/tio
endif
am__aclocal_m4_deps = $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
-DIST_COMMON = $(srcdir)/Makefile.am \
- $(am__dist_bashcompletion_DATA_DIST) $(am__DIST_COMMON)
+DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON)
mkinstalldirs = $(install_sh) -d
CONFIG_HEADER = $(top_builddir)/src/include/config.h
CONFIG_CLEAN_FILES =
n|no|NO) false;; \
*) (install-info --version) >/dev/null 2>&1;; \
esac
-am__dist_bashcompletion_DATA_DIST = bash-completion/tio
am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
am__vpath_adj = case $$p in \
$(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
|| { echo " ( cd '$$dir' && rm -f" $$files ")"; \
$(am__cd) "$$dir" && rm -f $$files; }; \
}
-DATA = $(dist_bashcompletion_DATA)
+DATA = $(bashcompletion_DATA)
am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
# Read a list of newline-separated strings from the standard input,
# and print each of them once, without duplicates. Input order is
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
-BASH_COMPLETION_CFLAGS = @BASH_COMPLETION_CFLAGS@
BASH_COMPLETION_DIR = @BASH_COMPLETION_DIR@
-BASH_COMPLETION_LIBS = @BASH_COMPLETION_LIBS@
BAUDRATES = @BAUDRATES@
BAUDRATE_CASES = @BAUDRATE_CASES@
CC = @CC@
include/tio/error.h
@ENABLE_BASH_COMPLETION_TRUE@bashcompletiondir = @BASH_COMPLETION_DIR@
-@ENABLE_BASH_COMPLETION_TRUE@dist_bashcompletion_DATA = bash-completion/tio
+@ENABLE_BASH_COMPLETION_TRUE@bashcompletion_DATA = bash-completion/tio
all: all-am
.SUFFIXES:
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
-install-dist_bashcompletionDATA: $(dist_bashcompletion_DATA)
+install-bashcompletionDATA: $(bashcompletion_DATA)
@$(NORMAL_INSTALL)
- @list='$(dist_bashcompletion_DATA)'; test -n "$(bashcompletiondir)" || list=; \
+ @list='$(bashcompletion_DATA)'; test -n "$(bashcompletiondir)" || list=; \
if test -n "$$list"; then \
echo " $(MKDIR_P) '$(DESTDIR)$(bashcompletiondir)'"; \
$(MKDIR_P) "$(DESTDIR)$(bashcompletiondir)" || exit 1; \
$(INSTALL_DATA) $$files "$(DESTDIR)$(bashcompletiondir)" || exit $$?; \
done
-uninstall-dist_bashcompletionDATA:
+uninstall-bashcompletionDATA:
@$(NORMAL_UNINSTALL)
- @list='$(dist_bashcompletion_DATA)'; test -n "$(bashcompletiondir)" || list=; \
+ @list='$(bashcompletion_DATA)'; test -n "$(bashcompletiondir)" || list=; \
files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
dir='$(DESTDIR)$(bashcompletiondir)'; $(am__uninstall_files_from_dir)
info-am:
-install-data-am: install-dist_bashcompletionDATA
+install-data-am: install-bashcompletionDATA
install-dvi: install-dvi-am
ps-am:
-uninstall-am: uninstall-binPROGRAMS uninstall-dist_bashcompletionDATA
+uninstall-am: uninstall-bashcompletionDATA uninstall-binPROGRAMS
.MAKE: install-am install-strip
clean-binPROGRAMS clean-generic cscopelist-am ctags ctags-am \
distclean distclean-compile distclean-generic distclean-tags \
distdir dvi dvi-am html html-am info info-am install \
- install-am install-binPROGRAMS install-data install-data-am \
- install-dist_bashcompletionDATA install-dvi install-dvi-am \
+ install-am install-bashcompletionDATA install-binPROGRAMS \
+ install-data install-data-am install-dvi install-dvi-am \
install-exec install-exec-am install-html install-html-am \
install-info install-info-am install-man install-pdf \
install-pdf-am install-ps install-ps-am install-strip \
installcheck installcheck-am installdirs maintainer-clean \
maintainer-clean-generic mostlyclean mostlyclean-compile \
mostlyclean-generic pdf pdf-am ps ps-am tags tags-am uninstall \
- uninstall-am uninstall-binPROGRAMS \
- uninstall-dist_bashcompletionDATA
+ uninstall-am uninstall-bashcompletionDATA \
+ uninstall-binPROGRAMS
.PRECIOUS: Makefile
+++ /dev/null
-#
-# Bash completion script for tio.
-#
-
-_tio()
-{
- local cur prev opts base
- COMPREPLY=()
- cur="${COMP_WORDS[COMP_CWORD]}"
- prev="${COMP_WORDS[COMP_CWORD-1]}"
-
- # The options we'll complete.
- opts="-b --baudrate \
- -d --databits \
- -f --flow \
- -s --stopbits \
- -p --parity \
- -o --output-delay \
- -n --no-autoconnect \
- -l --log \
- -v --version \
- -h --help"
-
- # Complete the arguments to the options.
- case "${prev}" in
- -b | --baudrate)
- local baudrates=" 0 50 75 110 134 150 200 300 600 1200 1800 2400 4800 9600 19200 38400 57600 115200 230400 460800 500000 576000 921600 1000000 1152000 1500000 2000000 2500000 3000000 3500000 4000000"
- COMPREPLY=( $(compgen -W "$baudrates" -- ${cur}) )
- return 0
- ;;
- -d | --databits)
- COMPREPLY=( $(compgen -W "5 6 7 8" -- ${cur}) )
- return 0
- ;;
- -f | --flow)
- COMPREPLY=( $(compgen -W "hard soft none" -- ${cur}) )
- return 0
- ;;
- -s | --stopbits)
- COMPREPLY=( $(compgen -W "1 2" -- ${cur}) )
- return 0
- ;;
- -p | --parity)
- COMPREPLY=( $(compgen -W "even odd none" -- ${cur}) )
- return 0
- ;;
- -o | --output-delay)
- COMPREPLY=( $(compgen -W "0 1 10 100" -- ${cur}) )
- return 0
- ;;
- -n | --no-autoconnect)
- COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
- return 0
- ;;
- -l | --log)
- COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
- return 0
- ;;
- -v | --version)
- COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
- return 0
- ;;
- -h | --help)
- COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
- return 0
- ;;
- *)
- ;;
- esac
-
- COMPREPLY=($(compgen -W "${opts}" -- ${cur}))
- return 0
-}
-
-# Bind completion to tio command
-complete -o default -F _tio tio
/*
* tio - a simple TTY terminal I/O application
*
- * Copyright (c) 2014-2016 Martin Lund
+ * Copyright (c) 2014-2017 Martin Lund
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
/*
* tio - a simple TTY terminal I/O application
*
- * Copyright (c) 2014-2016 Martin Lund
+ * Copyright (c) 2014-2017 Martin Lund
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
/*
* tio - a simple TTY terminal I/O application
*
- * Copyright (c) 2014-2016 Martin Lund
+ * Copyright (c) 2014-2017 Martin Lund
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
/*
* tio - a simple TTY terminal I/O application
*
- * Copyright (c) 2014-2016 Martin Lund
+ * Copyright (c) 2014-2017 Martin Lund
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
/*
* tio - a simple TTY terminal I/O application
*
- * Copyright (c) 2014-2016 Martin Lund
+ * Copyright (c) 2014-2017 Martin Lund
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
/*
* tio - a simple TTY terminal I/O application
*
- * Copyright (c) 2014-2016 Martin Lund
+ * Copyright (c) 2014-2017 Martin Lund
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
/*
* tio - a simple TTY terminal I/O application
*
- * Copyright (c) 2014-2016 Martin Lund
+ * Copyright (c) 2014-2017 Martin Lund
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
#define TTY_H
#define KEY_QUESTION 0x3f
+#define KEY_B 0x62
#define KEY_C 0x63
+#define KEY_H 0x68
#define KEY_L 0x6C
#define KEY_Q 0x71
#define KEY_S 0x73
#define KEY_T 0x74
#define KEY_CTRL_T 0x14
+#define NORMAL 0
+#define HEX 1
+
void stdout_configure(void);
void stdout_restore(void);
void tty_configure(void);
/*
* tio - a simple TTY terminal I/O application
*
- * Copyright (c) 2014-2016 Martin Lund
+ * Copyright (c) 2014-2017 Martin Lund
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
/*
* tio - a simple TTY terminal I/O application
*
- * Copyright (c) 2014-2016 Martin Lund
+ * Copyright (c) 2014-2017 Martin Lund
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
/*
* tio - a simple TTY terminal I/O application
*
- * Copyright (c) 2014-2016 Martin Lund
+ * Copyright (c) 2014-2017 Martin Lund
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
case 'v':
printf("tio v%s\n", VERSION);
- printf("Copyright (c) 2014-2016 Martin Lund\n");
+ printf("Copyright (c) 2014-2017 Martin Lund\n");
printf("\n");
printf("License GPLv2+: GNU GPL version 2 or later <http://gnu.org/licenses/gpl-2.0.html>.\n");
printf("This is free software: you are free to change and redistribute it.\n");
/*
* tio - a simple TTY terminal I/O application
*
- * Copyright (c) 2014-2016 Martin Lund
+ * Copyright (c) 2014-2017 Martin Lund
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
/*
* tio - a simple TTY terminal I/O application
*
- * Copyright (c) 2014-2016 Martin Lund
+ * Copyright (c) 2014-2017 Martin Lund
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
static bool connected = false;
static bool tainted = false;
static int fd;
+static bool print_mode = NORMAL;
+static void (*print)(char c);
#define tio_printf(format, args...) \
{ \
tainted = false; \
}
+static void print_hex(char c)
+{
+ printf("%02x ", (unsigned char) c);
+}
+
+static void print_normal(char c)
+{
+ putchar(c);
+}
+
void handle_command_sequence(char input_char, char previous_char, char *output_char, bool *forward)
{
char unused_char;
/* Handle escape key commands */
if (previous_char == KEY_CTRL_T)
{
+ /* Do not forward input char to output by default */
+ *forward = false;
+
switch (input_char)
{
case KEY_QUESTION:
tio_printf("Key commands:");
tio_printf(" ctrl-t ? List available key commands");
+ tio_printf(" ctrl-t b Send break");
tio_printf(" ctrl-t c Show configuration");
+ tio_printf(" ctrl-t h Toggle hexadecimal mode");
tio_printf(" ctrl-t l Clear screen");
tio_printf(" ctrl-t q Quit");
tio_printf(" ctrl-t s Show statistics");
tio_printf(" ctrl-t t Send ctrl-t key code");
- *forward = false;
break;
+
+ case KEY_B:
+ tcsendbreak(fd, 0);
+ break;
+
case KEY_C:
tio_printf("Configuration:");
tio_printf(" TTY device: %s", option.tty_device);
tio_printf(" Output delay: %d", option.output_delay);
if (option.log)
tio_printf(" Log file: %s", option.log_filename);
- *forward = false;
break;
+
+ case KEY_H:
+ /* Toggle hexadecimal printing mode */
+ if (print_mode == NORMAL)
+ {
+ print = print_hex;
+ print_mode = HEX;
+ tio_printf("Switched to hexadecimal mode");
+ }
+ else
+ {
+ print = print_normal;
+ print_mode = NORMAL;
+ tio_printf("Switched to normal mode");
+ }
+ break;
+
case KEY_L:
- status = system("clear");
- *forward = false;
+ /* Clear screen using ANSI/VT100 escape code */
+ printf("\033c");
+ fflush(stdout);
break;
+
case KEY_Q:
/* Exit upon ctrl-t q sequence */
exit(EXIT_SUCCESS);
+
case KEY_S:
/* Show tx/rx statistics upon ctrl-t s sequence */
tio_printf("Statistics:");
tio_printf(" Sent %lu bytes, received %lu bytes", tx_total, rx_total);
- *forward = false;
break;
+
case KEY_T:
/* Send ctrl-t key code upon ctrl-t t sequence */
*output_char = KEY_CTRL_T;
+ *forward = true;
break;
+
default:
/* Ignore unknown ctrl-t escaped keys */
- *forward = false;
break;
}
}
tio_printf("tio v%s", VERSION);
tio_printf("Press ctrl-t q to quit");
+ /* At start use normal print function */
+ print = print_normal;
+
/* Make sure we restore old stdout settings on exit */
atexit(&stdout_restore);
}
rx_total++;
/* Print received tty character to stdout */
- putchar(input_char);
+ print(input_char);
fflush(stdout);
/* Write to log */