Commit Graph

151 Commits

Author SHA1 Message Date
FRIGN
a5ae899a48 Scrap readrune(), introducing fgetrune()
Interface as proposed by cls, but internally rewritten after a few
considerations.
The code is much shorter and to the point, aligning itself with other
standard functions. It should also be much faster, which is not bad.
2015-02-11 20:16:49 +01:00
FRIGN
f9846a9a6b Split up is*rune() and to*rune() functions into individual source files
This optimizes the binary size for each tool that uses these functions.
Previously, if a program just used one single function, maybe even a
one-liner, it would statically compile in all lookup-tables, bloating
the binary by up to 20K.
All these changes are derived from a local libutf where I do the
primary changes. So I hope that I can merge these things into libutf
sooner or later, as discussed on the ml.
2015-02-11 15:48:18 +01:00
Evan Gates
bc07f1b9b5 Add initial implementation of sed(1)
No manpage yet.
2015-02-10 10:35:22 +00:00
Eon S. Jeon
6b93b14fba support llvm-ar
llvm-ar doesn't understand flags prefixed with dashes.
2015-02-03 10:08:26 +00:00
Hiltjo Posthuma
66e1bbccf3 Makefile: stricter regex replace for sbase VERSION 2015-02-01 16:33:46 +01:00
sin
0934e7f6ed Add .Os sbase and sed replace to .Os sbase $(VERSION) in make install 2015-01-31 19:37:03 +00:00
Hiltjo Posthuma
4a920a5960 remove sbase-VERSION from man page, fix sponge.1 date 2015-01-31 14:20:02 +01:00
FRIGN
fd562481f3 Convert estrto{l, ul} to estrtonum
Enough with this insanity!
2015-01-30 16:52:44 +01:00
sin
add25a464f Add strtonum() in preparation to nuking estrtol() and friends 2015-01-30 13:48:33 +00:00
sin
b90ca482a0 Add estrtoul() 2015-01-30 13:24:41 +00:00
FRIGN
b8b9d983c8 Add unescape() to libutil
formerly known as resolveescapes(), it is of central use to numerous
programs.
This drops a lot of LOC.
2015-01-29 21:52:44 +01:00
sin
bc9c752df5 Import strsep() from musl libc 2015-01-25 17:48:11 +00:00
FRIGN
a582cb8a2f Rewrite tr(1) in a sane way
tr(1) always used to be a saddening part of sbase, which was
inherently broken and crufted.
But to be fair, the POSIX-standard doesn't make it very simple.
Given the current version was unfixable and broken by design, I
sat down and rewrote tr(1) very close to the concept of set theory
and the POSIX-standard with a few exceptions:

 - UTF-8: not allowed in POSIX, but in my opinion a must. This
          finally allows you to work with UTF-8 streams without
          problems or unexpected behaviour.
 - Equivalence classes: Left out, even GNU coreutils ignore them
                        and depending on LC_COLLATE, which sucks.
 - Character classes: No experiments or environment-variable-trickery.
                      Just plain definitions derived from the POSIX-
                      standard, working as expected.

I tested this thoroughly, but expect problems to show up in some
way given the wide range of input this program has to handle.
The only thing left on the TODO is to add support for literal
expressions ('\n', '\t', '\001', ...) and probably rethinking
the way [_*n] is unnecessarily restricted to string2.
2015-01-10 14:26:30 +00:00
sin
e296329773 Rename crond to cron 2014-12-16 11:04:07 +00:00
sin
8d2c5dd9a3 Import crond from http://git.2f30.org/scron/tree/ 2014-12-09 16:05:38 +00:00
sin
5d1e46fefa Implement POSIX 2008 compliant logger(1) 2014-12-04 11:36:40 +00:00
sin
f141da6190 Bring back OpenBSD make compatibility in Makefile
Thanks @quing
2014-12-01 17:37:44 +00:00
Evan Gates
1bd598c9ed sort BIN, that was bugging me 2014-12-01 17:18:56 +00:00
sin
d13e5c2be3 Remove redundant deletions from clean target 2014-11-30 11:57:38 +00:00
sin
5b5bb82ec0 Factor out readrune and writerune 2014-11-21 16:31:16 +00:00
sin
ce86a05f36 Import strcasestr() from musl and remove -D_GNU_SOURCE 2014-11-20 23:46:06 +00:00
sin
5197affac5 Remove col(1)
Not quite necessary to have this in sbase at the moment.  We can do
a clean implementation when required.

