Unificate and improve both man page and usage message of expect

This commit is contained in:
Vitezslav Crhonek 2018-08-29 13:14:54 +02:00
parent 9db4b2f011
commit 0623976f9d
2 changed files with 74 additions and 1 deletions

View File

@ -0,0 +1,67 @@
diff -up expect5.45.4/expect.man.orig expect5.45.4/expect.man
--- expect5.45.4/expect.man.orig 2018-08-29 10:43:24.112949065 +0200
+++ expect5.45.4/expect.man 2018-08-29 10:45:47.652044587 +0200
@@ -4,7 +4,7 @@ expect \- programmed dialogue with inter
.SH SYNOPSIS
.B expect
[
-.B \-dDinN
+.B \-dDhinNv
]
[
.B \-c
@@ -180,6 +180,9 @@ problems when reading from a fifo or std
If the string "\-" is supplied as a filename, standard input is read instead.
(Use "./\-" to read from a file actually named "\-".)
.PP
+.B \-h
+causes Expect to print its usage message and exit.
+.PP
The
.B \-i
flag causes
diff -up expect5.45.4/exp_main_sub.c.orig expect5.45.4/exp_main_sub.c
--- expect5.45.4/exp_main_sub.c.orig 2018-02-04 11:43:58.000000000 +0100
+++ expect5.45.4/exp_main_sub.c 2018-08-29 11:04:44.307916140 +0200
@@ -72,7 +72,21 @@ usage(interp)
Tcl_Interp *interp;
{
char buffer [] = "exit 1";
- expErrorLog("usage: expect [-div] [-c cmds] [[-f] cmdfile] [args]\r\n");
+ expErrorLog("usage: expect [-dDhinNv] [-c cmds] [[-[f|b]] cmdfile] [args]\r\n"
+ " Flags are as follows:\r\n"
+ " -b prefaces a file from which to read commands from\r\n"
+ " (expect reads one line at a timei from the file)\r\n"
+ " -c prefaces a command to be executed before any in the script,\r\n"
+ " may be used multiple times\r\n"
+ " -d enables diagnostic output\r\n"
+ " -D enables interactive debugger\r\n"
+ " -f prefaces a file from which to read commands from\r\n"
+ " (expect reads the whole file at once)\r\n"
+ " -h prints this usage message and exits\r\n"
+ " -i interactively prompts for commands\r\n"
+ " -n expect doesn't read personal rc file\r\n"
+ " -N expect doesn't read system-wide rc file\r\n"
+ " -v prints version and exits\r\n");
/* SF #439042 -- Allow overide of "exit" by user / script
*/
@@ -700,7 +714,7 @@ char **argv;
* and generate a usage message.
*/
- while ((c = getopt(argc, argv, "+b:c:dD:f:inN-v")) != EOF) {
+ while ((c = getopt(argc, argv, "+b:c:dD:f:inN-vh")) != EOF) {
switch(c) {
case '-':
/* getopt already handles -- internally, however */
@@ -768,6 +782,9 @@ char **argv;
Tcl_Eval(interp, buffer);
}
break;
+ case 'h':
+ usage(interp);
+ break;
default: usage(interp);
}
}

View File

@ -5,7 +5,7 @@
Summary: A program-script interaction and testing utility
Name: expect
Version: %{majorver}
Release: 5%{?dist}
Release: 6%{?dist}
License: Public Domain
URL: https://core.tcl.tk/expect/index
Source: http://downloads.sourceforge.net/%{name}/%{name}%{version}.tar.gz
@ -27,6 +27,8 @@ Patch5: expect-5.45-exp-log-buf-overflow.patch
Patch6: expect-5.45-segfault-with-stubs.patch
# Patch7: fixes leaked fd, patch by Matej Mužila, rhbz#1001220
Patch7: expect-5.45-fd-leak.patch
# Patch8: unificates usage message of expect binary and man page, adds -h flag
Patch8: expect-5.45.4-unification-of-usage-and-man-page.patch
# examples patches
# Patch100: changes random function
Patch100: expect-5.32.2-random.patch
@ -88,6 +90,7 @@ of expectk.
%patch5 -p1 -b .exp-log-buf-overflow
%patch6 -p1 -b .segfault-with-stubs
%patch7 -p1 -b .fd-leak
%patch8 -p1 -b .unification-of-usage-and-man-page
# examples fixes
%patch100 -p1 -b .random
%patch101 -p1 -b .mkpasswd-dash
@ -171,6 +174,9 @@ chrpath --delete $RPM_BUILD_ROOT%{_libdir}/libexpect%{version}.so
%{_mandir}/man1/tknewsbiff.1*
%changelog
* Wed Aug 29 2018 Vitezslav Crhonek <vcrhonek@redhat.com> - 5.45.4-6
- Unificate and improve both man page and usage message of expect
* Fri Jul 13 2018 Fedora Release Engineering <releng@fedoraproject.org> - 5.45.4-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild