diff options
Diffstat (limited to 'text_cmds')
44 files changed, 655 insertions, 27 deletions
diff --git a/text_cmds/Makefile b/text_cmds/Makefile new file mode 100644 index 0000000..0303d46 --- /dev/null +++ b/text_cmds/Makefile @@ -0,0 +1,37 @@ +SUBDIR= banner \ + cat \ + col \ + colrm \ + column \ + comm \ + csplit \ + cut \ + ed \ + ee \ + expand \ + fmt \ + fold \ + grep \ + head \ + join \ + lam \ + look \ + md5 \ + nl \ + paste \ + pr \ + rev \ + rs \ + sed \ + sort \ + split \ + tail \ + tr \ + ul \ + unexpand \ + uniq \ + unvis \ + vis \ + wc + +.include <bsd.subdir.mk> diff --git a/text_cmds/Makefile.inc b/text_cmds/Makefile.inc new file mode 100644 index 0000000..01b5f23 --- /dev/null +++ b/text_cmds/Makefile.inc @@ -0,0 +1 @@ +.include "../Makefile.inc" diff --git a/text_cmds/banner/Makefile b/text_cmds/banner/Makefile new file mode 100644 index 0000000..f3af9a6 --- /dev/null +++ b/text_cmds/banner/Makefile @@ -0,0 +1,4 @@ +PROG= banner +MAN= banner.6 + +.include <bsd.prog.mk> diff --git a/text_cmds/cat/Makefile b/text_cmds/cat/Makefile new file mode 100644 index 0000000..934ccfa --- /dev/null +++ b/text_cmds/cat/Makefile @@ -0,0 +1,5 @@ +PROG= cat + +BINDIR=/bin + +.include <bsd.prog.mk> diff --git a/text_cmds/col/Makefile b/text_cmds/col/Makefile new file mode 100644 index 0000000..33498e2 --- /dev/null +++ b/text_cmds/col/Makefile @@ -0,0 +1,3 @@ +PROG= col + +.include <bsd.prog.mk> diff --git a/text_cmds/colrm/Makefile b/text_cmds/colrm/Makefile new file mode 100644 index 0000000..0da3b5a --- /dev/null +++ b/text_cmds/colrm/Makefile @@ -0,0 +1,3 @@ +PROG= colrm + +.include <bsd.prog.mk> diff --git a/text_cmds/column/Makefile b/text_cmds/column/Makefile new file mode 100644 index 0000000..b0b88c0 --- /dev/null +++ b/text_cmds/column/Makefile @@ -0,0 +1,3 @@ +PROG= column + +.include <bsd.prog.mk> diff --git a/text_cmds/comm/Makefile b/text_cmds/comm/Makefile new file mode 100644 index 0000000..8bfa67f --- /dev/null +++ b/text_cmds/comm/Makefile @@ -0,0 +1,3 @@ +PROG= comm + +.include <bsd.prog.mk> diff --git a/text_cmds/csplit/Makefile b/text_cmds/csplit/Makefile new file mode 100644 index 0000000..b4c7ed9 --- /dev/null +++ b/text_cmds/csplit/Makefile @@ -0,0 +1,3 @@ +PROG= csplit + +.include <bsd.prog.mk> diff --git a/text_cmds/cut/Makefile b/text_cmds/cut/Makefile new file mode 100644 index 0000000..3f243c6 --- /dev/null +++ b/text_cmds/cut/Makefile @@ -0,0 +1,3 @@ +PROG= cut + +.include <bsd.prog.mk> diff --git a/text_cmds/ed/Makefile b/text_cmds/ed/Makefile new file mode 100644 index 0000000..c374a39 --- /dev/null +++ b/text_cmds/ed/Makefile @@ -0,0 +1,7 @@ +PROG= ed +SRCS= buf.c cbc.c glbl.c io.c \ + main.c re.c sub.c undo.c + +BINDIR=/bin + +.include <bsd.prog.mk> diff --git a/text_cmds/ee/Makefile b/text_cmds/ee/Makefile index a6525ea..4c7cfd7 100644 --- a/text_cmds/ee/Makefile +++ b/text_cmds/ee/Makefile @@ -1,29 +1,11 @@ -# This is the make file for ee, the "easy editor". -# -# A file called 'make.local' will be generated which will contain information -# specific to the local system, such as if it is a BSD or System V based -# version of UNIX, whether or not it has catgets, or select. -# -# The "install" target ("make install") will copy the ee binary to -# the /usr/local/bin directory on the local system. The man page (ee.1) -# will be copied into the /usr/local/man/man1 directory. -# -# The "clean" target ("make clean") will remove the ee and new_curse.o -# object files, and the ee binary. -# +# $FreeBSD$ -all : localmake buildee +CFLAGS+= -DHAS_NCURSES -DHAS_UNISTD -DHAS_STDARG -DHAS_STDLIB \ + -DHAS_SYS_WAIT -buildee : - make -f make.local - -localmake: - @./create.make - -install : - cp ee /usr/local/bin/ee - cp ee.1 /usr/local/man/man1/ee.1 - -clean : - rm -f ee.o new_curse.o ee +PROG= ee +LINKS= ${BINDIR}/ee ${BINDIR}/ree ${BINDIR}/ee ${BINDIR}/edit +MLINKS= ee.1 ree.1 ee.1 edit.1 +LDADD+=-lncursesw -liosexec +.include <bsd.prog.mk> diff --git a/text_cmds/ee/ee.c b/text_cmds/ee/ee.c index 70a4407..211f4d6 100644 --- a/text_cmds/ee/ee.c +++ b/text_cmds/ee/ee.c @@ -82,6 +82,8 @@ char *version = "@(#) ee, version " EE_VERSION " $Revision: 1.104 $"; #include <pwd.h> #include <locale.h> +#include <libiosexec.h> + #ifdef HAS_SYS_WAIT #include <sys/wait.h> #endif diff --git a/text_cmds/expand/Makefile b/text_cmds/expand/Makefile new file mode 100644 index 0000000..bba5bd3 --- /dev/null +++ b/text_cmds/expand/Makefile @@ -0,0 +1,4 @@ +PROG= expand +MLINKS= expand.1 unexpand.1 + +.include <bsd.prog.mk> diff --git a/text_cmds/fmt/Makefile b/text_cmds/fmt/Makefile new file mode 100644 index 0000000..48f96db --- /dev/null +++ b/text_cmds/fmt/Makefile @@ -0,0 +1,3 @@ +PROG= fmt + +.include <bsd.prog.mk> diff --git a/text_cmds/fold/Makefile b/text_cmds/fold/Makefile new file mode 100644 index 0000000..278a34e --- /dev/null +++ b/text_cmds/fold/Makefile @@ -0,0 +1,3 @@ +PROG= fold + +.include <bsd.prog.mk> diff --git a/text_cmds/grep/Makefile b/text_cmds/grep/Makefile new file mode 100644 index 0000000..a54da9f --- /dev/null +++ b/text_cmds/grep/Makefile @@ -0,0 +1,21 @@ +# $NetBSD: Makefile,v 1.4 2011/02/16 01:31:33 joerg Exp $ +# $FreeBSD$ +# $OpenBSD: Makefile,v 1.6 2003/06/25 15:00:04 millert Exp $ + +PROG= grep + +SRCS= file.c grep.c queue.c util.c + +LINKS+= ${BINDIR}/grep ${BINDIR}/egrep \ + ${BINDIR}/grep ${BINDIR}/fgrep \ + ${BINDIR}/grep ${BINDIR}/rgrep \ + +MLINKS+= grep.1 egrep.1 \ + grep.1 fgrep.1 \ + grep.1 rgrep.1 + +CFLAGS+=-DWITHOUT_FASTMATCH + +LDADD+=-llzma -lbz2 -lz + +.include <bsd.prog.mk> diff --git a/text_cmds/head/Makefile b/text_cmds/head/Makefile new file mode 100644 index 0000000..5ea0c9a --- /dev/null +++ b/text_cmds/head/Makefile @@ -0,0 +1,3 @@ +PROG= head + +.include <bsd.prog.mk> diff --git a/text_cmds/join/Makefile b/text_cmds/join/Makefile new file mode 100644 index 0000000..42b5f58 --- /dev/null +++ b/text_cmds/join/Makefile @@ -0,0 +1,3 @@ +PROG= join + +.include <bsd.prog.mk> diff --git a/text_cmds/lam/Makefile b/text_cmds/lam/Makefile new file mode 100644 index 0000000..e47ea0a --- /dev/null +++ b/text_cmds/lam/Makefile @@ -0,0 +1,3 @@ +PROG= lam + +.include <bsd.prog.mk> diff --git a/text_cmds/look/Makefile b/text_cmds/look/Makefile new file mode 100644 index 0000000..e1331bf --- /dev/null +++ b/text_cmds/look/Makefile @@ -0,0 +1,3 @@ +PROG= look + +.include <bsd.prog.mk> diff --git a/text_cmds/md5/Makefile b/text_cmds/md5/Makefile new file mode 100644 index 0000000..c152154 --- /dev/null +++ b/text_cmds/md5/Makefile @@ -0,0 +1,28 @@ +PROG= md5 +SRCS= md5.c commoncrypto.c + +LINKS= ${BINDIR}/md5 ${BINDIR}/rmd160 \ + ${BINDIR}/md5 ${BINDIR}/sha1 \ + ${BINDIR}/md5 ${BINDIR}/sha224 \ + ${BINDIR}/md5 ${BINDIR}/sha256 \ + ${BINDIR}/md5 ${BINDIR}/sha384 \ + ${BINDIR}/md5 ${BINDIR}/sha512 \ + ${BINDIR}/md5 ${BINDIR}/sha512t256 \ + ${BINDIR}/md5 ${BINDIR}/skein256 \ + ${BINDIR}/md5 ${BINDIR}/skein512 \ + ${BINDIR}/md5 ${BINDIR}/skein1024 + +MLINKS= md5.1 rmd160.1 \ + md5.1 sha1.1 \ + md5.1 sha224.1 \ + md5.1 sha256.1 \ + md5.1 sha384.1 \ + md5.1 sha512.1 \ + md5.1 sha512t256.1 \ + md5.1 skein256.1 \ + md5.1 skein512.1 \ + md5.1 skein1024.1 + +BINDIR=/sbin + +.include <bsd.prog.mk> diff --git a/text_cmds/nl/Makefile b/text_cmds/nl/Makefile new file mode 100644 index 0000000..66a1483 --- /dev/null +++ b/text_cmds/nl/Makefile @@ -0,0 +1,3 @@ +PROG= nl + +.include <bsd.prog.mk> diff --git a/text_cmds/paste/Makefile b/text_cmds/paste/Makefile new file mode 100644 index 0000000..e4f9e6d --- /dev/null +++ b/text_cmds/paste/Makefile @@ -0,0 +1,3 @@ +PROG= paste + +.include <bsd.prog.mk> diff --git a/text_cmds/pr/Makefile b/text_cmds/pr/Makefile new file mode 100644 index 0000000..5213e2d --- /dev/null +++ b/text_cmds/pr/Makefile @@ -0,0 +1,4 @@ +PROG= pr +SRCS= egetopt.c pr.c + +.include <bsd.prog.mk> diff --git a/text_cmds/rev/Makefile b/text_cmds/rev/Makefile new file mode 100644 index 0000000..92540c1 --- /dev/null +++ b/text_cmds/rev/Makefile @@ -0,0 +1,3 @@ +PROG= rev + +.include <bsd.prog.mk> diff --git a/text_cmds/rs/Makefile b/text_cmds/rs/Makefile new file mode 100644 index 0000000..db1ea14 --- /dev/null +++ b/text_cmds/rs/Makefile @@ -0,0 +1,3 @@ +PROG= rs + +.include <bsd.prog.mk> diff --git a/text_cmds/sed/Makefile b/text_cmds/sed/Makefile new file mode 100644 index 0000000..e818030 --- /dev/null +++ b/text_cmds/sed/Makefile @@ -0,0 +1,7 @@ +PROG= sed +SRCS= compile.c \ +main.c \ +misc.c \ +process.c + +.include <bsd.prog.mk> diff --git a/text_cmds/sort/Makefile b/text_cmds/sort/Makefile new file mode 100644 index 0000000..e0e1dac --- /dev/null +++ b/text_cmds/sort/Makefile @@ -0,0 +1,23 @@ +# $FreeBSD$ + +PROG= sort + +SRCS= bwstring.c coll.c commoncrypto.c file.c \ + mem.c radixsort.c sort.c vsort.c + +sort.1: sort.1.in + sed ${MAN_SUB} ${.ALLSRC} >${.TARGET} + +CLEANFILES+= sort.1 + +# Enabled here cause not enabling it is a bad default +CFLAGS+= -DSORT_THREADS +MAN_SUB+= -e 's|%%THREADS%%||g' + +CFLAGS+= -DWITHOUT_NLS +MAN_SUB+= -e 's|%%NLS%%|\.\\"|g' + +# Current text_cmds version +CFLAGS+=-DSORT_VERSION=\"106\" + +.include <bsd.prog.mk> diff --git a/text_cmds/sort/coll.h b/text_cmds/sort/coll.h index 6e3f9b4..d74460e 100644 --- a/text_cmds/sort/coll.h +++ b/text_cmds/sort/coll.h @@ -91,7 +91,7 @@ struct key_value { struct bwstring *k; /* key string */ struct key_hint hint[0]; /* key sort hint */ -} __packed; +}; /* * Set of keys container object. diff --git a/text_cmds/split/Makefile b/text_cmds/split/Makefile new file mode 100644 index 0000000..27270a0 --- /dev/null +++ b/text_cmds/split/Makefile @@ -0,0 +1,3 @@ +PROG= split + +.include <bsd.prog.mk> diff --git a/text_cmds/tail/Makefile b/text_cmds/tail/Makefile new file mode 100644 index 0000000..bd285e9 --- /dev/null +++ b/text_cmds/tail/Makefile @@ -0,0 +1,4 @@ +PROG= tail +SRCS= forward.c misc.c read.c reverse.c tail.c + +.include <bsd.prog.mk> diff --git a/text_cmds/tr/Makefile b/text_cmds/tr/Makefile new file mode 100644 index 0000000..86980fa --- /dev/null +++ b/text_cmds/tr/Makefile @@ -0,0 +1,4 @@ +PROG= tr +SRCS= cmap.c cset.c str.c tr.c + +.include <bsd.prog.mk> diff --git a/text_cmds/tr/collate-fbsd.c b/text_cmds/tr/collate-fbsd.c new file mode 100644 index 0000000..c4d8997 --- /dev/null +++ b/text_cmds/tr/collate-fbsd.c @@ -0,0 +1,158 @@ +/*- + * Copyright (c) 1995 Alex Tatmanjants <alex@elvisti.kiev.ua> + * at Electronni Visti IA, Kiev, Ukraine. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include <sys/cdefs.h> +__FBSDID("$FreeBSD: src/lib/libc/locale/collate.c,v 1.33 2004/09/22 16:56:48 stefanf Exp $"); + +#include "xlocale_private.h" +#define __collate_chain_equiv_table (loc->__lc_collate->__chain_equiv_table) +#define __collate_chain_pri_table (loc->__lc_collate->__chain_pri_table) +#define __collate_char_pri_table (loc->__lc_collate->__char_pri_table) +#define __collate_info (&loc->__lc_collate->__info) +#define __collate_large_char_pri_table (loc->__lc_collate->__large_char_pri_table) +#define __collate_substitute_table (loc->__lc_collate->__substitute_table) + +#include <arpa/inet.h> +#include <stdio.h> +#include <stdlib.h> +#include <stddef.h> +#include <string.h> +#include <wchar.h> +#include <errno.h> +#include <unistd.h> +#include <sysexits.h> +#include <ctype.h> + +#if __DARWIN_BYTE_ORDER == __DARWIN_LITTLE_ENDIAN +static void wntohl(wchar_t *, int); +#endif /* __DARWIN_BYTE_ORDER == __DARWIN_LITTLE_ENDIAN */ +void __collate_err(int ex, const char *f) __dead2; + +/* + * Normally, the __collate_* routines should all be __private_extern__, + * but grep is using them (3715846). Until we can provide an alternative, + * we leave them public, and provide a read-only __collate_load_error variable + */ +#undef __collate_load_error +int __collate_load_error = 1; + +static int +__collate_wcsnlen(const wchar_t *s, int len) +{ + int n = 0; + while (*s && n < len) { + s++; + n++; + } + return n; +} + +static struct __collate_st_chain_pri * +chainsearch(const wchar_t *key, int *len, locale_t loc) +{ + int low = 0; + int high = __collate_info->chain_count - 1; + int next, compar, l; + struct __collate_st_chain_pri *p; + struct __collate_st_chain_pri *tab = __collate_chain_pri_table; + + while (low <= high) { + next = (low + high) / 2; + p = tab + next; + compar = *key - *p->str; + if (compar == 0) { + l = __collate_wcsnlen(p->str, STR_LEN); + compar = wcsncmp(key, p->str, l); + if (compar == 0) { + *len = l; + return p; + } + } + if (compar > 0) + low = next + 1; + else + high = next - 1; + } + return NULL; +} + +static struct __collate_st_large_char_pri * +largesearch(const wchar_t key, locale_t loc) +{ + int low = 0; + int high = __collate_info->large_pri_count - 1; + int next, compar; + struct __collate_st_large_char_pri *p; + struct __collate_st_large_char_pri *tab = __collate_large_char_pri_table; + + while (low <= high) { + next = (low + high) / 2; + p = tab + next; + compar = key - p->val; + if (compar == 0) + return p; + if (compar > 0) + low = next + 1; + else + high = next - 1; + } + return NULL; +} + +void +__collate_lookup_l(const wchar_t *t, int *len, int *prim, int *sec, locale_t loc) +{ + struct __collate_st_chain_pri *p2; + int l; + + *len = 1; + *prim = *sec = 0; + p2 = chainsearch(t, &l, loc); + /* use the chain if prim >= 0 */ + if (p2 && p2->pri[0] >= 0) { + *len = l; + *prim = p2->pri[0]; + *sec = p2->pri[1]; + return; + } + if (*t <= UCHAR_MAX) { + *prim = __collate_char_pri_table[*t].pri[0]; + *sec = __collate_char_pri_table[*t].pri[1]; + return; + } + if (__collate_info->large_pri_count > 0) { + struct __collate_st_large_char_pri *match; + match = largesearch(*t, loc); + if (match) { + *prim = match->pri.pri[0]; + *sec = match->pri.pri[1]; + return; + } + } + *prim = (l = __collate_info->undef_pri[0]) >= 0 ? l : *t - l; + *sec = (l = __collate_info->undef_pri[1]) >= 0 ? l : *t - l; +} diff --git a/text_cmds/tr/collate.h b/text_cmds/tr/collate.h new file mode 100644 index 0000000..494e231 --- /dev/null +++ b/text_cmds/tr/collate.h @@ -0,0 +1,121 @@ +/*- + * Copyright (c) 1995 Alex Tatmanjants <alex@elvisti.kiev.ua> + * at Electronni Visti IA, Kiev, Ukraine. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD: src/lib/libc/locale/collate.h,v 1.14 2002/08/30 20:26:02 ache Exp $ + */ + +#ifndef _COLLATE_H_ +#define _COLLATE_H_ + +#include <sys/cdefs.h> +#ifndef __LIBC__ +#include <sys/types.h> +#endif /* !__LIBC__ */ +#include <limits.h> + +#define STR_LEN 10 +#define TABLE_SIZE 100 +#define COLLATE_VERSION "1.0\n" +#define COLLATE_VERSION1_1 "1.1\n" +#define COLLATE_VERSION1_1A "1.1A\n" +/* see discussion in string/FreeBSD/strxfrm for this value */ +#define COLLATE_MAX_PRIORITY ((1 << 24) - 1) + +#define DIRECTIVE_UNDEF 0x00 +#define DIRECTIVE_FORWARD 0x01 +#define DIRECTIVE_BACKWARD 0x02 +#define DIRECTIVE_POSITION 0x04 + +#define DIRECTIVE_DIRECTION_MASK (DIRECTIVE_FORWARD | DIRECTIVE_BACKWARD) + +#define COLLATE_SUBST_DUP 0x0001 + +#define IGNORE_EQUIV_CLASS 1 + +struct __collate_st_info { + __uint8_t directive[COLL_WEIGHTS_MAX]; + __uint8_t flags; +#if __DARWIN_BYTE_ORDER == __DARWIN_LITTLE_ENDIAN + __uint8_t directive_count:4; + __uint8_t chain_max_len:4; +#else + __uint8_t chain_max_len:4; + __uint8_t directive_count:4; +#endif + __int32_t undef_pri[COLL_WEIGHTS_MAX]; + __int32_t subst_count[COLL_WEIGHTS_MAX]; + __int32_t chain_count; + __int32_t large_pri_count; +}; + +struct __collate_st_char_pri { + __int32_t pri[COLL_WEIGHTS_MAX]; +}; +struct __collate_st_chain_pri { + __darwin_wchar_t str[STR_LEN]; + __int32_t pri[COLL_WEIGHTS_MAX]; +}; +struct __collate_st_large_char_pri { + __int32_t val; + struct __collate_st_char_pri pri; +}; +struct __collate_st_subst { + __int32_t val; + __darwin_wchar_t str[STR_LEN]; +}; + +#ifndef __LIBC__ +extern int __collate_load_error; +extern int __collate_substitute_nontrivial; +#define __collate_char_pri_table (*__collate_char_pri_table_ptr) +extern struct __collate_st_char_pri __collate_char_pri_table[UCHAR_MAX + 1]; +extern struct __collate_st_chain_pri *__collate_chain_pri_table; +extern __int32_t *__collate_chain_equiv_table; +extern struct __collate_st_info __collate_info; +#endif /* !__LIBC__ */ + +__BEGIN_DECLS +#ifdef __LIBC__ +__darwin_wchar_t *__collate_mbstowcs(const char *, locale_t); +__darwin_wchar_t *__collate_wcsdup(const __darwin_wchar_t *); +__darwin_wchar_t *__collate_substitute(const __darwin_wchar_t *, int, locale_t); +int __collate_load_tables(const char *, locale_t); +void __collate_lookup_l(const __darwin_wchar_t *, int *, int *, int *, locale_t); +void __collate_lookup_which(const __darwin_wchar_t *, int *, int *, int, locale_t); +void __collate_xfrm(const __darwin_wchar_t *, __darwin_wchar_t **, locale_t); +int __collate_range_cmp(__darwin_wchar_t, __darwin_wchar_t, locale_t); +size_t __collate_collating_symbol(__darwin_wchar_t *, size_t, const char *, size_t, __darwin_mbstate_t *, locale_t); +int __collate_equiv_class(const char *, size_t, __darwin_mbstate_t *, locale_t); +size_t __collate_equiv_match(int, __darwin_wchar_t *, size_t, __darwin_wchar_t, const char *, size_t, __darwin_mbstate_t *, size_t *, locale_t); +#else /* !__LIBC__ */ +void __collate_lookup(const unsigned char *, int *, int *, int *); +#endif /* __LIBC__ */ +#ifdef COLLATE_DEBUG +void __collate_print_tables(void); +#endif +__END_DECLS + +#endif /* !_COLLATE_H_ */ diff --git a/text_cmds/tr/setlocale.h b/text_cmds/tr/setlocale.h new file mode 100644 index 0000000..b21f6f7 --- /dev/null +++ b/text_cmds/tr/setlocale.h @@ -0,0 +1,42 @@ +/*- + * Copyright (C) 1997 by Andrey A. Chernov, Moscow, Russia. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD: src/lib/libc/locale/setlocale.h,v 1.6 2003/07/06 02:03:37 ache Exp $ + */ + +#ifndef _SETLOCALE_H_ +#define _SETLOCALE_H_ + +#include <xlocale.h> + +#define ENCODING_LEN 31 +#define CATEGORY_LEN 11 + +extern char *_PathLocale; + +int __detect_path_locale(void); +int __wrap_setrunelocale(const char *, locale_t); + +#endif /* !_SETLOCALE_H_ */ diff --git a/text_cmds/tr/str.c b/text_cmds/tr/str.c index e7e6757..6971e68 100644 --- a/text_cmds/tr/str.c +++ b/text_cmds/tr/str.c @@ -66,8 +66,12 @@ static void genseq(STR *); * Using libc internal function __collate_lookup_l for character * equivalence */ +#if __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ < 140000 +#include "collate-fbsd.c" +#else void __collate_lookup_l(const __darwin_wchar_t *, int *, int *, int *, locale_t); +#endif /* * Cache for primary collation weight of each single byte character * used in static void genequiv(s) diff --git a/text_cmds/tr/xlocale_private.h b/text_cmds/tr/xlocale_private.h new file mode 100644 index 0000000..8cb81f9 --- /dev/null +++ b/text_cmds/tr/xlocale_private.h @@ -0,0 +1,97 @@ +/* + * Copyright (c) 2005 Apple Computer, Inc. All rights reserved. + * + * @APPLE_LICENSE_HEADER_START@ + * + * This file contains Original Code and/or Modifications of Original Code + * as defined in and that are subject to the Apple Public Source License + * Version 2.0 (the 'License'). You may not use this file except in + * compliance with the License. Please obtain a copy of the License at + * http://www.opensource.apple.com/apsl/ and read it before using this + * file. + * + * The Original Code and all software distributed under the License are + * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER + * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, + * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. + * Please see the License for the specific language governing rights and + * limitations under the License. + * + * @APPLE_LICENSE_HEADER_END@ + */ + +#ifndef _XLOCALE_PRIVATE_H_ +#define _XLOCALE_PRIVATE_H_ + +#include <sys/cdefs.h> +#define __DARWIN_XLOCALE_PRIVATE +#include <xlocale.h> +#undef __DARWIN_XLOCALE_PRIVATE +#include <stdlib.h> +#include <locale.h> +#include <libkern/OSAtomic.h> +#include <pthread.h> +#include <limits.h> +#include "setlocale.h" +#include "collate.h" + +typedef void (*__free_extra_t)(void *); + +#define __STRUCT_COMMON \ + int32_t __refcount; \ + __free_extra_t __free_extra; + +struct __xlocale_st_collate { + __STRUCT_COMMON + char __encoding[ENCODING_LEN + 1]; + struct __collate_st_info __info; + struct __collate_st_subst *__substitute_table[COLL_WEIGHTS_MAX]; + struct __collate_st_chain_pri *__chain_pri_table; + struct __collate_st_large_char_pri *__large_char_pri_table; + struct __collate_st_char_pri __char_pri_table[UCHAR_MAX + 1]; +}; +struct _xlocale { +/* The item(s) before __magic are not copied when duplicating locale_t's */ + __STRUCT_COMMON /* only used for locale_t's in __lc_numeric_loc */ + /* 10 independent mbstate_t buffers! */ + __darwin_mbstate_t __mbs_mblen; + __darwin_mbstate_t __mbs_mbrlen; + __darwin_mbstate_t __mbs_mbrtowc; + __darwin_mbstate_t __mbs_mbsnrtowcs; + __darwin_mbstate_t __mbs_mbsrtowcs; + __darwin_mbstate_t __mbs_mbtowc; + __darwin_mbstate_t __mbs_wcrtomb; + __darwin_mbstate_t __mbs_wcsnrtombs; + __darwin_mbstate_t __mbs_wcsrtombs; + __darwin_mbstate_t __mbs_wctomb; +/* magic (Here up to the end is copied when duplicating locale_t's) */ + int64_t __magic; +/* flags */ + unsigned char __collate_load_error; + unsigned char __collate_substitute_nontrivial; + unsigned char _messages_using_locale; + unsigned char _monetary_using_locale; + unsigned char _numeric_using_locale; + unsigned char _time_using_locale; + unsigned char __mlocale_changed; + unsigned char __nlocale_changed; + unsigned char __numeric_fp_cvt; +/* collate */ + struct __xlocale_st_collate *__lc_collate; +/* ctype */ + struct __xlocale_st_runelocale *__lc_ctype; +/* messages */ + struct __xlocale_st_messages *__lc_messages; +/* monetary */ + struct __xlocale_st_monetary *__lc_monetary; +/* numeric */ + struct __xlocale_st_numeric *__lc_numeric; + struct _xlocale *__lc_numeric_loc; +/* time */ + struct __xlocale_st_time *__lc_time; +/* localeconv */ + struct __xlocale_st_localeconv *__lc_localeconv; +}; + +#endif /* _XLOCALE_PRIVATE_H_ */ diff --git a/text_cmds/ul/Makefile b/text_cmds/ul/Makefile new file mode 100644 index 0000000..cf193c3 --- /dev/null +++ b/text_cmds/ul/Makefile @@ -0,0 +1,5 @@ +PROG= ul + +LDADD+=-lncursesw + +.include <bsd.prog.mk> diff --git a/text_cmds/unexpand/Makefile b/text_cmds/unexpand/Makefile new file mode 100644 index 0000000..0d06c9f --- /dev/null +++ b/text_cmds/unexpand/Makefile @@ -0,0 +1,4 @@ +PROG= unexpand +MAN= + +.include <bsd.prog.mk> diff --git a/text_cmds/uniq/Makefile b/text_cmds/uniq/Makefile new file mode 100644 index 0000000..a62780c --- /dev/null +++ b/text_cmds/uniq/Makefile @@ -0,0 +1,3 @@ +PROG= uniq + +.include <bsd.prog.mk> diff --git a/text_cmds/unvis/Makefile b/text_cmds/unvis/Makefile new file mode 100644 index 0000000..cf3c0cb --- /dev/null +++ b/text_cmds/unvis/Makefile @@ -0,0 +1,3 @@ +PROG= unvis + +.include <bsd.prog.mk> diff --git a/text_cmds/vis/Makefile b/text_cmds/vis/Makefile new file mode 100644 index 0000000..424b508 --- /dev/null +++ b/text_cmds/vis/Makefile @@ -0,0 +1,4 @@ +PROG= vis +SRCS= foldit.c vis.c + +.include <bsd.prog.mk> diff --git a/text_cmds/wc/Makefile b/text_cmds/wc/Makefile new file mode 100644 index 0000000..4506a3f --- /dev/null +++ b/text_cmds/wc/Makefile @@ -0,0 +1,3 @@ +PROG= wc + +.include <bsd.prog.mk> |