forked from bonsai/harakit
Compare commits
9 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
e7021e127c
|
|||
|
417d7ca405
|
|||
|
f7a74dc430
|
|||
|
cabe08bca4
|
|||
|
c97201fca9
|
|||
|
06fc461985
|
|||
|
0d445c71f4
|
|||
|
d45e3410f8
|
|||
|
452a1295e6
|
44
CONTRIBUTING
44
CONTRIBUTING
@@ -90,26 +90,44 @@ notice:
|
||||
* USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
When writing code, make sure lines never exceed 80 characters in width when
|
||||
using four-character-wide indentation steps.
|
||||
Make sure lines never exceed 80 columns in width when using four-character
|
||||
indentation steps. This helps contributors with smaller screens, those using
|
||||
side-by-side editor windows or panes, and those who have no text wrapping in
|
||||
their editor or terminal.
|
||||
|
||||
For usage text and help messages, please do not implement a -h option. Just
|
||||
print usage information when any erroneous option is specified. Follow the
|
||||
NetBSD style guide for usage text output format [1].
|
||||
For usage text and help messages, do not implement a -h option. Instead, print
|
||||
usage information when any erroneous option is specified. Follow the NetBSD
|
||||
style guide for the usage text’s output format [1].
|
||||
|
||||
If committing a new source file for a utility, format the commit message like
|
||||
this:
|
||||
[1] <http://cvsweb.netbsd.org/bsdweb.cgi/~checkout~/src/share/misc/style>
|
||||
|
||||
$ git commit -m 'tool(1): <information>'
|
||||
If committing a new source file, format the commit message following these
|
||||
guidelines:
|
||||
|
||||
$ git commit -m 'tool(1): add feature x'
|
||||
|
||||
If committing a new library or header file:
|
||||
|
||||
$ git commit -m 'library(1): <information>'
|
||||
$ git commit -m 'library(3): fix overflow'
|
||||
$ git commit -m 'header.h(3): add header.h(3)'
|
||||
|
||||
If committing a new manual page:
|
||||
|
||||
$ git commit -m 'tool.1: add author details'
|
||||
|
||||
If modifying some other file or directory:
|
||||
|
||||
$ git commit -m 'README: clarification'
|
||||
$ git commit -m 'tests: posix: fixed bug #47'
|
||||
$ git commit -m 'docs: tool(1): added author information'
|
||||
$ git commit -m 'README: clarify'
|
||||
$ git commit -m 'tests/posix: fix bug #47'
|
||||
|
||||
etc.
|
||||
For multiple of these:
|
||||
|
||||
$ git commit -m 'Makefile, tool(1): add tool(1)'
|
||||
$ git commit -m 'tool(1): add tool(1); library(3), library.3: add library(3)'
|
||||
$ git commit -m 'tool(1): fix #42 & add feature x'
|
||||
|
||||
Commit messages should be written in the present tense.
|
||||
|
||||
--
|
||||
This work © 2023–2024 by Emma Tebibyte is licensed under CC BY-SA 4.0. To view a
|
||||
copy of this license, visit <http://creativecommons.org/licenses/by-sa/4.0/>
|
||||
|
||||
2
Makefile
2
Makefile
@@ -14,6 +14,7 @@
|
||||
PREFIX=/usr/local
|
||||
|
||||
CC=cc
|
||||
MAKE=make
|
||||
RUSTC=rustc
|
||||
|
||||
.PHONY: all
|
||||
@@ -42,6 +43,7 @@ install: dist
|
||||
test: build
|
||||
tests/posix-compat.sh
|
||||
$(RUSTC) --test src/getopt-rs/lib.rs -o build/test/getopt
|
||||
$(MAKE) -f Testfile
|
||||
|
||||
build/o/libsysexits.rlib: build
|
||||
# bandage solution until bindgen(1) gets stdin support
|
||||
|
||||
78
Testfile
Normal file
78
Testfile
Normal file
@@ -0,0 +1,78 @@
|
||||
#!/usr/bin/env make
|
||||
# Copyright (c) 2024 DTB <trinity@trinity.moe>
|
||||
# SPDX-License-Identifier: FSFAP
|
||||
#
|
||||
# Copying and distribution of this file, with or without modification, are
|
||||
# permitted in any medium without royalty provided the copyright notice and this
|
||||
# notice are preserved. This file is offered as-is, without any warranty.
|
||||
|
||||
BIN = build/bin
|
||||
MAKE = make -B
|
||||
|
||||
DEFENDANTS = dj false intcmp strcmp true
|
||||
.PHONY: all $(DEFENDANTS)
|
||||
all: $(DEFENDANTS)
|
||||
|
||||
$(BIN)/dj:
|
||||
$(MAKE) dj
|
||||
|
||||
$(BIN)/false:
|
||||
$(MAKE) false
|
||||
|
||||
$(BIN)/intcmp:
|
||||
$(MAKE) intcmp
|
||||
|
||||
$(BIN)/strcmp:
|
||||
$(MAKE) strcmp
|
||||
|
||||
$(BIN)/true:
|
||||
$(MAKE) true
|
||||
|
||||
dj: $(BIN)/dj $(BIN)/strcmp
|
||||
sh -c "! $(BIN)/dj -h"
|
||||
# This test is theoretically Linux-dependent; write(2) should return -1 on
|
||||
# error.
|
||||
# Right now dj(1) interprets the return value of write(2) as the amount of
|
||||
# bytes written. This can decrement the stored quantity of bytes written,
|
||||
# which is an int, so doesn't underflow but goes negative. dj(1) tries to
|
||||
# again to write(2) if an error occurs in which no bytes are written, so in
|
||||
# total two write(2)s are attempted and so the written byte quantity is -2.
|
||||
# This is a bug and will change, but for now is at least documented.
|
||||
sh -ec "\
|
||||
$(BIN)/dj -Hi /dev/zero -o /dev/full \
|
||||
| xargs -I out $(BIN)/strcmp '1+0 > 0+0; 1024 > -2' out"
|
||||
# Read nothing from /dev/null, write nothing to /dev/null.
|
||||
sh -ec "\
|
||||
$(BIN)/dj -Hi /dev/null -o /dev/null \
|
||||
| xargs -I out $(BIN)/strcmp '0+0 > 0+0; 0 > 0' out"
|
||||
|
||||
false: $(BIN)/false
|
||||
sh -c "! $(BIN)/false"
|
||||
sh -c "! $(BIN)/false -h"
|
||||
|
||||
intcmp: $(BIN)/intcmp
|
||||
$(BIN)/intcmp -e 3 3 3
|
||||
$(BIN)/intcmp -g 3 2 1
|
||||
$(BIN)/intcmp -l 1 2 3
|
||||
$(BIN)/intcmp -ge 3 3 1
|
||||
$(BIN)/intcmp -le 1 3 3
|
||||
$(BIN)/intcmp -gl 1 2 3
|
||||
$(BIN)/intcmp -egl 3 1 1 2
|
||||
sh -c "! $(BIN)/intcmp -e 1 2 3"
|
||||
sh -c "! $(BIN)/intcmp -g 1 3 3"
|
||||
sh -c "! $(BIN)/intcmp -l 3 3 1"
|
||||
sh -c "! $(BIN)/intcmp -ge 1 2 3"
|
||||
sh -c "! $(BIN)/intcmp -le 3 2 1"
|
||||
sh -c "! $(BIN)/intcmp -gl 3 3 3"
|
||||
sh -c "! $(BIN)/intcmp -egl foo"
|
||||
|
||||
strcmp: $(BIN)/strcmp
|
||||
$(BIN)/strcmp equals equals
|
||||
sh -c "! $(BIN)/strcmp inequals equals"
|
||||
$(BIN)/strcmp - -
|
||||
sh -c "! $(BIN)/strcmp -h"
|
||||
sh -c "! $(BIN)/strcmp nocmp"
|
||||
|
||||
true:
|
||||
$(BIN)/true
|
||||
$(BIN)/true -h
|
||||
Reference in New Issue
Block a user