232 Commits

Author SHA1 Message Date
Roberto E. Vargas Caballero
608f88f08f dc: Add initial version
This is the initial version of dc already tested in deep and
with a considerable good set of tests.
2026-01-14 12:49:01 +01:00
Roberto E. Vargas Caballero
ead2c4616a build: Remove all .o in clean
Sometimes the OBJ variable gets out of sync with the object
files in the file system, and using a wildcard does a better
job in this regard.
2025-12-31 16:15:53 +01:00
Roberto E. Vargas Caballero
56b93ad91b bc: Add support for the bc library
This library was imported from the BSD 4.4 source code but it is a
portion of code with ownership from AT&T and it can be used under
the Caldera open source license.
2025-11-23 11:42:10 +01:00
Roberto E. Vargas Caballero
abce467a9d build: Fix .c and bc: rules
These rules were not adding the proper flags in every case
resulting in the lost of some important flags in some
cases.
2025-11-22 12:04:36 +01:00
Roberto E. Vargas Caballero
33ac9371b8 bc: Initial version
This version is almost finished, but it does not implements the return
keyword (it is ignored) and it does not include the default bc library
(the option to load it is silently ignored). It also lack tests.
2025-11-22 11:54:31 +01:00
Roberto E. Vargas Caballero
4593bfb359 tests: Add initial support for tests 2025-11-10 09:12:00 +01:00
Eduardo Santos
fdcca1be51 Makefile: copy scripts in dist recipe
Building from the tarball fails:

    curl --no-progress-meter https://dl.suckless.org/sbase/sbase-0.1.tar.gz \
        | tar -xz --strip-components=1 \
        && make >/dev/null
    ar: creating libutf.a
    ar: creating libutil.a
    /bin/sh: line 1: scripts/getconf.sh: No such file or directory
    make: *** [Makefile:221: getconf.h] Error 127

The scripts contained in the script directory are required
for several make targets (including all, install, uninstall,
sbase-box and maybe some others).

Signed-off-by: Eduardo Santos <eduardo.experimental@gmail.com>
2025-11-03 16:12:47 +01:00
Roberto E. Vargas Caballero
1281dc4f90 make: Add initial version
This implementation is ported from the scc compiler with
the author permission to re license it with sbase license.
Using this make implementation to bootstrap sbase removes
the problems found by some buggy make implementations
(specially in the case of OpenBSD). It has a drawback
that the options passed for parallel build with -j are
ignored(improvement are expected).

Due to the multi file nature of make, embedding it in
sbas-box creates some problems, and for now, we keep
it out of sbase-box.
2025-10-08 09:11:26 +02:00
Thibaut Aubin
8d07e5e8f6 libutil: add confirm() prompt 2025-04-20 09:20:02 +02:00
Roberto E. Vargas Caballero
97629ab386 build: Fix getconf generation
The Makefile was relaying in two extensions:

	1- Inference rule chaining: Based in getconf.c -> getconf.o -> getconf
	2- Inference rule .o: POSIX defines the .c rule, but not the .o rule
	(what makes sense because to be useful you need inference rule chaining).
2025-03-17 19:03:13 +01:00
Roberto E. Vargas Caballero
9b71b697fe build: Avoid using numbers in dist target directory
We are using a wildcard to copy things into the directory used to
build the distribution tar file, and this directory can contain
the .1 extension used in the *.1 wildcard used to copy the man
pages. Also, changed the cp command line from -r to -R because
-r is not specified in POSIX.
2025-03-13 12:10:07 +01:00
Roberto E. Vargas Caballero
ac6d382515 build: Fix sbase-box-install target
The target tried to execute a non valid shell script
and there was a possibility to fatorize the creation
of the proto file instead of repeating it in all
the actions that required.
2024-03-12 17:11:35 +01:00
Roberto E. Vargas Caballero
6b9da17eb4 build: Fix OBJ definition and remove MAN
The MAN macro was not used, and it and OBJ had the same problem
because they were defined using an empty string in the replace
pattern of the macro expansion, but as it is said by POSIX:

	The subst1 to be replaced shall be recognized when it is a suffix
	at the end of a word in string1

so, an empty string should not be used.

