Compare commits

...

24 Commits
0.1.0 ... 0.1.6

Author SHA1 Message Date
Guillem Jover
56f2e55b7a Release libbsd 0.1.6 2009-08-30 12:18:28 +02:00
Hirokazu Takata
5ac14531b5 Fix typos in M32R local-elf.h endian definitions 2009-08-30 12:16:01 +02:00
Guillem Jover
2543c5a78b Release libbsd 0.1.5 2009-07-17 13:37:38 +02:00
Guillem Jover
33ef70b9e1 Add __pure2 dummy macro 2009-07-17 13:35:37 +02:00
Guillem Jover
8ef0ecdf44 Add more dummy id macros 2009-07-17 13:34:30 +02:00
Nobuhiro Iwamatsu
6660397589 Fix typos in AVR32 and SH local-elf.h endian definitions 2009-07-17 12:50:07 +02:00
Guillem Jover
391c75b427 Release libbsd 0.1.4 2009-05-29 02:48:00 +02:00
Guillem Jover
45783ae4ca Define N_SYMSIZE in case the system does not do it
Fixes build failures on some non-Linux ports.

Based-on-patch-by: Petr Salinger <Petr.Salinger@seznam.cz>
2009-05-29 02:45:54 +02:00
Guillem Jover
5902730a03 Create a relative symlink for .so if libdir and usrlibdir are the same 2009-05-29 02:28:49 +02:00
Guillem Jover
42601170ac Change @libdir@ in the pkg-config file to be $(usrlibdir)
The variable in the .pc file points to the directory where the .so
symlink is present, which is never going to be something like /lib,
but something like /usr/lib.
2009-05-25 10:02:26 +02:00
Guillem Jover
0bd48c4a4d Preserve the variables unexpanded in the pkg-config file 2009-05-25 09:57:14 +02:00
Guillem Jover
d03b2b07fc Release libbsd 0.1.3 2009-05-25 09:37:39 +02:00
Guillem Jover
cb1346e5b3 Export public functions as extern C 2009-05-25 09:25:13 +02:00
Guillem Jover
61fa98ea9e Add missing <stdarg.h> include in <bsd/err.h> 2009-05-25 09:12:45 +02:00
Guillem Jover
931e043430 Add new __RCSID macro
Define it to nothing, so that source imported from BSDs can be easily
compiled w/o needing to modify them.
2009-05-25 08:56:34 +02:00
Guillem Jover
f984a7006b Release libbsd 0.1.2 2009-05-25 06:57:50 +02:00
Guillem Jover
326a3a7619 Install humanize_number(3) man page 2009-05-25 06:57:03 +02:00
Guillem Jover
e4aff3d9fc Use N_SYMSIZE instead of directly accessing ‘struct exec’
On Linux alpha ‘struct exec’ does not have an a_syms member, and the
N_SYMSIZE is mapped to 0.
2009-05-25 06:41:42 +02:00
Gerardo Exequiel Pozzi
c3feeb0092 Add some man page links
Add man page links for strlcat, getmode and arc4random_*.

Signed-off-by: Gerardo Exequiel Pozzi <vmlinuz386@yahoo.com.ar>
2009-05-25 06:32:45 +02:00
Guillem Jover
80c3954e3c Use the correct path when including a.out.h
Reported-by: Aurélien Jarno <aurelien@aurel32.net>
2009-05-25 06:23:01 +02:00
Guillem Jover
4c3e03efeb Add man/md5.3bsd to .gitignore 2009-05-25 06:22:22 +02:00
Guillem Jover
9b30dae909 Fix typos (‘ELFDATA2MSG’ → ‘ELFDATA2MSB’) 2009-05-21 05:04:09 +02:00
Guillem Jover
25dd60b9cc Release libbsd 0.1.1 2009-05-20 05:14:32 +02:00
Guillem Jover
5b16707e95 Install nlist header and man page 2009-05-20 05:13:31 +02:00
16 changed files with 91 additions and 26 deletions

View File

