From fcc9ea4ee2991d096112808852070263c607af14 Mon Sep 17 00:00:00 2001 From: Chris Pressey Date: Wed, 24 Mar 2004 17:46:23 +0000 Subject: [PATCH] Style(9) cleanup. - Convert K&R-style function definitions to ANSI style. - Remove ``register'' keywords. - Add needed static prototypes. - Sort and space #include's as per style(9). - Adjust indentation issues in a few places. - Fix two typos in comments. - Add $DragonFly$ tags. --- usr.sbin/pcvt/cursor/cursor.c | 16 +++-- usr.sbin/pcvt/demo/playvt.c | 11 +-- usr.sbin/pcvt/fontedit/fontedit.c | 103 +++++++++++++--------------- usr.sbin/pcvt/ispcvt/ispcvt.c | 19 +++-- usr.sbin/pcvt/kcon/kcon.c | 66 +++++++++--------- usr.sbin/pcvt/keycap/keycap.c | 72 ++++++++++--------- usr.sbin/pcvt/loadfont/loadfont.c | 33 +++++---- usr.sbin/pcvt/scon/scon.c | 48 +++++++------ usr.sbin/pcvt/set2061/ICD2061Aalt.c | 74 +++++++++----------- usr.sbin/pcvt/set2061/main.c | 13 ++-- usr.sbin/pcvt/userkeys/vt220keys.c | 45 ++++++------ 11 files changed, 256 insertions(+), 244 deletions(-) diff --git a/usr.sbin/pcvt/cursor/cursor.c b/usr.sbin/pcvt/cursor/cursor.c index f91e0d7899..a7ac9dafe1 100644 --- a/usr.sbin/pcvt/cursor/cursor.c +++ b/usr.sbin/pcvt/cursor/cursor.c @@ -33,7 +33,7 @@ * * @(#)cursor.c, 3.20, Last Edit-Date: [Tue Apr 4 12:27:54 1995] * $FreeBSD: src/usr.sbin/pcvt/cursor/cursor.c,v 1.7.6.2 2001/05/12 10:11:41 kris Exp $ - * $DragonFly: src/usr.sbin/pcvt/cursor/Attic/cursor.c,v 1.2 2003/06/17 04:29:59 dillon Exp $ + * $DragonFly: src/usr.sbin/pcvt/cursor/Attic/cursor.c,v 1.3 2004/03/24 17:46:22 cpressey Exp $ */ /*---------------------------------------------------------------------------* @@ -44,18 +44,19 @@ * *---------------------------------------------------------------------------*/ +#include +#include + #include #include #include -#include -#include #include +static void usage(void); + #define DEFAULTFD 0 -main(argc,argv) -int argc; -char *argv[]; +main(int argc, char **argv) { extern int optind; extern int opterr; @@ -127,7 +128,8 @@ char *argv[]; exit(0); } -usage() +void +usage(void) { fprintf(stderr,"\ncursor - set cursor shape for pcvt video driver\n"); fprintf(stderr,"usage: cursor -d [device] -n [no] -s [line] -e [line]\n"); diff --git a/usr.sbin/pcvt/demo/playvt.c b/usr.sbin/pcvt/demo/playvt.c index b34d798c10..3950d9b487 100644 --- a/usr.sbin/pcvt/demo/playvt.c +++ b/usr.sbin/pcvt/demo/playvt.c @@ -28,6 +28,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * + * $DragonFly: src/usr.sbin/pcvt/demo/Attic/playvt.c,v 1.2 2004/03/24 17:46:22 cpressey Exp $ */ static char *id = @@ -44,9 +45,9 @@ static char *id = #include #include -main(argc,argv) -int argc; -char *argv[]; +static void usage(void); + +main(int argc, char **argv) { extern int optind; extern int opterr; @@ -99,8 +100,8 @@ char *argv[]; } } - -usage() +void +usage(void) { fprintf(stderr,"\nplayvt - play a VT animation with programmable delay\n"); fprintf(stderr,"usage: playvt -f [filename] -d [delay]\n"); diff --git a/usr.sbin/pcvt/fontedit/fontedit.c b/usr.sbin/pcvt/fontedit/fontedit.c index 2ee314094c..755b5cffc9 100644 --- a/usr.sbin/pcvt/fontedit/fontedit.c +++ b/usr.sbin/pcvt/fontedit/fontedit.c @@ -21,10 +21,10 @@ * Nov 22, 1987 - Added BSD Compatible ioctl, turned cursor on/off * - eap@bucsf.bu.edu * - * $DragonFly: src/usr.sbin/pcvt/fontedit/Attic/fontedit.c,v 1.2 2004/02/10 02:59:42 rob Exp $ + * $DragonFly: src/usr.sbin/pcvt/fontedit/Attic/fontedit.c,v 1.3 2004/03/24 17:46:23 cpressey Exp $ */ -void clear_screen(); +static void clear_screen(void); #include #ifdef SYSV #include @@ -120,9 +120,11 @@ FILE * font_file = (FILE *)0; * Exit gracefully. */ -interrupt() +void +interrupt(void) { void clear_screen(); + #ifdef CURFIX printf("%s\n",CURSORON); #endif CURFIX @@ -145,9 +147,8 @@ interrupt() * Grab input/output file and call main command processor. */ -main( argc, argv ) -int argc; -char *argv[]; +int +main(int argc, char **argv) { void command(), init_restore(), clear_screen(); void save_table(), get_table(), extract_entry(); @@ -245,11 +246,11 @@ char *argv[]; */ void -command() +command(void) { - register int c; - register int row, col; - register int i, j; + int c; + int row, col; + int i, j; bool change, error, override; void build_entry(), extract_entry(), send_entry(), print_entry(); @@ -473,11 +474,11 @@ char *key_table[] = { */ int -get_key() +get_key(void) { - register char *p; - char s[10]; - register int i, j; + char *p; + char s[10]; + int i, j; p = s; for ( i = 0; i < 10; ++i ) { @@ -503,7 +504,8 @@ get_key() * Emit nulls so that the terminal can catch up. */ -pad() +void +pad(void) { int i; @@ -520,10 +522,10 @@ pad() */ void -init_restore() +init_restore(void) { - register int row, col; - register int i; + int row, col; + int i; void draw_current(), clear_screen(), print_entry(); @@ -587,9 +589,9 @@ init_restore() */ void -draw_current() +draw_current(void) { - register int row, col; + int row, col; printf( "\033)0" ); /* Special graphics in G1 */ printf( "\016" ); /* Lock in G1 (SO) */ @@ -622,11 +624,8 @@ draw_current() */ void -highlight( row, col, on ) -unsigned int row, col; -bool on; +highlight(unsigned int row, unsigned int col, bool on) { - printf( "\033)0" ); /* Special graphics in G1 */ printf( "\016" ); /* Lock in G1 (SO) */ if ( on ) { @@ -658,7 +657,7 @@ bool on; */ void -clear_screen() +clear_screen(void) { printf( "\033[H\033[J" ); /* Clear screen. */ fflush( stdout ); @@ -670,8 +669,7 @@ clear_screen() * move */ -move( y, x ) -int y, x; +move(int y, int x) { printf( "\033[%d;%df", y, x ); } @@ -685,11 +683,10 @@ int y, x; */ void -build_entry( entry_no ) -unsigned int entry_no; +build_entry(unsigned int entry_no) { - register int row, col; - register unsigned int mask; + int row, col; + unsigned int mask; for ( col = 0; col < 8; ++col ) { @@ -719,16 +716,15 @@ unsigned int entry_no; /* - * Extract_engry + * Extract_entry * convert sixel representation into an array of bits. */ void -extract_entry( entry_no ) -unsigned int entry_no; +extract_entry(unsigned int entry_no) { - register int row, col; - register unsigned int mask; + int row, col; + unsigned int mask; for ( col = 0; col < 8; ++col ) { @@ -770,10 +766,9 @@ unsigned int entry_no; */ void -send_entry( entry_no ) -int entry_no; +send_entry(int entry_no) { - register char *fp = font_table[entry_no]; + char *fp = font_table[entry_no]; printf( "\033P1;%d;1;0;0;0{ @%c%c%c%c%c%c%c%c/%c%c%c%c%c%c%c%c\033\\", entry_no, @@ -792,12 +787,9 @@ int entry_no; */ void -print_entry( entry_no, highlight ) -register unsigned int entry_no; -bool highlight; +print_entry(unsigned int entry_no, bool highlight) { - - register int y, x; + int y, x; y = entry_no & 0x07; x = entry_no >> 3 & 0x1f; @@ -824,11 +816,10 @@ bool highlight; */ void -save_table( font_file ) -FILE *font_file; +save_table(FILE *font_file) { - register char *fp; - register int i; + char *fp; + int i; for ( i = 0; i < TOTAL_ENTRIES; ++i ) { fp = font_table[i]; @@ -847,14 +838,13 @@ FILE *font_file; */ void -get_table( font_file ) -FILE *font_file; +get_table(FILE *font_file) { - char s[256]; - register char *p; - char *fp; + char s[256]; + char *p; + char *fp; int i; - register int j; + int j; while( fgets( s, 255, font_file ) ) { if ( strncmp( s, "\033P1;", 4 ) != 0 ) @@ -892,7 +882,7 @@ FILE *font_file; */ void -help() +help(void) { printf( "Font editor\n\n" ); printf( "F6 - Pixel on\n" ); @@ -917,8 +907,7 @@ help() */ void -warning( s ) -char *s; +warning(char *s) { move( ERROR_ROW, ERROR_COL ); printf( "Warning: %s!\n", s ); diff --git a/usr.sbin/pcvt/ispcvt/ispcvt.c b/usr.sbin/pcvt/ispcvt/ispcvt.c index a9f46a494f..7727e6cdf0 100644 --- a/usr.sbin/pcvt/ispcvt/ispcvt.c +++ b/usr.sbin/pcvt/ispcvt/ispcvt.c @@ -29,7 +29,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD: src/usr.sbin/pcvt/ispcvt/ispcvt.c,v 1.7.6.1 2001/05/12 10:11:41 kris Exp $ - * $DragonFly: src/usr.sbin/pcvt/ispcvt/Attic/ispcvt.c,v 1.2 2003/06/17 04:29:59 dillon Exp $ + * $DragonFly: src/usr.sbin/pcvt/ispcvt/Attic/ispcvt.c,v 1.3 2004/03/24 17:46:23 cpressey Exp $ */ static char *id = @@ -54,16 +54,19 @@ static char *id = * *---------------------------------------------------------------------------*/ +#include + #include #include #include -#include #define DEFAULTFD 0 -main(argc,argv) -int argc; -char *argv[]; +static void usage(void); +static void next(void); + +int +main(int argc, char **argv) { extern int optind; extern int opterr; @@ -285,7 +288,8 @@ char *argv[]; } } -usage() +void +usage(void) { fprintf(stderr,"\nispcvt - verify current video driver is the pcvt-driver\n"); fprintf(stderr," usage: ispcvt [-v] [-c] [-d device]\n"); @@ -295,7 +299,8 @@ usage() exit(5); } -next() +void +next(void) { static int i = 0; diff --git a/usr.sbin/pcvt/kcon/kcon.c b/usr.sbin/pcvt/kcon/kcon.c index 1f9cdedd37..48455bcee0 100644 --- a/usr.sbin/pcvt/kcon/kcon.c +++ b/usr.sbin/pcvt/kcon/kcon.c @@ -34,6 +34,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * + * $DragonFly: src/usr.sbin/pcvt/kcon/Attic/kcon.c,v 1.2 2004/03/24 17:46:23 cpressey Exp $ */ static char *id = @@ -57,14 +58,24 @@ static char *id = * *---------------------------------------------------------------------------*/ -#include -#include #include #include #include +#include +#include + #include "keycap.h" +static void usage(void); +static void listcurrent(int); +static void setrepeat(int, int); +static void settypeam(int, int, int); +static void remapkeys(int, char *); +static void set_lock(char[], int); +static void set_shift(char[], int); +static void set_char(char[], int); + int Rf = 0; int df = 0; int lf = 0; @@ -79,9 +90,8 @@ int sf = 0; /*---------------------------------------------------------------------------* * main entry *---------------------------------------------------------------------------*/ -main(argc, argv) -int argc; -char *argv[]; +int +main(int argc, char **argv) { extern char *optarg; extern int optind; @@ -222,7 +232,8 @@ char *argv[]; /*---------------------------------------------------------------------------* * display usage info & exit *---------------------------------------------------------------------------*/ -usage() +void +usage(void) { fprintf(stderr, "\nkcon: keyboard control and remapping utility for pcvt video driver\n"); fprintf(stderr, "usage: [-R] [-d delay] [-l] [-m map] [-o] [-p] [-r rate] [-t +/-] [-x]\n"); @@ -242,8 +253,8 @@ usage() /*---------------------------------------------------------------------------* * convert control char in string to printable values *---------------------------------------------------------------------------*/ -char *showcntrl(s) -u_char *s; +char * +showcntrl(u_char *s) { static char res_str[80]; static char conv_buf[80]; @@ -278,8 +289,8 @@ u_char *s; /*---------------------------------------------------------------------------* * list the current keyboard mapping *---------------------------------------------------------------------------*/ -listcurrent(kbfd) -int kbfd; +void +listcurrent(int kbfd) { static char *keytypetab[] = { "NONE ", @@ -391,8 +402,8 @@ int kbfd; /*---------------------------------------------------------------------------* * show delay and rate values for keyboard *---------------------------------------------------------------------------*/ -showtypeamatic(kbfd) -int kbfd; +int +showtypeamatic(int kbfd) { static char *delaytab[] = { "250", @@ -456,9 +467,8 @@ int kbfd; /*---------------------------------------------------------------------------* * set repeat feature on/off *---------------------------------------------------------------------------*/ -setrepeat(kbfd, tf) -int kbfd; -int tf; +void +setrepeat(int kbfd, int tf) { int srepsw_val; @@ -477,10 +487,8 @@ int tf; /*---------------------------------------------------------------------------* * set delay and rate values for keyboard *---------------------------------------------------------------------------*/ -settypeam(kbfd, delay, rate) -int kbfd; -int delay; -int rate; +void +settypeam(int kbfd, int delay, int rate) { int cur_typemat_val; int new_typemat_val; @@ -513,9 +521,8 @@ int rate; /*---------------------------------------------------------------------------* * remap keyboard from keycap entry *---------------------------------------------------------------------------*/ -remapkeys(kbfd, map) -int kbfd; -char *map; +void +remapkeys(int kbfd, char *map) { char cap_entry[1024]; int ret; @@ -563,9 +570,8 @@ char *map; /*---------------------------------------------------------------------------* * care for lock keys *---------------------------------------------------------------------------*/ -set_lock(keyflag, kbfd) -char keyflag[]; -int kbfd; +void +set_lock(char keyflag[], int kbfd) { int i, j; char cap[16]; @@ -615,9 +621,8 @@ int kbfd; /*---------------------------------------------------------------------------* * care for shifting keys *---------------------------------------------------------------------------*/ -set_shift(keyflag, kbfd) -char keyflag[]; -int kbfd; +void +set_shift(char keyflag[], int kbfd) { int i, j; char cap[16]; @@ -668,9 +673,8 @@ int kbfd; /*---------------------------------------------------------------------------* * care for normal keys *---------------------------------------------------------------------------*/ -set_char(keyflag, kbfd) -char keyflag[]; -int kbfd; +void +set_char(char keyflag[], int kbfd) { int i, j; char cap[16]; diff --git a/usr.sbin/pcvt/keycap/keycap.c b/usr.sbin/pcvt/keycap/keycap.c index 9bbb7e5847..a987961d9e 100644 --- a/usr.sbin/pcvt/keycap/keycap.c +++ b/usr.sbin/pcvt/keycap/keycap.c @@ -33,6 +33,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * + * $DragonFly: src/usr.sbin/pcvt/keycap/Attic/keycap.c,v 1.2 2004/03/24 17:46:23 cpressey Exp $ */ static char *id = @@ -84,12 +85,13 @@ static char *kdecode(); /*---------------------------------------------------------------------------* * match a name *---------------------------------------------------------------------------*/ -static char *nmatch(id,cstr) -char *id,*cstr; +static char * +nmatch(char *id, char *cstr) { - register n = strlen(id); - register char *c = cstr+n; + int n; + char *c = cstr+n; + n = strlen(id); if (strncmp(id,cstr,n)==0 && (*c==':' || *c=='|' || *c=='=' || *c=='#') || *c=='@') return c; @@ -100,12 +102,12 @@ char *id,*cstr; * Get an entry for keyboard name in buffer bp from the keycap file. * Parse is very rudimentary, we just notice escaped newlines. *---------------------------------------------------------------------------*/ -kgetent(bp, name) -char *bp, *name; +int +kgetent(char *bp, char *name) { - register char *cp; - register int c; - register int i = 0, cnt = 0; + char *cp; + int c; + int i = 0, cnt = 0; char ibuf[KEYCAP_BUFSIZ]; char *cp2; int tf; @@ -159,9 +161,10 @@ char *bp, *name; * find xxx and append that entry (minus the names) to take the place of * the tc=xxx entry. Note that this works because of the left to right scan. *---------------------------------------------------------------------------*/ -static int knchktc() +static int +knchktc(void) { - register char *p, *q; + char *p, *q; char tcname[16]; /* name of similar keyboard */ char tcbuf[KEYCAP_BUFSIZ]; char *holdtbuf = tbuf; @@ -206,10 +209,10 @@ static int knchktc() * name. The normal : terminator after the last name (before the first field) * stops us. *---------------------------------------------------------------------------*/ -static int knamatch(np) -char *np; +static int +knamatch(char *np) { - register char *Np, *Bp; + char *Np, *Bp; Bp = tbuf; if (*Bp == '#' || *Bp == 0) @@ -232,8 +235,8 @@ char *np; * \: escapes or any such. If necessary, :'s can be put into the keycap file * in octal. *---------------------------------------------------------------------------*/ -static char *kskip(bp) -char *bp; +static char * +kskip(char *bp) { while (*bp && *bp != ':') bp++; @@ -248,11 +251,12 @@ char *bp; * If the option is not found we return -1. Note that we handle octal * numbers beginning with 0. *---------------------------------------------------------------------------*/ -int kgetnum(id) -char *id; +int +kgetnum(char *id) { - register int i, base; - register char *bp = tbuf,*xp; + int i, base; + char *bp = tbuf; + char *xp; for (;;) { bp = kskip(bp); @@ -281,10 +285,11 @@ char *id; * a : or the end of the buffer. Return 1 if we find the option, or 0 if * it is not given. *---------------------------------------------------------------------------*/ -int kgetflag(id) -char *id; +int +kgetflag(char *id) { - register char *bp = tbuf,*xp; + char *bp = tbuf; + char *xp; for (;;) { bp = kskip(bp); @@ -305,11 +310,11 @@ char *id; * is done on the strings, and the strings are placed in area, which is a * ref parameter which is updated. No checking on area overflow. *---------------------------------------------------------------------------*/ -char *kgetstr(id, area) -char *id; -char **area; +char * +kgetstr(char *id, char **area) { - register char *bp = tbuf,*xp; + char *bp = tbuf; + char *xp; for (;;) { bp = kskip(bp); @@ -328,15 +333,14 @@ char **area; } /*---------------------------------------------------------------------------* - * kdecode does the grung work to decode the string capability escapes. + * kdecode does the grunt work to decode the string capability escapes. *---------------------------------------------------------------------------*/ -static char *kdecode(str, area) -char *str; -char **area; +static char * +kdecode(char *str, char **area) { - register char *cp; - register int c; - register char *dp; + char *cp; + int c; + char *dp; int i; cp = *area; diff --git a/usr.sbin/pcvt/loadfont/loadfont.c b/usr.sbin/pcvt/loadfont/loadfont.c index 301c1fbeec..bb1ca5d822 100644 --- a/usr.sbin/pcvt/loadfont/loadfont.c +++ b/usr.sbin/pcvt/loadfont/loadfont.c @@ -32,7 +32,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD: src/usr.sbin/pcvt/loadfont/loadfont.c,v 1.6.6.1 2001/05/12 10:11:42 kris Exp $ - * $DragonFly: src/usr.sbin/pcvt/loadfont/Attic/loadfont.c,v 1.2 2003/06/17 04:29:59 dillon Exp $ + * $DragonFly: src/usr.sbin/pcvt/loadfont/Attic/loadfont.c,v 1.3 2004/03/24 17:46:23 cpressey Exp $ */ static char *id = @@ -76,10 +76,14 @@ struct screeninfo screeninfo; #define DEFAULTFD 0 int fd; +static void setfont(int, int, int, int, int); +static void loadfont(int, int, const unsigned char *); +static void printvgafontattr(int); +static void printheader(void); +static void usage(void); -main(argc,argv) -int argc; -char *argv[]; +int +main(int argc, char **argv) { extern int optind; extern int opterr; @@ -228,8 +232,8 @@ char *argv[]; exit(0); } -setfont(charset, fontloaded, charscan, scrscan, scrrow) -int charset, fontloaded, charscan, scrscan, scrrow; +void +setfont(int charset, int fontloaded, int charscan, int scrscan, int scrrow) { struct vgafontattr vfattr; @@ -243,10 +247,9 @@ int charset, fontloaded, charscan, scrscan, scrrow; err(1, "ioctl VGASETFONTATTR failed, error"); } -loadfont(fontset,charscanlines,font_table) -int fontset; -int charscanlines; -unsigned char *font_table; + +void +loadfont(int fontset, int charscanlines, const unsigned char *font_table) { int i, j; struct vgaloadchar vlc; @@ -267,8 +270,8 @@ unsigned char *font_table; } } -printvgafontattr(charset) -int charset; +void +printvgafontattr(int charset) { struct vgafontattr vfattr; static int sizetab[] = { 25, 28, 35, 40, 43, 50 }; @@ -295,14 +298,16 @@ int charset; printf("\n"); } -printheader() +void +printheader(void) { printf("\nEGA/VGA Charactersets Status Info:\n\n"); printf("Set Status Lines CharScanLines ScreenScanLines\n"); printf("--- ------ ----- ------------- ---------------\n"); } -usage() +void +usage(void) { fprintf(stderr,"\nloadfont - load font into ega/vga font ram for pcvt video driver\n"); fprintf(stderr,"usage: loadfont -c -d -f -i\n"); diff --git a/usr.sbin/pcvt/scon/scon.c b/usr.sbin/pcvt/scon/scon.c index ac2f579203..0bb0acf9a0 100644 --- a/usr.sbin/pcvt/scon/scon.c +++ b/usr.sbin/pcvt/scon/scon.c @@ -30,7 +30,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD: src/usr.sbin/pcvt/scon/scon.c,v 1.5.6.1 2001/05/12 10:11:42 kris Exp $ - * $DragonFly: src/usr.sbin/pcvt/scon/Attic/scon.c,v 1.2 2003/06/17 04:29:59 dillon Exp $ + * $DragonFly: src/usr.sbin/pcvt/scon/Attic/scon.c,v 1.3 2004/03/24 17:46:23 cpressey Exp $ */ static char *id = @@ -184,13 +184,16 @@ static struct colname { }; +static void usage(void); +static void printadaptor(int); +static void printmonitor(int); +static void printinfo(int); static void parsepopt(char *arg, unsigned *idx, unsigned *r, unsigned *g, unsigned *b); static void printpalette(int fd); -main(argc,argv) -int argc; -char *argv[]; +int +main(int argc, char **argv) { extern int optind; extern int opterr; @@ -491,7 +494,8 @@ success: exit(0); } -usage() +void +usage(void) { fprintf(stderr,"\nscon - screen control utility for the pcvt video driver\n"); fprintf(stderr,"usage: scon -a -l -m -v -c [n] -d [dev] -f [on|off] -V -H -s [n]\n"); @@ -517,8 +521,8 @@ usage() exit(1); } -printadaptor(fd) -int fd; +void +printadaptor(int fd) { if(ioctl(fd, VGAGETSCREEN, &screeninfo) == -1) err(1, "ioctl VGAGETSCREEN failed"); @@ -547,8 +551,8 @@ int fd; } } -printmonitor(fd) -int fd; +void +printmonitor(int fd) { if(ioctl(fd, VGAGETSCREEN, &screeninfo) == -1) err(1, "ioctl VGAGETSCREEN failed"); @@ -568,7 +572,8 @@ int fd; } } -char *vga_type(int number) +char * +vga_type(int number) { static char *vga_tab[] = { "Generic VGA", @@ -610,7 +615,8 @@ char *vga_type(int number) return(vga_tab[number]); } -char *vga_family(int number) +char * +vga_family(int number) { static char *vga_tab[] = { "Generic VGA", @@ -624,8 +630,8 @@ char *vga_family(int number) return(vga_tab[number]); } -printinfo(fd) -int fd; +void +printinfo(int fd) { if(ioctl(fd, VGAGETSCREEN, &screeninfo) == -1) err(1, "ioctl VGAGETSCREEN failed"); @@ -727,11 +733,12 @@ int fd; printf("\n\n"); } -static const char *findname(unsigned idx) +static const char * +findname(unsigned idx) { /* try to find a name for palette entry idx */ /* if multiple names exist, returns first matching */ - register struct colname *cnp; + struct colname *cnp; for(cnp = colnames; cnp->name; cnp++) if(cnp->idx == idx) @@ -741,9 +748,10 @@ static const char *findname(unsigned idx) return (const char *)NULL; } -static void printpalette(int fd) +static void +printpalette(int fd) { - register unsigned idx, last; + unsigned idx, last; for(idx = 0; idx < NVGAPEL; idx++) { @@ -781,11 +789,11 @@ static void printpalette(int fd) } -static void parsepopt(char *arg, unsigned *idx, - unsigned *r, unsigned *g, unsigned *b) +static void +parsepopt(char *arg, unsigned *idx, unsigned *r, unsigned *g, unsigned *b) { char firstarg[21]; - register unsigned i; + unsigned i; if(sscanf(arg, "%20[a-zA-Z0-9]%*[,:]%u,%u,%u", firstarg, r, g, b) < 4 || strlen(firstarg) == 0) diff --git a/usr.sbin/pcvt/set2061/ICD2061Aalt.c b/usr.sbin/pcvt/set2061/ICD2061Aalt.c index 9bcb61aa95..96976934f0 100644 --- a/usr.sbin/pcvt/set2061/ICD2061Aalt.c +++ b/usr.sbin/pcvt/set2061/ICD2061Aalt.c @@ -2,7 +2,7 @@ * This code is derived from code available from the STB bulletin board * * $FreeBSD: src/usr.sbin/pcvt/set2061/ICD2061Aalt.c,v 1.5 1999/12/29 05:07:54 peter Exp $ - * $DragonFly: src/usr.sbin/pcvt/set2061/Attic/ICD2061Aalt.c,v 1.2 2003/06/17 04:29:59 dillon Exp $ + * $DragonFly: src/usr.sbin/pcvt/set2061/Attic/ICD2061Aalt.c,v 1.3 2004/03/24 17:46:23 cpressey Exp $ */ /* $XFree86: mit/server/ddx/x386/common_hw/ICD2061Aalt.c,v 2.6 1994/04/15 05:10:30 dawes Exp $ */ @@ -50,9 +50,9 @@ static void wrt_clk_bit(); static void init_clock(); #endif -void AltICD2061SetClock(frequency, select) -register long frequency; /* in Hz */ -int select; +void +AltICD2061SetClock(long frequency, /* in Hz */ + int select) { unsigned int m, mval, ival; int i; @@ -114,8 +114,8 @@ int select; dev = devx; ival = i; mval = m; - } } + } fvco = fref; for (m=0; m>= 1; - } } +} #endif -static void wait_vb() - { +static void +wait_vb(void) +{ while ((inb(crtcaddr+6) & 0x08) == 0) ; while (inb(crtcaddr+6) & 0x08) ; - } +} -#ifdef __STDC__ -static void init_clock(unsigned long setup, unsigned short crtcport) -#else -static void init_clock(setup, crtcport) - unsigned long setup; - unsigned short crtcport; -#endif - { +static void +init_clock(unsigned long setup, unsigned short crtcport) +{ unsigned char nclk[2], clk[2]; unsigned short restore42; unsigned short oldclk; @@ -254,7 +245,7 @@ static void init_clock(setup, crtcport) for (i=0; i<5; i++) { wrt_clk_bit(nclk[1]); wrt_clk_bit(clk[1]); - } + } wrt_clk_bit(nclk[1]); wrt_clk_bit(nclk[0]); wrt_clk_bit(clk[0]); @@ -267,7 +258,7 @@ static void init_clock(setup, crtcport) wrt_clk_bit(nclk[1-bitval]); wrt_clk_bit(nclk[bitval]); wrt_clk_bit(clk[bitval]); - } + } wrt_clk_bit(clk[1]); wrt_clk_bit(nclk[1]); wrt_clk_bit(clk[1]); @@ -287,14 +278,13 @@ static void init_clock(setup, crtcport) xf86EnableInterrupts(); #endif - } +} -static void wrt_clk_bit(value) - unsigned int value; - { +static void wrt_clk_bit(unsigned int value) +{ int j; outb(0x3C2, value); for (j=2; --j; ) inb(0x200); - } +} diff --git a/usr.sbin/pcvt/set2061/main.c b/usr.sbin/pcvt/set2061/main.c index 49862fabaf..4ebde2c0a2 100644 --- a/usr.sbin/pcvt/set2061/main.c +++ b/usr.sbin/pcvt/set2061/main.c @@ -29,6 +29,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * + * $DragonFly: src/usr.sbin/pcvt/set2061/Attic/main.c,v 1.2 2004/03/24 17:46:23 cpressey Exp $ */ static char *id = @@ -48,11 +49,12 @@ static char *id = #define DEFAULTFD 0 -void AltICD2061SetClock(long frequency, int select); +extern void AltICD2061SetClock(long frequency, int select); -main(argc,argv) -int argc; -char *argv[]; +static void usage(void); + +int +main(int argc, char **argv) { extern int optind; extern int opterr; @@ -101,7 +103,8 @@ char *argv[]; exit(0); } -usage() +void +usage(void) { fprintf(stderr,"\nset2061 - program the ICD2061 video clock chip\n"); fprintf(stderr,"usage: set2061 -f -n \n"); diff --git a/usr.sbin/pcvt/userkeys/vt220keys.c b/usr.sbin/pcvt/userkeys/vt220keys.c index 77e770a5c2..bbc567edc0 100644 --- a/usr.sbin/pcvt/userkeys/vt220keys.c +++ b/usr.sbin/pcvt/userkeys/vt220keys.c @@ -25,22 +25,22 @@ -hm minor modifications for pcvt 2.0 release $FreeBSD: src/usr.sbin/pcvt/userkeys/vt220keys.c,v 1.5.6.1 2001/05/12 10:11:42 kris Exp $ -$DragonFly: src/usr.sbin/pcvt/userkeys/Attic/vt220keys.c,v 1.2 2003/06/17 04:29:59 dillon Exp $ +$DragonFly: src/usr.sbin/pcvt/userkeys/Attic/vt220keys.c,v 1.3 2004/03/24 17:46:23 cpressey Exp $ */ +#include +#include + #include #include #include #include -/* - * The default toupper() macro is stupid, will toupper anything - */ - -#ifdef toupper -#undef toupper -#endif -#define toupper(c) (islower(c) ? ((c)-' ') : c) +static void dokey(char *, char *); +static void clearkeys(void); +static void lockkeys(void); +static void usage(void); +static void getinit(void); #define VT200_7BIT 1 #define ESC 033 @@ -73,9 +73,8 @@ struct keynames { char prog[BUFSIZ]; -main(argc,argv) - int argc; - char *argv[]; +int +main(int argc, char **argv) { /* these are defined in the getopt routine */ extern char *optarg; /* argument give to an option */ @@ -145,10 +144,11 @@ main(argc,argv) * for each pair, who cares, really. */ -dokey(nm,val) char *nm, *val; +void +dokey(char *nm, char *val) { - register char *scr; - register struct keynames *kp; + char *scr; + struct keynames *kp; for(scr = nm; *scr = toupper(*scr); scr++) ; @@ -166,7 +166,8 @@ dokey(nm,val) char *nm, *val; /****************************************************************************/ -clearkeys() +void +clearkeys(void) { printf("%cP0;1|%c\\",ESC,ESC); fflush(stdout); @@ -174,7 +175,8 @@ clearkeys() /****************************************************************************/ -lockkeys() +void +lockkeys(void) { printf("%cP1;0|%c\\",ESC,ESC); fflush(stdout); @@ -182,7 +184,8 @@ lockkeys() /****************************************************************************/ -usage() +void +usage(void) { int i; @@ -219,10 +222,8 @@ usage() */ -#include -#include - -getinit() +void +getinit(void) { char *home; /* user's home directory */ char path[BUFSIZ]; /* full path name of init file */ -- 2.41.0