summaryrefslogtreecommitdiffstats
path: root/misc-utils
diff options
context:
space:
mode:
authorKarel Zak2006-12-07 00:25:49 +0100
committerKarel Zak2006-12-07 00:25:49 +0100
commite8f2641919de90b488ce3788a7795b88311750b5 (patch)
tree68f3732da38ff1b21ec49780d7c830250329fec9 /misc-utils
parentImported from util-linux-2.11f tarball. (diff)
downloadkernel-qcow2-util-linux-e8f2641919de90b488ce3788a7795b88311750b5.tar.gz
kernel-qcow2-util-linux-e8f2641919de90b488ce3788a7795b88311750b5.tar.xz
kernel-qcow2-util-linux-e8f2641919de90b488ce3788a7795b88311750b5.zip
Imported from util-linux-2.11m tarball.
Diffstat (limited to 'misc-utils')
-rw-r--r--misc-utils/Makefile7
-rw-r--r--misc-utils/cal.c100
-rw-r--r--misc-utils/logger.19
-rw-r--r--misc-utils/namei.c15
-rw-r--r--misc-utils/replay.1179
-rwxr-xr-xmisc-utils/replay.pl79
-rw-r--r--misc-utils/script.17
-rw-r--r--misc-utils/script.c17
-rw-r--r--misc-utils/setterm.c4
9 files changed, 388 insertions, 29 deletions
diff --git a/misc-utils/Makefile b/misc-utils/Makefile
index 8edf14ed3..67350b709 100644
--- a/misc-utils/Makefile
+++ b/misc-utils/Makefile
@@ -7,6 +7,8 @@
include ../make_include
include ../MCONFIG
+# replay not added yet
+
# Where to put man pages?
MAN1= cal.1 chkdupexe.1 ddate.1 kill.1 \
@@ -49,7 +51,7 @@ endif
NEEDS_CURSES= setterm
NEEDS_OPENPTY= script
-all: $(BIN) $(USRBIN) $(USRBIN.NONSHADOW) $(USRGAMES)
+all: $(BIN) $(USRBIN) $(USRBIN.NONSHADOW)
$(NEEDS_CURSES):
ifeq "$(HAVE_NCURSES)" "yes"
@@ -74,6 +76,7 @@ $(NEEDS_OPENPTY):
cal.o: $(LIB)/errs.h
cal: cal.o $(ERR_O)
chkdupexe: chkdupexe.pl
+ddate: ddate.o
kill: kill.o procs.o
logger: logger.o
mcookie: mcookie.o md5.o
@@ -92,7 +95,7 @@ install: all
$(INSTALLDIR) $(BINDIR) $(USRBINDIR)
$(INSTALLBIN) $(BIN) $(BINDIR)
$(INSTALLBIN) $(USRBIN) $(USRBINDIR)
- $(INSTALLDIR) $(MAN1DIR) $(MAN8DIR)
+ $(INSTALLDIR) $(MAN1DIR)
$(INSTALLMAN) $(MAN1) $(MAN1DIR)
ifeq "$(HAVE_WRITE)" "no"
ifeq "$(USE_TTY_GROUP)" "yes"
diff --git a/misc-utils/cal.c b/misc-utils/cal.c
index 768b0a510..2af9ae188 100644
--- a/misc-utils/cal.c
+++ b/misc-utils/cal.c
@@ -45,6 +45,14 @@
* get traditional output when -3 is the default. I hope that
* enough people will like -3 as the default that one day the
* product can be shipped that way.
+ *
+ * 2001-05-07 Pablo Saratxaga <pablo@mandrakesoft.com>
+ * Fixed the bugs with multi-byte charset (zg: cjk, utf-8)
+ * displaying. made the 'month year' ("%s %d") header translatable
+ * so it can be adapted to conventions used by different languages
+ * added support to read "first_weekday" locale information
+ * still to do: support for 'cal_direction' (will require a major
+ * rewrite of the displaying) and proper handling of RTL scripts
*/
#include <sys/types.h>
@@ -66,6 +74,8 @@
# include <localeinfo.h> /* libc4 only */
#endif
+#include "widechar.h"
+
/* allow compile-time define to over-ride default */
#ifndef NUM_MONTHS
#define NUM_MONTHS 1
@@ -115,9 +125,17 @@ int sep1752[MAXDAYS] = {
SPACE
};
-char day_headings[] = " S M Tu W Th F S ";
+#define DAY_LEN 3 /* 3 spaces per day */
+#define J_DAY_LEN 4 /* 4 spaces per day */
+#define WEEK_LEN 21 /* 7 days * 3 characters */
+#define J_WEEK_LEN 28 /* 7 days * 4 characters */
+#define HEAD_SEP 2 /* spaces between day headings */
+#define J_HEAD_SEP 2
+
+/* utf-8 can have up to 6 bytes per char; and an extra byte for ending \0 */
+char day_headings[WEEK_LEN*6+1];
/* week1stday = 1 => " M Tu W Th F S S " */
-char j_day_headings[] = "Sun Mon Tue Wed Thu Fri Sat ";
+char j_day_headings[J_WEEK_LEN*6+1];
/* week1stday = 1 => " M Tu W Th F S S " */
const char *full_month[12];
@@ -139,7 +157,7 @@ const char *full_month[12];
((yr) / 4 - centuries_since_1700(yr) + quad_centuries_since_1700(yr))
/* 0 => sunday (default), 1 => monday */
-int week1stday;
+int week1stday=0;
int julian;
#define FMT_ST_LINES 8
@@ -180,6 +198,12 @@ main(int argc, char **argv) {
setlocale(LC_ALL, "");
bindtextdomain(PACKAGE, LOCALEDIR);
textdomain(PACKAGE);
+
+#if 0 /* setting week1stday is against man page */
+#ifdef HAVE_langinfo_h
+ week1stday = (int)(nl_langinfo(_NL_TIME_FIRST_WEEKDAY))[0];
+#endif
+#endif
yflag = 0;
while ((ch = getopt(argc, argv, "13mjyV")) != EOF)
@@ -243,19 +267,28 @@ main(int argc, char **argv) {
exit(0);
}
-#define DAY_LEN 3 /* 3 spaces per day */
-#define J_DAY_LEN 4 /* 4 spaces per day */
-#define WEEK_LEN 21 /* 7 days * 3 characters */
-#define J_WEEK_LEN 28 /* 7 days * 4 characters */
-#define HEAD_SEP 2 /* spaces between day headings */
-#define J_HEAD_SEP 2
+#ifndef ENABLE_WIDECHAR
+static char *eos(char *s) {
+ while (s && *s)
+ s++;
+ return s;
+}
+#endif
void headers_init(void)
{
int i, wd;
+#ifdef ENABLE_WIDECHAR
+ wchar_t day_headings_wc[22],j_day_headings_wc[29];
+ wchar_t wd_wc[10];
+#endif
strcpy(day_headings,"");
strcpy(j_day_headings,"");
+#ifdef ENABLE_WIDECHAR
+ wcscpy(day_headings_wc,L"");
+ wcscpy(j_day_headings_wc,L"");
+#endif
#ifdef HAVE_langinfo_h
# define weekday(wd) nl_langinfo(ABDAY_1+wd)
@@ -265,14 +298,29 @@ void headers_init(void)
for(i = 0 ; i < 7 ; i++ ) {
wd = (i + week1stday) % 7;
- strncat(day_headings,weekday(wd),2);
- strncat(j_day_headings,weekday(wd),3);
- if (strlen(weekday(wd)) == 2)
- strcat(j_day_headings," ");
- strcat(day_headings," ");
- strcat(j_day_headings," ");
+#ifdef ENABLE_WIDECHAR
+ mbstowcs(wd_wc,weekday(wd),10);
+ if (wcslen(wd_wc) < 3)
+ wcscat(j_day_headings_wc,L" ");
+ if (wcslen(wd_wc) < 2) {
+ wcscat(day_headings_wc, L" ");
+ wcscat(j_day_headings_wc, L" ");
+ }
+ wcsncat(day_headings_wc,wd_wc,2);
+ wcsncat(j_day_headings_wc,wd_wc,3);
+ wcscat(day_headings_wc, L" ");
+ wcscat(j_day_headings_wc, L" ");
+#else
+ sprintf(eos(day_headings), "%2.2s ", weekday(wd));
+ sprintf(eos(j_day_headings), "%3.3s ", weekday(wd));
+#endif
}
+#ifdef ENABLE_WIDECHAR
+ wcstombs(day_headings,day_headings_wc,sizeof(day_headings));
+ wcstombs(j_day_headings,j_day_headings_wc,sizeof(j_day_headings));
+#endif
+
#undef weekday
for (i = 0; i < 12; i++) {
@@ -291,9 +339,20 @@ do_monthly(month, year, out)
{
int col, row, len, days[MAXDAYS];
char *p, lineout[300];
-
+#ifdef ENABLE_WIDECHAR
+ wchar_t lineout_wc[300];
+#endif
+
day_array(month, year, days);
- len = sprintf(lineout, "%s %d", full_month[month - 1], year);
+ /* %s is the month name, %d the year number.
+ * you can change the order and/or add something her; eg for
+ * Basque the translation should be: "%2$dko %1$s", and
+ * the Vietnamese should be "%s na(m %d", etc.
+ */
+ len = sprintf(lineout, _("%s %d"), full_month[month - 1], year);
+#ifdef ENABLE_WIDECHAR
+ len = mbstowcs(lineout_wc,lineout,len);
+#endif
(void)sprintf(out->s[0],"%*s%s",
((julian ? J_WEEK_LEN : WEEK_LEN) - len) / 2, "", lineout );
(void)sprintf(out->s[1],"%s",
@@ -567,8 +626,15 @@ center(str, len, separate)
int len;
int separate;
{
+#ifdef ENABLE_WIDECHAR
+ wchar_t str_wc[300];
+ int str_len;
+ str_len = mbstowcs(str_wc,str,300);
+ len -= str_len;
+#else
len -= strlen(str);
+#endif
(void)printf("%*s%s%*s", len / 2, "", str, len / 2 + len % 2, "");
if (separate)
(void)printf("%*s", separate, "");
diff --git a/misc-utils/logger.1 b/misc-utils/logger.1
index 2c154ec09..6e6f831be 100644
--- a/misc-utils/logger.1
+++ b/misc-utils/logger.1
@@ -102,9 +102,12 @@ a sensitive nature), cron, daemon, ftp, kern, lpr, mail, news,
security (deprecated synonym for auth), syslog, user, uucp, and local0
to local7, inclusive.
.Pp
-Valid level names are: alert, crit, debug, emerg, err, error
-(deprecated synonym for err), info, notice, panic (deprecated synonym
-for emerg), warning, warn (deprecated synonym for warning).
+Valid level names are):
+alert, crit, debug, emerg, err, error (deprecated synonym for err),
+info, notice, panic (deprecated synonym for emerg), warning,
+warn (deprecated synonym for warning).
+For the priority order and intended purposes of these levels, see
+.Xr syslog 3 .
.Sh EXAMPLES
.Bd -literal -offset indent -compact
logger System rebooted
diff --git a/misc-utils/namei.c b/misc-utils/namei.c
index 783c5b9b6..60ec98a93 100644
--- a/misc-utils/namei.c
+++ b/misc-utils/namei.c
@@ -98,7 +98,9 @@ main(int argc, char **argv) {
}
if(getcwd(curdir, sizeof(curdir)) == NULL){
- (void)fprintf(stderr, _("namei: unable to get current directory - %s\n"), curdir);
+ (void)fprintf(stderr,
+ _("namei: unable to get current directory - %s\n"),
+ curdir);
exit(1);
}
@@ -109,7 +111,9 @@ main(int argc, char **argv) {
namei(argv[optind], 0);
if(chdir(curdir) == -1){
- (void)fprintf(stderr, _("namei: unable to chdir to %s - %s (%d)\n"), curdir, ERR);
+ (void)fprintf(stderr,
+ _("namei: unable to chdir to %s - %s (%d)\n"),
+ curdir, ERR);
exit(1);
}
}
@@ -163,6 +167,11 @@ namei(char *file, int lev) {
for(;;){
+ if (strlen(file) >= BUFSIZ) {
+ fprintf(stderr,_("namei: buf overflow\n"));
+ return;
+ }
+
/*
* Copy up to the next / (or nil) into buf
*/
@@ -228,7 +237,7 @@ namei(char *file, int lev) {
case S_IFLNK:
/*
- * Sigh, another symlink. Read it's contents and
+ * Sigh, another symlink. Read its contents and
* call namei()
*/
diff --git a/misc-utils/replay.1 b/misc-utils/replay.1
new file mode 100644
index 000000000..578cadbc5
--- /dev/null
+++ b/misc-utils/replay.1
@@ -0,0 +1,179 @@
+.\" Automatically generated by Pod::Man version 1.02
+.\" Mon Sep 3 02:16:06 2001
+.\"
+.\" Standard preamble:
+.\" ======================================================================
+.de Sh \" Subsection heading
+.br
+.if t .Sp
+.ne 5
+.PP
+\fB\\$1\fR
+.PP
+..
+.de Sp \" Vertical space (when we can't use .PP)
+.if t .sp .5v
+.if n .sp
+..
+.de Ip \" List item
+.br
+.ie \\n(.$>=3 .ne \\$3
+.el .ne 3
+.IP "\\$1" \\$2
+..
+.de Vb \" Begin verbatim text
+.ft CW
+.nf
+.ne \\$1
+..
+.de Ve \" End verbatim text
+.ft R
+
+.fi
+..
+.\" Set up some character translations and predefined strings. \*(-- will
+.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
+.\" double quote, and \*(R" will give a right double quote. | will give a
+.\" real vertical bar. \*(C+ will give a nicer C++. Capital omega is used
+.\" to do unbreakable dashes and therefore won't be available. \*(C` and
+.\" \*(C' expand to `' in nroff, nothing in troff, for use with C<>
+.tr \(*W-|\(bv\*(Tr
+.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
+.ie n \{\
+. ds -- \(*W-
+. ds PI pi
+. if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
+. if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch
+. ds L" ""
+. ds R" ""
+. ds C` `
+. ds C' '
+'br\}
+.el\{\
+. ds -- \|\(em\|
+. ds PI \(*p
+. ds L" ``
+. ds R" ''
+'br\}
+.\"
+.\" If the F register is turned on, we'll generate index entries on stderr
+.\" for titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and
+.\" index entries marked with X<> in POD. Of course, you'll have to process
+.\" the output yourself in some meaningful fashion.
+.if \nF \{\
+. de IX
+. tm Index:\\$1\t\\n%\t"\\$2"
+. .
+. nr % 0
+. rr F
+.\}
+.\"
+.\" For nroff, turn off justification. Always turn off hyphenation; it
+.\" makes way too many mistakes in technical documents.
+.hy 0
+.if n .na
+.\"
+.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
+.\" Fear. Run. Save yourself. No user-serviceable parts.
+.bd B 3
+. \" fudge factors for nroff and troff
+.if n \{\
+. ds #H 0
+. ds #V .8m
+. ds #F .3m
+. ds #[ \f1
+. ds #] \fP
+.\}
+.if t \{\
+. ds #H ((1u-(\\\\n(.fu%2u))*.13m)
+. ds #V .6m
+. ds #F 0
+. ds #[ \&
+. ds #] \&
+.\}
+. \" simple accents for nroff and troff
+.if n \{\
+. ds ' \&
+. ds ` \&
+. ds ^ \&
+. ds , \&
+. ds ~ ~
+. ds /
+.\}
+.if t \{\
+. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
+. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
+. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
+. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
+. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
+. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
+.\}
+. \" troff and (daisy-wheel) nroff accents
+.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
+.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
+.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
+.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
+.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
+.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
+.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
+.ds ae a\h'-(\w'a'u*4/10)'e
+.ds Ae A\h'-(\w'A'u*4/10)'E
+. \" corrections for vroff
+.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
+.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
+. \" for low resolution devices (crt and lpr)
+.if \n(.H>23 .if \n(.V>19 \
+\{\
+. ds : e
+. ds 8 ss
+. ds o a
+. ds d- d\h'-1'\(ga
+. ds D- D\h'-1'\(hy
+. ds th \o'bp'
+. ds Th \o'LP'
+. ds ae ae
+. ds Ae AE
+.\}
+.rm #[ #] #H #V #F C
+.\" ======================================================================
+.\"
+.IX Title "REPLAY 1"
+.TH REPLAY 1 "perl v5.6.0" "2001-09-03" "User Contributed Perl Documentation"
+.UC
+.SH "NAME"
+replay \- play back typescripts, using timing information
+.SH "SYNOPSIS"
+.IX Header "SYNOPSIS"
+replay timingfile [typescript [divisor]]
+.SH "DESCRIPTION"
+.IX Header "DESCRIPTION"
+This program replays a typescript, using timing information to ensure that
+output happens at the same speed as it originally appeared when the script
+was recorded. It is only guaranteed to work preperly if run on the same
+terminal the script was recorded on.
+.PP
+The timings information is what script outputs to standard error if it is
+run with the \-t parameter.
+.PP
+By default, the typescript to display is assumed to be named \*(L"typescript\*(R",
+but other filenames may be specified, as the second parameter.
+.PP
+If the third parameter exits, it is used as a time divisor. For example,
+specifying a divisor of 2 makes the script be replayed twice as fast.
+.SH "EXAMPLE"
+.IX Header "EXAMPLE"
+.Vb 7
+\& % script -t 2> timingfile
+\& Script started, file is typescript
+\& % ls
+\& <etc, etc>
+\& % exit
+\& Script done, file is typescript
+\& % replay timingfile
+.Ve
+.SH "COPYRIGHT"
+.IX Header "COPYRIGHT"
+This program is in the public domain.
+.SH "AUTHOR"
+.IX Header "AUTHOR"
+Joey Hess <joey@kitenet.net>
diff --git a/misc-utils/replay.pl b/misc-utils/replay.pl
new file mode 100755
index 000000000..78564d6be
--- /dev/null
+++ b/misc-utils/replay.pl
@@ -0,0 +1,79 @@
+#!/usr/bin/perl -w
+
+# "script -t" will output a typescript with timings
+# this script "replay" replays it
+# run pod2man on it to get a man page
+
+=head1 NAME
+
+replay - play back typescripts, using timing information
+
+=head1 SYNOPSIS
+
+replay timingfile [typescript [divisor]]
+
+=head1 DESCRIPTION
+
+This program replays a typescript, using timing information to ensure that
+output happens at the same speed as it originally appeared when the script
+was recorded. It is only guaranteed to work preperly if run on the same
+terminal the script was recorded on.
+
+The timings information is what script outputs to standard error if it is
+run with the -t parameter.
+
+By default, the typescript to display is assumed to be named "typescript",
+but other filenames may be specified, as the second parameter.
+
+If the third parameter exits, it is used as a time divisor. For example,
+specifying a divisor of 2 makes the script be replayed twice as fast.
+
+=head1 EXAMPLE
+
+ % script -t 2> timingfile
+ Script started, file is typescript
+ % ls
+ <etc, etc>
+ % exit
+ Script done, file is typescript
+ % replay timingfile
+
+=cut
+
+use strict;
+$|=1;
+open (TIMING, shift)
+ or die "cannot read timing info: $!";
+open (TYPESCRIPT, shift || 'typescript')
+ or die "cannot read typescriot: $!";
+my $divisor=shift || 1;
+
+# Read starting timestamp line and ignore.
+<TYPESCRIPT>;
+
+my $block;
+my $oldblock='';
+while (<TIMING>) {
+ my ($delay, $blocksize)=split ' ', $_, 2;
+ # Sleep, unless the delay is really tiny. Realy tiny delays cannot
+ # be accurately done, because the system calls in this loop will
+ # have more overhead. The 0.0001 is arbitrary, but works fairly well.
+ if ($delay / $divisor > 0.0001) {
+ select(undef, undef, undef, $delay / $divisor - 0.0001);
+ }
+
+ read(TYPESCRIPT, $block, $blocksize)
+ or die "read filure on typescript: $!";
+ print $oldblock;
+ $oldblock=$block;
+}
+print $oldblock;
+
+=head1 COPYRIGHT
+
+This program is in the public domain.
+
+=head1 AUTHOR
+
+Joey Hess <joey@kitenet.net>
+
diff --git a/misc-utils/script.1 b/misc-utils/script.1
index 3edd82d4b..545ac3bc6 100644
--- a/misc-utils/script.1
+++ b/misc-utils/script.1
@@ -42,6 +42,7 @@
.Op Fl a
.Op Fl f
.Op Fl q
+.Op Fl t
.Op Ar file
.Sh DESCRIPTION
.Nm Script
@@ -74,6 +75,12 @@ One person does `mkfifo foo; script -f foo' and another can
supervise real-time what is being done using `cat foo'.
.It Fl q
Be quiet.
+.It Fl t
+Output timeing data to standard error. This data contains two fields,
+separated by a space. The first field indicates how much time elapsed since
+the previous output. The second field indicates how many characters were
+output this time. This information can be used to replay typescripts with
+realistic typing and output delays.
.El
.Pp
The script ends when the forked shell exits (a
diff --git a/misc-utils/script.c b/misc-utils/script.c
index de158cd35..973e80aa6 100644
--- a/misc-utils/script.c
+++ b/misc-utils/script.c
@@ -93,6 +93,7 @@ char line[] = "/dev/ptyXX";
int aflg = 0;
int fflg = 0;
int qflg = 0;
+int tflg = 0;
static char *progname;
@@ -134,7 +135,7 @@ main(int argc, char **argv) {
}
}
- while ((ch = getopt(argc, argv, "afq")) != EOF)
+ while ((ch = getopt(argc, argv, "afqt")) != EOF)
switch((char)ch) {
case 'a':
aflg++;
@@ -145,10 +146,13 @@ main(int argc, char **argv) {
case 'q':
qflg++;
break;
+ case 't':
+ tflg++;
+ break;
case '?':
default:
fprintf(stderr,
- _("usage: script [-a] [-f] [-q] [file]\n"));
+ _("usage: script [-a] [-f] [-q] [-t] [file]\n"));
exit(1);
}
argc -= optind;
@@ -239,6 +243,8 @@ dooutput() {
register int cc;
time_t tvec;
char obuf[BUFSIZ];
+ struct timeval tv;
+ double oldtime=time(NULL), newtime;
(void) close(0);
#ifdef HAVE_openpty
@@ -247,9 +253,16 @@ dooutput() {
tvec = time((time_t *)NULL);
fprintf(fscript, _("Script started on %s"), ctime(&tvec));
for (;;) {
+ if (tflg)
+ gettimeofday(&tv, NULL);
cc = read(master, obuf, sizeof (obuf));
if (cc <= 0)
break;
+ if (tflg) {
+ newtime=tv.tv_sec + (double) tv.tv_usec / 1000000;
+ fprintf(stderr, "%f %i\n", newtime - oldtime, cc);
+ oldtime=newtime;
+ }
(void) write(1, obuf, cc);
(void) fwrite(obuf, 1, cc, fscript);
if (fflg)
diff --git a/misc-utils/setterm.c b/misc-utils/setterm.c
index 2e265fc51..435e7e482 100644
--- a/misc-utils/setterm.c
+++ b/misc-utils/setterm.c
@@ -290,10 +290,10 @@ par_color(int argc, char **argv, int *option, int *opt_color, int *bad_arg) {
*opt_color = DEFAULT;
else if (isdigit(argv[0][0]))
*opt_color = atoi(argv[0]);
- else
+ else
*bad_arg = TRUE;
- if(*opt_color < 0 || *opt_color > 7)
+ if(*opt_color < 0 || *opt_color > 9 || *opt_color == 8)
*bad_arg = TRUE;
}
}