@@ -1,7 +1,7 @@
LIB_NAME := libbsd
LIB_VERSION_MAJOR := 0
LIB_VERSION_MINOR := 1
LIB_VERSION_MICRO := 0
LIB_VERSION_MICRO := 6
LIB_VERSION := $(LIB_VERSION_MAJOR).$(LIB_VERSION_MINOR).$(LIB_VERSION_MICRO)
LIB_PKGCONFIG := $(LIB_NAME).pc
@@ -54,15 +54,22 @@ LIB_INCLUDES := \
bsd/bsd.h \
bsd/cdefs.h \
bsd/stdlib.h \
nlist.h \
vis.h \
libutil.h
LIB_MANS := \
arc4random.3 \
arc4random_addrandom.3 \
arc4random_stir.3 \
strlcpy.3 \
strlcat.3 \
fgetln.3 \
humanize_number.3 \
fmtcheck.3 \
nlist.3 \
setmode.3 \
getmode.3 \
strmode.3 \
md5.3bsd
LIB_MANS := $(patsubst %,man/%,$(LIB_MANS))
@@ -75,13 +82,13 @@ CFLAGS ?= -g -Wall -Wextra -Wno-unused-variable
MK_CFLAGS := -Iinclude/ -include bsd/bsd.h -D_GNU_SOURCE -D__REENTRANT
prefix := /usr
exec_prefix :=
libdir := ${exec_prefix}/lib
usrlibdir := ${prefix}/lib
includedir := ${prefix}/include
pkgconfigdir := ${usrlibdir}/pkgconfig
mandir := ${prefix}/share/man
prefix = /usr
exec_prefix =
libdir = ${exec_prefix}/lib
usrlibdir = ${prefix}/lib
includedir = ${prefix}/include
pkgconfigdir = ${usrlibdir}/pkgconfig
mandir = ${prefix}/share/man
.PHONY: libs
libs: $(LIB_STATIC) $(LIB_SHARED_SO) $(LIB_PKGCONFIG)
@@ -101,13 +108,12 @@ man/md5.3bsd: man/mdX.3
src/hash/md5hl.c: src/hash/helper.c
sed -e 's:hashinc:bsd/md5.h:g' -e 's:HASH:MD5:g' $< > $@
# FIXME: the variables should be preserved unexpanded in the .pc file
$(LIB_PKGCONFIG): $(LIB_PKGCONFIG).in
sed -e 's:@VERSION@:$(LIB_VERSION):' \
-e 's:@prefix@:$(prefix):' \
-e 's:@exec_prefix@:$(exec_prefix):' \
-e 's:@libdir@:$(libdir):' \
-e 's:@includedir@:$(includedir):' \
-e 's:@prefix@:$(value prefix):' \
-e 's:@exec_prefix@:$(value exec_prefix):' \
-e 's:@libdir@:$(value usrlibdir):' \
-e 's:@includedir@:$(value includedir):' \
$< > $@
$(LIB_STATIC): $(LIB_STATIC_OBJS)
@@ -151,7 +157,13 @@ install: libs man
done
install -m644 $(LIB_MANS) $(DESTDIR)/$(mandir)/man3
install -m644 $(LIB_PKGCONFIG) $(DESTDIR)/$(pkgconfigdir)
ifeq ($(libdir),$(usrlibdir))
# If both dirs are the same, do a relative symlink.
ln -sf $(LIB_SHARED) $(DESTDIR)/$(usrlibdir)/$(LIB_SHARED_SO)
else
# Otherwise, do an absolute one.
ln -sf $(libdir)/$(LIB_SHARED) $(DESTDIR)/$(usrlibdir)/$(LIB_SHARED_SO)
endif
ln -sf $(LIB_SHARED) $(DESTDIR)/$(libdir)/$(LIB_SONAME)
.PHONY: clean

View File

