Compare commits
No commits in common. "791f44aa1e1ad6de28ebef90b2626ea111cb1da5" and "544b544d84b1fc8459483aa37e482e9446547d35" have entirely different histories.
791f44aa1e
...
544b544d84
@ -4,7 +4,7 @@
|
||||
.\" This work is licensed under CC BY-SA 4.0. To see a copy of this license,
|
||||
.\" visit <http://creativecommons.org/licenses/by-sa/4.0/>.
|
||||
.\"
|
||||
.TH DJ 1 2025-10-26 "Harakit X.X.X"
|
||||
.TH DJ 1 2024-07-14 "Harakit X.X.X"
|
||||
.SH NAME
|
||||
dj \(en disk jockey
|
||||
.\"
|
||||
|
||||
10
docs/mm.1
10
docs/mm.1
@ -4,7 +4,7 @@
|
||||
.\" This work is licensed under CC BY-SA 4.0. To see a copy of this license,
|
||||
.\" visit <http://creativecommons.org/licenses/by-sa/4.0/>.
|
||||
.\"
|
||||
.TH MM 1 2025-11-01 "Harakit X.X.X"
|
||||
.TH MM 1 2024-07-14 "Harakit X.X.X"
|
||||
.SH NAME
|
||||
mm \(en middleman
|
||||
.\"
|
||||
@ -22,9 +22,7 @@ Catenate input files and write them to the start of each output file or stream.
|
||||
.SH OPTIONS
|
||||
|
||||
.IP \fB-a\fP
|
||||
Opens outputs for appending rather than updating. Implies the
|
||||
.B -t
|
||||
option.
|
||||
Opens outputs for appending rather than updating.
|
||||
.IP \fB-e\fP
|
||||
Use the standard error as an output.
|
||||
.IP \fB-t\fP
|
||||
@ -61,10 +59,6 @@ unncessary.
|
||||
.\"
|
||||
.SH HISTORY
|
||||
|
||||
The \fB-t\fP option was originally the reverse functionality, as the default
|
||||
behavior was to overwrite outputs. This was deemed counterintuitive and the
|
||||
default behavior was changed.
|
||||
|
||||
This utility originally had a \fB-u\fP option for compatibility with cat(1p),
|
||||
but this option is almost always default behavior in practice; therefore, it
|
||||
was dropped both for simplicity and to expand the
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2024–2025 Emma Tebibyte <emma@tebibyte.media>
|
||||
* Copyright (c) 2024 Emma Tebibyte <emma@tebibyte.media>
|
||||
* Copyright (c) 2024 DTB <trinity@trinity.moe>
|
||||
* SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
*
|
||||
@ -168,7 +168,7 @@ fn main() -> ExitCode {
|
||||
|
||||
let options = File::options()
|
||||
/* don’t truncate if -t is specified, append if -a is specified */
|
||||
.truncate(!a && t)
|
||||
.truncate(t)
|
||||
.append(a)
|
||||
/* enable the ability to create and write to files */
|
||||
.create(true)
|
||||
|
||||
19
tests/mm.mk
19
tests/mm.mk
@ -1,12 +1,10 @@
|
||||
# Copyright (c) 2024–2025 Emma Tebibyte <emma@tebibyte.media>
|
||||
# Copyright (c) 2024 Emma Tebibyte <emma@tebibyte.media>
|
||||
# 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.
|
||||
|
||||
MM_FILE!=mktemp /tmp/mm.XXXXXX
|
||||
|
||||
.PHONY: mm_tests
|
||||
mm_tests: mm_args mm_help mm_stderr mm_remaining mm_remaining_options
|
||||
|
||||
@ -40,18 +38,3 @@ mm_remaining: $(BIN)/mm
|
||||
mm_remaining_options:
|
||||
! $(BIN)/mm -i README COPYING -o - 2>&1 | cut -d: -f2 \
|
||||
| xargs test " -o" =
|
||||
|
||||
.PHONY: mm_append
|
||||
mm_append:
|
||||
$(BIN)/mm -i /dev/null -o $(MM_FILE)
|
||||
printf 'test\nstring\nmulti-line\n' | $(BIN)/mm -o $(MM_FILE)
|
||||
printf 'new line\n' | $(BIN)/mm -a -o $(MM_FILE)
|
||||
$(BIN)/mm -i $(MM_FILE) | wc -l | xargs test 4 -eq
|
||||
|
||||
.PHONY: mm_no_truncate
|
||||
mm_no_truncate:
|
||||
$(BIN)/mm -i /dev/null -o $(MM_FILE)
|
||||
printf 'test\nstring\nmulti-line\n' | $(BIN)/mm -o $(MM_FILE)
|
||||
printf 'new line\n' | $(BIN)/mm -t -o $(MM_FILE)
|
||||
$(BIN)/mm -i $(MM_FILE) | wc -l | xargs test 3 -eq
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user