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 Make the exitcode != 0 when th...
details: https://anonhg.NetBSD.org/src/rev/6189e2bc1131
branches: trunk
changeset: 525546:6189e2bc1131
user: leo <leo%NetBSD.org@localhost>
date: Fri Apr 12 22:09:28 2002 +0000
description:
Make the exitcode != 0 when the ioctl fails.
diffstat:
sys/arch/atari/stand/loadkmap/loadkmap.c | 31 +++++++++++++++++++------------
1 files changed, 19 insertions(+), 12 deletions(-)
diffs (82 lines):
diff -r f4336b2ba352 -r 6189e2bc1131 sys/arch/atari/stand/loadkmap/loadkmap.c
--- a/sys/arch/atari/stand/loadkmap/loadkmap.c Fri Apr 12 21:52:45 2002 +0000
+++ b/sys/arch/atari/stand/loadkmap/loadkmap.c Fri Apr 12 22:09:28 2002 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: loadkmap.c,v 1.2 1995/07/24 05:47:48 leo Exp $ */
+/* $NetBSD: loadkmap.c,v 1.3 2002/04/12 22:09:28 leo Exp $ */
#include <sys/types.h>
#include <sys/stat.h>
@@ -8,8 +8,8 @@
#include <stdio.h>
-void load_kmap __P((const char *, int));
-void dump_kmap();
+int load_kmap __P((const char *, int));
+int dump_kmap();
int
main(argc, argv)
@@ -18,6 +18,7 @@
{
int set_sysmap = 0;
char *mapfile;
+ int rc = 0;
if (argc > 2) {
if ((argc == 3) && !strcmp(argv[1], "-f")) {
@@ -32,14 +33,14 @@
else mapfile = argv[1];
if (argc == 1)
- dump_kmap();
- else load_kmap(mapfile, set_sysmap);
+ rc = dump_kmap();
+ else rc = load_kmap(mapfile, set_sysmap);
- exit (0);
+ exit (rc);
}
-void
+int
load_kmap(file, set_sysmap)
const char *file;
int set_sysmap;
@@ -52,8 +53,10 @@
if ((fd = open (file, 0)) >= 0) {
if (read (fd, buf, sizeof (buf)) == sizeof (buf)) {
- if (ioctl (0, ioc, buf) == 0)
- return;
+ if (ioctl (0, ioc, buf) == 0) {
+ close(fd);
+ return 0;
+ }
else perror("ITEIOCSKMAP");
}
else perror("read kmap");
@@ -61,14 +64,18 @@
close(fd);
}
else perror("open kmap");
+ return 1;
}
-void
+int
dump_kmap()
{
char buf[sizeof (struct kbdmap)];
- if (ioctl (0, ITEIOCGKMAP, buf) == 0)
+ if (ioctl (0, ITEIOCGKMAP, buf) == 0) {
write (1, buf, sizeof (buf));
- else perror ("ITEIOCGKMAP");
+ return 0;
+ }
+ perror ("ITEIOCGKMAP");
+ return 1;
}
Home |
Main Index |
Thread Index |
Old Index