summaryrefslogtreecommitdiffstats
path: root/misc-utils
diff options
context:
space:
mode:
Diffstat (limited to 'misc-utils')
-rw-r--r--misc-utils/cal.c7
-rw-r--r--misc-utils/ddate.c36
-rw-r--r--misc-utils/kill.c1
-rw-r--r--misc-utils/kill.h1
-rw-r--r--misc-utils/logger.c23
-rw-r--r--misc-utils/md5.h2
-rw-r--r--misc-utils/namei.c42
-rw-r--r--misc-utils/procs.c9
-rw-r--r--misc-utils/rename.c4
-rw-r--r--misc-utils/script.c48
-rw-r--r--misc-utils/setterm.1229
-rw-r--r--misc-utils/setterm.c1606
-rw-r--r--misc-utils/tsort.c77
-rw-r--r--misc-utils/whereis.c5
-rw-r--r--misc-utils/write.c28
15 files changed, 1108 insertions, 1010 deletions
diff --git a/misc-utils/cal.c b/misc-utils/cal.c
index fe35e1851..bc0c1eff5 100644
--- a/misc-utils/cal.c
+++ b/misc-utils/cal.c
@@ -63,7 +63,7 @@
#define THURSDAY 4 /* for reformation */
#define SATURDAY 6 /* 1 Jan 1 was a Saturday */
-#define FIRST_MISSING_DAY 639787 /* 3 Sep 1752 */
+#define FIRST_MISSING_DAY 639799 /* 3 Sep 1752 */
#define NUMBER_MISSING_DAYS 11 /* 11 day correction */
#define MAXDAYS 43 /* max slots in a month array */
@@ -141,10 +141,7 @@ void headers_init(void);
extern char *__progname;
int
-main(argc, argv)
- int argc;
- char **argv;
-{
+main(int argc, char **argv) {
struct tm *local_time;
time_t now;
int ch, month, year, yflag;
diff --git a/misc-utils/ddate.c b/misc-utils/ddate.c
index f00a8fd07..304c31c60 100644
--- a/misc-utils/ddate.c
+++ b/misc-utils/ddate.c
@@ -29,6 +29,8 @@
1999-02-22 Arkadiusz Mi¶kiewicz <misiek@misiek.eu.org>
- added Native Language Support
+ 2000-03-17 Burt Holzman <bnh@iname.com>
+ - added range checks for dates
*/
#include "../defines.h" /* for util-linux-version */
@@ -129,13 +131,21 @@ default_fmt
#define DY(y) (y+1166)
-inline char *ending(int i) { return (i%10==1)?"st":(i%10==2?"nd":(i%10==3?"rd":"th"));};
-inline int leapp(int i) { return (!(DY(i)%4))&&((DY(i)%100)||(!(DY(i)%400)));};
+static inline char *ending(int i) {
+ return (i%10==1)?"st":(i%10==2?"nd":(i%10==3?"rd":"th"));
+}
+
+static inline int leapp(int i) {
+ return (!(DY(i)%4))&&((DY(i)%100)||(!(DY(i)%400)));
+}
+
+/* select a random string */
+static inline char *sel(char **strings, int num) {
+ return(strings[random()%num]);
+}
void print(struct disc_time,char **); /* old */
void format(char *buf, const char* fmt, struct disc_time dt);
-/* select a random string */
-inline char *sel(char **strings, int num) {return(strings[random()%num]); };
/* read a fortune file */
int load_fortunes(char *fn, char *delim, char** result);
@@ -186,6 +196,10 @@ main (int argc, char *argv[])
larry,moe,
#endif
curly);
+ if (hastur.season == -1) {
+ printf("Invalid date -- out of range\n");
+ return -1;
+ }
fnord=fnord?fnord:default_fmt;
} else if (argc!=pi) {
usage:
@@ -201,6 +215,7 @@ main (int argc, char *argv[])
}
format(schwa, fnord, hastur);
printf("%s\n", schwa);
+
return 0;
}
@@ -282,6 +297,19 @@ struct disc_time makeday(int imonth,int iday,int iyear) /*i for input */
int cal[12] = { 31,28,31,30,31,30,31,31,30,31,30,31 };
int dayspast=0;
+
+ /* basic range checks */
+ if (imonth < 1 || imonth > 12) {
+ funkychickens.season = -1;
+ return funkychickens;
+ }
+ if (iday < 1 || iday > cal[imonth-1]) {
+ if (!(imonth == 2 && iday == 29 && iyear%4 == 0 &&
+ (iyear%100 != 0 || iyear%400 == 0))) {
+ funkychickens.season = -1;
+ return funkychickens;
+ }
+ }
imonth--;
funkychickens.year= iyear+1166;
diff --git a/misc-utils/kill.c b/misc-utils/kill.c
index 5372f5216..ea4e4682d 100644
--- a/misc-utils/kill.c
+++ b/misc-utils/kill.c
@@ -48,6 +48,7 @@
#include <ctype.h>
#include <unistd.h>
#include <signal.h>
+#include "kill.h"
#include "nls.h"
#define SIZE(a) (sizeof(a)/sizeof(a[0]))
diff --git a/misc-utils/kill.h b/misc-utils/kill.h
new file mode 100644
index 000000000..27a12a805
--- /dev/null
+++ b/misc-utils/kill.h
@@ -0,0 +1 @@
+extern int *get_pids (char *process_name, int get_all);
diff --git a/misc-utils/logger.c b/misc-utils/logger.c
index 9d848a660..372fe1ece 100644
--- a/misc-utils/logger.c
+++ b/misc-utils/logger.c
@@ -54,12 +54,10 @@ int decode __P((char *, CODE *));
int pencode __P((char *));
void usage __P((void));
-int
-myopenlog(sock)
- const char *sock;
-{
+static int
+myopenlog(const char *sock) {
int fd;
- static struct sockaddr s_addr; /* AF_UNIX address of local logger */
+ static struct sockaddr s_addr; /* AF_UNIX address of local logger */
s_addr.sa_family = AF_UNIX;
(void)strncpy(s_addr.sa_data, sock, sizeof(s_addr.sa_data));
@@ -76,14 +74,8 @@ myopenlog(sock)
return fd;
}
-void
-mysyslog(fd, logflags, pri, tag, msg)
- int fd;
- int logflags;
- int pri;
- char *tag;
- char *msg;
-{
+static void
+mysyslog(int fd, int logflags, int pri, char *tag, char *msg) {
char buf[1000], pid[30], *cp, *tp;
time_t now;
@@ -120,10 +112,7 @@ mysyslog(fd, logflags, pri, tag, msg)
* log.
*/
int
-main(argc, argv)
- int argc;
- char *argv[];
-{
+main(int argc, char **argv) {
int ch, logflags, pri;
char *tag, buf[1024];
char *usock = NULL;
diff --git a/misc-utils/md5.h b/misc-utils/md5.h
index e264f686d..b211ed24e 100644
--- a/misc-utils/md5.h
+++ b/misc-utils/md5.h
@@ -1,7 +1,7 @@
#ifndef MD5_H
#define MD5_H
-#ifdef __alpha
+#if defined (__alpha__) || defined (__ia64__)
typedef unsigned int uint32;
#else
typedef unsigned long uint32;
diff --git a/misc-utils/namei.c b/misc-utils/namei.c
index 2541d03bc..65faad4f3 100644
--- a/misc-utils/namei.c
+++ b/misc-utils/namei.c
@@ -47,17 +47,13 @@ chdir to /, or if it encounters an unknown file type.
#include <stdio.h>
#include <unistd.h>
#include <string.h>
+#include <errno.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/param.h>
#include "nls.h"
-#ifndef __GNU_LIBRARY__
-extern char *sys_errlist[];
-#endif
-
-extern int errno;
-#define ERR sys_errlist[errno],errno
+#define ERR strerror(errno),errno
int symcount;
int mflag = 0;
@@ -67,17 +63,14 @@ int xflag = 0;
#define MAXSYMLINKS 256
#endif
-static char *pperm();
+static char *pperm(unsigned short);
+static void namei(char *, int);
+static void usage(void);
int
-main(argc, argv)
-int argc;
-char *argv[];
-{
- void namei(), usage();
- int getopt();
+main(int argc, char **argv) {
extern int optind;
- register int c;
+ int c;
char curdir[MAXPATHLEN];
setlocale(LC_ALL, "");
@@ -122,9 +115,8 @@ char *argv[];
return 0;
}
-void
-usage()
-{
+static void
+usage(void) {
(void)fprintf(stderr,_("usage: namei [-mx] pathname [pathname ...]\n"));
exit(1);
}
@@ -133,16 +125,12 @@ usage()
#define NODEV (dev_t)(-1)
#endif
-void
-namei(file, lev)
-
-register char *file;
-register int lev;
-{
- register char *cp;
+static void
+namei(char *file, int lev) {
+ char *cp;
char buf[BUFSIZ], sym[BUFSIZ];
struct stat stb;
- register int i;
+ int i;
dev_t lastdev = NODEV;
/*
@@ -305,9 +293,7 @@ register int lev;
* For example 0755 produces "rwxr-xr-x"
*/
static char *
-pperm(mode)
-unsigned short mode;
-{
+pperm(unsigned short mode) {
unsigned short m;
static char buf[16];
char *bp;
diff --git a/misc-utils/procs.c b/misc-utils/procs.c
index fd0e5add3..715d9fb09 100644
--- a/misc-utils/procs.c
+++ b/misc-utils/procs.c
@@ -14,20 +14,21 @@
#define _POSIX_SOURCE 1
-#include <sys/types.h>
-#include <sys/stat.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <dirent.h>
#include <ctype.h>
#include <unistd.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include "kill.h"
extern char *mybasename (char *);
static char *parse_parens (char *buf);
-int *get_pids (char *process_name, int get_all)
-{
+int *
+get_pids (char *process_name, int get_all) {
DIR *dir;
struct dirent *ent;
int status;
diff --git a/misc-utils/rename.c b/misc-utils/rename.c
index af5ba44cc..05f8f19b2 100644
--- a/misc-utils/rename.c
+++ b/misc-utils/rename.c
@@ -21,7 +21,7 @@ for i in $@; do N=`echo "$i" | sed "s/$FROM/$TO/g"`; mv "$i" "$N"; done
static char *progname;
-int
+static int
do_rename(char *from, char *to, char *s) {
char *newname, *where, *p, *q;
int flen, tlen, slen;
@@ -49,7 +49,7 @@ do_rename(char *from, char *to, char *s) {
p = where+flen;
while (*p)
*q++ = *p++;
- *p = 0;
+ *q = 0;
if (rename(s, newname) != 0) {
int errsv = errno;
diff --git a/misc-utils/script.c b/misc-utils/script.c
index 283bc8fcb..cb7ae1a96 100644
--- a/misc-utils/script.c
+++ b/misc-utils/script.c
@@ -38,6 +38,10 @@
/*
* script
*/
+#include <stdio.h>
+#include <stdlib.h>
+#include <paths.h>
+#include <time.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <termios.h>
@@ -45,8 +49,6 @@
#include <sys/time.h>
#include <sys/file.h>
#include <sys/signal.h>
-#include <stdio.h>
-#include <paths.h>
#include "nls.h"
#ifdef __linux__
@@ -59,6 +61,7 @@
#include <pty.h>
#endif
+void finish(int);
void done(void);
void fail(void);
void fixtty(void);
@@ -86,14 +89,9 @@ char line[] = "/dev/ptyXX";
int aflg;
int
-main(argc, argv)
- int argc;
- char *argv[];
-{
+main(int argc, char **argv) {
extern int optind;
int ch;
- void finish();
- char *getenv();
setlocale(LC_ALL, "");
bindtextdomain(PACKAGE, LOCALEDIR);
@@ -152,8 +150,7 @@ main(argc, argv)
}
void
-doinput()
-{
+doinput() {
register int cc;
char ibuf[BUFSIZ];
@@ -169,8 +166,7 @@ doinput()
#include <sys/wait.h>
void
-finish()
-{
+finish(int dummy) {
union wait status;
register int pid;
register int die = 0;
@@ -184,11 +180,10 @@ finish()
}
void
-dooutput()
-{
+dooutput() {
register int cc;
- time_t tvec, time();
- char obuf[BUFSIZ], *ctime();
+ time_t tvec;
+ char obuf[BUFSIZ];
(void) close(0);
#ifdef HAVE_openpty
@@ -207,8 +202,7 @@ dooutput()
}
void
-doshell()
-{
+doshell() {
/***
int t;
@@ -235,8 +229,7 @@ doshell()
}
void
-fixtty()
-{
+fixtty() {
struct termios rtt;
rtt = tt;
@@ -246,18 +239,15 @@ fixtty()
}
void
-fail()
-{
+fail() {
(void) kill(0, SIGTERM);
done();
}
void
-done()
-{
- time_t tvec, time();
- char *ctime();
+done() {
+ time_t tvec;
if (subchild) {
tvec = time((time_t *)NULL);
@@ -272,8 +262,7 @@ done()
}
void
-getmaster()
-{
+getmaster() {
#ifdef HAVE_openpty
(void) tcgetattr(0, &tt);
(void) ioctl(0, TIOCGWINSZ, (char *)&win);
@@ -318,8 +307,7 @@ getmaster()
}
void
-getslave()
-{
+getslave() {
#ifndef HAVE_openpty
line[strlen("/dev/")] = 't';
slave = open(line, O_RDWR);
diff --git a/misc-utils/setterm.1 b/misc-utils/setterm.1
index 0dbbdf42e..6fffa219c 100644
--- a/misc-utils/setterm.1
+++ b/misc-utils/setterm.1
@@ -1,81 +1,192 @@
.\" Copyright 1990 Gordon Irlam (gordoni@cs.ua.oz.au)
.\" Copyright 1992 Rickard E. Faith (faith@cs.unc.edu)
-.\" Most of this was copied from the source code. Do not restrict distribution.
+.\" Most of this was copied from the source code.
+.\" Do not restrict distribution.
.\" May be distributed under the GNU General Public License
-.TH SETTERM 1 "2 July 1996" "Util-Linux 2.6" "Linux Programmer's Manual"
+.\"
+.\" Most options documented by Colin Watson (cjw44@cam.ac.uk)
+.\" Undocumented: -snow, -softscroll, -standout; these are
+.\" commented out in the source
+.\"
+.TH SETTERM 1 "7 January 2000" "Util-Linux 2.10" "Linux Programmer's Manual"
.SH NAME
setterm \- set terminal attributes
.SH SYNOPSIS
.nf
-.BR "setterm [ \-term " terminal_name " ]"
-.B "setterm [ \-reset ]"
-.B "setterm [ \-initialize ]"
-.B "setterm [ \-cursor [on|off] ]"
-.B "setterm [ \-repeat [on|off] ]"
-.B "setterm [ \-appcursorkeys [on|off] ]"
-.B "setterm [ \-linewrap [on|off] ]"
-.B "setterm [ \-snow [on|off] ]"
-.B "setterm [ \-softscroll [on|off] ]"
-.B "setterm [ \-defaults ]"
-.B "setterm [ \-foreground black|red|green|yellow|blue|magenta|cyan|white|default ]"
-.B "setterm [ \-background black|red|green|yellow|blue|magenta|cyan|white|default ]"
-.B "setterm [ \-ulcolor black|grey|red|green|yellow|blue|magenta|cyan|white ]"
-.B "setterm [ \-ulcolor bright red|green|yellow|blue|magenta|cyan|white ]"
-.B "setterm [ \-hbcolor black|grey|red|green|yellow|blue|magenta|cyan|white ]"
-.B "setterm [ \-hbcolor bright red|green|yellow|blue|magenta|cyan|white ]"
-.B "setterm [ \-inversescreen [on|off] ]"
-.B "setterm [ \-bold [on|off] ]"
-.B "setterm [ \-half-bright [on|off] ]"
-.B "setterm [ \-blink [on|off] ]"
-.B "setterm [ \-reverse [on|off] ]"
-.B "setterm [ \-underline [on|off] ]"
-.B "setterm [ \-store ]"
-.B "setterm [ \-clear [ all|rest ] ]"
-.BR "setterm [ \-tabs [tab1 tab2 tab3 ... ] ]" " where (tabn = 1-160)"
-.BR "setterm [ \-clrtabs [ tab1 tab2 tab3 ... ]" " where (tabn = 1-160)"
-.BR "setterm [ \-regtabs [" " 1-160 " "] ]"
-.BR "setterm [ \-blank [" " 0-60 " "] ]"
-.BR "setterm [ \-powersave [ on|vsync|hsync|powerdown|off ] ]"
-.BR "setterm [ \-powerdown [" " 0-60 " "] ]"
-.BR "setterm [ \-dump [" " 1-NR_CONS " "] ]"
-.BR "setterm [ \-append [" " 1-NR_CONS " "] ]"
-.BR "setterm [ \-file" " dumpfilename " ]
-.BR "setterm [ \-standout [" " attr " "] ]"
-.BR "setterm [ \-blength [" " 0-2000 " "] ]"
-.B "setterm [ \-bfreq freqnumber ]"
+.BR "setterm " [ options ]
.fi
.SH DESCRIPTION
.B setterm
-writes to standard output a character string that will invoke the specified
-terminal capabilities. Where possibile
+writes to standard output a character string that will invoke the
+specified terminal capabilities. Where possible
.I terminfo
-is consulted to find the string to use. Some options however do not
-correspond to a
+is consulted to find the string to use. Some options however (marked
+"virtual consoles only" below) do not correspond to a
.BR terminfo (5)
-capability. In this case, if the terminal type is "con", or
-"linux" the string that invokes the specified capabilities on the PC
-Minix virtual console driver is output. Options that are not implemented
-by the terminal are ignored.
+capability. In this case, if the terminal type is "con" or "linux" the
+string that invokes the specified capabilities on the PC Minix virtual
+console driver is output. Options that are not implemented by the terminal
+are ignored.
.SH OPTIONS
-Most options are self explanatory. The less obvious options are as
-follows:
+For boolean options (\fBon\fP or \fBoff\fP), the default is \fBon\fP.
+.P
+For conciseness, an \fI8-color\fP below is \fBblack\fP, \fBred\fP,
+\fBgreen\fP, \fByellow\fP, \fBblue\fP, \fBmagenta\fP, \fBcyan\fP, or
+\fBwhite\fP.
+.P
+A \fI16-color\fP is an \fI8-color\fP, \fBgrey\fP, or \fBbright\fP followed
+by \fBred\fP, \fBgreen\fP, \fByellow\fP, \fBblue\fP, \fBmagenta\fP,
+\fBcyan\fP, or \fBwhite\fP.
+.P
+The various color options may be set independently, at least at virtual
+consoles, though the results of setting multiple modes (for example,
+.BR \-underline " and " \-half-bright )
+are hardware-dependent.
.TP
-.B \-term
-can be used to override the TERM environment variable.
+.BR \-term " terminal_name"
+Overrides the TERM environment variable.
.TP
.B \-reset
-displays the terminal reset string, which typically resets the terminal to
+Displays the terminal reset string, which typically resets the terminal to
its power on state.
.TP
.B \-initialize
-displays the terminal initialization string, which typically sets the
+Displays the terminal initialization string, which typically sets the
terminal's rendering options, and other attributes to the default values.
.TP
+.BR \-cursor " [" on | off ]
+Turns the terminal's cursor on or off.
+.TP
+.BR \-repeat " [" on | off "] (virtual consoles only)"
+Turns keyboard repeat on or off.
+.TP
+.BR \-appcursorkeys " [" on | off "] (virtual consoles only)"
+Sets Cursor Key Application Mode on or off. When on, ESC O A, ESC O B, etc.
+will be sent for the cursor keys instead of ESC [ A, ESC [ B, etc. See the
+"vi and Cursor-Keys" section of the Text-Terminal-HOWTO for how this can
+cause problems for vi users.
+.TP
+.BR \-linewrap " [" on | off "] (virtual consoles only)"
+Turns automatic line-wrapping on or off.
+.TP
.B \-default
-sets the terminal's rendering options to the default values.
+Sets the terminal's rendering options to the default values.
+.TP
+\fB\-foreground\fP \fI8-color\fP|\fBdefault\fP (virtual consoles only)
+Sets the foreground text color.
+.TP
+\fB\-background\fP \fI8-color\fP|\fBdefault\fP (virtual consoles only)
+Sets the background text color.
+.TP
+\fB\-ulcolor\fP \fI16-color\fP (virtual consoles only)
+Sets the color for underlined characters.
+.TP
+\fB\-hbcolor\fP \fI16-color\fP (virtual consoles only)
+Sets the color for half-bright characters.
+.TP
+.BR \-inversescreen " [" on | off "] (virtual consoles only)"
+Inverts the screen colors. Foreground and background are swapped, as are
+underline and half-brightness.
+.TP
+.BR \-bold " [" on | off ]
+Turns bold (extra bright) mode on or off. Except at a virtual console,
+\fB\-bold off\fP turns off all attributes (bold, half-brightness, blink,
+reverse).
+.TP
+.BR \-half-bright " [" on | off ]
+Turns dim (half-brightness) mode on or off (see \fB\-hbcolor\fP). Except at
+a virtual console, \fB\-half-bright off\fP turns off all attributes (bold,
+half-brightness, blink, reverse).
+.TP
+.BR \-blink " [" on | off ]
+Turns blink mode on or off. Except at a virtual console, \fB\-blink off\fP
+turns off all attributes (bold, half-brightness, blink, reverse).
+.TP
+.BR \-reverse " [" on | off ]
+Turns reverse video mode on or off. Except at a virtual console,
+\fB\-reverse off\fP turns off all attributes (bold, half-brightness, blink,
+reverse).
+.TP
+.BR \-underline " [" on | off ]
+Turns underline mode on or off (see \fB\-ulcolor\fP).
+.TP
+.BR \-store " (virtual consoles only)"
+Stores the terminal's current rendering options as the default values.
+.TP
+.BR \-clear " [" all ]
+Clears the screen and "homes" the cursor, as
+.BR clear (1).
+.TP
+.B \-clear rest
+Clears from the current cursor position to the end of the screen.
+.TP
+.BR \-tabs " [tab1 tab2 tab3 ...] (virtual consoles only)"
+Sets tab stops at the given horizontal cursor positions, in the range 1-160.
+Without arguments, shows the current tab stop settings.
+.TP
+.BR \-clrtabs " [tab1 tab2 tab3 ...] (virtual consoles only)"
+Clears tab stops from the given horizontal cursor positions, in the range
+1-160. Without arguments, clears all tab stops.
+.TP
+.BR \-regtabs " [1-160] (virtual consoles only)"
+Clears all tab stops, then sets a regular tab stop pattern, with one tab
+every specified number of positions. Without an argument, defaults to 8.
+.TP
+.BR \-blank " [0-60] (virtual consoles only)"
+Sets the interval of inactivity, in minutes, after which the screen will be
+automatically blanked (using APM if available). Without an argument,
+defaults to 0 (disable console blanking).
+.TP
+.BR \-dump " [1-NR_CONS]"
+Writes a snapshot of the given virtual console (with attributes) to the file
+specified in the \fB\-file\fP option, overwriting its contents; the default
+is screen.dump. Without an argument, dumps the current virtual console.
+Overrides \fB\-append\fP.
+.TP
+.BR \-append " [1-NR_CONS]"
+Like \fB\-dump\fP, but appends to the snapshot file instead of overwriting
+it. Only works if no \fB\-dump\fP options are given.
+.TP
+.BR \-file " dumpfilename"
+Sets the snapshot file name for any \fB\-dump\fP or \fB\-append\fP options
+on the same command line. If this option is not present, the default is
+screen.dump in the current directory.
+.TP
+.BR \-msg " [" on | off "] (virtual consoles only)"
+Enables or disables the sending of kernel \fBprintk()\fP messages to the
+console.
+.TP
+.BR \-msglevel " 1-8 (virtual consoles only)"
+Sets the console logging level for kernel \fBprintk()\fP messages. All
+messages strictly more important than this will be printed, so a logging
+level of 0 has the same effect as \fB\-msg on\fP and a logging level of 8
+will print all kernel messages.
+.BR klogd (8)
+may be a more convenient interface to the logging of kernel messages.
+.TP
+.BR "\-powersave on" | vsync
+Puts the monitor into VESA vsync suspend mode.
+.TP
+.B \-powersave hsync
+Puts the monitor into VESA hsync suspend mode.
+.TP
+.B \-powersave powerdown
+Puts the monitor into VESA powerdown mode.
+.TP
+.BR \-powersave " [" off "]"
+Turns off monitor VESA powersaving features.
+.TP
+.BR \-powerdown " [0-60]"
+Sets the VESA powerdown interval in minutes. Without an argument, defaults
+to 0 (disable powerdown). If the console is blanked or the monitor is in
+suspend mode, then the monitor will go into vsync suspend mode or powerdown
+mode respectively after this period of time has elapsed.
+.TP
+.BR \-blength " [0-2000]"
+Sets the bell duration in milliseconds. Without an argument, defaults to 0.
.TP
-.B \-store
-stores the terminal's current rendering options as the default values.
+.BR \-bfreq " [freqnumber]"
+Sets the bell frequency in Hz. Without an argument, defaults to 0.
.SH "SEE ALSO"
.BR tput (1),
.BR stty (1),
@@ -83,11 +194,3 @@ stores the terminal's current rendering options as the default values.
.BR tty (4)
.SH BUGS
Differences between the Minix and Linux versions are not documented.
-.SH AUTHORS
-Gordon Irlam (gordoni@cs.ua.oz.au)
-.br
-Adaption to Linux by Peter MacDonald
-.br
-Enhancements by Mika Liljeberg (liljeber@cs.Helsinki.FI)
-.br
-Beep patch by Christophe Jolif (cjolif@storm.gatelink.fr.net)
diff --git a/misc-utils/setterm.c b/misc-utils/setterm.c
index 36d3be190..92161d01c 100644
--- a/misc-utils/setterm.c
+++ b/misc-utils/setterm.c
@@ -90,8 +90,8 @@
* -store stores the terminal's current rendering options as the default
* values. */
-#include <stdlib.h>
#include <stdio.h>
+#include <stdlib.h>
#include <errno.h>
#include <ctype.h>
#include <unistd.h>
@@ -193,892 +193,921 @@ int opt_ps_mode, opt_pd_min; /* powersave mode/powerdown time */
char opt_sn_name[200] = "screen.dump";
-void screendump(int vcnum, FILE *F);
+static void screendump(int vcnum, FILE *F);
/* Command line parsing routines.
*
* Note that it is an error for a given option to be invoked more than once.
*/
-void parse_term(argc, argv, option, opt_term, bad_arg)
-int argc; /* Number of arguments for this option. */
-char *argv[]; /* Arguments for this option. */
-int *option; /* Term flag to set. */
-char **opt_term; /* Terminal name to set. */
-int *bad_arg; /* Set to true if an error is detected. */
-{
+static void
+parse_term(int argc, char **argv, int *option, char **opt_term, int *bad_arg) {
+ /* argc: Number of arguments for this option. */
+ /* argv: Arguments for this option. */
+ /* option: Term flag to set. */
+ /* opt_term: Terminal name to set. */
+ /* bad_arg: Set to true if an error is detected. */
+
/* Parse a -term specification. */
- if (argc != 1 || *option) *bad_arg = TRUE;
- *option = TRUE;
- if (argc == 1) {
- *opt_term = argv[0];
- }
+ if (argc != 1 || *option)
+ *bad_arg = TRUE;
+ *option = TRUE;
+ if (argc == 1)
+ *opt_term = argv[0];
}
-void parse_none(argc, argv, option, bad_arg)
-int argc; /* Number of arguments for this option. */
-char *argv[]; /* Arguments for this option. */
-int *option; /* Option flag to set. */
-int *bad_arg; /* Set to true if an error is detected. */
-{
+static void
+parse_none(int argc, char **argv, int *option, int *bad_arg) {
+ /* argc: Number of arguments for this option. */
+ /* argv: Arguments for this option. */
+ /* option: Term flag to set. */
+ /* bad_arg: Set to true if an error is detected. */
+
/* Parse a parameterless specification. */
- if (argc != 0 || *option) *bad_arg = TRUE;
- *option = TRUE;
+ if (argc != 0 || *option)
+ *bad_arg = TRUE;
+ *option = TRUE;
}
-void parse_switch(argc, argv, option, opt_on, bad_arg)
-int argc; /* Number of arguments for this option. */
-char *argv[]; /* Arguments for this option. */
-int *option; /* Option flag to set. */
-int *opt_on; /* Boolean option switch to set or reset. */
-int *bad_arg; /* Set to true if an error is detected. */
-{
+static void
+parse_switch(int argc, char **argv, int *option, int *opt_on, int *bad_arg) {
+ /* argc: Number of arguments for this option. */
+ /* argv: Arguments for this option. */
+ /* option: Option flag to set. */
+ /* opt_on: Boolean option switch to set or reset. */
+ /* bad_arg: Set to true if an error is detected. */
+
/* Parse a boolean (on/off) specification. */
- if (argc > 1 || *option) *bad_arg = TRUE;
- *option = TRUE;
- if (argc == 1) {
- if (strcmp(argv[0], "on") == 0)
- *opt_on = TRUE;
- else if (strcmp(argv[0], "off") == 0)
- *opt_on = FALSE;
- else
+ if (argc > 1 || *option)
*bad_arg = TRUE;
- } else {
- *opt_on = TRUE;
- }
+ *option = TRUE;
+ if (argc == 1) {
+ if (strcmp(argv[0], "on") == 0)
+ *opt_on = TRUE;
+ else if (strcmp(argv[0], "off") == 0)
+ *opt_on = FALSE;
+ else
+ *bad_arg = TRUE;
+ } else {
+ *opt_on = TRUE;
+ }
}
-void par_color(argc, argv, option, opt_color, bad_arg)
-int argc; /* Number of arguments for this option. */
-char *argv[]; /* Arguments for this option. */
-int *option; /* Color flag to set. */
-int *opt_color; /* Color to set. */
-int *bad_arg; /* Set to true if an error is detected. */
-{
+static void
+par_color(int argc, char **argv, int *option, int *opt_color, int *bad_arg) {
+ /* argc: Number of arguments for this option. */
+ /* argv: Arguments for this option. */
+ /* option: Color flag to set. */
+ /* opt_color: Color to set. */
+ /* bad_arg: Set to true if an error is detected. */
+
/* Parse a -foreground or -background specification. */
- if (argc != 1 || *option) *bad_arg = TRUE;
- *option = TRUE;
- if (argc == 1) {
- if (strcmp(argv[0], "black") == 0)
- *opt_color = BLACK;
- else if (strcmp(argv[0], "red") == 0)
- *opt_color = RED;
- else if (strcmp(argv[0], "green") == 0)
- *opt_color = GREEN;
- else if (strcmp(argv[0], "yellow") == 0)
- *opt_color = YELLOW;
- else if (strcmp(argv[0], "blue") == 0)
- *opt_color = BLUE;
- else if (strcmp(argv[0], "magenta") == 0)
- *opt_color = MAGENTA;
- else if (strcmp(argv[0], "cyan") == 0)
- *opt_color = CYAN;
- else if (strcmp(argv[0], "white") == 0)
- *opt_color = WHITE;
- else if (strcmp(argv[0], "default") == 0)
- *opt_color = DEFAULT;
- else if (isdigit(argv[0][0]))
- *opt_color = atoi(argv[0]);
- else
- *bad_arg = TRUE;
+ if (argc != 1 || *option)
+ *bad_arg = TRUE;
+ *option = TRUE;
+ if (argc == 1) {
+ if (strcmp(argv[0], "black") == 0)
+ *opt_color = BLACK;
+ else if (strcmp(argv[0], "red") == 0)
+ *opt_color = RED;
+ else if (strcmp(argv[0], "green") == 0)
+ *opt_color = GREEN;
+ else if (strcmp(argv[0], "yellow") == 0)
+ *opt_color = YELLOW;
+ else if (strcmp(argv[0], "blue") == 0)
+ *opt_color = BLUE;
+ else if (strcmp(argv[0], "magenta") == 0)
+ *opt_color = MAGENTA;
+ else if (strcmp(argv[0], "cyan") == 0)
+ *opt_color = CYAN;
+ else if (strcmp(argv[0], "white") == 0)
+ *opt_color = WHITE;
+ else if (strcmp(argv[0], "default") == 0)
+ *opt_color = DEFAULT;
+ else if (isdigit(argv[0][0]))
+ *opt_color = atoi(argv[0]);
+ else
+ *bad_arg = TRUE;
- if(*opt_color < 0 || *opt_color > 7)
- *bad_arg = TRUE;
- }
+ if(*opt_color < 0 || *opt_color > 7)
+ *bad_arg = TRUE;
+ }
}
-void par_color2(argc, argv, option, opt_color, bad_arg)
-int argc; /* Number of arguments for this option. */
-char *argv[]; /* Arguments for this option. */
-int *option; /* Color flag to set. */
-int *opt_color; /* Color to set. */
-int *bad_arg; /* Set to true if an error is detected. */
-{
+static void
+par_color2(int argc, char **argv, int *option, int *opt_color, int *bad_arg) {
+ /* argc: Number of arguments for this option. */
+ /* argv: Arguments for this option. */
+ /* option: Color flag to set. */
+ /* opt_color: Color to set. */
+ /* bad_arg: Set to true if an error is detected. */
+
/* Parse a -ulcolor or -hbcolor specification. */
- if (!argc || argc > 2 || *option) *bad_arg = TRUE;
- *option = TRUE;
- *opt_color = 0;
- if (argc == 2) {
- if (strcmp(argv[0], "bright") == 0)
- *opt_color = 8;
- else {
+ if (!argc || argc > 2 || *option)
*bad_arg = TRUE;
- return;
+ *option = TRUE;
+ *opt_color = 0;
+ if (argc == 2) {
+ if (strcmp(argv[0], "bright") == 0)
+ *opt_color = 8;
+ else {
+ *bad_arg = TRUE;
+ return;
+ }
}
- }
- if (argc) {
- if (strcmp(argv[argc-1], "black") == 0) {
- if(*opt_color)
+ if (argc) {
+ if (strcmp(argv[argc-1], "black") == 0) {
+ if(*opt_color)
+ *bad_arg = TRUE;
+ else
+ *opt_color = BLACK;
+ } else if (strcmp(argv[argc-1], "grey") == 0) {
+ if(*opt_color)
+ *bad_arg = TRUE;
+ else
+ *opt_color = GREY;
+ } else if (strcmp(argv[argc-1], "red") == 0)
+ *opt_color |= RED;
+ else if (strcmp(argv[argc-1], "green") == 0)
+ *opt_color |= GREEN;
+ else if (strcmp(argv[argc-1], "yellow") == 0)
+ *opt_color |= YELLOW;
+ else if (strcmp(argv[argc-1], "blue") == 0)
+ *opt_color |= BLUE;
+ else if (strcmp(argv[argc-1], "magenta") == 0)
+ *opt_color |= MAGENTA;
+ else if (strcmp(argv[argc-1], "cyan") == 0)
+ *opt_color |= CYAN;
+ else if (strcmp(argv[argc-1], "white") == 0)
+ *opt_color |= WHITE;
+ else if (isdigit(argv[argc-1][0]))
+ *opt_color = atoi(argv[argc-1]);
+ else
*bad_arg = TRUE;
- else
- *opt_color = BLACK;
- } else if (strcmp(argv[argc-1], "grey") == 0) {
- if(*opt_color)
+ if(*opt_color < 0 || *opt_color > 15)
*bad_arg = TRUE;
- else
- *opt_color = GREY;
- } else if (strcmp(argv[argc-1], "red") == 0)
- *opt_color |= RED;
- else if (strcmp(argv[argc-1], "green") == 0)
- *opt_color |= GREEN;
- else if (strcmp(argv[argc-1], "yellow") == 0)
- *opt_color |= YELLOW;
- else if (strcmp(argv[argc-1], "blue") == 0)
- *opt_color |= BLUE;
- else if (strcmp(argv[argc-1], "magenta") == 0)
- *opt_color |= MAGENTA;
- else if (strcmp(argv[argc-1], "cyan") == 0)
- *opt_color |= CYAN;
- else if (strcmp(argv[argc-1], "white") == 0)
- *opt_color |= WHITE;
- else if (isdigit(argv[argc-1][0]))
- *opt_color = atoi(argv[argc-1]);
- else
- *bad_arg = TRUE;
- if(*opt_color < 0 || *opt_color > 15)
- *bad_arg = TRUE;
- }
+ }
}
-void parse_clear(argc, argv, option, opt_all, bad_arg)
-int argc; /* Number of arguments for this option. */
-char *argv[]; /* Arguments for this option. */
-int *option; /* Clear flag to set. */
-int *opt_all; /* Clear all switch to set or reset. */
-int *bad_arg; /* Set to true if an error is detected. */
-{
+static void
+parse_clear(int argc, char **argv, int *option, int *opt_all, int *bad_arg) {
+ /* argc: Number of arguments for this option. */
+ /* argv: Arguments for this option. */
+ /* option: Clear flag to set. */
+ /* opt_all: Clear all switch to set or reset. */
+ /* bad_arg: Set to true if an error is detected. */
+
/* Parse a -clear specification. */
- if (argc > 1 || *option) *bad_arg = TRUE;
- *option = TRUE;
- if (argc == 1) {
- if (strcmp(argv[0], "all") == 0)
- *opt_all = TRUE;
- else if (strcmp(argv[0], "rest") == 0)
- *opt_all = FALSE;
- else
+ if (argc > 1 || *option)
*bad_arg = TRUE;
- } else {
- *opt_all = TRUE;
- }
+ *option = TRUE;
+ if (argc == 1) {
+ if (strcmp(argv[0], "all") == 0)
+ *opt_all = TRUE;
+ else if (strcmp(argv[0], "rest") == 0)
+ *opt_all = FALSE;
+ else
+ *bad_arg = TRUE;
+ } else {
+ *opt_all = TRUE;
+ }
}
-void parse_blank(argc, argv, option, opt_all, bad_arg)
-int argc; /* Number of arguments for this option. */
-char *argv[]; /* Arguments for this option. */
-int *option; /* Clear flag to set. */
-int *opt_all; /* Clear all switch to set or reset. */
-int *bad_arg; /* Set to true if an error is detected. */
-{
+static void
+parse_blank(int argc, char **argv, int *option, int *opt_all, int *bad_arg) {
+ /* argc: Number of arguments for this option. */
+ /* argv: Arguments for this option. */
+ /* option: Clear flag to set. */
+ /* opt_all: Clear all switch to set or reset. */
+ /* bad_arg: Set to true if an error is detected. */
+
/* Parse a -blank specification. */
- if (argc > 1 || *option) *bad_arg = TRUE;
- *option = TRUE;
- if (argc == 1) {
- *opt_all = atoi(argv[0]);
- if ((*opt_all > 60) || (*opt_all < 0))
+ if (argc > 1 || *option)
*bad_arg = TRUE;
- } else {
- *opt_all = 0;
- }
+ *option = TRUE;
+ if (argc == 1) {
+ *opt_all = atoi(argv[0]);
+ if ((*opt_all > 60) || (*opt_all < 0))
+ *bad_arg = TRUE;
+ } else {
+ *opt_all = 0;
+ }
}
-void parse_powersave(argc, argv, option, opt_mode, bad_arg)
-int argc; /* Number of arguments for this option. */
-char *argv[]; /* Arguments for this option. */
-int *option; /* powersave flag to set. */
-int *opt_mode; /* Powersaving mode, defined in vesa_blank.c */
-int *bad_arg; /* Set to true if an error is detected. */
-{
+static void
+parse_powersave(int argc, char **argv, int *option, int *opt_mode, int *bad_arg) {
+ /* argc: Number of arguments for this option. */
+ /* argv: Arguments for this option. */
+ /* option: powersave flag to set. */
+ /* opt_mode: Powersaving mode, defined in vesa_blank.c */
+ /* bad_arg: Set to true if an error is detected. */
+
/* Parse a -powersave mode specification. */
- if (argc > 1 || *option) *bad_arg = TRUE;
- *option = TRUE;
- if (argc == 1) {
- if (strcmp(argv[0], "on") == 0)
- *opt_mode = 1;
- else if (strcmp(argv[0], "vsync") == 0)
- *opt_mode = 1;
- else if (strcmp(argv[0], "hsync") == 0)
- *opt_mode = 2;
- else if (strcmp(argv[0], "powerdown") == 0)
- *opt_mode = 3;
- else if (strcmp(argv[0], "off") == 0)
- *opt_mode = 0;
- else
+ if (argc > 1 || *option)
*bad_arg = TRUE;
- } else {
- *opt_mode = 0;
- }
+ *option = TRUE;
+ if (argc == 1) {
+ if (strcmp(argv[0], "on") == 0)
+ *opt_mode = 1;
+ else if (strcmp(argv[0], "vsync") == 0)
+ *opt_mode = 1;
+ else if (strcmp(argv[0], "hsync") == 0)
+ *opt_mode = 2;
+ else if (strcmp(argv[0], "powerdown") == 0)
+ *opt_mode = 3;
+ else if (strcmp(argv[0], "off") == 0)
+ *opt_mode = 0;
+ else
+ *bad_arg = TRUE;
+ } else {
+ *opt_mode = 0;
+ }
}
#if 0
-void parse_standout(argc, argv, option, opt_all, bad_arg)
-int argc; /* Number of arguments for this option. */
-char *argv[]; /* Arguments for this option. */
-int *option; /* Clear flag to set. */
-int *opt_all; /* Clear all switch to set or reset. */
-int *bad_arg; /* Set to true if an error is detected. */
-{
+static void
+parse_standout(int argc, char *argv, int *option, int *opt_all, int *bad_arg) {
+ /* argc: Number of arguments for this option. */
+ /* argv: Arguments for this option. */
+ /* option: Clear flag to set. */
+ /* opt_all: Clear all switch to set or reset. */
+ /* bad_arg: Set to true if an error is detected. */
+
/* Parse a -standout specification. */
- if (argc > 1 || *option) *bad_arg = TRUE;
- *option = TRUE;
- if (argc == 1) {
- *opt_all = atoi(argv[0]);
- } else {
- *opt_all = -1;
- }
+ if (argc > 1 || *option)
+ *bad_arg = TRUE;
+ *option = TRUE;
+ if (argc == 1)
+ *opt_all = atoi(argv[0]);
+ else
+ *opt_all = -1;
}
#endif
-void parse_msglevel(argc, argv, option, opt_all, bad_arg)
-int argc; /* Number of arguments for this option. */
-char *argv[]; /* Arguments for this option. */
-int *option; /* Clear flag to set. */
-int *opt_all; /* Clear all switch to set or reset. */
-int *bad_arg; /* Set to true if an error is detected. */
-{
-
- if (argc > 1 || *option) *bad_arg = TRUE;
- *option = TRUE;
- if (argc == 1) {
- *opt_all = atoi(argv[0]);
- if (*opt_all < 0 || *opt_all > 8)
+static void
+parse_msglevel(int argc, char **argv, int *option, int *opt_all, int *bad_arg) {
+ /* argc: Number of arguments for this option. */
+ /* argv: Arguments for this option. */
+ /* option: Clear flag to set. */
+ /* opt_all: Clear all switch to set or reset. */
+ /* bad_arg: Set to true if an error is detected. */
+
+ if (argc > 1 || *option)
*bad_arg = TRUE;
- } else {
- *opt_all = -1;
- }
+ *option = TRUE;
+ if (argc == 1) {
+ *opt_all = atoi(argv[0]);
+ if (*opt_all < 0 || *opt_all > 8)
+ *bad_arg = TRUE;
+ } else {
+ *opt_all = -1;
+ }
}
-void parse_snap(argc, argv, option, opt_all, bad_arg)
-int argc; /* Number of arguments for this option. */
-char *argv[]; /* Arguments for this option. */
-int *option; /* Clear flag to set. */
-int *opt_all; /* Clear all switch to set or reset. */
-int *bad_arg; /* Set to true if an error is detected. */
-{
+static void
+parse_snap(int argc, char **argv, int *option, int *opt_all, int *bad_arg) {
+ /* argc: Number of arguments for this option. */
+ /* argv: Arguments for this option. */
+ /* option: Clear flag to set. */
+ /* opt_all: Clear all switch to set or reset. */
+ /* bad_arg: Set to true if an error is detected. */
+
/* Parse a -dump or -append specification. */
- if (argc > 1 || *option) *bad_arg = TRUE;
- *option = TRUE;
- if (argc == 1) {
- *opt_all = atoi(argv[0]);
- if ((*opt_all <= 0))
+ if (argc > 1 || *option)
*bad_arg = TRUE;
- } else {
- *opt_all = 0;
- }
+ *option = TRUE;
+ if (argc == 1) {
+ *opt_all = atoi(argv[0]);
+ if ((*opt_all <= 0))
+ *bad_arg = TRUE;
+ } else {
+ *opt_all = 0;
+ }
}
-void parse_snapfile(argc, argv, option, opt_all, bad_arg)
-int argc; /* Number of arguments for this option. */
-char *argv[]; /* Arguments for this option. */
-int *option; /* Clear flag to set. */
-int *opt_all; /* Clear all switch to set or reset. */
-int *bad_arg; /* Set to true if an error is detected. */
-{
+static void
+parse_snapfile(int argc, char **argv, int *option, int *opt_all, int *bad_arg) {
+ /* argc: Number of arguments for this option. */
+ /* argv: Arguments for this option. */
+ /* option: Clear flag to set. */
+ /* opt_all: Clear all switch to set or reset. */
+ /* bad_arg: Set to true if an error is detected. */
+
/* Parse a -file specification. */
- if (argc != 1 || *option) *bad_arg = TRUE;
- *option = TRUE;
- if (argc == 1) {
- strcpy((char *)opt_all, argv[0]);
- }
+ if (argc != 1 || *option)
+ *bad_arg = TRUE;
+ *option = TRUE;
+ if (argc == 1)
+ strcpy((char *)opt_all, argv[0]);
}
-void parse_tabs(argc, argv, option, tab_array, bad_arg)
-int argc; /* Number of arguments for this option. */
-char *argv[]; /* Arguments for this option. */
-int *option; /* Clear flag to set. */
-int *tab_array; /* Array of tabs */
-int *bad_arg; /* Set to true if an error is detected. */
-{
- if (*option || argc > 160) *bad_arg = TRUE;
- *option = TRUE;
- tab_array[argc] = -1;
- while(argc--) {
- tab_array[argc] = atoi(argv[argc]);
- if(tab_array[argc] < 1 || tab_array[argc] > 160) {
- *bad_arg = TRUE;
- return;
- }
- }
+static void
+parse_tabs(int argc, char **argv, int *option, int *tab_array, int *bad_arg) {
+ /* argc: Number of arguments for this option. */
+ /* argv: Arguments for this option. */
+ /* option: Clear flag to set. */
+ /* tab_array: Array of tabs */
+ /* bad_arg: Set to true if an error is detected. */
+
+ if (*option || argc > 160)
+ *bad_arg = TRUE;
+ *option = TRUE;
+ tab_array[argc] = -1;
+ while(argc--) {
+ tab_array[argc] = atoi(argv[argc]);
+ if(tab_array[argc] < 1 || tab_array[argc] > 160) {
+ *bad_arg = TRUE;
+ return;
+ }
+ }
}
-void parse_clrtabs(argc, argv, option, tab_array, bad_arg)
-int argc; /* Number of arguments for this option. */
-char *argv[]; /* Arguments for this option. */
-int *option; /* Clear flag to set. */
-int *tab_array; /* Array of tabs */
-int *bad_arg; /* Set to true if an error is detected. */
-{
- if (*option || argc > 160) *bad_arg = TRUE;
- *option = TRUE;
- if(argc == 0) {
- tab_array[0] = -1;
- return;
- }
- tab_array[argc] = -1;
- while(argc--) {
- tab_array[argc] = atoi(argv[argc]);
- if(tab_array[argc] < 1 || tab_array[argc] > 160) {
- *bad_arg = TRUE;
- return;
- }
- }
+static void
+parse_clrtabs(int argc, char **argv, int *option, int *tab_array, int *bad_arg) {
+ /* argc: Number of arguments for this option. */
+ /* argv: Arguments for this option. */
+ /* option: Clear flag to set. */
+ /* tab_array: Array of tabs */
+ /* bad_arg: Set to true if an error is detected. */
+
+ if (*option || argc > 160)
+ *bad_arg = TRUE;
+ *option = TRUE;
+ if(argc == 0) {
+ tab_array[0] = -1;
+ return;
+ }
+ tab_array[argc] = -1;
+ while(argc--) {
+ tab_array[argc] = atoi(argv[argc]);
+ if(tab_array[argc] < 1 || tab_array[argc] > 160) {
+ *bad_arg = TRUE;
+ return;
+ }
+ }
}
-void parse_regtabs(argc, argv, option, opt_len, bad_arg)
-int argc; /* Number of arguments for this option. */
-char *argv[]; /* Arguments for this option. */
-int *option; /* Clear flag to set. */
-int *opt_len; /* Regular tab length. */
-int *bad_arg; /* Set to true if an error is detected. */
-{
- if (*option || argc > 1) *bad_arg = TRUE;
- *option = TRUE;
- if(argc == 0) {
- *opt_len = 8;
- return;
- }
- *opt_len = atoi(argv[0]);
- if(*opt_len < 1 || *opt_len > 160) {
- *bad_arg = TRUE;
- return;
- }
+static void
+parse_regtabs(int argc, char **argv, int *option, int *opt_len, int *bad_arg) {
+ /* argc: Number of arguments for this option. */
+ /* argv: Arguments for this option. */
+ /* option: Clear flag to set. */
+ /* opt_len: Regular tab length. */
+ /* bad_arg: Set to true if an error is detected. */
+
+ if (*option || argc > 1)
+ *bad_arg = TRUE;
+ *option = TRUE;
+ if(argc == 0) {
+ *opt_len = 8;
+ return;
+ }
+ *opt_len = atoi(argv[0]);
+ if(*opt_len < 1 || *opt_len > 160) {
+ *bad_arg = TRUE;
+ return;
+ }
}
-void parse_blength(argc, argv, option, opt_all, bad_arg)
-int argc; /* Number of arguments for this option. */
-char *argv[]; /* Arguments for this option. */
-int *option; /* Clear flag to set. */
-int *opt_all;
-int *bad_arg; /* Set to true if an error is detected. */
-{
+static void
+parse_blength(int argc, char **argv, int *option, int *opt_all, int *bad_arg) {
+ /* argc: Number of arguments for this option. */
+ /* argv: Arguments for this option. */
+ /* option: Clear flag to set. */
+ /* opt_all */
+ /* bad_arg: Set to true if an error is detected. */
+
/* Parse -blength specification. */
- if (argc > 1 || *option) *bad_arg = TRUE;
- *option = TRUE;
- if (argc == 1) {
- *opt_all = atoi(argv[0]);
- if (*opt_all > 2000)
+ if (argc > 1 || *option)
*bad_arg = TRUE;
- } else {
- *opt_all = 0;
- }
+ *option = TRUE;
+ if (argc == 1) {
+ *opt_all = atoi(argv[0]);
+ if (*opt_all > 2000)
+ *bad_arg = TRUE;
+ } else {
+ *opt_all = 0;
+ }
}
-void parse_bfreq(argc, argv, option, opt_all, bad_arg)
-int argc; /* Number of arguments for this option. */
-char *argv[]; /* Arguments for this option. */
-int *option; /* Clear flag to set. */
-int *opt_all;
-int *bad_arg; /* Set to true if an error is detected. */
-{
+static void
+parse_bfreq(int argc, char **argv, int *option, int *opt_all, int *bad_arg) {
+ /* argc: Number of arguments for this option. */
+ /* argv: Arguments for this option. */
+ /* option: Clear flag to set. */
+ /* opt_all */
+ /* bad_arg: Set to true if an error is detected. */
+
/* Parse -bfreq specification. */
- if (argc > 1 || *option) *bad_arg = TRUE;
- *option = TRUE;
- if (argc == 1) {
- *opt_all = atoi(argv[0]);
- } else {
- *opt_all = 0;
- }
+ if (argc > 1 || *option)
+ *bad_arg = TRUE;
+ *option = TRUE;
+ if (argc == 1) {
+ *opt_all = atoi(argv[0]);
+ } else {
+ *opt_all = 0;
+ }
}
-void show_tabs()
-{
- int i, co = tigetnum("cols");
-
- if(co > 0) {
- printf("\r ");
- for(i = 10; i < co-2; i+=10)
- printf("%-10d", i);
- putchar('\n');
- for(i = 1; i <= co; i++)
- putchar(i%10+'0');
- putchar('\n');
- for(i = 1; i < co; i++)
- printf("\tT\b");
- putchar('\n');
- }
+static void
+show_tabs(void) {
+ int i, co = tigetnum("cols");
+
+ if(co > 0) {
+ printf("\r ");
+ for(i = 10; i < co-2; i+=10)
+ printf("%-10d", i);
+ putchar('\n');
+ for(i = 1; i <= co; i++)
+ putchar(i%10+'0');
+ putchar('\n');
+ for(i = 1; i < co; i++)
+ printf("\tT\b");
+ putchar('\n');
+ }
}
#define STRCMP(str1,str2) strncmp(str1,str2,strlen(str1))
-void parse_option(option, argc, argv, bad_arg)
-char *option; /* Option with leading '-' removed. */
-int argc; /* Number of arguments for this option. */
-char *argv[]; /* Arguments for this option. */
-int *bad_arg; /* Set to true if an error is detected. */
-{
+static void
+parse_option(char *option, int argc, char **argv, int *bad_arg) {
+ /* option: Option with leading '-' removed. */
+ /* argc: Number of arguments for this option. */
+ /* argv: Arguments for this option. */
+ /* bad_arg: Set to true if an error is detected. */
+
/* Parse a single specification. */
- if (STRCMP(option, "term") == 0)
- parse_term(argc, argv, &opt_term, &opt_te_terminal_name, bad_arg);
- else if (STRCMP(option, "reset") == 0)
- parse_none(argc, argv, &opt_reset, bad_arg);
- else if (STRCMP(option, "initialize") == 0)
- parse_none(argc, argv, &opt_initialize, bad_arg);
- else if (STRCMP(option, "cursor") == 0)
- parse_switch(argc, argv, &opt_cursor, &opt_cu_on, bad_arg);
- else if (STRCMP(option, "repeat") == 0)
- parse_switch(argc, argv, &opt_repeat, &opt_rep_on, bad_arg);
- else if (STRCMP(option, "appcursorkeys") == 0)
- parse_switch(argc, argv, &opt_appcursorkeys, &opt_appck_on, bad_arg);
- else if (STRCMP(option, "linewrap") == 0)
- parse_switch(argc, argv, &opt_linewrap, &opt_li_on, bad_arg);
+ if (STRCMP(option, "term") == 0)
+ parse_term(argc, argv, &opt_term, &opt_te_terminal_name, bad_arg);
+ else if (STRCMP(option, "reset") == 0)
+ parse_none(argc, argv, &opt_reset, bad_arg);
+ else if (STRCMP(option, "initialize") == 0)
+ parse_none(argc, argv, &opt_initialize, bad_arg);
+ else if (STRCMP(option, "cursor") == 0)
+ parse_switch(argc, argv, &opt_cursor, &opt_cu_on, bad_arg);
+ else if (STRCMP(option, "repeat") == 0)
+ parse_switch(argc, argv, &opt_repeat, &opt_rep_on, bad_arg);
+ else if (STRCMP(option, "appcursorkeys") == 0)
+ parse_switch(argc, argv, &opt_appcursorkeys, &opt_appck_on, bad_arg);
+ else if (STRCMP(option, "linewrap") == 0)
+ parse_switch(argc, argv, &opt_linewrap, &opt_li_on, bad_arg);
#if 0
- else if (STRCMP(option, "snow") == 0)
- parse_switch(argc, argv, &opt_snow, &opt_sn_on, bad_arg);
- else if (STRCMP(option, "softscroll") == 0)
- parse_switch(argc, argv, &opt_softscroll, &opt_so_on, bad_arg);
+ else if (STRCMP(option, "snow") == 0)
+ parse_switch(argc, argv, &opt_snow, &opt_sn_on, bad_arg);
+ else if (STRCMP(option, "softscroll") == 0)
+ parse_switch(argc, argv, &opt_softscroll, &opt_so_on, bad_arg);
#endif
- else if (STRCMP(option, "default") == 0)
- parse_none(argc, argv, &opt_default, bad_arg);
- else if (STRCMP(option, "foreground") == 0)
- par_color(argc, argv, &opt_foreground, &opt_fo_color, bad_arg);
- else if (STRCMP(option, "background") == 0)
- par_color(argc, argv, &opt_background, &opt_ba_color, bad_arg);
- else if (STRCMP(option, "ulcolor") == 0)
- par_color2(argc, argv, &opt_ulcolor, &opt_ul_color, bad_arg);
- else if (STRCMP(option, "hbcolor") == 0)
- par_color2(argc, argv, &opt_hbcolor, &opt_hb_color, bad_arg);
- else if (STRCMP(option, "inversescreen") == 0)
- parse_switch(argc, argv, &opt_inversescreen, &opt_invsc_on, bad_arg);
- else if (STRCMP(option, "bold") == 0)
- parse_switch(argc, argv, &opt_bold, &opt_bo_on, bad_arg);
- else if (STRCMP(option, "half-bright") == 0)
- parse_switch(argc, argv, &opt_halfbright, &opt_hb_on, bad_arg);
- else if (STRCMP(option, "blink") == 0)
- parse_switch(argc, argv, &opt_blink, &opt_bl_on, bad_arg);
- else if (STRCMP(option, "reverse") == 0)
- parse_switch(argc, argv, &opt_reverse, &opt_re_on, bad_arg);
- else if (STRCMP(option, "underline") == 0)
- parse_switch(argc, argv, &opt_underline, &opt_un_on, bad_arg);
- else if (STRCMP(option, "store") == 0)
- parse_none(argc, argv, &opt_store, bad_arg);
- else if (STRCMP(option, "clear") == 0)
- parse_clear(argc, argv, &opt_clear, &opt_cl_all, bad_arg);
- else if (STRCMP(option, "tabs") == 0)
- parse_tabs(argc, argv, &opt_tabs, opt_tb_array, bad_arg);
- else if (STRCMP(option, "clrtabs") == 0)
- parse_clrtabs(argc, argv, &opt_clrtabs, opt_tb_array, bad_arg);
- else if (STRCMP(option, "regtabs") == 0)
- parse_regtabs(argc, argv, &opt_regtabs, &opt_rt_len, bad_arg);
- else if (STRCMP(option, "blank") == 0)
- parse_blank(argc, argv, &opt_blank, &opt_bl_min, bad_arg);
- else if (STRCMP(option, "dump") == 0)
- parse_snap(argc, argv, &opt_snap, &opt_sn_num, bad_arg);
- else if (STRCMP(option, "append") == 0)
- parse_snap(argc, argv, &opt_append, &opt_sn_num, bad_arg);
- else if (STRCMP(option, "file") == 0)
- parse_snapfile(argc, argv, &opt_snapfile, (int *)opt_sn_name, bad_arg);
- else if (STRCMP(option, "msg") == 0)
- parse_switch(argc, argv, &opt_msg, &opt_msg_on, bad_arg);
- else if (STRCMP(option, "msglevel") == 0)
- parse_msglevel(argc, argv, &opt_msglevel, &opt_msglevel_num, bad_arg);
- else if (STRCMP(option, "powersave") == 0)
- parse_powersave(argc, argv, &opt_powersave, &opt_ps_mode, bad_arg);
- else if (STRCMP(option, "powerdown") == 0)
- parse_blank(argc, argv, &opt_powerdown, &opt_pd_min, bad_arg);
- else if (STRCMP(option, "blength") == 0)
- parse_blength(argc, argv, &opt_blength, &opt_blength_l, bad_arg);
- else if (STRCMP(option, "bfreq") == 0)
- parse_bfreq(argc, argv, &opt_bfreq, &opt_bfreq_f, bad_arg);
+ else if (STRCMP(option, "default") == 0)
+ parse_none(argc, argv, &opt_default, bad_arg);
+ else if (STRCMP(option, "foreground") == 0)
+ par_color(argc, argv, &opt_foreground, &opt_fo_color, bad_arg);
+ else if (STRCMP(option, "background") == 0)
+ par_color(argc, argv, &opt_background, &opt_ba_color, bad_arg);
+ else if (STRCMP(option, "ulcolor") == 0)
+ par_color2(argc, argv, &opt_ulcolor, &opt_ul_color, bad_arg);
+ else if (STRCMP(option, "hbcolor") == 0)
+ par_color2(argc, argv, &opt_hbcolor, &opt_hb_color, bad_arg);
+ else if (STRCMP(option, "inversescreen") == 0)
+ parse_switch(argc, argv, &opt_inversescreen, &opt_invsc_on, bad_arg);
+ else if (STRCMP(option, "bold") == 0)
+ parse_switch(argc, argv, &opt_bold, &opt_bo_on, bad_arg);
+ else if (STRCMP(option, "half-bright") == 0)
+ parse_switch(argc, argv, &opt_halfbright, &opt_hb_on, bad_arg);
+ else if (STRCMP(option, "blink") == 0)
+ parse_switch(argc, argv, &opt_blink, &opt_bl_on, bad_arg);
+ else if (STRCMP(option, "reverse") == 0)
+ parse_switch(argc, argv, &opt_reverse, &opt_re_on, bad_arg);
+ else if (STRCMP(option, "underline") == 0)
+ parse_switch(argc, argv, &opt_underline, &opt_un_on, bad_arg);
+ else if (STRCMP(option, "store") == 0)
+ parse_none(argc, argv, &opt_store, bad_arg);
+ else if (STRCMP(option, "clear") == 0)
+ parse_clear(argc, argv, &opt_clear, &opt_cl_all, bad_arg);
+ else if (STRCMP(option, "tabs") == 0)
+ parse_tabs(argc, argv, &opt_tabs, opt_tb_array, bad_arg);
+ else if (STRCMP(option, "clrtabs") == 0)
+ parse_clrtabs(argc, argv, &opt_clrtabs, opt_tb_array, bad_arg);
+ else if (STRCMP(option, "regtabs") == 0)
+ parse_regtabs(argc, argv, &opt_regtabs, &opt_rt_len, bad_arg);
+ else if (STRCMP(option, "blank") == 0)
+ parse_blank(argc, argv, &opt_blank, &opt_bl_min, bad_arg);
+ else if (STRCMP(option, "dump") == 0)
+ parse_snap(argc, argv, &opt_snap, &opt_sn_num, bad_arg);
+ else if (STRCMP(option, "append") == 0)
+ parse_snap(argc, argv, &opt_append, &opt_sn_num, bad_arg);
+ else if (STRCMP(option, "file") == 0)
+ parse_snapfile(argc, argv, &opt_snapfile, (int *)opt_sn_name, bad_arg);
+ else if (STRCMP(option, "msg") == 0)
+ parse_switch(argc, argv, &opt_msg, &opt_msg_on, bad_arg);
+ else if (STRCMP(option, "msglevel") == 0)
+ parse_msglevel(argc, argv, &opt_msglevel, &opt_msglevel_num, bad_arg);
+ else if (STRCMP(option, "powersave") == 0)
+ parse_powersave(argc, argv, &opt_powersave, &opt_ps_mode, bad_arg);
+ else if (STRCMP(option, "powerdown") == 0)
+ parse_blank(argc, argv, &opt_powerdown, &opt_pd_min, bad_arg);
+ else if (STRCMP(option, "blength") == 0)
+ parse_blength(argc, argv, &opt_blength, &opt_blength_l, bad_arg);
+ else if (STRCMP(option, "bfreq") == 0)
+ parse_bfreq(argc, argv, &opt_bfreq, &opt_bfreq_f, bad_arg);
#if 0
- else if (STRCMP(option, "standout") == 0)
- parse_standout(argc, argv, &opt_standout, &opt_st_attr, bad_arg);
+ else if (STRCMP(option, "standout") == 0)
+ parse_standout(argc, argv, &opt_standout, &opt_st_attr, bad_arg);
#endif
- else
- *bad_arg = TRUE;
+ else
+ *bad_arg = TRUE;
}
/* End of command line parsing routines. */
-void usage(prog_name)
-char *prog_name; /* Name of this program. */
-{
+static void
+usage(char *prog_name) {
/* Print error message about arguments, and the command's syntax. */
- fprintf(stderr, _("%s: Argument error, usage\n"), prog_name);
- fprintf(stderr, "\n");
- fprintf(stderr, "%s\n", prog_name);
- fprintf(stderr, _(" [ -term terminal_name ]\n"));
- fprintf(stderr, _(" [ -reset ]\n"));
- fprintf(stderr, _(" [ -initialize ]\n"));
- fprintf(stderr, _(" [ -cursor [on|off] ]\n"));
+ fprintf(stderr, _("%s: Argument error, usage\n"), prog_name);
+ fprintf(stderr, "\n");
+ fprintf(stderr, "%s\n", prog_name);
+ fprintf(stderr, _(" [ -term terminal_name ]\n"));
+ fprintf(stderr, _(" [ -reset ]\n"));
+ fprintf(stderr, _(" [ -initialize ]\n"));
+ fprintf(stderr, _(" [ -cursor [on|off] ]\n"));
#if 0
- fprintf(stderr, _(" [ -snow [on|off] ]\n"));
- fprintf(stderr, _(" [ -softscroll [on|off] ]\n"));
+ fprintf(stderr, _(" [ -snow [on|off] ]\n"));
+ fprintf(stderr, _(" [ -softscroll [on|off] ]\n"));
#endif
- fprintf(stderr, _(" [ -repeat [on|off] ]\n"));
- fprintf(stderr, _(" [ -appcursorkeys [on|off] ]\n"));
- fprintf(stderr, _(" [ -linewrap [on|off] ]\n"));
- fprintf(stderr, _(" [ -default ]\n"));
- fprintf(stderr, _(" [ -foreground black|blue|green|cyan"));
- fprintf(stderr, _("|red|magenta|yellow|white|default ]\n"));
- fprintf(stderr, _(" [ -background black|blue|green|cyan"));
- fprintf(stderr, _("|red|magenta|yellow|white|default ]\n"));
- fprintf(stderr, _(" [ -ulcolor black|grey|blue|green|cyan"));
- fprintf(stderr, _("|red|magenta|yellow|white ]\n"));
- fprintf(stderr, _(" [ -ulcolor bright blue|green|cyan"));
- fprintf(stderr, _("|red|magenta|yellow|white ]\n"));
- fprintf(stderr, _(" [ -hbcolor black|grey|blue|green|cyan"));
- fprintf(stderr, _("|red|magenta|yellow|white ]\n"));
- fprintf(stderr, _(" [ -hbcolor bright blue|green|cyan"));
- fprintf(stderr, _("|red|magenta|yellow|white ]\n"));
+ fprintf(stderr, _(" [ -repeat [on|off] ]\n"));
+ fprintf(stderr, _(" [ -appcursorkeys [on|off] ]\n"));
+ fprintf(stderr, _(" [ -linewrap [on|off] ]\n"));
+ fprintf(stderr, _(" [ -default ]\n"));
+ fprintf(stderr, _(" [ -foreground black|blue|green|cyan"));
+ fprintf(stderr, _("|red|magenta|yellow|white|default ]\n"));
+ fprintf(stderr, _(" [ -background black|blue|green|cyan"));
+ fprintf(stderr, _("|red|magenta|yellow|white|default ]\n"));
+ fprintf(stderr, _(" [ -ulcolor black|grey|blue|green|cyan"));
+ fprintf(stderr, _("|red|magenta|yellow|white ]\n"));
+ fprintf(stderr, _(" [ -ulcolor bright blue|green|cyan"));
+ fprintf(stderr, _("|red|magenta|yellow|white ]\n"));
+ fprintf(stderr, _(" [ -hbcolor black|grey|blue|green|cyan"));
+ fprintf(stderr, _("|red|magenta|yellow|white ]\n"));
+ fprintf(stderr, _(" [ -hbcolor bright blue|green|cyan"));
+ fprintf(stderr, _("|red|magenta|yellow|white ]\n"));
#if 0
- fprintf(stderr, _(" [ -standout [ attr ] ]\n"));
+ fprintf(stderr, _(" [ -standout [ attr ] ]\n"));
#endif
- fprintf(stderr, _(" [ -inversescreen [on|off] ]\n"));
- fprintf(stderr, _(" [ -bold [on|off] ]\n"));
- fprintf(stderr, _(" [ -half-bright [on|off] ]\n"));
- fprintf(stderr, _(" [ -blink [on|off] ]\n"));
- fprintf(stderr, _(" [ -reverse [on|off] ]\n"));
- fprintf(stderr, _(" [ -underline [on|off] ]\n"));
- fprintf(stderr, _(" [ -store ]\n"));
- fprintf(stderr, _(" [ -clear [all|rest] ]\n"));
- fprintf(stderr, _(" [ -tabs [ tab1 tab2 tab3 ... ] ] (tabn = 1-160)\n"));
- fprintf(stderr, _(" [ -clrtabs [ tab1 tab2 tab3 ... ] ] (tabn = 1-160)\n"));
- fprintf(stderr, _(" [ -regtabs [1-160] ]\n"));
- fprintf(stderr, _(" [ -blank [0-60] ]\n"));
- fprintf(stderr, _(" [ -dump [1-NR_CONSOLES] ]\n"));
- fprintf(stderr, _(" [ -append [1-NR_CONSOLES] ]\n"));
- fprintf(stderr, _(" [ -file dumpfilename ]\n"));
- fprintf(stderr, _(" [ -msg [on|off] ]\n"));
- fprintf(stderr, _(" [ -msglevel [0-8] ]\n"));
- fprintf(stderr, _(" [ -powersave [on|vsync|hsync|powerdown|off] ]\n"));
- fprintf(stderr, _(" [ -powerdown [0-60] ]\n"));
- fprintf(stderr, _(" [ -blength [0-2000] ]\n"));
- fprintf(stderr, _(" [ -bfreq freqnumber ]\n"));
+ fprintf(stderr, _(" [ -inversescreen [on|off] ]\n"));
+ fprintf(stderr, _(" [ -bold [on|off] ]\n"));
+ fprintf(stderr, _(" [ -half-bright [on|off] ]\n"));
+ fprintf(stderr, _(" [ -blink [on|off] ]\n"));
+ fprintf(stderr, _(" [ -reverse [on|off] ]\n"));
+ fprintf(stderr, _(" [ -underline [on|off] ]\n"));
+ fprintf(stderr, _(" [ -store ]\n"));
+ fprintf(stderr, _(" [ -clear [all|rest] ]\n"));
+ fprintf(stderr, _(" [ -tabs [ tab1 tab2 tab3 ... ] ] (tabn = 1-160)\n"));
+ fprintf(stderr, _(" [ -clrtabs [ tab1 tab2 tab3 ... ] ] (tabn = 1-160)\n"));
+ fprintf(stderr, _(" [ -regtabs [1-160] ]\n"));
+ fprintf(stderr, _(" [ -blank [0-60] ]\n"));
+ fprintf(stderr, _(" [ -dump [1-NR_CONSOLES] ]\n"));
+ fprintf(stderr, _(" [ -append [1-NR_CONSOLES] ]\n"));
+ fprintf(stderr, _(" [ -file dumpfilename ]\n"));
+ fprintf(stderr, _(" [ -msg [on|off] ]\n"));
+ fprintf(stderr, _(" [ -msglevel [0-8] ]\n"));
+ fprintf(stderr, _(" [ -powersave [on|vsync|hsync|powerdown|off] ]\n"));
+ fprintf(stderr, _(" [ -powerdown [0-60] ]\n"));
+ fprintf(stderr, _(" [ -blength [0-2000] ]\n"));
+ fprintf(stderr, _(" [ -bfreq freqnumber ]\n"));
}
-char *ti_entry(name)
-const char *name; /* Terminfo capability string to lookup. */
-{
+static char *ti_entry(const char *name) {
+ /* name: Terminfo capability string to lookup. */
+
/* Return the specified terminfo string, or an empty string if no such terminfo
* capability exists.
*/
- char *buf_ptr;
+ char *buf_ptr;
- if ((buf_ptr = tigetstr(name)) == (char *)-1) buf_ptr = NULL;
- return buf_ptr;
+ if ((buf_ptr = tigetstr(name)) == (char *)-1) buf_ptr = NULL;
+ return buf_ptr;
}
-void perform_sequence(vcterm)
-int vcterm; /* Set if terminal is a virtual console. */
-{
- int result;
+static void
+perform_sequence(int vcterm) {
+ /* vcterm: Set if terminal is a virtual console. */
+
+ int result;
/* Perform the selected options. */
- /* -reset. */
- if (opt_reset) {
- putp(ti_entry("rs1"));
- }
+ /* -reset. */
+ if (opt_reset) {
+ putp(ti_entry("rs1"));
+ }
- /* -initialize. */
- if (opt_initialize) {
- putp(ti_entry("is2"));
- }
+ /* -initialize. */
+ if (opt_initialize) {
+ putp(ti_entry("is2"));
+ }
- /* -cursor [on|off]. */
- if (opt_cursor) {
- if (opt_cu_on)
- putp(ti_entry("cnorm"));
- else
- putp(ti_entry("civis"));
- }
+ /* -cursor [on|off]. */
+ if (opt_cursor) {
+ if (opt_cu_on)
+ putp(ti_entry("cnorm"));
+ else
+ putp(ti_entry("civis"));
+ }
- /* -linewrap [on|off]. Vc only (vt102) */
- if (opt_linewrap && vcterm) {
- if (opt_li_on)
- printf("\033[?7h");
- else
- printf("\033[?7l");
- }
+ /* -linewrap [on|off]. Vc only (vt102) */
+ if (opt_linewrap && vcterm) {
+ if (opt_li_on)
+ printf("\033[?7h");
+ else
+ printf("\033[?7l");
+ }
- /* -repeat [on|off]. Vc only (vt102) */
- if (opt_repeat && vcterm) {
- if (opt_rep_on)
- printf("\033[?8h");
- else
- printf("\033[?8l");
- }
+ /* -repeat [on|off]. Vc only (vt102) */
+ if (opt_repeat && vcterm) {
+ if (opt_rep_on)
+ printf("\033[?8h");
+ else
+ printf("\033[?8l");
+ }
- /* -appcursorkeys [on|off]. Vc only (vt102) */
- if (opt_appcursorkeys && vcterm) {
- if (opt_appck_on)
- printf("\033[?1h");
- else
- printf("\033[?1l");
- }
+ /* -appcursorkeys [on|off]. Vc only (vt102) */
+ if (opt_appcursorkeys && vcterm) {
+ if (opt_appck_on)
+ printf("\033[?1h");
+ else
+ printf("\033[?1l");
+ }
#if 0
- /* -snow [on|off]. Vc only. */
- if (opt_snow && vcterm) {
- if (opt_sn_on)
- printf("%s%s%s", DCS, _("snow.on"), ST);
- else
- printf("%s%s%s", DCS, _("snow.off"), ST);
- }
-
- /* -softscroll [on|off]. Vc only. */
- if (opt_softscroll && vcterm) {
- if (opt_so_on)
- printf("%s%s%s", DCS, _("softscroll.on"), ST);
- else
- printf("%s%s%s", DCS, _("softscroll.off"), ST);
- }
-#endif
+ /* -snow [on|off]. Vc only. */
+ if (opt_snow && vcterm) {
+ if (opt_sn_on)
+ printf("%s%s%s", DCS, _("snow.on"), ST);
+ else
+ printf("%s%s%s", DCS, _("snow.off"), ST);
+ }
- /* -default. Vc sets default rendition, otherwise clears all
- * attributes.
- */
- if (opt_default) {
- if (vcterm)
- printf("\033[0m");
- else
- putp(ti_entry("sgr0"));
- }
-
- /* -foreground black|red|green|yellow|blue|magenta|cyan|white|default.
- * Vc only (ANSI).
- */
- if (opt_foreground && vcterm) {
- printf("%s%s%c%s", ESC, "[3", '0' + opt_fo_color, "m");
- }
-
- /* -background black|red|green|yellow|blue|magenta|cyan|white|default.
- * Vc only (ANSI).
- */
- if (opt_background && vcterm) {
- printf("%s%s%c%s", ESC, "[4", '0' + opt_ba_color, "m");
- }
-
- /* -ulcolor black|red|green|yellow|blue|magenta|cyan|white|default.
- * Vc only.
- */
- if (opt_ulcolor && vcterm) {
- printf("\033[1;%d]", opt_ul_color);
- }
-
- /* -hbcolor black|red|green|yellow|blue|magenta|cyan|white|default.
- * Vc only.
- */
- if (opt_hbcolor && vcterm) {
- printf("\033[2;%d]", opt_hb_color);
- }
-
- /* -inversescreen [on|off]. Vc only (vt102).
- */
- if (opt_inversescreen) {
- if (vcterm) {
- if (opt_invsc_on)
- printf("\033[?5h");
+ /* -softscroll [on|off]. Vc only. */
+ if (opt_softscroll && vcterm) {
+ if (opt_so_on)
+ printf("%s%s%s", DCS, _("softscroll.on"), ST);
else
- printf("\033[?5l");
+ printf("%s%s%s", DCS, _("softscroll.off"), ST);
}
- }
-
- /* -bold [on|off]. Vc behaves as expected, otherwise off turns off
- * all attributes.
- */
- if (opt_bold) {
- if (opt_bo_on)
- putp(ti_entry("bold"));
- else {
+#endif
+
+ /* -default. Vc sets default rendition, otherwise clears all
+ * attributes.
+ */
+ if (opt_default) {
if (vcterm)
- printf("%s%s", ESC, "[22m");
+ printf("\033[0m");
else
putp(ti_entry("sgr0"));
}
- }
-
- /* -half-bright [on|off]. Vc behaves as expected, otherwise off turns off
- * all attributes.
- */
- if (opt_halfbright) {
- if (opt_hb_on)
- putp(ti_entry("dim"));
- else {
- if (vcterm)
- printf("%s%s", ESC, "[22m");
+
+ /* -foreground black|red|green|yellow|blue|magenta|cyan|white|default.
+ * Vc only (ANSI).
+ */
+ if (opt_foreground && vcterm) {
+ printf("%s%s%c%s", ESC, "[3", '0' + opt_fo_color, "m");
+ }
+
+ /* -background black|red|green|yellow|blue|magenta|cyan|white|default.
+ * Vc only (ANSI).
+ */
+ if (opt_background && vcterm) {
+ printf("%s%s%c%s", ESC, "[4", '0' + opt_ba_color, "m");
+ }
+
+ /* -ulcolor black|red|green|yellow|blue|magenta|cyan|white|default.
+ * Vc only.
+ */
+ if (opt_ulcolor && vcterm) {
+ printf("\033[1;%d]", opt_ul_color);
+ }
+
+ /* -hbcolor black|red|green|yellow|blue|magenta|cyan|white|default.
+ * Vc only.
+ */
+ if (opt_hbcolor && vcterm) {
+ printf("\033[2;%d]", opt_hb_color);
+ }
+
+ /* -inversescreen [on|off]. Vc only (vt102).
+ */
+ if (opt_inversescreen) {
+ if (vcterm) {
+ if (opt_invsc_on)
+ printf("\033[?5h");
+ else
+ printf("\033[?5l");
+ }
+ }
+
+ /* -bold [on|off]. Vc behaves as expected, otherwise off turns off
+ * all attributes.
+ */
+ if (opt_bold) {
+ if (opt_bo_on)
+ putp(ti_entry("bold"));
+ else {
+ if (vcterm)
+ printf("%s%s", ESC, "[22m");
+ else
+ putp(ti_entry("sgr0"));
+ }
+ }
+
+ /* -half-bright [on|off]. Vc behaves as expected, otherwise off turns off
+ * all attributes.
+ */
+ if (opt_halfbright) {
+ if (opt_hb_on)
+ putp(ti_entry("dim"));
+ else {
+ if (vcterm)
+ printf("%s%s", ESC, "[22m");
+ else
+ putp(ti_entry("sgr0"));
+ }
+ }
+
+ /* -blink [on|off]. Vc behaves as expected, otherwise off turns off
+ * all attributes.
+ */
+ if (opt_blink) {
+ if (opt_bl_on)
+ putp(ti_entry("blink"));
+ else {
+ if (vcterm)
+ printf("%s%s", ESC, "[25m");
+ else
+ putp(ti_entry("sgr0"));
+ }
+ }
+
+ /* -reverse [on|off]. Vc behaves as expected, otherwise off turns
+ * off all attributes.
+ */
+ if (opt_reverse) {
+ if (opt_re_on)
+ putp(ti_entry("rev"));
+ else {
+ if (vcterm)
+ printf("%s%s", ESC, "[27m");
+ else
+ putp(ti_entry("sgr0"));
+ }
+ }
+
+ /* -underline [on|off]. */
+ if (opt_underline) {
+ if (opt_un_on)
+ putp(ti_entry("smul"));
else
- putp(ti_entry("sgr0"));
+ putp(ti_entry("rmul"));
}
- }
-
- /* -blink [on|off]. Vc behaves as expected, otherwise off turns off
- * all attributes.
- */
- if (opt_blink) {
- if (opt_bl_on)
- putp(ti_entry("blink"));
- else {
- if (vcterm)
- printf("%s%s", ESC, "[25m");
+
+ /* -store. Vc only. */
+ if (opt_store && vcterm) {
+ printf("\033[8]");
+ }
+
+ /* -clear [all|rest]. */
+ if (opt_clear) {
+ if (opt_cl_all)
+ putp(ti_entry("clear"));
else
- putp(ti_entry("sgr0"));
+ putp(ti_entry("ed"));
}
- }
-
- /* -reverse [on|off]. Vc behaves as expected, otherwise off turns
- * off all attributes.
- */
- if (opt_reverse) {
- if (opt_re_on)
- putp(ti_entry("rev"));
- else {
- if (vcterm)
- printf("%s%s", ESC, "[27m");
+
+ /* -tabs Vc only. */
+ if (opt_tabs && vcterm) {
+ int i;
+
+ if (opt_tb_array[0] == -1)
+ show_tabs();
+ else {
+ for(i=0; opt_tb_array[i] > 0; i++)
+ printf("\033[%dG\033H", opt_tb_array[i]);
+ putchar('\r');
+ }
+ }
+
+ /* -clrtabs Vc only. */
+ if (opt_clrtabs && vcterm) {
+ int i;
+
+ if (opt_tb_array[0] == -1)
+ printf("\033[3g");
else
- putp(ti_entry("sgr0"));
+ for(i=0; opt_tb_array[i] > 0; i++)
+ printf("\033[%dG\033[g", opt_tb_array[i]);
+ putchar('\r');
}
- }
- /* -underline [on|off]. */
- if (opt_underline) {
- if (opt_un_on)
- putp(ti_entry("smul"));
- else
- putp(ti_entry("rmul"));
- }
-
- /* -store. Vc only. */
- if (opt_store && vcterm) {
- printf("\033[8]");
- }
-
- /* -clear [all|rest]. */
- if (opt_clear) {
- if (opt_cl_all)
- putp(ti_entry("clear"));
- else
- putp(ti_entry("ed"));
- }
-
- /* -tabs Vc only. */
- if (opt_tabs && vcterm) {
- int i;
-
- if (opt_tb_array[0] == -1)
- show_tabs();
- else {
- for(i=0; opt_tb_array[i] > 0; i++)
- printf("\033[%dG\033H", opt_tb_array[i]);
- putchar('\r');
- }
- }
-
- /* -clrtabs Vc only. */
- if (opt_clrtabs && vcterm) {
- int i;
-
- if (opt_tb_array[0] == -1)
- printf("\033[3g");
- else
- for(i=0; opt_tb_array[i] > 0; i++)
- printf("\033[%dG\033[g", opt_tb_array[i]);
- putchar('\r');
- }
-
- /* -regtabs Vc only. */
- if (opt_regtabs && vcterm) {
- int i;
-
- printf("\033[3g\r");
- for(i=opt_rt_len+1; i<=160; i+=opt_rt_len)
- printf("\033[%dC\033H",opt_rt_len);
- putchar('\r');
- }
-
- /* -blank [0-60]. */
- if (opt_blank && vcterm)
- printf("\033[9;%d]", opt_bl_min);
+ /* -regtabs Vc only. */
+ if (opt_regtabs && vcterm) {
+ int i;
+
+ printf("\033[3g\r");
+ for(i=opt_rt_len+1; i<=160; i+=opt_rt_len)
+ printf("\033[%dC\033H",opt_rt_len);
+ putchar('\r');
+ }
+
+ /* -blank [0-60]. */
+ if (opt_blank && vcterm)
+ printf("\033[9;%d]", opt_bl_min);
- /* -powersave [on|vsync|hsync|powerdown|off] (console) */
- if (opt_powersave) {
- char ioctlarg[2];
- ioctlarg[0] = 10; /* powersave */
- ioctlarg[1] = opt_ps_mode;
- if (ioctl(0,TIOCLINUX,ioctlarg))
- fprintf(stderr,_("cannot (un)set powersave mode\n"));
- }
-
- /* -powerdown [0-60]. */
- if (opt_powerdown) {
- printf("\033[14;%d]", opt_pd_min);
- }
+ /* -powersave [on|vsync|hsync|powerdown|off] (console) */
+ if (opt_powersave) {
+ char ioctlarg[2];
+ ioctlarg[0] = 10; /* powersave */
+ ioctlarg[1] = opt_ps_mode;
+ if (ioctl(0,TIOCLINUX,ioctlarg))
+ fprintf(stderr,_("cannot (un)set powersave mode\n"));
+ }
+
+ /* -powerdown [0-60]. */
+ if (opt_powerdown) {
+ printf("\033[14;%d]", opt_pd_min);
+ }
#if 0
- /* -standout [num]. */
- if (opt_standout)
- /* nothing */;
+ /* -standout [num]. */
+ if (opt_standout)
+ /* nothing */;
#endif
- /* -snap [1-NR_CONS]. */
- if (opt_snap || opt_append) {
- FILE *F;
-
- F = fopen(opt_sn_name, opt_snap ? "w" : "a");
- if (!F) {
- perror(opt_sn_name);
- fprintf(stderr,("setterm: can not open dump file %s for output\n"),
- opt_sn_name);
- exit(-1);
- }
- screendump(opt_sn_num, F);
- fclose(F);
- }
-
- /* -msg [on|off]. */
- if (opt_msg && vcterm) {
- if (opt_msg_on)
- /* 7 -- Enable printk's to console */
- result = klogctl(7, NULL, 0);
- else
- /* 6 -- Disable printk's to console */
- result = klogctl(6, NULL, 0);
-
- if (result != 0)
- printf(_("klogctl error: %s\n"), strerror(result));
- }
-
- /* -msglevel [0-8] */
- if (opt_msglevel && vcterm) {
- /* 8 -- Set level of messages printed to console */
- result = klogctl(8, NULL, opt_msglevel_num);
- if (result != 0)
- printf(_("klogctl error: %s\n"), strerror(result));
- }
-
- /* -blength [0-2000] */
- if (opt_blength && vcterm) {
- printf("\033[11;%d]", opt_blength_l);
- }
+ /* -snap [1-NR_CONS]. */
+ if (opt_snap || opt_append) {
+ FILE *F;
+
+ F = fopen(opt_sn_name, opt_snap ? "w" : "a");
+ if (!F) {
+ perror(opt_sn_name);
+ fprintf(stderr,("setterm: can not open dump file %s for output\n"),
+ opt_sn_name);
+ exit(-1);
+ }
+ screendump(opt_sn_num, F);
+ fclose(F);
+ }
+
+ /* -msg [on|off]. */
+ if (opt_msg && vcterm) {
+ if (opt_msg_on)
+ /* 7 -- Enable printk's to console */
+ result = klogctl(7, NULL, 0);
+ else
+ /* 6 -- Disable printk's to console */
+ result = klogctl(6, NULL, 0);
+
+ if (result != 0)
+ printf(_("klogctl error: %s\n"), strerror(result));
+ }
+
+ /* -msglevel [0-8] */
+ if (opt_msglevel && vcterm) {
+ /* 8 -- Set level of messages printed to console */
+ result = klogctl(8, NULL, opt_msglevel_num);
+ if (result != 0)
+ printf(_("klogctl error: %s\n"), strerror(result));
+ }
+
+ /* -blength [0-2000] */
+ if (opt_blength && vcterm) {
+ printf("\033[11;%d]", opt_blength_l);
+ }
- /* -bfreq freqnumber */
- if (opt_bfreq && vcterm) {
- printf("\033[10;%d]", opt_bfreq_f);
- }
+ /* -bfreq freqnumber */
+ if (opt_bfreq && vcterm) {
+ printf("\033[10;%d]", opt_bfreq_f);
+ }
}
-extern char *malloc();
-
-void
-screendump(int vcnum, FILE *F){
+static void
+screendump(int vcnum, FILE *F) {
#include <sys/param.h>
char infile[MAXPATHLEN];
unsigned char header[4];
@@ -1148,69 +1177,70 @@ try_ioctl:
}
}
-int main(int argc, char **argv)
-{
- int bad_arg = FALSE; /* Set if error in arguments. */
- int arg, modifier;
- char *term; /* Terminal type. */
- int vcterm; /* Set if terminal is a virtual console. */
+int
+main(int argc, char **argv) {
+ int bad_arg = FALSE; /* Set if error in arguments. */
+ int arg, modifier;
+ char *term; /* Terminal type. */
+ int vcterm; /* Set if terminal is a virtual console. */
- setlocale(LC_ALL, "");
- bindtextdomain(PACKAGE, LOCALEDIR);
- textdomain(PACKAGE);
+ setlocale(LC_ALL, "");
+ bindtextdomain(PACKAGE, LOCALEDIR);
+ textdomain(PACKAGE);
- if (argc < 2) bad_arg = TRUE;
+ if (argc < 2)
+ bad_arg = TRUE;
- /* Parse arguments. */
+ /* Parse arguments. */
- for (arg = 1; arg < argc;) {
- if (*argv[arg] == '-') {
+ for (arg = 1; arg < argc;) {
+ if (*argv[arg] == '-') {
- /* Parse a single option. */
+ /* Parse a single option. */
- for (modifier = arg + 1; modifier < argc; modifier++) {
- if (*argv[modifier] == '-') break;
+ for (modifier = arg + 1; modifier < argc; modifier++) {
+ if (*argv[modifier] == '-') break;
+ }
+ parse_option(argv[arg] + 1, modifier - arg - 1,
+ &argv[arg + 1], &bad_arg);
+ arg = modifier;
+ } else {
+ bad_arg = TRUE;
+ arg++;
}
- parse_option(argv[arg] + 1, modifier - arg - 1,
- &argv[arg + 1], &bad_arg);
- arg = modifier;
- } else {
-
- bad_arg = TRUE;
- arg++;
}
- }
- /* Display syntax message if error in arguments. */
+ /* Display syntax message if error in arguments. */
- if (bad_arg) {
- usage(argv[0]);
- exit(1);
- }
+ if (bad_arg) {
+ usage(argv[0]);
+ exit(1);
+ }
- /* Find out terminal name. */
+ /* Find out terminal name. */
- if (opt_term) {
- term = opt_te_terminal_name;
- } else {
- term = getenv("TERM");
- if (term == NULL) {
- fprintf(stderr, _("%s: $TERM is not defined.\n"), argv[0]);
- exit(1);
+ if (opt_term) {
+ term = opt_te_terminal_name;
+ } else {
+ term = getenv("TERM");
+ if (term == NULL) {
+ fprintf(stderr, _("%s: $TERM is not defined.\n"),
+ argv[0]);
+ exit(1);
+ }
}
- }
- /* Find terminfo entry. */
+ /* Find terminfo entry. */
- setupterm(term, 1, (int *)0);
+ setupterm(term, 1, (int *)0);
- /* See if the terminal is a virtual console terminal. */
+ /* See if the terminal is a virtual console terminal. */
- vcterm = (!strncmp(term, "con", 3) || !strncmp(term, "linux", 5));
+ vcterm = (!strncmp(term, "con", 3) || !strncmp(term, "linux", 5));
- /* Perform the selected options. */
+ /* Perform the selected options. */
- perform_sequence(vcterm);
+ perform_sequence(vcterm);
- return 0;
+ return 0;
}
diff --git a/misc-utils/tsort.c b/misc-utils/tsort.c
index a1fab2a9e..b97b1a03b 100644
--- a/misc-utils/tsort.c
+++ b/misc-utils/tsort.c
@@ -86,24 +86,21 @@ typedef struct _buf {
int b_bsize;
} BUF;
-NODE *add_node(), *find_node();
-void add_arc(), no_memory(), remove_node(), tsort();
-char *grow_buf();
+NODE *add_node(char *), *find_node(char *);
+void add_arc(char *, char *), no_memory(void);
+void remove_node(NODE *), tsort(void);
+char *grow_buf(char *, int);
int find_cycle(NODE *, NODE *, int, int);
-extern int errno;
NODE *graph;
NODE *hashtable[HASHSIZE];
NODE **cycle_buf;
NODE **longest_cycle;
int
-main(argc, argv)
- int argc;
- char **argv;
-{
- register BUF *b;
- register int c, n;
+main(int argc, char **argv) {
+ BUF *b;
+ int c, n;
FILE *fp;
int bsize, nused;
BUF bufs[2];
@@ -165,10 +162,7 @@ main(argc, argv)
/* double the size of oldbuf and return a pointer to the new buffer. */
char *
-grow_buf(bp, size)
- char *bp;
- int size;
-{
+grow_buf(char *bp, int size) {
if (!(bp = realloc(bp, (u_int)size)))
no_memory();
return(bp);
@@ -179,10 +173,8 @@ grow_buf(bp, size)
* the graph, then add them.
*/
void
-add_arc(s1, s2)
- char *s1, *s2;
-{
- register NODE *n1;
+add_arc(char *s1, char *s2) {
+ NODE *n1;
NODE *n2;
int bsize;
@@ -213,11 +205,9 @@ add_arc(s1, s2)
++n2->n_refcnt;
}
-int
-hash_string(s)
- char *s;
-{
- register int hash, i;
+static int
+hash_string(char *s) {
+ int hash, i;
for (hash = 0, i = 1; *s; s++, i++)
hash += *s * i;
@@ -229,10 +219,8 @@ hash_string(s)
* found.
*/
NODE *
-find_node(name)
- char *name;
-{
- register NODE *n;
+find_node(char *name) {
+ NODE *n;
for (n = hashtable[hash_string(name)]; n; n = n->n_hash)
if (!strcmp(n->n_name, name))
@@ -242,10 +230,8 @@ find_node(name)
/* Add a node to the graph and return a pointer to it. */
NODE *
-add_node(name)
- char *name;
-{
- register NODE *n;
+add_node(char *name) {
+ NODE *n;
int hash;
if (!(n = (NODE *)malloc(sizeof(NODE))) || !(n->n_name = strdup(name)))
@@ -272,10 +258,9 @@ add_node(name)
/* do topological sort on graph */
void
-tsort()
-{
- register NODE *n, *next;
- register int cnt;
+tsort(void) {
+ NODE *n, *next;
+ int cnt;
while (graph) {
/*
@@ -314,7 +299,7 @@ tsort()
for (n = graph; n; n = n->n_next)
if (!(n->n_flags & NF_ACYCLIC)) {
if ((cnt = find_cycle(n, n, 0, 0)) != 0) {
- register int i;
+ int i;
(void)fprintf(stderr,
_("tsort: cycle in data.\n"));
@@ -338,11 +323,9 @@ tsort()
/* print node and remove from graph (does not actually free node) */
void
-remove_node(n)
- register NODE *n;
-{
- register NODE **np;
- register int i;
+remove_node(NODE *n) {
+ NODE **np;
+ int i;
(void)printf("%s\n", n->n_name);
for (np = n->n_arcs, i = n->n_narcs; --i >= 0; np++)
@@ -355,12 +338,9 @@ remove_node(n)
/* look for the longest cycle from node from to node to. */
int
-find_cycle(from, to, longest_len, depth)
- NODE *from, *to;
- int depth, longest_len;
-{
- register NODE **np;
- register int i, len;
+find_cycle(NODE *from, NODE *to, int longest_len, int depth) {
+ NODE **np;
+ int i, len;
/*
* avoid infinite loops and ignore portions of the graph known
@@ -390,8 +370,7 @@ find_cycle(from, to, longest_len, depth)
}
void
-no_memory()
-{
+no_memory(void) {
(void)fprintf(stderr, "tsort: %s.\n", strerror(ENOMEM));
exit(1);
}
diff --git a/misc-utils/whereis.c b/misc-utils/whereis.c
index cb07bc685..bc505c54f 100644
--- a/misc-utils/whereis.c
+++ b/misc-utils/whereis.c
@@ -143,10 +143,7 @@ char uflag;
* look for source, documentation and binaries
*/
int
-main(argc, argv)
- int argc;
- char *argv[];
-{
+main(int argc, char **argv) {
setlocale(LC_ALL, "");
bindtextdomain(PACKAGE, LOCALEDIR);
textdomain(PACKAGE);
diff --git a/misc-utils/write.c b/misc-utils/write.c
index cac26239e..1cf99c7f0 100644
--- a/misc-utils/write.c
+++ b/misc-utils/write.c
@@ -45,13 +45,16 @@
*
*/
+#include <stdio.h>
#include <unistd.h>
#include <utmp.h>
+#include <errno.h>
#include <ctype.h>
+#include <time.h>
#include <pwd.h>
-#include <stdio.h>
#include <string.h>
#include <locale.h>
+#include <signal.h>
#include <sys/param.h>
#include <sys/signal.h>
#include <sys/stat.h>
@@ -66,19 +69,17 @@
void search_utmp(char *, char *, char *, uid_t);
void do_write(char *, char *, uid_t);
void wr_fputs(char *);
+static void done(int);
int term_chk(char *, int *, time_t *, int);
int utmp_chk(char *, char *);
-extern int errno;
int
-main(int argc, char **argv)
-{
+main(int argc, char **argv) {
time_t atime;
uid_t myuid;
int msgsok, myttyfd;
- char tty[MAXPATHLEN], *mytty, *ttyname();
- void done();
+ char tty[MAXPATHLEN], *mytty;
setlocale(LC_ALL, "");
bindtextdomain(PACKAGE, LOCALEDIR);
@@ -146,7 +147,7 @@ main(int argc, char **argv)
(void)fprintf(stderr, _("usage: write user [tty]\n"));
exit(1);
}
- done();
+ done(0);
/* NOTREACHED */
return 0;
}
@@ -287,14 +288,11 @@ int term_chk(char *tty, int *msgsokP, time_t *atimeP, int showerror)
/*
* do_write - actually make the connection
*/
-void do_write(char *tty, char *mytty, uid_t myuid)
-
-{
+void do_write(char *tty, char *mytty, uid_t myuid) {
register char *login, *nows;
register struct passwd *pwd;
- time_t now, time();
- char *getlogin(), path[MAXPATHLEN], host[MAXHOSTNAMELEN], line[512];
- void done();
+ time_t now;
+ char path[MAXPATHLEN], host[MAXHOSTNAMELEN], line[512];
/* Determine our login name before the we reopen() stdout */
if ((login = getlogin()) == NULL) {
@@ -333,8 +331,8 @@ void do_write(char *tty, char *mytty, uid_t myuid)
/*
* done - cleanup and exit
*/
-void done(void)
-{
+static void
+done(int dummy) {
(void)printf("EOF\r\n");
exit(0);
}