Commit Graph

221 Commits

Author SHA1 Message Date
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
sin 6b14c50e57 Fix sbase-box target 2015-12-15 08:48:43 +00:00
Roberto E. Vargas Caballero 136f012d23 Remove ifdef hell from getconf.c
Every system is going to have a different configuration
so the only solution is to put an ifdef guard for every
value.  To do this, we generate the header at compile time
with a shell script.
2015-12-15 08:45:39 +00:00
Roberto E. Vargas Caballero 1de650edf5 Add ed(1) - the standard text editor 2015-12-14 12:14:52 +00:00
FRIGN 09c279285a Add whoami(1)
including manpage and other stuff. This program is a no-brainer.
This was inspired by an initial commit by e@bestmx.net. Thanks!
2015-12-14 10:14:07 +00:00
sin 2652dcfd6c Initial implementation of flock(1)
Very useful to prevent overlapping cron jobs amongst other things.
2015-10-07 10:27:47 +01:00
FRIGN 05996b997c Add getconf(1)
The logic is simple, it's just a pain in the ass to fill the
data-structures.
Some lines had to be commented out, as glibc/musl apparently
have not fully implemented the mandatory variables for the
2013 corrigendum of POSIX 2008.

Also added a manpage and the necessary entries in README.

I also removed it from the TODO.
2015-10-01 17:17:23 +01:00
FRIGN 007df69fc5 Add parseoffset()
This is a utility function to allow easy parsing of file or other
offsets, automatically taking in regard suffixes, proper bases and
so on, for instance used in split(1) -b or od -j, -N(1).
Of course, POSIX is very arbitrary when it comes to defining the
parsing rules for different tools.
The main focus here lies on being as flexible and consistent as
possible. One central utility-function handling the parsing makes
this stuff a lot more trivial.
2015-09-30 19:44:10 +01:00
Greg Reagle fd0d1e4567 Created od, with improvements suggested by FRIGN 2015-09-30 19:44:10 +01:00
Evan Gates 51009a9600 use CC for sbase-box, remove LD 2015-09-03 19:17:59 +01:00
sin 1fa942a0ee Add TFTP client as specified by RFC 1350
This client does not support the netascii mode.  The default mode
is octet/binary and should be sufficient.

One thing left to do is to check the source port of the server
to make sure it doesn't change.  If it does, we should ignore the
packet and send an error back without disturbing an existing
transfer.
2015-08-14 13:11:16 +01:00
Shiz 8d1ae98163 Call C compiler for linking
Using $(LD) directly for linking can cause issues with cross-compilers
and various other toolchains, as various libraries such as libc may not
be implicitly linked in, causing symbol resolution errors.
Linking through the C compiler frontend solves this issue.
2015-07-31 23:15:42 +01:00