Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/atari/stand/loadkmap Misc KNF and cleanup.



details:   https://anonhg.NetBSD.org/src/rev/d0de003bd2d8
branches:  trunk
changeset: 1000008:d0de003bd2d8
user:      tsutsui <tsutsui%NetBSD.org@localhost>
date:      Sat Jun 29 16:29:24 2019 +0000

description:
Misc KNF and cleanup.

diffstat:

 sys/arch/atari/stand/loadkmap/loadkmap.c |  42 ++++++++++++++++----------------
 1 files changed, 21 insertions(+), 21 deletions(-)

diffs (86 lines):

diff -r e64c808d631f -r d0de003bd2d8 sys/arch/atari/stand/loadkmap/loadkmap.c
--- a/sys/arch/atari/stand/loadkmap/loadkmap.c  Sat Jun 29 14:45:10 2019 +0000
+++ b/sys/arch/atari/stand/loadkmap/loadkmap.c  Sat Jun 29 16:29:24 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: loadkmap.c,v 1.11 2015/08/12 17:53:03 tsutsui Exp $    */
+/*     $NetBSD: loadkmap.c,v 1.12 2019/06/29 16:29:24 tsutsui Exp $    */
 
 #include <sys/types.h>
 #include <sys/stat.h>
@@ -25,19 +25,19 @@
                if ((argc == 3) && !strcmp(argv[1], "-f")) {
                        mapfile = argv[2];
                        set_sysmap = 1;
-               }
-               else {
+               } else {
                        fprintf(stderr, "%s [-f] keymap\n", argv[0]);
                        exit(1);
                }
-       }
-       else mapfile = argv[1];
+       } else
+               mapfile = argv[1];
 
        if (argc == 1)
                rc = dump_kmap();
-       else rc = load_kmap(mapfile, set_sysmap);
+       else
+               rc = load_kmap(mapfile, set_sysmap);
 
-       exit (rc);
+       exit(rc);
 }
 
 
@@ -45,36 +45,36 @@
 load_kmap(const char *file, int set_sysmap)
 {
        int     fd;
-       char    buf[sizeof (struct kbdmap)];
+       char    buf[sizeof(struct kbdmap)];
        int     ioc;
 
        ioc = set_sysmap ? ITEIOCSSKMAP : ITEIOCSKMAP;
        
-       if ((fd = open (file, 0)) >= 0) {
-               if (read (fd, buf, sizeof (buf)) == sizeof (buf)) {
-                       if (ioctl (0, ioc, buf) == 0) {
+       if ((fd = open(file, 0)) >= 0) {
+               if (read(fd, buf, sizeof(buf)) == sizeof(buf)) {
+                       if (ioctl(0, ioc, buf) == 0) {
                                close(fd);
                                return 0;
-                       }
-                       else perror("ITEIOCSKMAP");
-               }
-               else perror("read kmap");
+                       } else
+                               perror("ITEIOCSKMAP");
+               } else
+                       perror("read kmap");
 
                close(fd);
-       }
-       else perror("open kmap");
+       } else
+               perror("open kmap");
        return 1;
 }
 
 static int
 dump_kmap(void)
 {
-       char buf[sizeof (struct kbdmap)];
+       char buf[sizeof(struct kbdmap)];
 
-       if (ioctl (0, ITEIOCGKMAP, buf) == 0) {
-               write (1, buf, sizeof (buf));
+       if (ioctl(0, ITEIOCGKMAP, buf) == 0) {
+               write(1, buf, sizeof(buf));
                return 0;
        }
-       perror ("ITEIOCGKMAP");
+       perror("ITEIOCGKMAP");
        return 1;
 }



Home | Main Index | Thread Index | Old Index