Also, a new inference rule is added to generate the binary
directly from the .c without generating the intermediate
object, removing the need of chaining different inference
rules which is not guaranteed to work in all the make
implementations.
2024-01-19 22:01:25 +01:00
Quentin Rameau
c31af02d22 make: fix rogue parameter in install target 2023-11-14 19:34:08 +01:00
Roberto E. Vargas Caballero
090490b81d build: Posixfy the Makefile 2023-09-27 09:46:39 +02:00
Roberto E. Vargas Caballero
ddde8021b3 Simplify install/uninstall 2023-09-27 07:59:27 +02:00
Roberto E. Vargas Caballero
6285c22a07 build: Remove unneeded dependency
Make will search in the catalogue of rules for a way to
update the target, and in case of finding the dependency
it will apply the rule without a need of specifying that
dependency.
2023-09-27 07:59:27 +02:00
Roberto E. Vargas Caballero
986bbb9253 sbase-box: Add -i flag 2023-09-27 07:59:27 +02:00
Roberto E. Vargas Caballero
58ec1f6285 build: Move getconf.sh to scripts
The scripts directory is meant to contain all the scripts needed
in the build.
2023-09-27 07:59:27 +02:00
Roberto E. Vargas Caballero
ba2fc773f3 build: Simplify dist target
We can get rid of the SRC variable if we use shell wildcards.
2023-09-27 07:59:27 +02:00
Roberto E. Vargas Caballero
8933987544 build: Use ARFLAGS when creating libraries
ARFLAGS has the expected value for the toolchain used.
2023-09-27 07:59:02 +02:00
Roberto E. Vargas Caballero
bb4a01e837 build: Remove LIBUTIL and LIBUTF
They were just hidding the actual names of te libraries and as
they were added to OBJ they were listed twice in the clean
command.
2023-09-27 07:58:59 +02:00
Roberto E. Vargas Caballero
0f542cab58 build: Remove LIBUTFSRC and LIBUTILSRC
These variables were used only to generate the variables
LIBUTFOBJ and LIBUTILOBJ.
2023-09-27 07:10:10 +02:00
Roberto E. Vargas Caballero
3c36fb4177 sbase-box: Simplify Makefile rule
The Makefile rule was too complex and these cases is better to just
move it to a script where will be eassier to use sed properly
and not looping over all the files 4 times.
2023-09-27 07:10:05 +02:00
Roberto E. Vargas Caballero
8ca12835a5 build: Remove .gitignore rule
It is not needed because it is just easier to maintain
the gitignore file.
2023-09-27 06:37:38 +02:00
sewn
8d97acc135 xargs: add replace string flag (-I) 2023-09-22 10:34:36 +02:00
Cem Keylan
991ff90064 remove sbase-box from PHONY
I have noticed this issue while I was trying to package sbase-box. Since
sbase-box was in the PHONY target, running sbase-box-install caused it to
be rebuilt when it was unnecessary. This also caused options passed to make
to be lost (such as LDFLAGS).
2020-07-03 13:18:23 -07:00
Michael Forney
6ff6bb57ce Add implementation of dd(1) 2020-05-12 19:58:21 -07:00
Michael Forney
e5d8efb32f Import mknod from ubase
Although mknod is not a POSIX tool, it is widely available on nearly
all UNIX-like systems. It also can be implemented portably apart
from use of the makedev macros, which is already a requirement of
a couple other tools in sbase.

While we're at it, fix a few bugs:
- Include sys/sysmacros.h if makedev was not defined by sys/types.h
- The default mode should respect the user's umask, rather than
  assuming it is 022.
- Clear the umask when -m is specified explicitly so that nodes can
  be created with permissions wider than the user's umask.