@@ -1,5 +1,5 @@
/*
* Copyright © 2004, 2005, 2006 Guillem Jover
* Copyright © 2004, 2005, 2006, 2009 Guillem Jover
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -37,6 +37,10 @@
# define __dead2
#endif
#ifndef __pure2
# define __pure2
#endif
/* Linux headers define a struct with a member names __unused.
* Disable for now. */
#if 0
@@ -61,8 +65,28 @@
# define __bounded__(x, y, z)
#endif
#ifndef __RCSID
# define __RCSID(x)
#endif
#ifndef __FBSDID
# define __FBSDID(x)
#endif
#ifndef __RCSID
# define __RCSID(x)
#endif
#ifndef __RCSID_SOURCE
# define __RCSID_SOURCE
#endif
#ifndef __SCCSID
# define __SCCSID
#endif
#ifndef __COPYRIGHT
# define __COPYRIGHT
#endif
#endif

View File

@@ -1,5 +1,6 @@
/*
* Copyright © 2006 Robert Millan
* Copyright © 2009 Guillem Jover
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -27,11 +28,15 @@
#ifndef LIBBSD_ERR_H
#define LIBBSD_ERR_H
#include <sys/cdefs.h>
#include <err.h>
#include <stdarg.h>
__BEGIN_DECLS
extern void warnc (int code, const char *format, ...);
extern void vwarnc (int code, const char *format, va_list ap);
extern void errc (int status, int code, const char *format, ...);
extern void verrc (int status, int code, const char *format, va_list ap);
__END_DECLS
#endif

View File

@@ -1,5 +1,6 @@
/*
* Copyright © 2006 Robert Millan
* Copyright © 2009 Guillem Jover
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -27,10 +28,13 @@
#ifndef LIBBSD_GETOPT_H
#define LIBBSD_GETOPT_H
#include <sys/cdefs.h>
#include <getopt.h>
__BEGIN_DECLS
extern int optreset;
int bsd_getopt (int, char **, char *);
__END_DECLS
#endif

View File

@@ -1,5 +1,5 @@
/*
* Copyright © 2008 Guillem Jover
* Copyright © 2008, 2009 Guillem Jover
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -27,9 +27,12 @@
#ifndef LIBBSD_INET_H
#define LIBBSD_INET_H
#include <sys/cdefs.h>
#include <stddef.h>
__BEGIN_DECLS
int inet_net_pton(int af, const char *src, void *dst, siez_t size);
__END_DECLS
#endif

View File

@@ -1,5 +1,5 @@
/*
* Copyright © 2004, 2005 Guillem Jover
* Copyright © 2004, 2005, 2009 Guillem Jover
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -27,11 +27,14 @@
#ifndef LIBBSD_RANDOM_H
#define LIBBSD_RANDOM_H
#include <sys/cdefs.h>
#include <sys/types.h>
__BEGIN_DECLS
u_int32_t arc4random();
void arc4random_stir();
void arc4random_addrandom(u_char *dat, int datlen);
__END_DECLS
#endif

View File

@@ -1,7 +1,7 @@
/*
* Copyright © 2005 Aurelien Jarno
* Copyright © 2006 Robert Millan
* Copyright © 2008 Guillem Jover
* Copyright © 2008, 2009 Guillem Jover
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -29,9 +29,11 @@
#ifndef LIBBSD_STDLIB_H
#define LIBBSD_STDLIB_H
#include <sys/cdefs.h>
#include <sys/stat.h>
#include <stdlib.h>
__BEGIN_DECLS
const char *fmtcheck (const char *, const char *);
char *getprogname ();
@@ -45,5 +47,6 @@ int heapsort (void *, size_t, size_t, int (*)(const void *, const void *));
mode_t getmode(const void *set, mode_t mode);
void *setmode(const char *mode_str);
__END_DECLS
#endif

View File

@@ -27,15 +27,18 @@
#ifndef LIBBSD_STRING_H
#define LIBBSD_STRING_H
#include <sys/cdefs.h>
#include <sys/types.h>
#include <stddef.h>
#include <stdio.h>
__BEGIN_DECLS
size_t strlcpy(char *dst, const char *src, size_t siz);
size_t strlcat(char *dst, const char *src, size_t siz);
char *fgetln(FILE *fp, size_t *lenp);
wchar_t *fgetwln(FILE * __restrict fp, size_t *lenp);
void strmode(mode_t mode, char *str);
__END_DECLS
#endif

View File

@@ -28,7 +28,7 @@
#define LIBBSD_NLIST_H
#include <sys/cdefs.h>
#include <sys/a.out.h>
#include <a.out.h>
__BEGIN_DECLS
extern int nlist(const char *filename, struct nlist *list);

1
man/.gitignore vendored
View File

@@ -1 +1,2 @@
md5.3
md5.3bsd

View File

@@ -0,0 +1 @@
.so man3/arc4random.3

1
man/arc4random_stir.3 Normal file
View File

@@ -0,0 +1 @@
.so man3/arc4random.3

1
man/getmode.3 Normal file
View File

@@ -0,0 +1 @@
.so man3/setmode.3

1
man/strlcat.3 Normal file
View File

@@ -0,0 +1 @@
.so man3/strlcpy.3

View File

@@ -66,7 +66,7 @@
#endif
#define ELF_TARG_MACH EM_AVR32
#define ELF_TARG_CLASS ELFCLASS32
#if define(__LITTLE_ENDIAN__)
#if defined(__LITTLE_ENDIAN__)
#define ELF_TARG_DATA ELFDATA2LSB
#elif defined(__BIG_ENDIAN__)
#define ELF_TARG_DATA ELFDATA2LMSB
@@ -97,9 +97,9 @@
#define ELF_TARG_MACH EM_M32R
#define ELF_TARG_CLASS ELFCLASS32
#if defined(__LITTLE_ENDIAN__)
#define ELF_DATA ELFDATA2LSB
#define ELF_TARG_DATA ELFDATA2LSB
#elif defined(__BIG_ENDIAN__)
#define ELF_DATA ELFDATA2MSB
#define ELF_TARG_DATA ELFDATA2MSB
#else
#error Unknown M32R endianness
#endif
@@ -124,13 +124,13 @@
#define ELF_TARG_MACH EM_PPC
#define ELF_TARG_CLASS ELFCLASS32
#define ELF_TARG_DATA ELFDATA2MSG
#define ELF_TARG_DATA ELFDATA2MSB
#elif defined(__powerpc64__)
#define ELF_TARG_MACH EM_PPC64
#define ELF_TARG_CLASS ELFCLASS64
#define ELF_TARG_DATA ELFDATA2MSG
#define ELF_TARG_DATA ELFDATA2MSB
#elif defined(__sparc__)
@@ -147,7 +147,7 @@
#define ELF_TARG_MACH EM_SH
#define ELF_TARG_CLASS ELFCLASS32
#if define(__LITTLE_ENDIAN__)
#if defined(__LITTLE_ENDIAN__)
#define ELF_TARG_DATA ELFDATA2LSB
#elif defined(__BIG_ENDIAN__)
#define ELF_TARG_DATA ELFDATA2LMSB
@@ -163,7 +163,7 @@
#else
#define ELF_TARG_CLASS ELFCLASS32
#endif
#define ELF_TARG_DATA ELFDATA2MSG
#define ELF_TARG_DATA ELFDATA2MSB
#else

View File

@@ -57,6 +57,9 @@ static char sccsid[] = "@(#)nlist.c 8.1 (Berkeley) 6/4/93";
#ifdef _NLIST_DO_AOUT
static int __aout_fdnlist(int, struct nlist *);
#ifndef N_SYMSIZE
#define N_SYMSIZE(a) ((a).a_syms)
#endif
#endif
#ifdef _NLIST_DO_ELF
static int __elf_fdnlist(int, struct nlist *);
@@ -155,7 +158,7 @@ __aout_fdnlist(fd, list)
}
symoff = N_SYMOFF(*exec);
symsize = exec->a_syms;
symsize = N_SYMSIZE(*exec);
stroff = symoff + symsize;
/* find the string table in our mmapped area */