Compare commits
	
		
			2 Commits
		
	
	
		
			544b544d84
			...
			791f44aa1e
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 791f44aa1e | |||
| feac3bf4f8 | 
@ -4,7 +4,7 @@
 | 
				
			|||||||
.\" This work is licensed under CC BY-SA 4.0. To see a copy of this license,
 | 
					.\" 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/>.
 | 
					.\" visit <http://creativecommons.org/licenses/by-sa/4.0/>.
 | 
				
			||||||
.\"
 | 
					.\"
 | 
				
			||||||
.TH DJ 1 2024-07-14 "Harakit X.X.X"
 | 
					.TH DJ 1 2025-10-26 "Harakit X.X.X"
 | 
				
			||||||
.SH NAME
 | 
					.SH NAME
 | 
				
			||||||
dj \(en disk jockey
 | 
					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,
 | 
					.\" 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/>.
 | 
					.\" visit <http://creativecommons.org/licenses/by-sa/4.0/>.
 | 
				
			||||||
.\"
 | 
					.\"
 | 
				
			||||||
.TH MM 1 2024-07-14 "Harakit X.X.X"
 | 
					.TH MM 1 2025-11-01 "Harakit X.X.X"
 | 
				
			||||||
.SH NAME
 | 
					.SH NAME
 | 
				
			||||||
mm \(en middleman
 | 
					mm \(en middleman
 | 
				
			||||||
.\"
 | 
					.\"
 | 
				
			||||||
@ -22,7 +22,9 @@ Catenate input files and write them to the start of each output file or stream.
 | 
				
			|||||||
.SH OPTIONS
 | 
					.SH OPTIONS
 | 
				
			||||||
 | 
					
 | 
				
			||||||
.IP \fB-a\fP
 | 
					.IP \fB-a\fP
 | 
				
			||||||
Opens outputs for appending rather than updating.
 | 
					Opens outputs for appending rather than updating. Implies the
 | 
				
			||||||
 | 
					.B -t
 | 
				
			||||||
 | 
					option.
 | 
				
			||||||
.IP \fB-e\fP
 | 
					.IP \fB-e\fP
 | 
				
			||||||
Use the standard error as an output.
 | 
					Use the standard error as an output.
 | 
				
			||||||
.IP \fB-t\fP
 | 
					.IP \fB-t\fP
 | 
				
			||||||
@ -59,6 +61,10 @@ unncessary.
 | 
				
			|||||||
.\"
 | 
					.\"
 | 
				
			||||||
.SH HISTORY
 | 
					.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),
 | 
					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
 | 
					but this option is almost always default behavior in practice; therefore, it
 | 
				
			||||||
was dropped both for simplicity and to expand the
 | 
					was dropped both for simplicity and to expand the
 | 
				
			||||||
 | 
				
			|||||||
@ -1,5 +1,5 @@
 | 
				
			|||||||
/*
 | 
					/*
 | 
				
			||||||
 * Copyright (c) 2024 Emma Tebibyte <emma@tebibyte.media>
 | 
					 * Copyright (c) 2024–2025 Emma Tebibyte <emma@tebibyte.media>
 | 
				
			||||||
 * Copyright (c) 2024 DTB <trinity@trinity.moe>
 | 
					 * Copyright (c) 2024 DTB <trinity@trinity.moe>
 | 
				
			||||||
 * SPDX-License-Identifier: AGPL-3.0-or-later
 | 
					 * SPDX-License-Identifier: AGPL-3.0-or-later
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
@ -168,7 +168,7 @@ fn main() -> ExitCode {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
		let options = File::options()
 | 
							let options = File::options()
 | 
				
			||||||
			/* don’t truncate if -t is specified, append if -a is specified */
 | 
								/* don’t truncate if -t is specified, append if -a is specified */
 | 
				
			||||||
			.truncate(t)
 | 
								.truncate(!a && t)
 | 
				
			||||||
			.append(a)
 | 
								.append(a)
 | 
				
			||||||
			/* enable the ability to create and write to files */
 | 
								/* enable the ability to create and write to files */
 | 
				
			||||||
			.create(true)
 | 
								.create(true)
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										19
									
								
								tests/mm.mk
									
									
									
									
									
								
							
							
						
						
									
										19
									
								
								tests/mm.mk
									
									
									
									
									
								
							@ -1,10 +1,12 @@
 | 
				
			|||||||
# Copyright (c) 2024 Emma Tebibyte <emma@tebibyte.media>
 | 
					# Copyright (c) 2024–2025 Emma Tebibyte <emma@tebibyte.media>
 | 
				
			||||||
# SPDX-License-Identifier: FSFAP
 | 
					# SPDX-License-Identifier: FSFAP
 | 
				
			||||||
#
 | 
					#
 | 
				
			||||||
# Copying and distribution of this file, with or without modification, are
 | 
					# Copying and distribution of this file, with or without modification, are
 | 
				
			||||||
# permitted in any medium without royalty provided the copyright notice and
 | 
					# permitted in any medium without royalty provided the copyright notice and
 | 
				
			||||||
# this notice are preserved.  This file is offered as-is, without any warranty.
 | 
					# this notice are preserved.  This file is offered as-is, without any warranty.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					MM_FILE!=mktemp /tmp/mm.XXXXXX
 | 
				
			||||||
 | 
					
 | 
				
			||||||
.PHONY: mm_tests
 | 
					.PHONY: mm_tests
 | 
				
			||||||
mm_tests: mm_args mm_help mm_stderr mm_remaining mm_remaining_options
 | 
					mm_tests: mm_args mm_help mm_stderr mm_remaining mm_remaining_options
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -38,3 +40,18 @@ mm_remaining: $(BIN)/mm
 | 
				
			|||||||
mm_remaining_options:
 | 
					mm_remaining_options:
 | 
				
			||||||
	! $(BIN)/mm -i README COPYING -o - 2>&1 | cut -d: -f2 \
 | 
						! $(BIN)/mm -i README COPYING -o - 2>&1 | cut -d: -f2 \
 | 
				
			||||||
		| xargs test " -o" =
 | 
							| 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