- Utilize parsemode from libutil to support symbolic mode strings.
2020-03-01 16:33:11 -08:00
Michael Forney
9ae6c45097 Add .gitignore
Also, add rule to regenerate in case executable list changes.
2019-06-28 00:10:10 -07:00
Eric Pruitt
fb936d5ba5 Add missing getconf.h dependency to sbase-box 2017-09-05 23:00:42 -07:00
Michael Forney
5cb3a1eba1 libutil: Add writeall utility function
writeall makes successive write calls to write an entire buffer to the
output file descriptor. It returns the number of bytes written, or -1 on
the first error.
2017-07-03 21:04:12 +02:00
parazyd
aded902891 remove install.1 on make uninstall
Just a minor fix since xinstall.1 is installed as install.1.
2016-12-27 13:30:08 +01:00
Evan Gates
d6154bd87f Makefile: sort file lists 2016-12-27 13:16:53 +01:00
Evan Gates
4b5a948cee targets must be prerequisites to .PHONY not commands 2016-12-27 13:15:10 +01:00
Mattias Andrée
28129a87c4 Add rev(1)
Signed-off-by: Mattias Andrée <maandree@kth.se>
2016-12-27 11:35:27 +01:00
Evan Gates
de28c8bfa7 use only one getconf header
this simplifies the getconf.sh script and handling parallel make
2016-10-05 18:48:10 +02:00
FRIGN
0fa5a3e5bb Rename struct linebufline to struct line and add linecmp()
This simplifies the handling in sort(1) and comm(1) quite a bit.
2016-03-10 08:48:09 +00:00
FRIGN
eb9bda8787 Support NUL-containing lines in sort(1)
For sort(1) we need memmem(), which I imported from OpenBSD.
Inside sort(1), the changes involved working with the explicit lengths
given by getlines() earlier and rewriting some of the functions.

Now we can handle NUL-characters in the input just fine.
2016-03-10 08:48:09 +00:00
FRIGN
a88906b423 Rever the strmem() addition and add a TODO element
strmem() was not very well thought out. The thing is the following:
If the string contains a zero character, we want to match it, and not
stop right there in place.

The "real" solution is to use memmem() where needed and replace all
functions that assume zero-terminated-strings from standard input, which
could lead to early string-breakoffs.
This requires a strict tracking of string lengths.
2016-02-26 09:54:46 +00:00
FRIGN
3396088666 Implement strmem() and use it in join(1)
We want our delimiters to also contain 0 characters and have them
handled gracefully.
To accomplish this, I wrote a function strmem(), which looks for a
certain, arbitrarily long memory subset in a given string.
memmem() is a GNU extension and forces you to call strlen every time.
2016-02-26 09:54:46 +00:00
Mattias Andrée
a392cd475e add sha512-224sum (SHA512/224) and sha512-256sum (SHA512/256)
Signed-off-by: Mattias Andrée <maandree@kth.se>
2016-02-24 10:40:57 +00:00
Mattias Andrée
ae1da536bb add sha224sum and sha384sum
Signed-off-by: Mattias Andrée <maandree@kth.se>
2016-02-24 10:15:16 +00:00
Mattias Andrée
b44d4d8edd Add tsort(1)
Signed-off-by: Mattias Andrée <maandree@kth.se>
2016-02-17 08:24:53 +00:00
Mattias Andrée
d9c85a2d79 Makefile: add sbase-box-uninstall rule
Signed-off-by: Mattias Andrée <maandree@kth.se>
2016-02-15 09:49:54 +00:00
sin
6ca2a046f8 Fix uninstall target
The installed tool is called install not xinstall.
2016-02-15 09:44:27 +00:00
Eivind Uggedal
2f128ab050 install: bsd make compatibility 2016-02-15 09:41:58 +00:00
Mattias Andrée
db952ed18c New command with corresponding man page. Includes the flags:
-s strip binary
-d create directory
-D create missing directories
-t DIR target directory
-m MODE permission bits
-o USER set owner
-g GROUP set group

Installed files are copied, and default mode is 755.

Signed-off-by: Mattias Andrée <maandree@kth.se>
2016-02-15 09:41:58 +00:00
Mattias Andrée
60ef169a18 Makefile: uninstall [ command in the uninstall rule
Signed-off-by: Mattias Andrée <maandree@kth.se>
2016-02-12 09:50:24 +00:00
Mattias Andrée
b445614f70 Add pathchk(1)
New command, including man page.
UTF-8 compatible and should be POSIX-compliant.

Signed-off-by: Mattias Andrée <maandree@kth.se>
2016-02-11 10:01:58 +00:00