summaryrefslogtreecommitdiff
path: root/lib/libc/nls
diff options
context:
space:
mode:
authorThorsten Lockert <tholo@cvs.openbsd.org>1996-09-15 09:32:02 +0000
committerThorsten Lockert <tholo@cvs.openbsd.org>1996-09-15 09:32:02 +0000
commit5839b84db8fa4a49976868786c93b29df9c4d568 (patch)
treeef3d545e61baa18f319312ada4e97e2c799c24c6 /lib/libc/nls
parent1d3f47d20a2b64c481a047ce24f39564b3e74533 (diff)
Remove dead code
Remove unused variables Silence some warnings lint(1) is your friend
Diffstat (limited to 'lib/libc/nls')
-rw-r--r--lib/libc/nls/_catopen.c6
-rw-r--r--lib/libc/nls/catgets.c10
-rw-r--r--lib/libc/nls/catopen.c7
3 files changed, 12 insertions, 11 deletions
diff --git a/lib/libc/nls/_catopen.c b/lib/libc/nls/_catopen.c
index 0c3afe41c49..c146156edf7 100644
--- a/lib/libc/nls/_catopen.c
+++ b/lib/libc/nls/_catopen.c
@@ -4,7 +4,7 @@
*/
#if defined(LIBC_SCCS) && !defined(lint)
-static char rcsid[] = "$OpenBSD: _catopen.c,v 1.2 1996/08/19 08:30:03 tholo Exp $";
+static char rcsid[] = "$OpenBSD: _catopen.c,v 1.3 1996/09/15 09:31:21 tholo Exp $";
#endif /* LIBC_SCCS and not lint */
#include <sys/cdefs.h>
@@ -15,11 +15,11 @@ __indr_reference(_catopen,catopen);
#include <nl_types.h>
-extern nl_catd _catopen __P((__const char *, int));
+extern nl_catd _catopen __P((const char *, int));
nl_catd
catopen(name, oflag)
- __const char *name;
+ const char *name;
int oflag;
{
return _catopen(name, oflag);
diff --git a/lib/libc/nls/catgets.c b/lib/libc/nls/catgets.c
index 1d1f269c1f5..1763a782e10 100644
--- a/lib/libc/nls/catgets.c
+++ b/lib/libc/nls/catgets.c
@@ -35,7 +35,7 @@
*/
#if defined(LIBC_SCCS) && !defined(lint)
-static char rcsid[] = "$OpenBSD: catgets.c,v 1.4 1996/08/19 08:30:06 tholo Exp $";
+static char rcsid[] = "$OpenBSD: catgets.c,v 1.5 1996/09/15 09:31:22 tholo Exp $";
#endif /* LIBC_SCCS and not lint */
#define _NLS_PRIVATE
@@ -63,7 +63,7 @@ _catgets(catd, set_id, msg_id, s)
}
cat_hdr = (struct _nls_cat_hdr *) catd->__data;
- set_hdr = (struct _nls_set_hdr *) (catd->__data
+ set_hdr = (struct _nls_set_hdr *) ((char *)catd->__data
+ sizeof(struct _nls_cat_hdr));
/* binary search, see knuth algorithm b */
@@ -74,7 +74,7 @@ _catgets(catd, set_id, msg_id, s)
r = set_id - ntohl(set_hdr[i].__setno);
if (r == 0) {
- msg_hdr = (struct _nls_msg_hdr *) (catd->__data
+ msg_hdr = (struct _nls_msg_hdr *) ((char *)catd->__data
+ sizeof(struct _nls_cat_hdr)
+ ntohl(cat_hdr->__msg_hdr_offset));
@@ -84,10 +84,10 @@ _catgets(catd, set_id, msg_id, s)
i = (l + u) / 2;
r = msg_id - ntohl(msg_hdr[i].__msgno);
if (r == 0) {
- return (char *) (catd->__data
+ return (char *) catd->__data
+ sizeof(struct _nls_cat_hdr)
+ ntohl(cat_hdr->__msg_txt_offset)
- + ntohl(msg_hdr[i].__offset));
+ + ntohl(msg_hdr[i].__offset);
} else if (r < 0) {
u = i - 1;
} else {
diff --git a/lib/libc/nls/catopen.c b/lib/libc/nls/catopen.c
index 193250fc24e..ffbfda21c17 100644
--- a/lib/libc/nls/catopen.c
+++ b/lib/libc/nls/catopen.c
@@ -35,7 +35,7 @@
*/
#if defined(LIBC_SCCS) && !defined(lint)
-static char rcsid[] = "$OpenBSD: catopen.c,v 1.7 1996/09/05 12:32:33 deraadt Exp $";
+static char rcsid[] = "$OpenBSD: catopen.c,v 1.8 1996/09/15 09:31:23 tholo Exp $";
#endif /* LIBC_SCCS and not lint */
#define _NLS_PRIVATE
@@ -54,8 +54,9 @@ static char rcsid[] = "$OpenBSD: catopen.c,v 1.7 1996/09/05 12:32:33 deraadt Exp
#define NLS_DEFAULT_PATH "/usr/share/nls/%L/%N.cat:/usr/share/nls/%N/%L"
#define NLS_DEFAULT_LANG "C"
-static nl_catd load_msgcat();
+static nl_catd load_msgcat __P((const char *));
+/* ARGSUSED */
nl_catd
_catopen(name, oflag)
const char *name;
@@ -141,7 +142,7 @@ load_msgcat(path)
return (nl_catd) -1;
}
- data = mmap(0, (size_t) st.st_size, PROT_READ, MAP_SHARED, fd, 0);
+ data = mmap(0, (size_t) st.st_size, PROT_READ, MAP_SHARED, fd, (off_t)0);
close (fd);
if (data == (void *) -1) {