This implementation also has some bugs that they have been fixed
in OpenBSD -current but I am too lazy to backport (we also had local
changes to col(1)).

printf(1) as imported from OpenBSD will stay for now because I need
it for booting my system.
2014-11-20 13:57:52 +00:00
sin
0d7c2351b4 Remove csplit(1)
Get rid of it for now as it is not really widely used.  We can do
a simple implementation when time comes.

Remove the table from README because it is not easy to edit unless
you use emacs.
2014-11-20 13:52:18 +00:00
sin
2c42905f63 Make libutf.a and libutil.a different 2014-11-19 10:51:29 +00:00
Evan Gates
84b08427a1 remove agetline 2014-11-18 21:05:28 +00:00
Evan Gates
cca0522872 clear suffix list then add only .o and .c in that order to avoid use of builtin .c inference rule skipping .c.o 2014-11-18 20:18:05 +00:00
sin
fda3ed9a56 Remove .POSIX from Makefile 2014-11-18 19:28:04 +00:00
sin
027052f5e5 Rename util/ to libutil/ 2014-11-17 16:48:34 +00:00
sin
cb7cbde722 Add compat.h 2014-11-17 15:46:28 +00:00
sin
56709a2414 Import libutf from http://git.suckless.org/libutf 2014-11-17 15:46:01 +00:00
sin
ba70777b56 Remove binlib and bin from PHONY 2014-11-17 14:46:52 +00:00
sin
74ac827587 Require GNU make to build sbase
We seem to have problems building individual tools across various
make implementations.  If anyone can step up and fix this we will
remove the dependency on GNU make.
2014-11-17 13:54:24 +00:00
sin
a84cbe9e1c Avoid messed up output because of trailing spaces 2014-11-17 13:22:54 +00:00
sin
ba89dc565f Add .PHONY targets 2014-11-17 13:02:32 +00:00
sin
0d0624b855 Use $(RANLIB) in Makefile 2014-11-17 12:24:03 +00:00
sin
2ee3ae5994 Use LIB, LIBSRC and LIBOBJ and derive SRC, OBJ and MAN from BIN 2014-11-17 12:14:25 +00:00
sin
4a97e0b526 List libutil.a first to be a bit more clear 2014-11-17 10:50:45 +00:00
sin
1b0d2c1ab3 Make clean more verbose 2014-11-17 10:39:02 +00:00
sin
e1c044e298 Do not append CPPFLAGS to CFLAGS 2014-11-17 10:38:37 +00:00
sin
2fd6e769dd Rename util.a to libutil.a 2014-11-17 10:37:07 +00:00
sin
9a9d6bb0dc Make build process more verbose 2014-11-17 10:36:39 +00:00
Hiltjo Posthuma
ce90cc57d4 util: add eregcomp: show descriptive error message on regcomp error 2014-11-16 14:36:41 +00:00
sin
67fcc79046 Use queue.h in grep(1) 2014-11-16 12:39:15 +00:00
sin
2982d88533 Import ealloc.c from ubase 2014-11-14 18:10:05 +00:00
sin
3de142ba70 Delete dist when cleaning 2014-11-14 14:41:05 +00:00
sin
300eedc50a Add README and TODO to dist target 2014-11-14 11:58:42 +00:00
sin
ee55fbe9e9 Just make $(HDR) a prereq for $(OBJ)
The result is always correct but it might do redundant builds.
Not really an issue as sbase builds very fast.  The alternative is
to track the header deps manually but this is already incomplete and
unlikely to be kept up to date.
2014-11-13 18:28:18 +00:00
sin
2c7516c716 Sort HDR in Makefile 2014-11-13 18:21:19 +00:00
Evan Gates
5cf965ffbf return exit status of command in sbase-box 2014-11-08 13:50:55 +00:00
Hiltjo Posthuma
b6b8fe9591 separate humansize into a util function
also show 1 decimal of human size string like: 4M -> 4.4M
2014-10-18 23:56:51 +01:00