Subject: bin/13975: bin/stty with corrected style
To: None <gnats-bugs@gnats.netbsd.org>
From: Petri Koistinen <thoron@mb-u10ip029.mbnet.fi>
List: netbsd-bugs
Date: 09/16/2001 21:58:36
>Number: 13975
>Category: bin
>Synopsis: bin/stty with corrected style
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: bin-bug-people
>State: open
>Class: change-request
>Submitter-Id: net
>Arrival-Date: Sun Sep 16 11:57:00 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator: Petri Koistinen
>Release: NetBSD-current Sun Sep 16 21:57:17 EEST 2001
>Organization:
>Environment:
>Description:
Please apply attached patches for bin/stty.
>How-To-Repeat:
>Fix:
Index: cchar.c
===================================================================
RCS file: /cvsroot/basesrc/bin/stty/cchar.c,v
retrieving revision 1.13
diff -u -r1.13 cchar.c
--- cchar.c 1998/07/28 11:51:47 1.13
+++ cchar.c 2001/09/16 18:52:53
@@ -1,4 +1,4 @@
-/* $NetBSD: cchar.c,v 1.13 1998/07/28 11:51:47 mycroft Exp $ */
+/* $NetBSD: cchar.c,v 1.13 1998/07/28 11:51:47 mycroft Exp $ */
/*-
* Copyright (c) 1991, 1993, 1994
@@ -89,20 +89,17 @@
{ NULL },
};
-static int c_cchar __P((const void *, const void *));
+static int c_cchar(const void *, const void *);
static int
-c_cchar(a, b)
- const void *a, *b;
+c_cchar(const void *a, const void *b)
{
return (strcmp(((const struct cchar *)a)->name,
((const struct cchar *)b)->name));
}
int
-csearch(argvp, ip)
- char ***argvp;
- struct info *ip;
+csearch(char ***argvp, struct info *ip)
{
struct cchar *cp, tmp;
long val;
Index: extern.h
===================================================================
RCS file: /cvsroot/basesrc/bin/stty/extern.h,v
retrieving revision 1.9
diff -u -r1.9 extern.h
--- extern.h 1998/07/28 11:40:58 1.9
+++ extern.h 2001/09/16 18:52:53
@@ -1,4 +1,4 @@
-/* $NetBSD: extern.h,v 1.9 1998/07/28 11:40:58 mycroft Exp $ */
+/* $NetBSD: extern.h,v 1.9 1998/07/28 11:40:58 mycroft Exp $ */
/*-
* Copyright (c) 1991, 1993
@@ -35,16 +35,21 @@
* @(#)extern.h 8.1 (Berkeley) 5/31/93
*/
-int c_cchars __P((const void *, const void *));
-int c_modes __P((const void *, const void *));
-int csearch __P((char ***, struct info *));
-void checkredirect __P((void));
-void gprint __P((struct termios *));
-void gread __P((struct termios *, char *));
-int ksearch __P((char ***, struct info *));
-int msearch __P((char ***, struct info *));
-void optlist __P((void));
-void print __P((struct termios *, struct winsize *, int, enum FMT));
-void usage __P((void));
+#ifndef _EXTERN_H_
+#define _EXTERN_H_
+int c_cchars(const void *, const void *);
+int c_modes(const void *, const void *);
+int csearch(char ***, struct info *);
+void checkredirect(void);
+void gprint(struct termios *);
+void gread(struct termios *, char *);
+int ksearch(char ***, struct info *);
+int msearch(char ***, struct info *);
+void optlist(void);
+void print(struct termios *, struct winsize *, int, enum FMT);
+void usage(void);
+
extern const struct cchar cchars1[], cchars2[];
+
+#endif /* !_EXTERN_H_ */
Index: gfmt.c
===================================================================
RCS file: /cvsroot/basesrc/bin/stty/gfmt.c,v
retrieving revision 1.14
diff -u -r1.14 gfmt.c
--- gfmt.c 1999/06/10 14:59:50 1.14
+++ gfmt.c 2001/09/16 18:52:53
@@ -1,4 +1,4 @@
-/* $NetBSD: gfmt.c,v 1.14 1999/06/10 14:59:50 mrg Exp $ */
+/* $NetBSD: gfmt.c,v 1.14 1999/06/10 14:59:50 mrg Exp $ */
/*-
* Copyright (c) 1991, 1993, 1994
@@ -51,11 +51,10 @@
#include "stty.h"
#include "extern.h"
-static void gerr __P((char *));
+static void gerr(char *);
static void
-gerr(s)
- char *s;
+gerr(char *s)
{
if (s)
errx(1, "illegal gfmt1 option -- %s", s);
@@ -64,8 +63,7 @@
}
void
-gprint(tp)
- struct termios *tp;
+gprint(struct termios *tp)
{
const struct cchar *cp;
@@ -77,9 +75,7 @@
}
void
-gread(tp, s)
- struct termios *tp;
- char *s;
+gread(struct termios *tp, char *s)
{
const struct cchar *cp;
char *ep, *p;
Index: key.c
===================================================================
RCS file: /cvsroot/basesrc/bin/stty/key.c,v
retrieving revision 1.17
diff -u -r1.17 key.c
--- key.c 1999/03/02 17:30:05 1.17
+++ key.c 2001/09/16 18:52:55
@@ -1,4 +1,4 @@
-/* $NetBSD: key.c,v 1.17 1999/03/02 17:30:05 christos Exp $ */
+/* $NetBSD: key.c,v 1.17 1999/03/02 17:30:05 christos Exp $ */
/*-
* Copyright (c) 1991, 1993, 1994
@@ -54,28 +54,28 @@
#include "extern.h"
__BEGIN_DECLS
-void f_all __P((struct info *));
-void f_cbreak __P((struct info *));
-void f_columns __P((struct info *));
-void f_dec __P((struct info *));
-void f_everything __P((struct info *));
-void f_extproc __P((struct info *));
-void f_ispeed __P((struct info *));
-void f_nl __P((struct info *));
-void f_ospeed __P((struct info *));
-void f_raw __P((struct info *));
-void f_rows __P((struct info *));
-void f_sane __P((struct info *));
-void f_size __P((struct info *));
-void f_speed __P((struct info *));
-void f_ostart __P((struct info *));
-void f_ostop __P((struct info *));
-void f_tty __P((struct info *));
+void f_all(struct info *);
+void f_cbreak(struct info *);
+void f_columns(struct info *);
+void f_dec(struct info *);
+void f_everything(struct info *);
+void f_extproc(struct info *);
+void f_ispeed(struct info *);
+void f_nl(struct info *);
+void f_ospeed(struct info *);
+void f_raw(struct info *);
+void f_rows(struct info *);
+void f_sane(struct info *);
+void f_size(struct info *);
+void f_speed(struct info *);
+void f_ostart(struct info *);
+void f_ostop(struct info *);
+void f_tty(struct info *);
__END_DECLS
static const struct key {
const char *name; /* name */
- void (*f) __P((struct info *)); /* function */
+ void (*f)(struct info *); /* function */
#define F_NEEDARG 0x01 /* needs an argument */
#define F_OFFOK 0x02 /* can turn off */
int flags;
@@ -103,11 +103,10 @@
{ "tty", f_tty, 0 },
};
-static int c_key __P((const void *, const void *));
+static int c_key(const void *, const void *);
static int
-c_key(a, b)
- const void *a, *b;
+c_key(const void *a, const void *b)
{
return (strcmp(((const struct key *)a)->name,
@@ -115,9 +114,7 @@
}
int
-ksearch(argvp, ip)
- char ***argvp;
- struct info *ip;
+ksearch(char ***argvp, struct info *ip)
{
char *name;
struct key *kp, tmp;
@@ -146,17 +143,14 @@
}
void
-f_all(ip)
- struct info *ip;
+f_all(struct info *ip)
{
print(&ip->t, &ip->win, ip->ldisc, STTY_BSD);
}
void
-f_cbreak(ip)
- struct info *ip;
+f_cbreak(struct info *ip)
{
-
if (ip->off)
f_sane(ip);
else {
@@ -169,19 +163,15 @@
}
void
-f_columns(ip)
- struct info *ip;
+f_columns(struct info *ip)
{
-
ip->win.ws_col = atoi(ip->arg);
ip->wset = 1;
}
void
-f_dec(ip)
- struct info *ip;
+f_dec(struct info *ip)
{
-
ip->t.c_cc[VERASE] = (u_char)0177;
ip->t.c_cc[VKILL] = CTRL('u');
ip->t.c_cc[VINTR] = CTRL('c');
@@ -192,16 +182,13 @@
}
void
-f_everything(ip)
- struct info *ip;
+f_everything(struct info *ip)
{
-
print(&ip->t, &ip->win, ip->ldisc, STTY_BSD);
}
void
-f_extproc(ip)
- struct info *ip;
+f_extproc(struct info *ip)
{
#ifdef TIOCEXT
if (ip->off) {
@@ -216,19 +203,15 @@
}
void
-f_ispeed(ip)
- struct info *ip;
+f_ispeed(struct info *ip)
{
-
cfsetispeed(&ip->t, atoi(ip->arg));
ip->set = 1;
}
void
-f_nl(ip)
- struct info *ip;
+f_nl(struct info *ip)
{
-
if (ip->off) {
ip->t.c_iflag |= ICRNL;
ip->t.c_oflag |= ONLCR;
@@ -240,19 +223,15 @@
}
void
-f_ospeed(ip)
- struct info *ip;
+f_ospeed(struct info *ip)
{
-
cfsetospeed(&ip->t, atoi(ip->arg));
ip->set = 1;
}
void
-f_raw(ip)
- struct info *ip;
+f_raw(struct info *ip)
{
-
if (ip->off)
f_sane(ip);
else {
@@ -264,19 +243,15 @@
}
void
-f_rows(ip)
- struct info *ip;
+f_rows(struct info *ip)
{
-
ip->win.ws_row = atoi(ip->arg);
ip->wset = 1;
}
void
-f_sane(ip)
- struct info *ip;
+f_sane(struct info *ip)
{
-
ip->t.c_cflag = TTYDEF_CFLAG | (ip->t.c_cflag & (CLOCAL|CRTSCTS|CDTRCTS));
ip->t.c_iflag = TTYDEF_IFLAG;
ip->t.c_iflag |= ICRNL;
@@ -288,25 +263,20 @@
}
void
-f_size(ip)
- struct info *ip;
+f_size(struct info *ip)
{
-
(void)printf("%d %d\n", ip->win.ws_row, ip->win.ws_col);
}
void
-f_speed(ip)
- struct info *ip;
+f_speed(struct info *ip)
{
-
(void)printf("%d\n", cfgetospeed(&ip->t));
}
/* ARGSUSED */
void
-f_tty(ip)
- struct info *ip;
+f_tty(struct info *ip)
{
#ifdef TTYDISC
int tmp;
@@ -318,16 +288,14 @@
}
void
-f_ostart(ip)
- struct info *ip;
+f_ostart(struct info *ip)
{
if (ioctl (0, TIOCSTART) < 0)
err(1, "TIOCSTART");
}
void
-f_ostop(ip)
- struct info *ip;
+f_ostop(struct info *ip)
{
if (ioctl (0, TIOCSTOP) < 0)
err(1, "TIOCSTOP");
Index: modes.c
===================================================================
RCS file: /cvsroot/basesrc/bin/stty/modes.c,v
retrieving revision 1.14
diff -u -r1.14 modes.c
--- modes.c 1998/07/28 11:40:59 1.14
+++ modes.c 2001/09/16 18:52:55
@@ -1,4 +1,4 @@
-/* $NetBSD: modes.c,v 1.14 1998/07/28 11:40:59 mycroft Exp $ */
+/* $NetBSD: modes.c,v 1.14 1998/07/28 11:40:59 mycroft Exp $ */
/*-
* Copyright (c) 1991, 1993, 1994
@@ -43,8 +43,10 @@
#endif /* not lint */
#include <sys/types.h>
+
#include <stddef.h>
#include <string.h>
+
#include "stty.h"
#include "extern.h"
@@ -205,9 +207,7 @@
#define CHK(s) (!strcmp(name, s))
int
-msearch(argvp, ip)
- char ***argvp;
- struct info *ip;
+msearch(char ***argvp, struct info *ip)
{
const struct modes *mp;
char *name;
Index: print.c
===================================================================
RCS file: /cvsroot/basesrc/bin/stty/print.c,v
retrieving revision 1.19
diff -u -r1.19 print.c
--- print.c 1999/03/02 17:27:03 1.19
+++ print.c 2001/09/16 18:52:55
@@ -1,4 +1,4 @@
-/* $NetBSD: print.c,v 1.19 1999/03/02 17:27:03 christos Exp $ */
+/* $NetBSD: print.c,v 1.19 1999/03/02 17:27:03 christos Exp $ */
/*-
* Copyright (c) 1991, 1993, 1994
@@ -51,16 +51,12 @@
#include "stty.h"
#include "extern.h"
-static void binit __P((const char *));
-static void bput __P((const char *));
-static char *ccval __P((const struct cchar *, int));
+static void binit(const char *);
+static void bput(const char *);
+static char *ccval(const struct cchar *, int);
void
-print(tp, wp, ldisc, fmt)
- struct termios *tp;
- struct winsize *wp;
- int ldisc;
- enum FMT fmt;
+print(struct termios *tp, struct winsize *wp, int ldisc, enum FMT fmt)
{
const struct cchar *p;
long tmp;
@@ -221,8 +217,7 @@
static const char *label;
static void
-binit(lb)
- const char *lb;
+binit(const char *lb)
{
if (col) {
@@ -233,8 +228,7 @@
}
static void
-bput(s)
- const char *s;
+bput(const char *s)
{
if (col == 0) {
@@ -250,9 +244,7 @@
}
static char *
-ccval(p, c)
- const struct cchar *p;
- int c;
+ccval(const struct cchar *p, int c)
{
static char buf[5];
char *bp;
Index: stty.c
===================================================================
RCS file: /cvsroot/basesrc/bin/stty/stty.c,v
retrieving revision 1.17
diff -u -r1.17 stty.c
--- stty.c 1999/03/02 17:30:05 1.17
+++ stty.c 2001/09/16 18:52:55
@@ -1,4 +1,4 @@
-/* $NetBSD: stty.c,v 1.17 1999/03/02 17:30:05 christos Exp $ */
+/* $NetBSD: stty.c,v 1.17 1999/03/02 17:30:05 christos Exp $ */
/*-
* Copyright (c) 1989, 1991, 1993, 1994
@@ -61,17 +61,17 @@
#include "stty.h"
#include "extern.h"
-int main __P((int, char *[]));
+int main(int, char *[]);
int
-main(argc, argv)
- int argc;
- char *argv[];
+main(int argc, char *argv[])
{
struct info i;
enum FMT fmt;
int ch;
+ setprogname(argv[0]);
+
fmt = STTY_NOTSET;
i.fd = STDIN_FILENO;
@@ -161,10 +161,10 @@
}
void
-usage()
+usage(void)
{
- (void)fprintf(stderr, "usage: stty [-a|-e|-g] [-f file] [options]\n");
+ (void)fprintf(stderr, "usage: %s [-a|-e|-g] [-f file] [options]\n", getprogname());
exit(1);
/* NOTREACHED */
}
Index: stty.h
===================================================================
RCS file: /cvsroot/basesrc/bin/stty/stty.h,v
retrieving revision 1.8
diff -u -r1.8 stty.h
--- stty.h 1999/03/02 17:27:04 1.8
+++ stty.h 2001/09/16 18:52:55
@@ -1,4 +1,4 @@
-/* $NetBSD: stty.h,v 1.8 1999/03/02 17:27:04 christos Exp $ */
+/* $NetBSD: stty.h,v 1.8 1999/03/02 17:27:04 christos Exp $ */
/*-
* Copyright (c) 1991, 1993
@@ -35,6 +35,9 @@
* @(#)stty.h 8.1 (Berkeley) 5/31/93
*/
+#ifndef _STTY_H_
+#define _STTY_H_
+
#include <sys/ioctl.h>
#include <termios.h>
@@ -58,3 +61,5 @@
enum FMT { STTY_NOTSET, STTY_GFLAG, STTY_BSD, STTY_POSIX };
#define LINELENGTH 72
+
+#endif /* !_STTY_H_ */
>Release-Note:
>Audit-Trail:
>Unformatted:
>System: NetBSD mb-u10ip029.mbnet.fi 1.5Y NetBSD 1.5Y (SPEEDBALL) #4: Sun Sep 16 17:06:05 EEST 2001 thoron@legoland:/usr/src/sys/arch/amiga/compile/SPEEDBALL amiga
Architecture: m68k
Machine: amiga