diff options
355 files changed, 22250 insertions, 31888 deletions
diff --git a/etc/agpl.c b/agpl.c index 4cc71115..e7682757 100644 --- a/etc/agpl.c +++ b/agpl.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2020 C. McEnroe <june@causal.agency> +/* Copyright (C) 2024 June McEnroe <june@causal.agency> * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by @@ -17,4 +17,3 @@ #include <err.h> #include <stdio.h> #include <stdlib.h> -#include <sysexits.h> diff --git a/bin/.gitignore b/bin/.gitignore index cf808c77..42269bac 100644 --- a/bin/.gitignore +++ b/bin/.gitignore @@ -1,35 +1,37 @@ *.html *.o beef +bibsort bit -bri c config.mk +dehtml +downgrade dtch -edit +enc ever -fbatt -fbclock +freecell +git-comment glitch -hi -hnel +hilex +htagml +htmltags modem -open +mtags +nudge order -pbcopy pbd -pbpaste pngo psf2png -psfed ptee +qf +quick relay scheme -scheme.h shotty +sup tags title -ttpre up when xx diff --git a/bin/1sh/.gitignore b/bin/1sh/.gitignore deleted file mode 100644 index 54db1cf1..00000000 --- a/bin/1sh/.gitignore +++ /dev/null @@ -1,13 +0,0 @@ -*.o -.depend -1sh -builtins.c -builtins.h -config.mk -mknodes -mksyntax -nodes.c -nodes.h -syntax.c -syntax.h -token.h diff --git a/bin/1sh/1sh-kill.1 b/bin/1sh/1sh-kill.1 deleted file mode 100644 index 110fab7d..00000000 --- a/bin/1sh/1sh-kill.1 +++ /dev/null @@ -1,157 +0,0 @@ -.\"- -.\" Copyright (c) 1980, 1990, 1993 -.\" The Regents of the University of California. All rights reserved. -.\" -.\" This code is derived from software contributed to Berkeley by -.\" the Institute of Electrical and Electronics Engineers, Inc. -.\" -.\" Redistribution and use in source and binary forms, with or without -.\" modification, are permitted provided that the following conditions -.\" are met: -.\" 1. Redistributions of source code must retain the above copyright -.\" notice, this list of conditions and the following disclaimer. -.\" 2. Redistributions in binary form must reproduce the above copyright -.\" notice, this list of conditions and the following disclaimer in the -.\" documentation and/or other materials provided with the distribution. -.\" 3. Neither the name of the University nor the names of its contributors -.\" may be used to endorse or promote products derived from this software -.\" without specific prior written permission. -.\" -.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND -.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE -.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -.\" SUCH DAMAGE. -.\" -.\" @(#)kill.1 8.2 (Berkeley) 4/28/95 -.\" $FreeBSD: releng/12.1/bin/kill/kill.1 314436 2017-02-28 23:42:47Z imp $ -.\" -.Dd October 3, 2016 -.Dt 1SH-KILL 1 -.Os -.Sh NAME -.Nm kill -.Nd terminate or signal a process -.Sh SYNOPSIS -.Nm -.Op Fl s Ar signal_name -.Ar pid ... -.Nm -.Fl l -.Op Ar exit_status -.Nm -.Fl Ar signal_name -.Ar pid ... -.Nm -.Fl Ar signal_number -.Ar pid ... -.Sh DESCRIPTION -The -.Nm -utility sends a signal to the processes specified by the -.Ar pid -operands. -.Pp -Only the super-user may send signals to other users' processes. -.Pp -The options are as follows: -.Bl -tag -width indent -.It Fl s Ar signal_name -A symbolic signal name specifying the signal to be sent instead of the -default -.Dv TERM . -.It Fl l Op Ar exit_status -If no operand is given, list the signal names; otherwise, write -the signal name corresponding to -.Ar exit_status . -.It Fl Ar signal_name -A symbolic signal name specifying the signal to be sent instead of the -default -.Dv TERM . -.It Fl Ar signal_number -A non-negative decimal integer, specifying the signal to be sent instead -of the default -.Dv TERM . -.El -.Pp -The following PIDs have special meanings: -.Bl -tag -width indent -.It -1 -If superuser, broadcast the signal to all processes; otherwise broadcast -to all processes belonging to the user. -.El -.Pp -Some of the more commonly used signals: -.Pp -.Bl -tag -width indent -compact -.It 1 -HUP (hang up) -.It 2 -INT (interrupt) -.It 3 -QUIT (quit) -.It 6 -ABRT (abort) -.It 9 -KILL (non-catchable, non-ignorable kill) -.It 14 -ALRM (alarm clock) -.It 15 -TERM (software termination signal) -.El -.Pp -Some shells may provide a builtin -.Nm -command which is similar or identical to this utility. -Consult the -.Xr builtin 1 -manual page. -.Sh EXIT STATUS -.Ex -std -.Sh EXAMPLES -Terminate -the processes with PIDs 142 and 157: -.Pp -.Dl "kill 142 157" -.Pp -Send the hangup signal -.Pq Dv SIGHUP -to the process with PID 507: -.Pp -.Dl "kill -s HUP 507" -.Pp -Terminate the process group with PGID 117: -.Pp -.Dl "kill -- -117" -.Sh SEE ALSO -.Xr builtin 1 , -.Xr csh 1 , -.Xr killall 1 , -.Xr ps 1 , -.Xr sh 1 , -.Xr kill 2 , -.Xr sigaction 2 -.Sh STANDARDS -The -.Nm -utility is expected to be -.St -p1003.2 -compatible. -.Sh HISTORY -A -.Nm -command appeared in -.At v3 -in section 8 of the manual. -.Sh BUGS -A replacement for the command -.Dq Li kill 0 -for -.Xr csh 1 -users should be provided. diff --git a/bin/1sh/1sh-printf.1 b/bin/1sh/1sh-printf.1 deleted file mode 100644 index 33c4b9f5..00000000 --- a/bin/1sh/1sh-printf.1 +++ /dev/null @@ -1,385 +0,0 @@ -.\" Copyright (c) 1989, 1990, 1993 -.\" The Regents of the University of California. All rights reserved. -.\" -.\" This code is derived from software contributed to Berkeley by -.\" the Institute of Electrical and Electronics Engineers, Inc. -.\" -.\" Redistribution and use in source and binary forms, with or without -.\" modification, are permitted provided that the following conditions -.\" are met: -.\" 1. Redistributions of source code must retain the above copyright -.\" notice, this list of conditions and the following disclaimer. -.\" 2. Redistributions in binary form must reproduce the above copyright -.\" notice, this list of conditions and the following disclaimer in the -.\" documentation and/or other materials provided with the distribution. -.\" 3. Neither the name of the University nor the names of its contributors -.\" may be used to endorse or promote products derived from this software -.\" without specific prior written permission. -.\" -.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND -.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE -.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -.\" SUCH DAMAGE. -.\" -.\" @(#)printf.1 8.1 (Berkeley) 6/6/93 -.\" $FreeBSD: releng/12.1/usr.bin/printf/printf.1 350613 2019-08-05 20:19:38Z jilles $ -.\" -.Dd July 29, 2019 -.Dt 1SH-PRINTF 1 -.Os -.Sh NAME -.Nm printf -.Nd formatted output -.Sh SYNOPSIS -.Nm -.Ar format Op Ar arguments ... -.Sh DESCRIPTION -The -.Nm -utility formats and prints its arguments, after the first, under control -of the -.Ar format . -The -.Ar format -is a character string which contains three types of objects: plain characters, -which are simply copied to standard output, character escape sequences which -are converted and copied to the standard output, and format specifications, -each of which causes printing of the next successive -.Ar argument . -.Pp -The -.Ar arguments -after the first are treated as strings if the corresponding format is -either -.Cm c , b -or -.Cm s ; -otherwise it is evaluated as a C constant, with the following extensions: -.Pp -.Bl -bullet -offset indent -compact -.It -A leading plus or minus sign is allowed. -.It -If the leading character is a single or double quote, the value is the -character code of the next character. -.El -.Pp -The format string is reused as often as necessary to satisfy the -.Ar arguments . -Any extra format specifications are evaluated with zero or the null -string. -.Pp -Character escape sequences are in backslash notation as defined in the -.St -ansiC , -with extensions. -The characters and their meanings -are as follows: -.Pp -.Bl -tag -width Ds -offset indent -compact -.It Cm \ea -Write a <bell> character. -.It Cm \eb -Write a <backspace> character. -.It Cm \ef -Write a <form-feed> character. -.It Cm \en -Write a <new-line> character. -.It Cm \er -Write a <carriage return> character. -.It Cm \et -Write a <tab> character. -.It Cm \ev -Write a <vertical tab> character. -.It Cm \e\' -Write a <single quote> character. -.It Cm \e\e -Write a backslash character. -.It Cm \e Ns Ar num -Write a byte whose -value is the 1-, 2-, or 3-digit -octal number -.Ar num . -Multibyte characters can be constructed using multiple -.Cm \e Ns Ar num -sequences. -.El -.Pp -Each format specification is introduced by the percent character -(``%''). -The remainder of the format specification includes, -in the following order: -.Bl -tag -width Ds -.It "Zero or more of the following flags:" -.Bl -tag -width Ds -.It Cm # -A `#' character -specifying that the value should be printed in an ``alternate form''. -For -.Cm b , c , d , s -and -.Cm u -formats, this option has no effect. -For the -.Cm o -formats the precision of the number is increased to force the first -character of the output string to a zero. -For the -.Cm x -.Pq Cm X -format, a non-zero result has the string -.Li 0x -.Pq Li 0X -prepended to it. -For -.Cm a , A , e , E , f , F , g -and -.Cm G -formats, the result will always contain a decimal point, even if no -digits follow the point (normally, a decimal point only appears in the -results of those formats if a digit follows the decimal point). -For -.Cm g -and -.Cm G -formats, trailing zeros are not removed from the result as they -would otherwise be; -.It Cm \&\- -A minus sign `\-' which specifies -.Em left adjustment -of the output in the indicated field; -.It Cm \&+ -A `+' character specifying that there should always be -a sign placed before the number when using signed formats. -.It Sq \&\ \& -A space specifying that a blank should be left before a positive number -for a signed format. -A `+' overrides a space if both are used; -.It Cm \&0 -A zero `0' character indicating that zero-padding should be used -rather than blank-padding. -A `\-' overrides a `0' if both are used; -.El -.It "Field Width:" -An optional digit string specifying a -.Em field width ; -if the output string has fewer bytes than the field width it will -be blank-padded on the left (or right, if the left-adjustment indicator -has been given) to make up the field width (note that a leading zero -is a flag, but an embedded zero is part of a field width); -.It Precision: -An optional period, -.Sq Cm \&.\& , -followed by an optional digit string giving a -.Em precision -which specifies the number of digits to appear after the decimal point, -for -.Cm e -and -.Cm f -formats, or the maximum number of bytes to be printed -from a string; if the digit string is missing, the precision is treated -as zero; -.It Format: -A character which indicates the type of format to use (one of -.Cm diouxXfFeEgGaAcsb ) . -The uppercase formats differ from their lowercase counterparts only in -that the output of the former is entirely in uppercase. -The floating-point format specifiers -.Pq Cm fFeEgGaA -may be prefixed by an -.Cm L -to request that additional precision be used, if available. -.El -.Pp -A field width or precision may be -.Sq Cm \&* -instead of a digit string. -In this case an -.Ar argument -supplies the field width or precision. -.Pp -The format characters and their meanings are: -.Bl -tag -width Fl -.It Cm diouXx -The -.Ar argument -is printed as a signed decimal (d or i), unsigned octal, unsigned decimal, -or unsigned hexadecimal (X or x), respectively. -.It Cm fF -The -.Ar argument -is printed in the style `[\-]ddd.ddd' where the number of d's -after the decimal point is equal to the precision specification for -the argument. -If the precision is missing, 6 digits are given; if the precision -is explicitly 0, no digits and no decimal point are printed. -The values \*[If] and \*[Na] are printed as -.Ql inf -and -.Ql nan , -respectively. -.It Cm eE -The -.Ar argument -is printed in the style -.Cm e -.Sm off -.Sq Op - Ar d.ddd No \(+- Ar dd -.Sm on -where there -is one digit before the decimal point and the number after is equal to -the precision specification for the argument; when the precision is -missing, 6 digits are produced. -The values \*[If] and \*[Na] are printed as -.Ql inf -and -.Ql nan , -respectively. -.It Cm gG -The -.Ar argument -is printed in style -.Cm f -.Pq Cm F -or in style -.Cm e -.Pq Cm E -whichever gives full precision in minimum space. -.It Cm aA -The -.Ar argument -is printed in style -.Sm off -.Sq Op - Ar h.hhh No \(+- Li p Ar d -.Sm on -where there is one digit before the hexadecimal point and the number -after is equal to the precision specification for the argument; -when the precision is missing, enough digits are produced to convey -the argument's exact double-precision floating-point representation. -The values \*[If] and \*[Na] are printed as -.Ql inf -and -.Ql nan , -respectively. -.It Cm c -The first byte of -.Ar argument -is printed. -.It Cm s -Bytes from the string -.Ar argument -are printed until the end is reached or until the number of bytes -indicated by the precision specification is reached; however if the -precision is 0 or missing, the string is printed entirely. -.It Cm b -As for -.Cm s , -but interpret character escapes in backslash notation in the string -.Ar argument . -The permitted escape sequences are slightly different in that -octal escapes are -.Cm \e0 Ns Ar num -instead of -.Cm \e Ns Ar num -and that an additional escape sequence -.Cm \ec -stops further output from this -.Nm -invocation. -.It Cm n$ -Allows reordering of the output according to -.Ar argument . -.It Cm \&% -Print a `%'; no argument is used. -.El -.Pp -The decimal point -character is defined in the program's locale (category -.Dv LC_NUMERIC ) . -.Pp -In no case does a non-existent or small field width cause truncation of -a field; padding takes place only if the specified field width exceeds -the actual width. -.Pp -Some shells may provide a builtin -.Nm -command which is similar or identical to this utility. -Consult the -.Xr builtin 1 -manual page. -.Sh EXIT STATUS -.Ex -std -.Sh COMPATIBILITY -The traditional -.Bx -behavior of converting arguments of numeric formats not beginning -with a digit to the -.Tn ASCII -code of the first character is not supported. -.Sh SEE ALSO -.Xr builtin 1 , -.Xr echo 1 , -.Xr sh 1 , -.Xr printf 3 -.Sh STANDARDS -The -.Nm -command is expected to be compatible with the -.St -p1003.2 -specification. -.Sh HISTORY -The -.Nm -command appeared in -.Bx 4.3 Reno . -It is modeled -after the standard library function, -.Xr printf 3 . -.Sh CAVEATS -.Tn ANSI -hexadecimal character constants were deliberately not provided. -.Pp -Trying to print a dash ("-") as the first character causes -.Nm -to interpret the dash as a program argument. -.Nm -- -must be used before -.Ar format . -.Pp -If the locale contains multibyte characters -(such as UTF-8), -the -.Cm c -format and -.Cm b -and -.Cm s -formats with a precision -may not operate as expected. -.Sh BUGS -Since the floating point numbers are translated from -.Tn ASCII -to floating-point and -then back again, floating-point precision may be lost. -(By default, the number is translated to an IEEE-754 double-precision -value before being printed. -The -.Cm L -modifier may produce additional precision, depending on the hardware platform.) -.Pp -The escape sequence \e000 is the string terminator. -When present in the argument for the -.Cm b -format, the argument will be truncated at the \e000 character. -.Pp -Multibyte characters are not recognized in format strings (this is only -a problem if -.Ql % -can appear inside a multibyte character). diff --git a/bin/1sh/1sh-test.1 b/bin/1sh/1sh-test.1 deleted file mode 100644 index 8ad8d0f4..00000000 --- a/bin/1sh/1sh-test.1 +++ /dev/null @@ -1,395 +0,0 @@ -.\"- -.\" Copyright (c) 1991, 1993 -.\" The Regents of the University of California. All rights reserved. -.\" -.\" This code is derived from software contributed to Berkeley by -.\" the Institute of Electrical and Electronics Engineers, Inc. -.\" -.\" Redistribution and use in source and binary forms, with or without -.\" modification, are permitted provided that the following conditions -.\" are met: -.\" 1. Redistributions of source code must retain the above copyright -.\" notice, this list of conditions and the following disclaimer. -.\" 2. Redistributions in binary form must reproduce the above copyright -.\" notice, this list of conditions and the following disclaimer in the -.\" documentation and/or other materials provided with the distribution. -.\" 3. Neither the name of the University nor the names of its contributors -.\" may be used to endorse or promote products derived from this software -.\" without specific prior written permission. -.\" -.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND -.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE -.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -.\" SUCH DAMAGE. -.\" -.\" @(#)test.1 8.1 (Berkeley) 5/31/93 -.\" $FreeBSD: releng/12.1/bin/test/test.1 314436 2017-02-28 23:42:47Z imp $ -.\" -.Dd October 5, 2016 -.Dt 1SH-TEST 1 -.Os -.Sh NAME -.Nm test , -.Nm \&[ -.Nd condition evaluation utility -.Sh SYNOPSIS -.Nm -.Ar expression -.Nm \&[ -.Ar expression Cm \&] -.Sh DESCRIPTION -The -.Nm -utility evaluates the expression and, if it evaluates -to true, returns a zero (true) exit status; otherwise -it returns 1 (false). -If there is no expression, -.Nm -also -returns 1 (false). -.Pp -All operators and flags are separate arguments to the -.Nm -utility. -.Pp -The following primaries are used to construct expression: -.Bl -tag -width Ar -.It Fl b Ar file -True if -.Ar file -exists and is a block special -file. -.It Fl c Ar file -True if -.Ar file -exists and is a character -special file. -.It Fl d Ar file -True if -.Ar file -exists and is a directory. -.It Fl e Ar file -True if -.Ar file -exists (regardless of type). -.It Fl f Ar file -True if -.Ar file -exists and is a regular file. -.It Fl g Ar file -True if -.Ar file -exists and its set group ID flag -is set. -.It Fl h Ar file -True if -.Ar file -exists and is a symbolic link. -This operator is retained for compatibility with previous versions of -this program. -Do not rely on its existence; use -.Fl L -instead. -.It Fl k Ar file -True if -.Ar file -exists and its sticky bit is set. -.It Fl n Ar string -True if the length of -.Ar string -is nonzero. -.It Fl p Ar file -True if -.Ar file -is a named pipe -.Pq Tn FIFO . -.It Fl r Ar file -True if -.Ar file -exists and is readable. -.It Fl s Ar file -True if -.Ar file -exists and has a size greater -than zero. -.It Fl t Ar file_descriptor -True if the file whose file descriptor number -is -.Ar file_descriptor -is open and is associated with a terminal. -.It Fl u Ar file -True if -.Ar file -exists and its set user ID flag -is set. -.It Fl w Ar file -True if -.Ar file -exists and is writable. -True -indicates only that the write flag is on. -The file is not writable on a read-only file -system even if this test indicates true. -.It Fl x Ar file -True if -.Ar file -exists and is executable. -True -indicates only that the execute flag is on. -If -.Ar file -is a directory, true indicates that -.Ar file -can be searched. -.It Fl z Ar string -True if the length of -.Ar string -is zero. -.It Fl L Ar file -True if -.Ar file -exists and is a symbolic link. -.It Fl O Ar file -True if -.Ar file -exists and its owner matches the effective user id of this process. -.It Fl G Ar file -True if -.Ar file -exists and its group matches the effective group id of this process. -.It Fl S Ar file -True if -.Ar file -exists and is a socket. -.It Ar file1 Fl nt Ar file2 -True if -.Ar file1 -exists and is newer than -.Ar file2 . -.It Ar file1 Fl ot Ar file2 -True if -.Ar file1 -exists and is older than -.Ar file2 . -.It Ar file1 Fl ef Ar file2 -True if -.Ar file1 -and -.Ar file2 -exist and refer to the same file. -.It Ar string -True if -.Ar string -is not the null -string. -.It Ar s1 Cm = Ar s2 -True if the strings -.Ar s1 -and -.Ar s2 -are identical. -.It Ar s1 Cm != Ar s2 -True if the strings -.Ar s1 -and -.Ar s2 -are not identical. -.It Ar s1 Cm < Ar s2 -True if string -.Ar s1 -comes before -.Ar s2 -based on the binary value of their characters. -.It Ar s1 Cm > Ar s2 -True if string -.Ar s1 -comes after -.Ar s2 -based on the binary value of their characters. -.It Ar n1 Fl eq Ar n2 -True if the integers -.Ar n1 -and -.Ar n2 -are algebraically -equal. -.It Ar n1 Fl ne Ar n2 -True if the integers -.Ar n1 -and -.Ar n2 -are not -algebraically equal. -.It Ar n1 Fl gt Ar n2 -True if the integer -.Ar n1 -is algebraically -greater than the integer -.Ar n2 . -.It Ar n1 Fl ge Ar n2 -True if the integer -.Ar n1 -is algebraically -greater than or equal to the integer -.Ar n2 . -.It Ar n1 Fl lt Ar n2 -True if the integer -.Ar n1 -is algebraically less -than the integer -.Ar n2 . -.It Ar n1 Fl le Ar n2 -True if the integer -.Ar n1 -is algebraically less -than or equal to the integer -.Ar n2 . -.El -.Pp -If -.Ar file -is a symbolic link, -.Nm -will fully dereference it and then evaluate the expression -against the file referenced, except for the -.Fl h -and -.Fl L -primaries. -.Pp -These primaries can be combined with the following operators: -.Bl -tag -width Ar -.It Cm \&! Ar expression -True if -.Ar expression -is false. -.It Ar expression1 Fl a Ar expression2 -True if both -.Ar expression1 -and -.Ar expression2 -are true. -.It Ar expression1 Fl o Ar expression2 -True if either -.Ar expression1 -or -.Ar expression2 -are true. -.It Cm \&( Ar expression Cm \&) -True if expression is true. -.El -.Pp -The -.Fl a -operator has higher precedence than the -.Fl o -operator. -.Pp -Some shells may provide a builtin -.Nm -command which is similar or identical to this utility. -Consult the -.Xr builtin 1 -manual page. -.Sh GRAMMAR AMBIGUITY -The -.Nm -grammar is inherently ambiguous. -In order to assure a degree of consistency, -the cases described in the -.St -p1003.2 , -section D11.2/4.62.4, standard -are evaluated consistently according to the rules specified in the -standards document. -All other cases are subject to the ambiguity in the -command semantics. -.Pp -In particular, only expressions containing -.Fl a , -.Fl o , -.Cm \&( -or -.Cm \&) -can be ambiguous. -.Sh EXIT STATUS -The -.Nm -utility exits with one of the following values: -.Bl -tag -width indent -.It 0 -expression evaluated to true. -.It 1 -expression evaluated to false or expression was -missing. -.It >1 -An error occurred. -.El -.Sh EXAMPLES -Implement -.Li test FILE1 -nt FILE2 -using only -.Tn POSIX -functionality: -.Pp -.Dl test -n \&"$(find -L -- FILE1 -prune -newer FILE2 2>/dev/null)\&" -.Pp -This can be modified using non-standard -.Xr find 1 -primaries like -.Cm -newerca -to compare other timestamps. -.Sh COMPATIBILITY -For compatibility with some other implementations, -the -.Cm = -primary can be substituted with -.Cm == -with the same meaning. -.Sh SEE ALSO -.Xr builtin 1 , -.Xr expr 1 , -.Xr find 1 , -.Xr sh 1 , -.Xr stat 1 , -.Xr symlink 7 -.Sh STANDARDS -The -.Nm -utility implements a superset of the -.St -p1003.2 -specification. -The primaries -.Cm < , -.Cm == , -.Cm > , -.Fl ef , -.Fl nt , -.Fl ot , -.Fl G , -and -.Fl O -are extensions. -.Sh HISTORY -A -.Nm -utility appeared in -.At v7 . -.Sh BUGS -Both sides are always evaluated in -.Fl a -and -.Fl o . -For instance, the writable status of -.Pa file -will be tested by the following command even though the former expression -indicated false, which results in a gratuitous access to the file system: -.Dl "[ -z abc -a -w file ]" -To avoid this, write -.Dl "[ -z abc ] && [ -w file ]" diff --git a/bin/1sh/1sh.1 b/bin/1sh/1sh.1 deleted file mode 100644 index aa906bca..00000000 --- a/bin/1sh/1sh.1 +++ /dev/null @@ -1,2917 +0,0 @@ -.\"- -.\" Copyright (c) 1991, 1993 -.\" The Regents of the University of California. All rights reserved. -.\" -.\" This code is derived from software contributed to Berkeley by -.\" Kenneth Almquist. -.\" -.\" Redistribution and use in source and binary forms, with or without -.\" modification, are permitted provided that the following conditions -.\" are met: -.\" 1. Redistributions of source code must retain the above copyright -.\" notice, this list of conditions and the following disclaimer. -.\" 2. Redistributions in binary form must reproduce the above copyright -.\" notice, this list of conditions and the following disclaimer in the -.\" documentation and/or other materials provided with the distribution. -.\" 3. Neither the name of the University nor the names of its contributors -.\" may be used to endorse or promote products derived from this software -.\" without specific prior written permission. -.\" -.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND -.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE -.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -.\" SUCH DAMAGE. -.\" -.\" from: @(#)sh.1 8.6 (Berkeley) 5/4/95 -.\" $FreeBSD: releng/12.1/bin/sh/sh.1 345487 2019-03-24 22:10:26Z jilles $ -.\" -.Dd March 9, 2020 -.Dt 1SH 1 -.Os -.Sh NAME -.Nm 1sh -.Nd command interpreter (shell) -.Sh SYNOPSIS -.Nm -.Op Fl /+abCEefhIimnPpTuVvx -.Op Fl /+o Ar longname -.Oo -.Ar script -.Op Ar arg ... -.Oc -.Nm -.Op Fl /+abCEefhIimnPpTuVvx -.Op Fl /+o Ar longname -.Fl c Ar string -.Oo -.Ar name -.Op Ar arg ... -.Oc -.Nm -.Op Fl /+abCEefhIimnPpTuVvx -.Op Fl /+o Ar longname -.Fl s -.Op Ar arg ... -.Sh DESCRIPTION -The -.Nm -utility is a command interpreter. -The current version of -.Nm -is close to the -.St -p1003.1 -specification for the shell. -It only supports features -designated by POSIX, -plus a few Berkeley extensions. -This man page is not intended to be a tutorial nor a complete -specification of the shell. -.Ss Overview -The shell is a command that reads lines from -either a file or the terminal, interprets them, and -generally executes other commands. -It is the program that is started when a user logs into the system, -although a user can select a different shell with the -.Xr chsh 1 -command. -The shell -implements a language that has flow control constructs, -a macro facility that provides a variety of features in -addition to data storage, along with built-in history and line -editing capabilities. -It incorporates many features to -aid interactive use and has the advantage that the interpretative -language is common to both interactive and non-interactive -use (shell scripts). -That is, commands can be typed directly -to the running shell or can be put into a file, -which can be executed directly by the shell. -.Ss Invocation -.\" -.\" XXX This next sentence is incredibly confusing. -.\" -If no arguments are present and if the standard input of the shell -is connected to a terminal -(or if the -.Fl i -option is set), -the shell is considered an interactive shell. -An interactive shell -generally prompts before each command and handles programming -and command errors differently (as described below). -When first starting, the shell inspects argument 0, and -if it begins with a dash -.Pq Ql - , -the shell is also considered a login shell. -This is normally done automatically by the system -when the user first logs in. -A login shell first reads commands -from the files -.Pa /etc/profile -and then -.Pa .profile -in a user's home directory, -if they exist. -If the environment variable -.Ev ENV -is set on entry to a shell, or is set in the -.Pa .profile -of a login shell, the shell then subjects its value to parameter expansion -and arithmetic expansion and reads commands from the named file. -Therefore, a user should place commands that are to be executed only -at login time in the -.Pa .profile -file, and commands that are executed for every shell inside the -.Ev ENV -file. -The user can set the -.Ev ENV -variable to some file by placing the following line in the file -.Pa .profile -in the home directory, -substituting for -.Pa .shrc -the filename desired: -.Pp -.Dl "ENV=$HOME/.shrc; export ENV" -.Pp -The first non-option argument specified on the command line -will be treated as the -name of a file from which to read commands (a shell script), and -the remaining arguments are set as the positional parameters -of the shell -.Li ( $1 , $2 , -etc.). -Otherwise, the shell reads commands -from its standard input. -.Pp -Unlike older versions of -.Nm -the -.Ev ENV -script is only sourced on invocation of interactive shells. -This -closes a well-known, and sometimes easily exploitable security -hole related to poorly thought out -.Ev ENV -scripts. -.Ss Argument List Processing -All of the single letter options to -.Nm -have a corresponding long name, -with the exception of -.Fl c -and -.Fl /+o . -These long names are provided next to the single letter options -in the descriptions below. -The long name for an option may be specified as an argument to the -.Fl /+o -option of -.Nm . -Once the shell is running, -the long name for an option may be specified as an argument to the -.Fl /+o -option of the -.Ic set -built-in command -(described later in the section called -.Sx Built-in Commands ) . -Introducing an option with a dash -.Pq Ql - -enables the option, -while using a plus -.Pq Ql + -disables the option. -A -.Dq Li -- -or plain -.Ql - -will stop option processing and will force the remaining -words on the command line to be treated as arguments. -The -.Fl /+o -and -.Fl c -options do not have long names. -They take arguments and are described after the single letter options. -.Bl -tag -width indent -.It Fl a Li allexport -Flag variables for export when assignments are made to them. -.It Fl b Li notify -Enable asynchronous notification of background job -completion. -(UNIMPLEMENTED) -.It Fl C Li noclobber -Do not overwrite existing files with -.Ql > . -.It Fl E Li emacs -Enable the built-in -.Xr emacs 1 -command line editor (disables the -.Fl V -option if it has been set; -set automatically when interactive on terminals). -.It Fl e Li errexit -Exit immediately if any untested command fails in non-interactive mode. -The exit status of a command is considered to be -explicitly tested if the command is part of the list used to control -an -.Ic if , elif , while , -or -.Ic until ; -if the command is the left -hand operand of an -.Dq Li && -or -.Dq Li || -operator; or if the command is a pipeline preceded by the -.Ic !\& -keyword. -If a shell function is executed and its exit status is explicitly -tested, all commands of the function are considered to be tested as -well. -.Pp -It is recommended to check for failures explicitly -instead of relying on -.Fl e -because it tends to behave in unexpected ways, -particularly in larger scripts. -.It Fl f Li noglob -Disable pathname expansion. -.It Fl h Li trackall -A do-nothing option for POSIX compliance. -.It Fl I Li ignoreeof -Ignore -.Dv EOF Ap s -from input when in interactive mode. -.It Fl i Li interactive -Force the shell to behave interactively. -.It Fl m Li monitor -Turn on job control (set automatically when interactive). -A new process group is created for each pipeline (called a job). -It is possible to suspend jobs or to have them run in the foreground or -in the background. -In a non-interactive shell, -this option can be set even if no terminal is available -and is useful to place processes in separate process groups. -.It Fl n Li noexec -If not interactive, read commands but do not -execute them. -This is useful for checking the -syntax of shell scripts. -.It Fl P Li physical -Change the default for the -.Ic cd -and -.Ic pwd -commands from -.Fl L -(logical directory layout) -to -.Fl P -(physical directory layout). -.It Fl p Li privileged -Turn on privileged mode. -This mode is enabled on startup -if either the effective user or group ID is not equal to the -real user or group ID. -Turning this mode off sets the -effective user and group IDs to the real user and group IDs. -When this mode is enabled for interactive shells, the file -.Pa /etc/suid_profile -is sourced instead of -.Pa ~/.profile -after -.Pa /etc/profile -is sourced, and the contents of the -.Ev ENV -variable are ignored. -.It Fl s Li stdin -Read commands from standard input (set automatically -if no file arguments are present). -This option has -no effect when set after the shell has already started -running (i.e., when set with the -.Ic set -command). -.It Fl T Li trapsasync -When waiting for a child, execute traps immediately. -If this option is not set, -traps are executed after the child exits, -as specified in -.St -p1003.2 . -This nonstandard option is useful for putting guarding shells around -children that block signals. -The surrounding shell may kill the child -or it may just return control to the tty and leave the child alone, -like this: -.Bd -literal -offset indent -1sh -T -c "trap 'exit 1' 2 ; some-blocking-program" -.Ed -.It Fl u Li nounset -Write a message to standard error when attempting -to expand a variable, a positional parameter or -the special parameter -.Va \&! -that is not set, and if the -shell is not interactive, exit immediately. -.It Fl V Li vi -Enable the built-in -.Xr vi 1 -command line editor (disables -.Fl E -if it has been set). -.It Fl v Li verbose -The shell writes its input to standard error -as it is read. -Useful for debugging. -.It Fl x Li xtrace -Write each command -(preceded by the value of the -.Va PS4 -variable subjected to parameter expansion and arithmetic expansion) -to standard error before it is executed. -Useful for debugging. -.It Li nolog -Another do-nothing option for POSIX compliance. -It only has a long name. -.It Li pipefail -Change the exit status of a pipeline to the last non-zero exit status of -any command in the pipeline, if any. -Since an exit due to -.Dv SIGPIPE -counts as a non-zero exit status, -this option may cause non-zero exit status for successful pipelines -if a command such as -.Xr head 1 -in the pipeline terminates with status 0 without reading its -input completely. -This option only has a long name. -.El -.Pp -The -.Fl c -option causes the commands to be read from the -.Ar string -operand instead of from the standard input. -Keep in mind that this option only accepts a single string as its -argument, hence multi-word strings must be quoted. -.Pp -The -.Fl /+o -option takes as its only argument the long name of an option -to be enabled or disabled. -For example, the following two invocations of -.Nm -both enable the built-in -.Xr emacs 1 -command line editor: -.Bd -literal -offset indent -set -E -set -o emacs -.Ed -.Pp -If used without an argument, the -.Fl o -option displays the current option settings in a human-readable format. -If -.Cm +o -is used without an argument, the current option settings are output -in a format suitable for re-input into the shell. -.Ss Lexical Structure -The shell reads input in terms of lines from a file and breaks -it up into words at whitespace (blanks and tabs), and at -certain sequences of -characters called -.Dq operators , -which are special to the shell. -There are two types of operators: control operators and -redirection operators (their meaning is discussed later). -The following is a list of valid operators: -.Bl -tag -width indent -.It Control operators: -.Bl -column "XXX" "XXX" "XXX" "XXX" "XXX" -offset center -compact -.It Li & Ta Li && Ta Li \&( Ta Li \&) Ta Li \en -.It Li ;; Ta Li ;& Ta Li \&; Ta Li \&| Ta Li || -.El -.It Redirection operators: -.Bl -column "XXX" "XXX" "XXX" "XXX" "XXX" -offset center -compact -.It Li < Ta Li > Ta Li << Ta Li >> Ta Li <> -.It Li <& Ta Li >& Ta Li <<- Ta Li >| Ta \& -.El -.El -.Pp -The character -.Ql # -introduces a comment if used at the beginning of a word. -The word starting with -.Ql # -and the rest of the line are ignored. -.Pp -ASCII -.Dv NUL -characters (character code 0) are not allowed in shell input. -.Ss Quoting -Quoting is used to remove the special meaning of certain characters -or words to the shell, such as operators, whitespace, keywords, -or alias names. -.Pp -There are four types of quoting: matched single quotes, -dollar-single quotes, -matched double quotes, and backslash. -.Bl -tag -width indent -.It Single Quotes -Enclosing characters in single quotes preserves the literal -meaning of all the characters (except single quotes, making -it impossible to put single-quotes in a single-quoted string). -.It Dollar-Single Quotes -Enclosing characters between -.Li $' -and -.Li ' -preserves the literal meaning of all characters -except backslashes and single quotes. -A backslash introduces a C-style escape sequence: -.Bl -tag -width xUnnnnnnnn -.It \ea -Alert (ring the terminal bell) -.It \eb -Backspace -.It \ec Ns Ar c -The control character denoted by -.Li ^ Ns Ar c -in -.Xr stty 1 . -If -.Ar c -is a backslash, it must be doubled. -.It \ee -The ESC character (ASCII 0x1b) -.It \ef -Formfeed -.It \en -Newline -.It \er -Carriage return -.It \et -Horizontal tab -.It \ev -Vertical tab -.It \e\e -Literal backslash -.It \e\&' -Literal single-quote -.It \e\&" -Literal double-quote -.It \e Ns Ar nnn -The byte whose octal value is -.Ar nnn -(one to three digits) -.It \ex Ns Ar nn -The byte whose hexadecimal value is -.Ar nn -(one or more digits only the last two of which are used) -.It \eu Ns Ar nnnn -The Unicode code point -.Ar nnnn -(four hexadecimal digits) -.It \eU Ns Ar nnnnnnnn -The Unicode code point -.Ar nnnnnnnn -(eight hexadecimal digits) -.El -.Pp -The sequences for Unicode code points are currently only useful with -UTF-8 locales. -They reject code point 0 and UTF-16 surrogates. -.Pp -If an escape sequence would produce a byte with value 0, -that byte and the rest of the string until the matching single-quote -are ignored. -.Pp -Any other string starting with a backslash is an error. -.It Double Quotes -Enclosing characters within double quotes preserves the literal -meaning of all characters except dollar sign -.Pq Ql $ , -backquote -.Pq Ql ` , -and backslash -.Pq Ql \e . -The backslash inside double quotes is historically weird. -It remains literal unless it precedes the following characters, -which it serves to quote: -.Pp -.Bl -column "XXX" "XXX" "XXX" "XXX" "XXX" -offset center -compact -.It Li $ Ta Li ` Ta Li \&" Ta Li \e Ta Li \en -.El -.It Backslash -A backslash preserves the literal meaning of the following -character, with the exception of the newline character -.Pq Ql \en . -A backslash preceding a newline is treated as a line continuation. -.El -.Ss Keywords -Keywords or reserved words are words that have special meaning to the -shell and are recognized at the beginning of a line and -after a control operator. -The following are keywords: -.Bl -column "doneXX" "elifXX" "elseXX" "untilXX" "whileX" -offset center -.It Li \&! Ta { Ta } Ta Ic case Ta Ic do -.It Ic done Ta Ic elif Ta Ic else Ta Ic esac Ta Ic fi -.It Ic for Ta Ic if Ta Ic then Ta Ic until Ta Ic while -.El -.Ss Aliases -An alias is a name and corresponding value set using the -.Ic alias -built-in command. -Wherever the command word of a simple command may occur, -and after checking for keywords if a keyword may occur, the shell -checks the word to see if it matches an alias. -If it does, it replaces it in the input stream with its value. -For example, if there is an alias called -.Dq Li lf -with the value -.Dq Li "ls -F" , -then the input -.Pp -.Dl "lf foobar" -.Pp -would become -.Pp -.Dl "ls -F foobar" -.Pp -Aliases are also recognized after an alias -whose value ends with a space or tab. -For example, if there is also an alias called -.Dq Li nohup -with the value -.Dq Li "nohup " , -then the input -.Pp -.Dl "nohup lf foobar" -.Pp -would become -.Pp -.Dl "nohup ls -F foobar" -.Pp -Aliases provide a convenient way for naive users to -create shorthands for commands without having to learn how -to create functions with arguments. -Using aliases in scripts is discouraged -because the command that defines them must be executed -before the code that uses them is parsed. -This is fragile and not portable. -.Pp -An alias name may be escaped in a command line, so that it is not -replaced by its alias value, by using quoting characters within or -adjacent to the alias name. -This is most often done by prefixing -an alias name with a backslash to execute a function, built-in, or -normal program with the same name. -See the -.Sx Quoting -subsection. -.Ss Commands -The shell interprets the words it reads according to a -language, the specification of which is outside the scope -of this man page (refer to the BNF in the -.St -p1003.2 -document). -Essentially though, a line is read and if -the first word of the line (or after a control operator) -is not a keyword, then the shell has recognized a -simple command. -Otherwise, a complex command or some -other special construct may have been recognized. -.Ss Simple Commands -If a simple command has been recognized, the shell performs -the following actions: -.Bl -enum -.It -Leading words of the form -.Dq Li name=value -are stripped off and assigned to the environment of -the simple command -(they do not affect expansions). -Redirection operators and -their arguments (as described below) are stripped -off and saved for processing. -.It -The remaining words are expanded as described in -the section called -.Sx Word Expansions , -and the first remaining word is considered the command -name and the command is located. -The remaining -words are considered the arguments of the command. -If no command name resulted, then the -.Dq Li name=value -variable assignments recognized in 1) affect the -current shell. -.It -Redirections are performed as described in -the next section. -.El -.Ss Redirections -Redirections are used to change where a command reads its input -or sends its output. -In general, redirections open, close, or -duplicate an existing reference to a file. -The overall format -used for redirection is: -.Pp -.D1 Oo Ar n Oc Ar redir-op file -.Pp -The -.Ar redir-op -is one of the redirection operators mentioned -previously. -The following gives some examples of how these -operators can be used. -Note that stdin and stdout are commonly used abbreviations -for standard input and standard output respectively. -.Bl -tag -width "1234567890XX" -offset indent -.It Oo Ar n Oc Ns Li > Ar file -redirect stdout (or file descriptor -.Ar n ) -to -.Ar file -.It Oo Ar n Oc Ns Li >| Ar file -same as above, but override the -.Fl C -option -.It Oo Ar n Oc Ns Li >> Ar file -append stdout (or file descriptor -.Ar n ) -to -.Ar file -.It Oo Ar n Oc Ns Li < Ar file -redirect stdin (or file descriptor -.Ar n ) -from -.Ar file -.It Oo Ar n Oc Ns Li <> Ar file -redirect stdin (or file descriptor -.Ar n ) -to and from -.Ar file -.It Oo Ar n1 Oc Ns Li <& Ns Ar n2 -duplicate stdin (or file descriptor -.Ar n1 ) -from file descriptor -.Ar n2 -.It Oo Ar n Oc Ns Li <&- -close stdin (or file descriptor -.Ar n ) -.It Oo Ar n1 Oc Ns Li >& Ns Ar n2 -duplicate stdout (or file descriptor -.Ar n1 ) -to file descriptor -.Ar n2 -.It Oo Ar n Oc Ns Li >&- -close stdout (or file descriptor -.Ar n ) -.El -.Pp -The following redirection is often called a -.Dq here-document . -.Bd -unfilled -offset indent -.Oo Ar n Oc Ns Li << Ar delimiter -.Ar here-doc-text -.Ar ... -.Ar delimiter -.Ed -.Pp -All the text on successive lines up to the delimiter is -saved away and made available to the command on standard -input, or file descriptor -.Ar n -if it is specified. -If the -.Ar delimiter -as specified on the initial line is quoted, then the -.Ar here-doc-text -is treated literally, otherwise the text is subjected to -parameter expansion, command substitution, and arithmetic -expansion (as described in the section on -.Sx Word Expansions ) . -If the operator is -.Dq Li <<- -instead of -.Dq Li << , -then leading tabs -in the -.Ar here-doc-text -are stripped. -.Ss Search and Execution -There are three types of commands: shell functions, -built-in commands, and normal programs. -The command is searched for (by name) in that order. -The three types of commands are all executed in a different way. -.Pp -When a shell function is executed, all of the shell positional -parameters (except -.Li $0 , -which remains unchanged) are -set to the arguments of the shell function. -The variables which are explicitly placed in the environment of -the command (by placing assignments to them before the -function name) are made local to the function and are set -to the values given. -Then the command given in the function definition is executed. -The positional parameters are restored to their original values -when the command completes. -This all occurs within the current shell. -.Pp -Shell built-in commands are executed internally to the shell, without -spawning a new process. -There are two kinds of built-in commands: regular and special. -Assignments before special builtins persist after they finish -executing and assignment errors, redirection errors and certain -operand errors cause a script to be aborted. -Special builtins cannot be overridden with a function. -Both regular and special builtins can affect the shell in ways -normal programs cannot. -.Pp -Otherwise, if the command name does not match a function -or built-in command, the command is searched for as a normal -program in the file system (as described in the next section). -When a normal program is executed, the shell runs the program, -passing the arguments and the environment to the program. -If the program is not a normal executable file -(i.e., if it does not begin with the -.Dq "magic number" -whose ASCII representation is -.Dq Li #! , -resulting in an -.Er ENOEXEC -return value from -.Xr execve 2 ) -but appears to be a text file, -the shell will run a new instance of -.Nm -to interpret it. -.Pp -Note that previous versions of this document -and the source code itself misleadingly and sporadically -refer to a shell script without a magic number -as a -.Dq "shell procedure" . -.Ss Path Search -When locating a command, the shell first looks to see if -it has a shell function by that name. -Then it looks for a -built-in command by that name. -If a built-in command is not found, -one of two things happen: -.Bl -enum -.It -Command names containing a slash are simply executed without -performing any searches. -.It -The shell searches each entry in the -.Va PATH -variable -in turn for the command. -The value of the -.Va PATH -variable should be a series of -entries separated by colons. -Each entry consists of a -directory name. -The current directory -may be indicated implicitly by an empty directory name, -or explicitly by a single period. -.El -.Ss Command Exit Status -Each command has an exit status that can influence the behavior -of other shell commands. -The paradigm is that a command exits -with zero for normal or success, and non-zero for failure, -error, or a false indication. -The man page for each command -should indicate the various exit codes and what they mean. -Additionally, the built-in commands return exit codes, as does -an executed shell function. -.Pp -If a command is terminated by a signal, its exit status is greater than 128. -The signal name can be found by passing the exit status to -.Li kill -l . -.Pp -If there is no command word, -the exit status is the exit status of the last command substitution executed, -or zero if the command does not contain any command substitutions. -.Ss Complex Commands -Complex commands are combinations of simple commands -with control operators or keywords, together creating a larger complex -command. -More generally, a command is one of the following: -.Bl -item -offset indent -.It -simple command -.It -pipeline -.It -list or compound-list -.It -compound command -.It -function definition -.El -.Pp -Unless otherwise stated, the exit status of a command is -that of the last simple command executed by the command, -or zero if no simple command was executed. -.Ss Pipelines -A pipeline is a sequence of one or more commands separated -by the control operator -.Ql \&| . -The standard output of all but -the last command is connected to the standard input -of the next command. -The standard output of the last -command is inherited from the shell, as usual. -.Pp -The format for a pipeline is: -.Pp -.D1 Oo Li \&! Oc Ar command1 Op Li \&| Ar command2 ... -.Pp -The standard output of -.Ar command1 -is connected to the standard input of -.Ar command2 . -The standard input, standard output, or -both of a command is considered to be assigned by the -pipeline before any redirection specified by redirection -operators that are part of the command. -.Pp -Note that unlike some other shells, -.Nm -executes each process in a pipeline with more than one command -in a subshell environment and as a child of the -.Nm -process. -.Pp -If the pipeline is not in the background (discussed later), -the shell waits for all commands to complete. -.Pp -If the keyword -.Ic !\& -does not precede the pipeline, the -exit status is the exit status of the last command specified -in the pipeline if the -.Cm pipefail -option is not set or all commands returned zero, -or the last non-zero exit status of any command in the pipeline otherwise. -Otherwise, the exit status is the logical -NOT of that exit status. -That is, if -that status is zero, the exit status is 1; if -that status is greater than zero, the exit status -is zero. -.Pp -Because pipeline assignment of standard input or standard -output or both takes place before redirection, it can be -modified by redirection. -For example: -.Pp -.Dl "command1 2>&1 | command2" -.Pp -sends both the standard output and standard error of -.Ar command1 -to the standard input of -.Ar command2 . -.Pp -A -.Ql \&; -or newline terminator causes the preceding -AND-OR-list -(described below in the section called -.Sx Short-Circuit List Operators ) -to be executed sequentially; -an -.Ql & -causes asynchronous execution of the preceding AND-OR-list. -.Ss Background Commands (&) -If a command is terminated by the control operator ampersand -.Pq Ql & , -the shell executes the command in a subshell environment (see -.Sx Grouping Commands Together -below) and asynchronously; -the shell does not wait for the command to finish -before executing the next command. -.Pp -The format for running a command in background is: -.Pp -.D1 Ar command1 Li & Op Ar command2 Li & Ar ... -.Pp -If the shell is not interactive, the standard input of an -asynchronous command is set to -.Pa /dev/null . -.Pp -The exit status is zero. -.Ss Lists (Generally Speaking) -A list is a sequence of zero or more commands separated by -newlines, semicolons, or ampersands, -and optionally terminated by one of these three characters. -The commands in a -list are executed in the order they are written. -If command is followed by an ampersand, the shell starts the -command and immediately proceeds onto the next command; -otherwise it waits for the command to terminate before -proceeding to the next one. -.Ss Short-Circuit List Operators -.Dq Li && -and -.Dq Li || -are AND-OR list operators. -.Dq Li && -executes the first command, and then executes the second command -if the exit status of the first command is zero. -.Dq Li || -is similar, but executes the second command if the exit -status of the first command is nonzero. -.Dq Li && -and -.Dq Li || -both have the same priority. -.Ss Flow-Control Constructs (if, while, for, case) -The syntax of the -.Ic if -command is: -.Bd -unfilled -offset indent -compact -.Ic if Ar list -.Ic then Ar list -.Oo Ic elif Ar list -.Ic then Ar list Oc Ar ... -.Op Ic else Ar list -.Ic fi -.Ed -.Pp -The exit status is that of selected -.Ic then -or -.Ic else -list, -or zero if no list was selected. -.Pp -The syntax of the -.Ic while -command is: -.Bd -unfilled -offset indent -compact -.Ic while Ar list -.Ic do Ar list -.Ic done -.Ed -.Pp -The two lists are executed repeatedly while the exit status of the -first list is zero. -The -.Ic until -command is similar, but has the word -.Ic until -in place of -.Ic while , -which causes it to -repeat until the exit status of the first list is zero. -.Pp -The exit status is that of the last execution of the second list, -or zero if it was never executed. -.Pp -The syntax of the -.Ic for -command is: -.Bd -unfilled -offset indent -compact -.Ic for Ar variable Op Ic in Ar word ... -.Ic do Ar list -.Ic done -.Ed -.Pp -If -.Ic in -and the following words are omitted, -.Ic in Li \&"$@\&" -is used instead. -The words are expanded, and then the list is executed -repeatedly with the variable set to each word in turn. -The -.Ic do -and -.Ic done -commands may be replaced with -.Ql { -and -.Ql } . -.Pp -The syntax of the -.Ic break -and -.Ic continue -commands is: -.D1 Ic break Op Ar num -.D1 Ic continue Op Ar num -.Pp -The -.Ic break -command terminates the -.Ar num -innermost -.Ic for -or -.Ic while -loops. -The -.Ic continue -command continues with the next iteration of the innermost loop. -These are implemented as special built-in commands. -.Pp -The syntax of the -.Ic case -command is: -.Bd -unfilled -offset indent -compact -.Ic case Ar word Ic in -.Ar pattern ) Ar list Li ;; -.Ar ... -.Ic esac -.Ed -.Pp -The pattern can actually be one or more patterns -(see -.Sx Shell Patterns -described later), -separated by -.Ql \&| -characters. -Tilde expansion, parameter expansion, command substitution, -arithmetic expansion and quote removal are applied to the word. -Then, each pattern is expanded in turn using tilde expansion, -parameter expansion, command substitution and arithmetic expansion and -the expanded form of the word is checked against it. -If a match is found, the corresponding list is executed. -If the selected list is terminated by the control operator -.Ql ;& -instead of -.Ql ;; , -execution continues with the next list, -continuing until a list terminated with -.Ql ;; -or the end of the -.Ic case -command. -.Ss Grouping Commands Together -Commands may be grouped by writing either -.Pp -.Sm off -.Bd -literal -offset -ident -.Po Ar list Pc -.Ed -.Sm on -.Pp -or -.Bd -literal -offset -ident -.No { Ar list ; } -.Ed -.Pp -The first form executes the commands in a subshell environment. -A subshell environment has its own copy of: -.Bl -enum -.It -The current working directory as set by -.Ic cd . -.It -The file creation mask as set by -.Ic umask . -.It -Resource limits as set by -.Ic ulimit . -.It -References to open files. -.It -Traps as set by -.Ic trap . -.It -Known jobs. -.It -Positional parameters and variables. -.It -Shell options. -.It -Shell functions. -.It -Shell aliases. -.El -.Pp -These are copied from the parent shell environment, -except that trapped (but not ignored) signals are reset to the default action -and known jobs are cleared. -Any changes do not affect the parent shell environment. -.Pp -A subshell environment may be implemented as a child process or differently. -If job control is enabled in an interactive shell, -commands grouped in parentheses can be suspended and continued as a unit. -.Pp -For compatibility with other shells, -two open parentheses in sequence should be separated by whitespace. -.Pp -The second form never forks another shell, -so it is slightly more efficient. -Grouping commands together this way allows the user to -redirect their output as though they were one program: -.Bd -literal -offset indent -{ echo -n "hello"; echo " world"; } > greeting -.Ed -.Ss Functions -The syntax of a function definition is -.Pp -.D1 Ar name Li \&( \&) Ar command -.Pp -A function definition is an executable statement; when -executed it installs a function named -.Ar name -and returns an -exit status of zero. -The -.Ar command -is normally a list -enclosed between -.Ql { -and -.Ql } . -.Pp -Variables may be declared to be local to a function by -using the -.Ic local -command. -This should appear as the first statement of a function, -and the syntax is: -.Pp -.D1 Ic local Oo Ar variable ... Oc Op Fl -.Pp -The -.Ic local -command is implemented as a built-in command. -The exit status is zero -unless the command is not in a function or a variable name is invalid. -.Pp -When a variable is made local, it inherits the initial -value and exported and readonly flags from the variable -with the same name in the surrounding scope, if there is -one. -Otherwise, the variable is initially unset. -The shell -uses dynamic scoping, so that if the variable -.Va x -is made local to function -.Em f , -which then calls function -.Em g , -references to the variable -.Va x -made inside -.Em g -will refer to the variable -.Va x -declared inside -.Em f , -not to the global variable named -.Va x . -.Pp -The only special parameter that can be made local is -.Ql - . -Making -.Ql - -local causes any shell options -(including those that only have long names) -that are -changed via the -.Ic set -command inside the function to be -restored to their original values when the function -returns. -.Pp -The syntax of the -.Ic return -command is -.Pp -.D1 Ic return Op Ar exitstatus -.Pp -It terminates the current executional scope, returning from the closest -nested function or sourced script; -if no function or sourced script is being executed, -it exits the shell instance. -The -.Ic return -command is implemented as a special built-in command. -.Ss Variables and Parameters -The shell maintains a set of parameters. -A parameter -denoted by a name -(consisting solely -of alphabetics, numerics, and underscores, -and starting with an alphabetic or an underscore) -is called a variable. -When starting up, -the shell turns all environment variables with valid names into shell -variables. -New variables can be set using the form -.Pp -.D1 Ar name Ns = Ns Ar value -.Pp -A parameter can also be denoted by a number -or a special character as explained below. -.Pp -Assignments are expanded differently from other words: -tilde expansion is also performed after the equals sign and after any colon -and usernames are also terminated by colons, -and field splitting and pathname expansion are not performed. -.Pp -This special expansion applies not only to assignments that form a simple -command by themselves or precede a command word, -but also to words passed to the -.Ic export , -.Ic local -or -.Ic readonly -built-in commands that have this form. -For this, the builtin's name must be literal -(not the result of an expansion) -and may optionally be preceded by one or more literal instances of -.Ic command -without options. -.Ss Positional Parameters -A positional parameter is a parameter denoted by a number greater than zero. -The shell sets these initially to the values of its command line -arguments that follow the name of the shell script. -The -.Ic set -built-in command can also be used to set or reset them. -.Ss Special Parameters -Special parameters are parameters denoted by a single special character -or the digit zero. -They are shown in the following list, exactly as they would appear in input -typed by the user or in the source of a shell script. -.Bl -hang -.It Li $* -Expands to the positional parameters, starting from one. -When -the expansion occurs within a double-quoted string -it expands to a single field with the value of each parameter -separated by the first character of the -.Va IFS -variable, -or by a space if -.Va IFS -is unset. -.It Li $@ -Expands to the positional parameters, starting from one. -When -the expansion occurs within double-quotes, each positional -parameter expands as a separate argument. -If there are no positional parameters, the -expansion of -.Li @ -generates zero arguments, even when -.Li @ -is double-quoted. -What this basically means, for example, is -if -.Li $1 -is -.Dq Li abc -and -.Li $2 -is -.Dq Li "def ghi" , -then -.Li \&"$@\&" -expands to -the two arguments: -.Bd -literal -offset indent -"abc" "def ghi" -.Ed -.It Li $# -Expands to the number of positional parameters. -.It Li $? -Expands to the exit status of the most recent pipeline. -.It Li $- -(hyphen) Expands to the current option flags (the single-letter -option names concatenated into a string) as specified on -invocation, by the -.Ic set -built-in command, or implicitly -by the shell. -.It Li $$ -Expands to the process ID of the invoked shell. -A subshell -retains the same value of -.Va $ -as its parent. -.It Li $! -Expands to the process ID of the most recent background -command executed from the current shell. -For a -pipeline, the process ID is that of the last command in the -pipeline. -If this parameter is referenced, the shell will remember -the process ID and its exit status until the -.Ic wait -built-in command reports completion of the process. -.It Li $0 -(zero) Expands to the name of the shell script if passed on the command line, -the -.Ar name -operand if given (with -.Fl c ) -or otherwise argument 0 passed to the shell. -.El -.Ss Special Variables -The following variables are set by the shell or -have special meaning to it: -.Bl -tag -width ".Va HISTSIZE" -.It Va CDPATH -The search path used with the -.Ic cd -built-in. -.It Va EDITOR -The fallback editor used with the -.Ic fc -built-in. -If not set, the default editor is -.Xr ed 1 . -.It Va FCEDIT -The default editor used with the -.Ic fc -built-in. -.It Va HISTFILE -The path to the file in which command history is saved. -History is loaded when -.Va HISTFILE -is set and saved on exit. -.It Va HISTSIZE -The number of previous commands that are accessible. -.It Va HOME -The user's home directory, -used in tilde expansion and as a default directory for the -.Ic cd -built-in. -.It Va IFS -Input Field Separators. -This is initialized at startup to -.Aq space , -.Aq tab , -and -.Aq newline -in that order. -This value also applies if -.Va IFS -is unset, but not if it is set to the empty string. -See the -.Sx White Space Splitting -section for more details. -.It Va LINENO -The current line number in the script or function. -.It Va MAIL -The name of a mail file, that will be checked for the arrival of new -mail. -Overridden by -.Va MAILPATH . -.It Va MAILPATH -A colon -.Pq Ql \&: -separated list of file names, for the shell to check for incoming -mail. -This variable overrides the -.Va MAIL -setting. -There is a maximum of 10 mailboxes that can be monitored at once. -.It Va OPTIND -The index of the next argument to be processed by -.Ic getopts . -This is initialized to 1 at startup. -.It Va PATH -The default search path for executables. -See the -.Sx Path Search -section for details. -.It Va PPID -The parent process ID of the invoked shell. -This is set at startup -unless this variable is in the environment. -A later change of parent process ID is not reflected. -A subshell retains the same value of -.Va PPID . -.It Va PS0 -The pre-prompt string, -which is printed before each new prompt. -.Va PS0 -may include any of the formatting sequences from -.Va PS1 . -.It Va PS1 -The primary prompt string, which defaults to -.Dq Li "$ " , -unless you are the superuser, in which case it defaults to -.Dq Li "# " . -.Va PS1 -may include any of the following formatting sequences, -which are replaced by the given information: -.Bl -tag -width indent -.It Li \eH -This system's fully-qualified hostname (FQDN). -.It Li \eh -This system's hostname. -.It Li \eW -The final component of the current working directory. -.It Li \ew -The entire path of the current working directory. -.It Li \e? -Exit status if it is non-zero, empty string otherwise. -.It Li \e$ -Superuser status. -.Dq Li "$ " -for normal users and -.Dq Li "# " -for superusers. -.It Li \e\e -A literal backslash. -.El -.It Va PS2 -The secondary prompt string, which defaults to -.Dq Li "> " . -.Va PS2 -may include any of the formatting sequences from -.Va PS1 . -.It Va PS4 -The prefix for the trace output (if -.Fl x -is active). -The default is -.Dq Li "+ " . -.It Va RPS1 -The primary right prompt string. -.Va RPS1 -may include any of the formatting sequences from -.Va PS1 . -.It Va RPS2 -The secondary right prompt string. -.Va RPS2 -may include any of the formatting sequences from -.Va PS1 . -.El -.Ss Word Expansions -This clause describes the various expansions that are -performed on words. -Not all expansions are performed on -every word, as explained later. -.Pp -Tilde expansions, parameter expansions, command substitutions, -arithmetic expansions, and quote removals that occur within -a single word expand to a single field. -It is only field -splitting or pathname expansion that can create multiple -fields from a single word. -The single exception to this rule is -the expansion of the special parameter -.Va @ -within double-quotes, -as was described above. -.Pp -The order of word expansion is: -.Bl -enum -.It -Tilde Expansion, Parameter Expansion, Command Substitution, -Arithmetic Expansion (these all occur at the same time). -.It -Field Splitting is performed on fields generated by step (1) -unless the -.Va IFS -variable is null. -.It -Pathname Expansion (unless the -.Fl f -option is in effect). -.It -Quote Removal. -.El -.Pp -The -.Ql $ -character is used to introduce parameter expansion, command -substitution, or arithmetic expansion. -.Ss Tilde Expansion (substituting a user's home directory) -A word beginning with an unquoted tilde character -.Pq Ql ~ -is -subjected to tilde expansion. -All the characters up to a slash -.Pq Ql / -or the end of the word are treated as a username -and are replaced with the user's home directory. -If the -username is missing (as in -.Pa ~/foobar ) , -the tilde is replaced with the value of the -.Va HOME -variable (the current user's home directory). -.Ss Parameter Expansion -The format for parameter expansion is as follows: -.Pp -.D1 Li ${ Ns Ar expression Ns Li } -.Pp -where -.Ar expression -consists of all characters until the matching -.Ql } . -Any -.Ql } -escaped by a backslash or within a single-quoted or double-quoted -string, and characters in -embedded arithmetic expansions, command substitutions, and variable -expansions, are not examined in determining the matching -.Ql } . -If the variants with -.Ql + , -.Ql - , -.Ql = -or -.Ql ?\& -occur within a double-quoted string, -as an extension there may be unquoted parts -(via double-quotes inside the expansion); -.Ql } -within such parts are also not examined in determining the matching -.Ql } . -.Pp -The simplest form for parameter expansion is: -.Pp -.D1 Li ${ Ns Ar parameter Ns Li } -.Pp -The value, if any, of -.Ar parameter -is substituted. -.Pp -The parameter name or symbol can be enclosed in braces, which are -optional except for positional parameters with more than one digit or -when parameter is followed by a character that could be interpreted as -part of the name. -If a parameter expansion occurs inside double-quotes: -.Bl -enum -.It -Field splitting is not performed on the results of the -expansion, with the exception of the special parameter -.Va @ . -.It -Pathname expansion is not performed on the results of the -expansion. -.El -.Pp -In addition, a parameter expansion can be modified by using one of the -following formats. -.Bl -tag -width indent -.It Li ${ Ns Ar parameter Ns Li :- Ns Ar word Ns Li } -Use Default Values. -If -.Ar parameter -is unset or null, the expansion of -.Ar word -is substituted; otherwise, the value of -.Ar parameter -is substituted. -.It Li ${ Ns Ar parameter Ns Li := Ns Ar word Ns Li } -Assign Default Values. -If -.Ar parameter -is unset or null, the expansion of -.Ar word -is assigned to -.Ar parameter . -In all cases, the -final value of -.Ar parameter -is substituted. -Quoting inside -.Ar word -does not prevent field splitting or pathname expansion. -Only variables, not positional -parameters or special parameters, can be -assigned in this way. -.It Li ${ Ns Ar parameter Ns Li :? Ns Oo Ar word Oc Ns Li } -Indicate Error if Null or Unset. -If -.Ar parameter -is unset or null, the expansion of -.Ar word -(or a message indicating it is unset if -.Ar word -is omitted) is written to standard -error and the shell exits with a nonzero -exit status. -Otherwise, the value of -.Ar parameter -is substituted. -An -interactive shell need not exit. -.It Li ${ Ns Ar parameter Ns Li :+ Ns Ar word Ns Li } -Use Alternate Value. -If -.Ar parameter -is unset or null, null is substituted; -otherwise, the expansion of -.Ar word -is substituted. -.El -.Pp -In the parameter expansions shown previously, use of the colon in the -format results in a test for a parameter that is unset or null; omission -of the colon results in a test for a parameter that is only unset. -.Pp -The -.Ar word -inherits the type of quoting -(unquoted, double-quoted or here-document) -from the surroundings, -with the exception that a backslash that quotes a closing brace is removed -during quote removal. -.Bl -tag -width indent -.It Li ${# Ns Ar parameter Ns Li } -String Length. -The length in characters of -the value of -.Ar parameter . -.El -.Pp -The following four varieties of parameter expansion provide for substring -processing. -In each case, pattern matching notation -(see -.Sx Shell Patterns ) , -rather than regular expression notation, -is used to evaluate the patterns. -If parameter is one of the special parameters -.Va * -or -.Va @ , -the result of the expansion is unspecified. -Enclosing the full parameter expansion string in double-quotes does not -cause the following four varieties of pattern characters to be quoted, -whereas quoting characters within the braces has this effect. -.Bl -tag -width indent -.It Li ${ Ns Ar parameter Ns Li % Ns Ar word Ns Li } -Remove Smallest Suffix Pattern. -The -.Ar word -is expanded to produce a pattern. -The -parameter expansion then results in -.Ar parameter , -with the smallest portion of the -suffix matched by the pattern deleted. -.It Li ${ Ns Ar parameter Ns Li %% Ns Ar word Ns Li } -Remove Largest Suffix Pattern. -The -.Ar word -is expanded to produce a pattern. -The -parameter expansion then results in -.Ar parameter , -with the largest portion of the -suffix matched by the pattern deleted. -.It Li ${ Ns Ar parameter Ns Li # Ns Ar word Ns Li } -Remove Smallest Prefix Pattern. -The -.Ar word -is expanded to produce a pattern. -The -parameter expansion then results in -.Ar parameter , -with the smallest portion of the -prefix matched by the pattern deleted. -.It Li ${ Ns Ar parameter Ns Li ## Ns Ar word Ns Li } -Remove Largest Prefix Pattern. -The -.Ar word -is expanded to produce a pattern. -The -parameter expansion then results in -.Ar parameter , -with the largest portion of the -prefix matched by the pattern deleted. -.El -.Ss Command Substitution -Command substitution allows the output of a command to be substituted in -place of the command name itself. -Command substitution occurs when -the command is enclosed as follows: -.Pp -.D1 Li $( Ns Ar command Ns Li )\& -.Pp -or the backquoted version: -.Pp -.D1 Li ` Ns Ar command Ns Li ` -.Pp -The shell expands the command substitution by executing command -and replacing the command substitution -with the standard output of the command, -removing sequences of one or more newlines at the end of the substitution. -Embedded newlines before the end of the output are not removed; -however, during field splitting, they may be translated into spaces -depending on the value of -.Va IFS -and the quoting that is in effect. -The command is executed in a subshell environment, -except that the built-in commands -.Ic jobid , -.Ic jobs , -and -.Ic trap -return information about the parent shell environment -and -.Ic times -returns information about the same process -if they are the only command in a command substitution. -.Pp -If a command substitution of the -.Li $( -form begins with a subshell, -the -.Li $( -and -.Li (\& -must be separated by whitespace -to avoid ambiguity with arithmetic expansion. -.Ss Arithmetic Expansion -Arithmetic expansion provides a mechanism for evaluating an arithmetic -expression and substituting its value. -The format for arithmetic expansion is as follows: -.Pp -.D1 Li $(( Ns Ar expression Ns Li )) -.Pp -The -.Ar expression -is treated as if it were in double-quotes, except -that a double-quote inside the expression is not treated specially. -The -shell expands all tokens in the -.Ar expression -for parameter expansion, -command substitution, -arithmetic expansion -and quote removal. -.Pp -The allowed expressions are a subset of C expressions, -summarized below. -.Bl -tag -width "Variables" -offset indent -.It Values -All values are of type -.Ft intmax_t . -.It Constants -Decimal, octal (starting with -.Li 0 ) -and hexadecimal (starting with -.Li 0x ) -integer constants. -.It Variables -Shell variables can be read and written -and contain integer constants. -.It Unary operators -.Li "! ~ + -" -.It Binary operators -.Li "* / % + - << >> < <= > >= == != & ^ | && ||"\& -.It Assignment operators -.Li "= += -= *= /= %= <<= >>= &= ^= |=" -.It Conditional operator -.Li "? :"\& -.El -.Pp -The result of the expression is substituted in decimal. -.Ss White Space Splitting (Field Splitting) -In certain contexts, -after parameter expansion, command substitution, and -arithmetic expansion the shell scans the results of -expansions and substitutions that did not occur in double-quotes for -field splitting and multiple fields can result. -.Pp -Characters in -.Va IFS -that are whitespace -.Po -.Aq space , -.Aq tab , -and -.Aq newline -.Pc -are treated differently from other characters in -.Va IFS . -.Pp -Whitespace in -.Va IFS -at the beginning or end of a word is discarded. -.Pp -Subsequently, a field is delimited by either -.Bl -enum -.It -a non-whitespace character in -.Va IFS -with any whitespace in -.Va IFS -surrounding it, or -.It -one or more whitespace characters in -.Va IFS . -.El -.Pp -If a word ends with a non-whitespace character in -.Va IFS , -there is no empty field after this character. -.Pp -If no field is delimited, the word is discarded. -In particular, if a word consists solely of an unquoted substitution -and the result of the substitution is null, -it is removed by field splitting even if -.Va IFS -is null. -.Ss Pathname Expansion (File Name Generation) -Unless the -.Fl f -option is set, -file name generation is performed -after word splitting is complete. -Each word is -viewed as a series of patterns, separated by slashes. -The -process of expansion replaces the word with the names of -all existing files whose names can be formed by replacing -each pattern with a string that matches the specified pattern. -There are two restrictions on this: first, a pattern cannot match -a string containing a slash, and second, -a pattern cannot match a string starting with a period -unless the first character of the pattern is a period. -The next section describes the patterns used for -Pathname Expansion, -the four varieties of parameter expansion for substring processing and the -.Ic case -command. -.Ss Shell Patterns -A pattern consists of normal characters, which match themselves, -and meta-characters. -The meta-characters are -.Ql * , -.Ql \&? , -and -.Ql \&[ . -These characters lose their special meanings if they are quoted. -When command or variable substitution is performed and the dollar sign -or back quotes are not double-quoted, the value of the -variable or the output of the command is scanned for these -characters and they are turned into meta-characters. -.Pp -An asterisk -.Pq Ql * -matches any string of characters. -A question mark -.Pq Ql \&? -matches any single character. -A left bracket -.Pq Ql \&[ -introduces a character class. -The end of the character class is indicated by a -.Ql \&] ; -if the -.Ql \&] -is missing then the -.Ql \&[ -matches a -.Ql \&[ -rather than introducing a character class. -A character class matches any of the characters between the square brackets. -A locale-dependent range of characters may be specified using a minus sign. -A named class of characters (see -.Xr wctype 3 ) -may be specified by surrounding the name with -.Ql \&[:\& -and -.Ql :\&] . -For example, -.Ql \&[\&[:alpha:\&]\&] -is a shell pattern that matches a single letter. -The character class may be complemented by making an exclamation point -.Pq Ql !\& -the first character of the character class. -A caret -.Pq Ql ^ -has the same effect but is non-standard. -.Pp -To include a -.Ql \&] -in a character class, make it the first character listed -(after the -.Ql \&! -or -.Ql ^ , -if any). -To include a -.Ql - , -make it the first or last character listed. -.Ss Built-in Commands -This section lists the built-in commands. -.Bl -tag -width indent -.It Ic \&: -A null command that returns a 0 (true) exit value. -.It Ic \&. Ar file -The commands in the specified file are read and executed by the shell. -The -.Ic return -command may be used to return to the -.Ic \&. -command's caller. -If -.Ar file -contains any -.Ql / -characters, it is used as is. -Otherwise, the shell searches the -.Va PATH -for the file. -If it is not found in the -.Va PATH , -it is sought in the current working directory. -.It Ic \&[ -A built-in equivalent of -.Xr test 1 . -.It Ic alias Oo Ar name Ns Oo = Ns Ar string Oc ... Oc -If -.Ar name Ns = Ns Ar string -is specified, the shell defines the alias -.Ar name -with value -.Ar string . -If just -.Ar name -is specified, the value of the alias -.Ar name -is printed. -With no arguments, the -.Ic alias -built-in command prints the names and values of all defined aliases -(see -.Ic unalias ) . -Alias values are written with appropriate quoting so that they are -suitable for re-input to the shell. -Also see the -.Sx Aliases -subsection. -.It Ic bg Op Ar job ... -Continue the specified jobs -(or the current job if no jobs are given) -in the background. -.It Ic bind Oo Fl aeklrsv Oc Oo Ar key Oo Ar command Oc Oc -List or alter key bindings for the line editor. -This command is documented in -.Xr editrc 5 . -.It Ic break Op Ar num -See the -.Sx Flow-Control Constructs -subsection. -.It Ic builtin Ar cmd Op Ar arg ... -Execute the specified built-in command, -.Ar cmd . -This is useful when the user wishes to override a shell function -with the same name as a built-in command. -.It Ic cd Oo Fl L | P Oc Oo Fl e Oc Op Ar directory -.It Ic cd Fl -Switch to the specified -.Ar directory , -to the directory specified in the -.Va HOME -environment variable if no -.Ar directory -is specified or -to the directory specified in the -.Va OLDPWD -environment variable if -.Ar directory -is -.Fl . -If -.Ar directory -does not begin with -.Pa / , \&. , -or -.Pa .. , -then the directories listed in the -.Va CDPATH -variable will be -searched for the specified -.Ar directory . -If -.Va CDPATH -is unset, the current directory is searched. -The format of -.Va CDPATH -is the same as that of -.Va PATH . -In an interactive shell, -the -.Ic cd -command will print out the name of the directory -that it actually switched to -if the -.Va CDPATH -mechanism was used or if -.Ar directory -was -.Fl . -.Pp -If the -.Fl P -option is specified, -.Pa .. -is handled physically and symbolic links are resolved before -.Pa .. -components are processed. -If the -.Fl L -option is specified, -.Pa .. -is handled logically. -This is the default. -.Pp -The -.Fl e -option causes -.Ic cd -to return exit status 1 if the full pathname of the new directory -cannot be determined reliably or at all. -Normally this is not considered an error, -although a warning is printed. -.Pp -If changing the directory fails, the exit status is greater than 1. -If the directory is changed, the exit status is 0, or also 1 if -.Fl e -was given. -.It Ic chdir -A synonym for the -.Ic cd -built-in command. -.It Ic command Oo Fl p Oc Op Ar utility Op Ar argument ... -.It Ic command Oo Fl p Oc Fl v Ar utility -.It Ic command Oo Fl p Oc Fl V Ar utility -The first form of invocation executes the specified -.Ar utility , -ignoring shell functions in the search. -If -.Ar utility -is a special builtin, -it is executed as if it were a regular builtin. -.Pp -If the -.Fl p -option is specified, the command search is performed using a -default value of -.Va PATH -that is guaranteed to find all of the standard utilities. -.Pp -If the -.Fl v -option is specified, -.Ar utility -is not executed but a description of its interpretation by the shell is -printed. -For ordinary commands the output is the path name; for shell built-in -commands, shell functions and keywords only the name is written. -Aliases are printed as -.Dq Ic alias Ar name Ns = Ns Ar value . -.Pp -The -.Fl V -option is identical to -.Fl v -except for the output. -It prints -.Dq Ar utility Ic is Ar description -where -.Ar description -is either -the path name to -.Ar utility , -a special shell builtin, -a shell builtin, -a shell function, -a shell keyword -or -an alias for -.Ar value . -.It Ic continue Op Ar num -See the -.Sx Flow-Control Constructs -subsection. -.It Ic echo Oo Fl e | n Oc Op Ar string ... -Print a space-separated list of the arguments to the standard output -and append a newline character. -.Bl -tag -width indent -.It Fl n -Suppress the output of the trailing newline. -.It Fl e -Process C-style backslash escape sequences. -The -.Ic echo -command understands the following character escapes: -.Bl -tag -width indent -.It \ea -Alert (ring the terminal bell) -.It \eb -Backspace -.It \ec -Suppress the trailing newline (this has the side-effect of truncating the -line if it is not the last character) -.It \ee -The ESC character (ASCII 0x1b) -.It \ef -Formfeed -.It \en -Newline -.It \er -Carriage return -.It \et -Horizontal tab -.It \ev -Vertical tab -.It \e\e -Literal backslash -.It \e0nnn -(Zero) The character whose octal value is -.Ar nnn -.El -.Pp -If -.Ar string -is not enclosed in quotes then the backslash itself must be escaped -with a backslash to protect it from the shell. -For example -.Bd -literal -offset indent -$ echo -e "a\evb" -a - b -$ echo -e a\e\evb -a - b -$ echo -e "a\e\eb" -a\eb -$ echo -e a\e\e\e\eb -a\eb -.Ed -.El -.Pp -Only one of the -.Fl e -and -.Fl n -options may be specified. -.It Ic eval Ar string ... -Concatenate all the arguments with spaces. -Then re-parse and execute the command. -.It Ic exec Op Ar command Op arg ... -Unless -.Ar command -is omitted, -the shell process is replaced with the specified program -(which must be a real program, not a shell built-in command or function). -Any redirections on the -.Ic exec -command are marked as permanent, -so that they are not undone when the -.Ic exec -command finishes. -.It Ic exit Op Ar exitstatus -Terminate the shell process. -If -.Ar exitstatus -is given -it is used as the exit status of the shell. -Otherwise, if the shell is executing an -.Cm EXIT -trap, the exit status of the last command before the trap is used; -if the shell is executing a trap for a signal, -the shell exits by resending the signal to itself. -Otherwise, the exit status of the preceding command is used. -The exit status should be an integer between 0 and 255. -.It Ic export Ar name ... -.It Ic export Op Fl p -The specified names are exported so that they will -appear in the environment of subsequent commands. -The only way to un-export a variable is to -.Ic unset -it. -The shell allows the value of a variable to be set -at the same time as it is exported by writing -.Pp -.D1 Ic export Ar name Ns = Ns Ar value -.Pp -With no arguments the -.Ic export -command lists the names -of all exported variables. -If the -.Fl p -option is specified, the exported variables are printed as -.Dq Ic export Ar name Ns = Ns Ar value -lines, suitable for re-input to the shell. -.It Ic false -A null command that returns a non-zero (false) exit value. -.It Ic fc Oo Fl e Ar editor Oc Op Ar first Op Ar last -.It Ic fc Fl l Oo Fl nr Oc Op Ar first Op Ar last -.It Ic fc Fl s Oo Ar old Ns = Ns Ar new Oc Op Ar first -The -.Ic fc -built-in command lists, or edits and re-executes, -commands previously entered to an interactive shell. -.Bl -tag -width indent -.It Fl e Ar editor -Use the editor named by -.Ar editor -to edit the commands. -The -.Ar editor -string is a command name, -subject to search via the -.Va PATH -variable. -The value in the -.Va FCEDIT -variable is used as a default when -.Fl e -is not specified. -If -.Va FCEDIT -is null or unset, the value of the -.Va EDITOR -variable is used. -If -.Va EDITOR -is null or unset, -.Xr ed 1 -is used as the editor. -.It Fl l No (ell) -List the commands rather than invoking -an editor on them. -The commands are written in the -sequence indicated by the -.Ar first -and -.Ar last -operands, as affected by -.Fl r , -with each command preceded by the command number. -.It Fl n -Suppress command numbers when listing with -.Fl l . -.It Fl r -Reverse the order of the commands listed -(with -.Fl l ) -or edited -(with neither -.Fl l -nor -.Fl s ) . -.It Fl s -Re-execute the command without invoking an editor. -.It Ar first -.It Ar last -Select the commands to list or edit. -The number of previous commands that can be accessed -are determined by the value of the -.Va HISTSIZE -variable. -The value of -.Ar first -or -.Ar last -or both are one of the following: -.Bl -tag -width indent -.It Oo Cm + Oc Ns Ar num -A positive number representing a command number; -command numbers can be displayed with the -.Fl l -option. -.It Fl Ar num -A negative decimal number representing the -command that was executed -.Ar num -of -commands previously. -For example, \-1 is the immediately previous command. -.It Ar string -A string indicating the most recently entered command -that begins with that string. -If the -.Ar old Ns = Ns Ar new -operand is not also specified with -.Fl s , -the string form of the first operand cannot contain an embedded equal sign. -.El -.El -.Pp -The following variables affect the execution of -.Ic fc : -.Bl -tag -width ".Va HISTSIZE" -.It Va FCEDIT -Name of the editor to use for history editing. -.It Va HISTSIZE -The number of previous commands that are accessible. -.El -.It Ic fg Op Ar job -Move the specified -.Ar job -or the current job to the foreground. -.It Ic getopts Ar optstring var -The POSIX -.Ic getopts -command. -The -.Ic getopts -command deprecates the older -.Xr getopt 1 -command. -The first argument should be a series of letters, each possibly -followed by a colon which indicates that the option takes an argument. -The specified variable is set to the parsed option. -The index of -the next argument is placed into the shell variable -.Va OPTIND . -If an option takes an argument, it is placed into the shell variable -.Va OPTARG . -If an invalid option is encountered, -.Ar var -is set to -.Ql \&? . -It returns a false value (1) when it encounters the end of the options. -A new set of arguments may be parsed by assigning -.Li OPTIND=1 . -.It Ic hash Oo Fl rv Oc Op Ar command ... -The shell maintains a hash table which remembers the locations of commands. -With no arguments whatsoever, the -.Ic hash -command prints out the contents of this table. -.Pp -With arguments, the -.Ic hash -command removes each specified -.Ar command -from the hash table (unless they are functions) and then locates it. -With the -.Fl v -option, -.Ic hash -prints the locations of the commands as it finds them. -The -.Fl r -option causes the -.Ic hash -command to delete all the entries in the hash table except for functions. -.It Ic jobid Op Ar job -Print the process IDs of the processes in the specified -.Ar job . -If the -.Ar job -argument is omitted, use the current job. -.It Ic jobs Oo Fl lps Oc Op Ar job ... -Print information about the specified jobs, or all jobs if no -.Ar job -argument is given. -The information printed includes job ID, status and command name. -.Pp -If the -.Fl l -option is specified, the PID of each job is also printed. -If the -.Fl p -option is specified, only the process IDs for the process group leaders -are printed, one per line. -If the -.Fl s -option is specified, only the PIDs of the job commands are printed, one per -line. -.It Ic kill -A built-in equivalent of -.Xr kill 1 -that additionally supports sending signals to jobs. -.It Ic local Oo Ar variable ... Oc Op Fl -See the -.Sx Functions -subsection. -.It Ic printf -A built-in equivalent of -.Xr printf 1 . -.It Ic pwd Op Fl L | P -Print the path of the current directory. -The built-in command may -differ from the program of the same name because the -built-in command remembers what the current directory -is rather than recomputing it each time. -This makes -it faster. -However, if the current directory is -renamed, -the built-in version of -.Xr pwd 1 -will continue to print the old name for the directory. -.Pp -If the -.Fl P -option is specified, symbolic links are resolved. -If the -.Fl L -option is specified, the shell's notion of the current directory -is printed (symbolic links are not resolved). -This is the default. -.It Ic read Oo Fl p Ar prompt Oc Oo -.Fl t Ar timeout Oc Oo Fl er Oc Ar variable ... -The -.Ar prompt -is printed if the -.Fl p -option is specified -and the standard input is a terminal. -Then a line is -read from the standard input. -The trailing newline -is deleted from the line and the line is split as -described in the section on -.Sx White Space Splitting (Field Splitting)\& -above, and -the pieces are assigned to the variables in order. -If there are more pieces than variables, the remaining -pieces (along with the characters in -.Va IFS -that separated them) -are assigned to the last variable. -If there are more variables than pieces, the remaining -variables are assigned the null string. -.Pp -Backslashes are treated specially, unless the -.Fl r -option is -specified. -If a backslash is followed by -a newline, the backslash and the newline will be -deleted. -If a backslash is followed by any other -character, the backslash will be deleted and the following -character will be treated as though it were not in -.Va IFS , -even if it is. -.Pp -If the -.Fl t -option is specified and the -.Ar timeout -elapses before a complete line of input is supplied, -the -.Ic read -command will return an exit status as if terminated by -.Dv SIGALRM -without assigning any values. -The -.Ar timeout -value may optionally be followed by one of -.Ql s , -.Ql m -or -.Ql h -to explicitly specify seconds, minutes or hours. -If none is supplied, -.Ql s -is assumed. -.Pp -The -.Fl e -option exists only for backward compatibility with older scripts. -.Pp -The exit status is 0 on success, 1 on end of file, -between 2 and 128 if an error occurs -and greater than 128 if a trapped signal interrupts -.Ic read . -.It Ic readonly Oo Fl p Oc Op Ar name ... -Each specified -.Ar name -is marked as read only, -so that it cannot be subsequently modified or unset. -The shell allows the value of a variable to be set -at the same time as it is marked read only -by using the following form: -.Pp -.D1 Ic readonly Ar name Ns = Ns Ar value -.Pp -With no arguments the -.Ic readonly -command lists the names of all read only variables. -If the -.Fl p -option is specified, the read-only variables are printed as -.Dq Ic readonly Ar name Ns = Ns Ar value -lines, suitable for re-input to the shell. -.It Ic return Op Ar exitstatus -See the -.Sx Functions -subsection. -.It Ic set Oo Fl /+abCEefIimnpTuVvx Oc Oo Fl /+o Ar longname Oc Oo -.Fl c Ar string Oc Op Fl - Ar arg ... -The -.Ic set -command performs three different functions: -.Bl -item -.It -With no arguments, it lists the values of all shell variables. -.It -If options are given, -either in short form or using the long -.Dq Fl /+o Ar longname -form, -it sets or clears the specified options as described in the section called -.Sx Argument List Processing . -.It -If the -.Dq Fl - -option is specified, -.Ic set -will replace the shell's positional parameters with the subsequent -arguments. -If no arguments follow the -.Dq Fl - -option, -all the positional parameters will be cleared, -which is equivalent to executing the command -.Dq Li "shift $#" . -The -.Dq Fl - -flag may be omitted when specifying arguments to be used -as positional replacement parameters. -This is not recommended, -because the first argument may begin with a dash -.Pq Ql - -or a plus -.Pq Ql + , -which the -.Ic set -command will interpret as a request to enable or disable options. -.El -.It Ic setvar Ar variable value -Assigns the specified -.Ar value -to the specified -.Ar variable . -The -.Ic setvar -command is intended to be used in functions that -assign values to variables whose names are passed as parameters. -In general it is better to write -.Dq Ar variable Ns = Ns Ar value -rather than using -.Ic setvar . -.It Ic shift Op Ar n -Shift the positional parameters -.Ar n -times, or once if -.Ar n -is not specified. -A shift sets the value of -.Li $1 -to the value of -.Li $2 , -the value of -.Li $2 -to the value of -.Li $3 , -and so on, -decreasing the value of -.Li $# -by one. -For portability, shifting if there are zero positional parameters -should be avoided, since the shell may abort. -.It Ic test -A built-in equivalent of -.Xr test 1 . -.It Ic times -Print the amount of time spent executing the shell process and its children. -The first output line shows the user and system times for the shell process -itself, the second one contains the user and system times for the -children. -.It Ic trap Oo Ar action Oc Ar signal ... -.It Ic trap Fl l -Cause the shell to parse and execute -.Ar action -when any specified -.Ar signal -is received. -The signals are specified by name or number. -In addition, the pseudo-signal -.Cm EXIT -may be used to specify an -.Ar action -that is performed when the shell terminates. -The -.Ar action -may be an empty string or a dash -.Pq Ql - ; -the former causes the specified signal to be ignored -and the latter causes the default action to be taken. -Omitting the -.Ar action -and using only signal numbers is another way to request the default action. -In a subshell or utility environment, -the shell resets trapped (but not ignored) signals to the default action. -The -.Ic trap -command has no effect on signals that were ignored on entry to the shell. -.Pp -Option -.Fl l -causes the -.Ic trap -command to display a list of valid signal names. -.It Ic true -A null command that returns a 0 (true) exit value. -.It Ic type Op Ar name ... -Interpret each -.Ar name -as a command and print the resolution of the command search. -Possible resolutions are: -shell keyword, alias, special shell builtin, shell builtin, command, -tracked alias -and not found. -For aliases the alias expansion is printed; -for commands and tracked aliases -the complete pathname of the command is printed. -.It Ic ulimit Oo Fl HSabcdfklmnopstuvw Oc Op Ar limit -Set or display resource limits (see -.Xr getrlimit 2 ) . -If -.Ar limit -is specified, the named resource will be set; -otherwise the current resource value will be displayed. -.Pp -If -.Fl H -is specified, the hard limits will be set or displayed. -While everybody is allowed to reduce a hard limit, -only the superuser can increase it. -The -.Fl S -option -specifies the soft limits instead. -When displaying limits, -only one of -.Fl S -or -.Fl H -can be given. -The default is to display the soft limits, -and to set both the hard and the soft limits. -.Pp -Option -.Fl a -causes the -.Ic ulimit -command to display all resources. -The parameter -.Ar limit -is not acceptable in this mode. -.Pp -The remaining options specify which resource value is to be -displayed or modified. -They are mutually exclusive. -.Bl -tag -width indent -.It Fl b Ar sbsize -The maximum size of socket buffer usage, in bytes. -.It Fl c Ar coredumpsize -The maximal size of core dump files, in 512-byte blocks. -Setting -.Ar coredumpsize -to 0 prevents core dump files from being created. -.It Fl d Ar datasize -The maximal size of the data segment of a process, in kilobytes. -.It Fl f Ar filesize -The maximal size of a file, in 512-byte blocks. -.It Fl k Ar kqueues -The maximal number of kqueues -(see -.Xr kqueue 2 ) -for this user ID. -.It Fl l Ar lockedmem -The maximal size of memory that can be locked by a process, in -kilobytes. -.It Fl m Ar memoryuse -The maximal resident set size of a process, in kilobytes. -.It Fl n Ar nofiles -The maximal number of descriptors that could be opened by a process. -.It Fl o Ar umtxp -The maximal number of process-shared locks -(see -.Xr pthread 3 ) -for this user ID. -.It Fl p Ar pseudoterminals -The maximal number of pseudo-terminals for this user ID. -.It Fl s Ar stacksize -The maximal size of the stack segment, in kilobytes. -.It Fl t Ar time -The maximal amount of CPU time to be used by each process, in seconds. -.It Fl u Ar userproc -The maximal number of simultaneous processes for this user ID. -.It Fl v Ar virtualmem -The maximal virtual size of a process, in kilobytes. -.It Fl w Ar swapuse -The maximum amount of swap space reserved or used for this user ID, -in kilobytes. -.El -.It Ic umask Oo Fl S Oc Op Ar mask -Set the file creation mask (see -.Xr umask 2 ) -to the octal or symbolic (see -.Xr chmod 1 ) -value specified by -.Ar mask . -If the argument is omitted, the current mask value is printed. -If the -.Fl S -option is specified, the output is symbolic, otherwise the output is octal. -.It Ic unalias Oo Fl a Oc Op Ar name ... -The specified alias names are removed. -If -.Fl a -is specified, all aliases are removed. -.It Ic unset Oo Fl fv Oc Ar name ... -The specified variables or functions are unset and unexported. -If the -.Fl v -option is specified or no options are given, the -.Ar name -arguments are treated as variable names. -If the -.Fl f -option is specified, the -.Ar name -arguments are treated as function names. -.It Ic wait Op Ar job ... -Wait for each specified -.Ar job -to complete and return the exit status of the last process in the -last specified -.Ar job . -If any -.Ar job -specified is unknown to the shell, it is treated as if it -were a known job that exited with exit status 127. -If no operands are given, wait for all jobs to complete -and return an exit status of zero. -.El -.Ss Command Line Editing -When -.Nm -is being used interactively from a terminal, the current command -and the command history -(see -.Ic fc -in -.Sx Built-in Commands ) -can be edited using -.Nm vi Ns -mode -command line editing. -This mode uses commands similar -to a subset of those described in the -.Xr vi 1 -man page. -The command -.Dq Li "set -o vi" -(or -.Dq Li "set -V" ) -enables -.Nm vi Ns -mode -editing and places -.Nm -into -.Nm vi -insert mode. -With -.Nm vi Ns -mode -enabled, -.Nm -can be switched between insert mode and command mode by typing -.Aq ESC . -Hitting -.Aq return -while in command mode will pass the line to the shell. -.Pp -Similarly, the -.Dq Li "set -o emacs" -(or -.Dq Li "set -E" ) -command can be used to enable a subset of -.Nm emacs Ns -style -command line editing features. -.Sh ENVIRONMENT -The following environment variables affect the execution of -.Nm : -.Bl -tag -width ".Ev LANGXXXXXX" -.It Ev ENV -Initialization file for interactive shells. -.It Ev LANG , Ev LC_* -Locale settings. -These are inherited by children of the shell, -and is used in a limited manner by the shell itself. -.It Ev OLDPWD -The previous current directory. -This is used and updated by -.Ic cd . -.It Ev PWD -An absolute pathname for the current directory, -possibly containing symbolic links. -This is used and updated by the shell. -.It Ev TERM -The default terminal setting for the shell. -This is inherited by children of the shell, and is used in the history -editing modes. -.El -.Pp -Additionally, environment variables are turned into shell variables -at startup, -which may affect the shell as described under -.Sx Special Variables . -.Sh FILES -.Bl -tag -width "/etc/suid_profileXX" -compact -.It Pa ~/.profile -User's login profile. -.It Pa /etc/profile -System login profile. -.It Pa /etc/shells -Shell database. -.It Pa /etc/suid_profile -Privileged shell profile. -.El -.Sh EXIT STATUS -Errors that are detected by the shell, such as a syntax error, will -cause the shell to exit with a non-zero exit status. -If the shell is not an interactive shell, the execution of the shell -file will be aborted. -Otherwise the shell will return the exit status of the last command -executed, or if the -.Ic exit -builtin is used with a numeric argument, it -will return the argument. -.Sh SEE ALSO -.Xr 1sh-kill 1 , -.Xr 1sh-printf 1 , -.Xr 1sh-test 1 , -.Xr builtin 1 , -.Xr chsh 1 , -.Xr echo 1 , -.Xr ed 1 , -.Xr emacs 1 , -.Xr pwd 1 , -.Xr vi 1 , -.Xr execve 2 , -.Xr getrlimit 2 , -.Xr umask 2 , -.Xr wctype 3 , -.Xr editrc 5 , -.Xr shells 5 -.Sh HISTORY -A -.Nm sh -command, the Thompson shell, appeared in -.At v1 . -It was superseded in -.At v7 -by the Bourne shell, which inherited the name -.Nm sh . -.Pp -This version of -.Nm sh -was rewritten in 1989 under the -.Bx -license after the Bourne shell from -.At V.4 . -The -.Nm -command is based on sources from -.Fx 12.1 . -.Sh AUTHORS -This version of -.Nm -was originally written by -.An Kenneth Almquist . -.Sh BUGS -The -.Nm -utility does not recognize multibyte characters other than UTF-8. -Splitting using -.Va IFS -does not recognize multibyte characters. diff --git a/bin/1sh/Makefile b/bin/1sh/Makefile deleted file mode 100644 index 26ce125f..00000000 --- a/bin/1sh/Makefile +++ /dev/null @@ -1,84 +0,0 @@ -PREFIX = /usr/local -MANDIR = ${PREFIX}/share/man - -CFLAGS += -std=c99 -Wall -Wextra -DSHELL -LDLIBS = -ledit - --include config.mk - -SRCS += alias.c -SRCS += arith_yacc.c -SRCS += arith_yylex.c -SRCS += cd.c -SRCS += echo.c -SRCS += error.c -SRCS += eval.c -SRCS += exec.c -SRCS += expand.c -SRCS += histedit.c -SRCS += input.c -SRCS += jobs.c -SRCS += kill.c -SRCS += mail.c -SRCS += main.c -SRCS += memalloc.c -SRCS += miscbltin.c -SRCS += mystring.c -SRCS += options.c -SRCS += output.c -SRCS += parser.c -SRCS += printf.c -SRCS += redir.c -SRCS += show.c -SRCS += test.c -SRCS += trap.c -SRCS += var.c - -GENSRCS = builtins.c nodes.c syntax.c -GENHDRS = builtins.h nodes.h syntax.h token.h - -SRCS += ${GENSRCS} -OBJS = ${SRCS:.c=.o} - -MANS = 1sh.1 1sh-kill.1 1sh-printf.1 1sh-test.1 - -all: tags 1sh - -1sh: ${OBJS} - ${CC} ${LDFLAGS} ${OBJS} ${LDLIBS} -o $@ - -${OBJS}: ${GENHDRS} - -builtins.c builtins.h: mkbuiltins builtins.def - sh mkbuiltins . - -nodes.c nodes.h: mknodes nodetypes nodes.c.pat - ./mknodes nodetypes nodes.c.pat - -syntax.c syntax.h: mksyntax - ./mksyntax - -token.h: mktokens - sh mktokens - -tags: *.h *.c - ctags -w *.h *.c - -depend: ${SRCS} ${GENHDRS} - ${CC} ${CFLAGS} -MM ${SRCS} > .depend - --include .depend - -clean: - rm -f 1sh ${OBJS} mknodes mksyntax ${GENSRCS} ${GENHDRS} tags .depend - -install: 1sh ${MANS} - install -d ${PREFIX}/bin ${MANDIR}/man1 - install 1sh ${PREFIX}/bin - for man in ${MANS}; do gzip -c $$man > ${MANDIR}/man1/$$man.gz; done - grep -q '^${PREFIX}/bin/1sh$$' /etc/shells \ - || echo '${PREFIX}/bin/1sh' >> /etc/shells - -uninstall: - rm -f ${PREFIX}/bin/1sh ${MANS:%=${MANDIR}/man1/%.gz} - sed -i sed '\;^${PREFIX}/bin/1sh$$;d' /etc/shells diff --git a/bin/1sh/TOUR b/bin/1sh/TOUR deleted file mode 100644 index 3f196c9b..00000000 --- a/bin/1sh/TOUR +++ /dev/null @@ -1,301 +0,0 @@ -# @(#)TOUR 8.1 (Berkeley) 5/31/93 -# $FreeBSD: releng/12.1/bin/sh/TOUR 317882 2017-05-06 13:28:42Z jilles $ - -NOTE -- This is the original TOUR paper distributed with ash and -does not represent the current state of the shell. It is provided anyway -since it provides helpful information for how the shell is structured, -but be warned that things have changed -- the current shell is -still under development. - -================================================================ - - A Tour through Ash - - Copyright 1989 by Kenneth Almquist. - - -DIRECTORIES: The subdirectory bltin contains commands which can -be compiled stand-alone. The rest of the source is in the main -ash directory. - -SOURCE CODE GENERATORS: Files whose names begin with "mk" are -programs that generate source code. A complete list of these -programs is: - - program input files generates - ------- ----------- --------- - mkbuiltins builtins.def builtins.h builtins.c - mknodes nodetypes nodes.h nodes.c - mksyntax - syntax.h syntax.c - mktokens - token.h - -There are undoubtedly too many of these. - -EXCEPTIONS: Code for dealing with exceptions appears in -exceptions.c. The C language doesn't include exception handling, -so I implement it using setjmp and longjmp. The global variable -exception contains the type of exception. EXERROR is raised by -calling error. EXINT is an interrupt. - -INTERRUPTS: In an interactive shell, an interrupt will cause an -EXINT exception to return to the main command loop. (Exception: -EXINT is not raised if the user traps interrupts using the trap -command.) The INTOFF and INTON macros (defined in exception.h) -provide uninterruptible critical sections. Between the execution -of INTOFF and the execution of INTON, interrupt signals will be -held for later delivery. INTOFF and INTON can be nested. - -MEMALLOC.C: Memalloc.c defines versions of malloc and realloc -which call error when there is no memory left. It also defines a -stack oriented memory allocation scheme. Allocating off a stack -is probably more efficient than allocation using malloc, but the -big advantage is that when an exception occurs all we have to do -to free up the memory in use at the time of the exception is to -restore the stack pointer. The stack is implemented using a -linked list of blocks. - -STPUTC: If the stack were contiguous, it would be easy to store -strings on the stack without knowing in advance how long the -string was going to be: - p = stackptr; - *p++ = c; /* repeated as many times as needed */ - stackptr = p; -The following three macros (defined in memalloc.h) perform these -operations, but grow the stack if you run off the end: - STARTSTACKSTR(p); - STPUTC(c, p); /* repeated as many times as needed */ - grabstackstr(p); - -We now start a top-down look at the code: - -MAIN.C: The main routine performs some initialization, executes -the user's profile if necessary, and calls cmdloop. Cmdloop -repeatedly parses and executes commands. - -OPTIONS.C: This file contains the option processing code. It is -called from main to parse the shell arguments when the shell is -invoked, and it also contains the set builtin. The -i and -m op- -tions (the latter turns on job control) require changes in signal -handling. The routines setjobctl (in jobs.c) and setinteractive -(in trap.c) are called to handle changes to these options. - -PARSING: The parser code is all in parser.c. A recursive des- -cent parser is used. Syntax tables (generated by mksyntax) are -used to classify characters during lexical analysis. There are -four tables: one for normal use, one for use when inside single -quotes and dollar single quotes, one for use when inside double -quotes and one for use in arithmetic. The tables are machine -dependent because they are indexed by character variables and -the range of a char varies from machine to machine. - -PARSE OUTPUT: The output of the parser consists of a tree of -nodes. The various types of nodes are defined in the file node- -types. - -Nodes of type NARG are used to represent both words and the con- -tents of here documents. An early version of ash kept the con- -tents of here documents in temporary files, but keeping here do- -cuments in memory typically results in significantly better per- -formance. It would have been nice to make it an option to use -temporary files for here documents, for the benefit of small -machines, but the code to keep track of when to delete the tem- -porary files was complex and I never fixed all the bugs in it. -(AT&T has been maintaining the Bourne shell for more than ten -years, and to the best of my knowledge they still haven't gotten -it to handle temporary files correctly in obscure cases.) - -The text field of a NARG structure points to the text of the -word. The text consists of ordinary characters and a number of -special codes defined in parser.h. The special codes are: - - CTLVAR Parameter expansion - CTLENDVAR End of parameter expansion - CTLBACKQ Command substitution - CTLBACKQ|CTLQUOTE Command substitution inside double quotes - CTLARI Arithmetic expansion - CTLENDARI End of arithmetic expansion - CTLESC Escape next character - -A variable substitution contains the following elements: - - CTLVAR type name '=' [ alternative-text CTLENDVAR ] - -The type field is a single character specifying the type of sub- -stitution. The possible types are: - - VSNORMAL $var - VSMINUS ${var-text} - VSMINUS|VSNUL ${var:-text} - VSPLUS ${var+text} - VSPLUS|VSNUL ${var:+text} - VSQUESTION ${var?text} - VSQUESTION|VSNUL ${var:?text} - VSASSIGN ${var=text} - VSASSIGN|VSNUL ${var:=text} - VSTRIMLEFT ${var#text} - VSTRIMLEFTMAX ${var##text} - VSTRIMRIGHT ${var%text} - VSTRIMRIGHTMAX ${var%%text} - VSLENGTH ${#var} - VSERROR delayed error - -In addition, the type field will have the VSQUOTE flag set if the -variable is enclosed in double quotes and the VSLINENO flag if -LINENO is being expanded (the parameter name is the decimal line -number). The parameter's name comes next, terminated by an equals -sign. If the type is not VSNORMAL (including when it is VSLENGTH), -then the text field in the substitution follows, terminated by a -CTLENDVAR byte. - -The type VSERROR is used to allow parsing bad substitutions like -${var[7]} and generate an error when they are expanded. - -Commands in back quotes are parsed and stored in a linked list. -The locations of these commands in the string are indicated by -CTLBACKQ and CTLBACKQ+CTLQUOTE characters, depending upon whether -the back quotes were enclosed in double quotes. - -Arithmetic expansion starts with CTLARI and ends with CTLENDARI. - -The character CTLESC escapes the next character, so that in case -any of the CTL characters mentioned above appear in the input, -they can be passed through transparently. CTLESC is also used to -escape '*', '?', '[', and '!' characters which were quoted by the -user and thus should not be used for file name generation. - -CTLESC characters have proved to be particularly tricky to get -right. In the case of here documents which are not subject to -variable and command substitution, the parser doesn't insert any -CTLESC characters to begin with (so the contents of the text -field can be written without any processing). Other here docu- -ments, and words which are not subject to file name generation, -have the CTLESC characters removed during the variable and command -substitution phase. Words which are subject to file name -generation have the CTLESC characters removed as part of the file -name phase. - -EXECUTION: Command execution is handled by the following files: - eval.c The top level routines. - redir.c Code to handle redirection of input and output. - jobs.c Code to handle forking, waiting, and job control. - exec.c Code to do path searches and the actual exec sys call. - expand.c Code to evaluate arguments. - var.c Maintains the variable symbol table. Called from expand.c. - -EVAL.C: Evaltree recursively executes a parse tree. The exit -status is returned in the global variable exitstatus. The alter- -native entry evalbackcmd is called to evaluate commands in back -quotes. It saves the result in memory if the command is a buil- -tin; otherwise it forks off a child to execute the command and -connects the standard output of the child to a pipe. - -JOBS.C: To create a process, you call makejob to return a job -structure, and then call forkshell (passing the job structure as -an argument) to create the process. Waitforjob waits for a job -to complete. These routines take care of process groups if job -control is defined. - -REDIR.C: Ash allows file descriptors to be redirected and then -restored without forking off a child process. This is accom- -plished by duplicating the original file descriptors. The redir- -tab structure records where the file descriptors have been dupli- -cated to. - -EXEC.C: The routine find_command locates a command, and enters -the command in the hash table if it is not already there. The -third argument specifies whether it is to print an error message -if the command is not found. (When a pipeline is set up, -find_command is called for all the commands in the pipeline be- -fore any forking is done, so to get the commands into the hash -table of the parent process. But to make command hashing as -transparent as possible, we silently ignore errors at that point -and only print error messages if the command cannot be found -later.) - -The routine shellexec is the interface to the exec system call. - -EXPAND.C: As the routine argstr generates words by parameter -expansion, command substitution and arithmetic expansion, it -performs word splitting on the result. As each word is output, -the routine expandmeta performs file name generation (if enabled). - -VAR.C: Variables are stored in a hash table. Probably we should -switch to extensible hashing. The variable name is stored in the -same string as the value (using the format "name=value") so that -no string copying is needed to create the environment of a com- -mand. Variables which the shell references internally are preal- -located so that the shell can reference the values of these vari- -ables without doing a lookup. - -When a program is run, the code in eval.c sticks any environment -variables which precede the command (as in "PATH=xxx command") in -the variable table as the simplest way to strip duplicates, and -then calls "environment" to get the value of the environment. - -BUILTIN COMMANDS: The procedures for handling these are scat- -tered throughout the code, depending on which location appears -most appropriate. They can be recognized because their names al- -ways end in "cmd". The mapping from names to procedures is -specified in the file builtins.def, which is processed by the -mkbuiltins command. - -A builtin command is invoked with argc and argv set up like a -normal program. A builtin command is allowed to overwrite its -arguments. Builtin routines can call nextopt to do option pars- -ing. This is kind of like getopt, but you don't pass argc and -argv to it. Builtin routines can also call error. This routine -normally terminates the shell (or returns to the main command -loop if the shell is interactive), but when called from a non- -special builtin command it causes the builtin command to -terminate with an exit status of 2. - -The directory bltins contains commands which can be compiled in- -dependently but can also be built into the shell for efficiency -reasons. The header file bltin.h takes care of most of the -differences between the ash and the stand-alone environment. -The user should call the main routine "main", and #define main to -be the name of the routine to use when the program is linked into -ash. This #define should appear before bltin.h is included; -bltin.h will #undef main if the program is to be compiled -stand-alone. A similar approach is used for a few utilities from -bin and usr.bin. - -CD.C: This file defines the cd and pwd builtins. - -SIGNALS: Trap.c implements the trap command. The routine set- -signal figures out what action should be taken when a signal is -received and invokes the signal system call to set the signal ac- -tion appropriately. When a signal that a user has set a trap for -is caught, the routine "onsig" sets a flag. The routine dotrap -is called at appropriate points to actually handle the signal. -When an interrupt is caught and no trap has been set for that -signal, the routine "onint" in error.c is called. - -OUTPUT: Ash uses its own output routines. There are three out- -put structures allocated. "Output" represents the standard out- -put, "errout" the standard error, and "memout" contains output -which is to be stored in memory. This last is used when a buil- -tin command appears in backquotes, to allow its output to be col- -lected without doing any I/O through the UNIX operating system. -The variables out1 and out2 normally point to output and errout, -respectively, but they are set to point to memout when appropri- -ate inside backquotes. - -INPUT: The basic input routine is pgetc, which reads from the -current input file. There is a stack of input files; the current -input file is the top file on this stack. The code allows the -input to come from a string rather than a file. (This is for the --c option and the "." and eval builtin commands.) The global -variable plinno is saved and restored when files are pushed and -popped from the stack. The parser routines store the number of -the current line in this variable. - -DEBUGGING: If DEBUG is defined in shell.h, then the shell will -write debugging information to the file $HOME/trace. Most of -this is done using the TRACE macro, which takes a set of printf -arguments inside two sets of parenthesis. Example: -"TRACE(("n=%d0, n))". The double parenthesis are necessary be- -cause the preprocessor can't handle functions with a variable -number of arguments. Defining DEBUG also causes the shell to -generate a core dump if it is sent a quit signal. The tracing -code is in show.c. diff --git a/bin/1sh/alias.c b/bin/1sh/alias.c deleted file mode 100644 index e343b853..00000000 --- a/bin/1sh/alias.c +++ /dev/null @@ -1,256 +0,0 @@ -/*- - * Copyright (c) 1993 - * The Regents of the University of California. All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * Kenneth Almquist. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#ifndef lint -#if 0 -static char sccsid[] = "@(#)alias.c 8.3 (Berkeley) 5/4/95"; -#endif -#endif /* not lint */ -#include <sys/cdefs.h> -/* $FreeBSD: releng/12.1/bin/sh/alias.c 317039 2017-04-16 22:10:02Z jilles $ */ - -#include <stdlib.h> -#include "shell.h" -#include "output.h" -#include "error.h" -#include "memalloc.h" -#include "mystring.h" -#include "alias.h" -#include "options.h" -#include "builtins.h" - -#define ATABSIZE 39 - -static struct alias *atab[ATABSIZE]; -static int aliases; - -static void setalias(const char *, const char *); -static int unalias(const char *); -static struct alias **hashalias(const char *); - -static -void -setalias(const char *name, const char *val) -{ - struct alias *ap, **app; - - unalias(name); - app = hashalias(name); - INTOFF; - ap = ckmalloc(sizeof (struct alias)); - ap->name = savestr(name); - ap->val = savestr(val); - ap->flag = 0; - ap->next = *app; - *app = ap; - aliases++; - INTON; -} - -static void -freealias(struct alias *ap) -{ - ckfree(ap->name); - ckfree(ap->val); - ckfree(ap); -} - -static int -unalias(const char *name) -{ - struct alias *ap, **app; - - app = hashalias(name); - - for (ap = *app; ap; app = &(ap->next), ap = ap->next) { - if (equal(name, ap->name)) { - /* - * if the alias is currently in use (i.e. its - * buffer is being used by the input routine) we - * just null out the name instead of freeing it. - * We could clear it out later, but this situation - * is so rare that it hardly seems worth it. - */ - if (ap->flag & ALIASINUSE) - *ap->name = '\0'; - else { - INTOFF; - *app = ap->next; - freealias(ap); - INTON; - } - aliases--; - return (0); - } - } - - return (1); -} - -static void -rmaliases(void) -{ - struct alias *ap, **app; - int i; - - INTOFF; - for (i = 0; i < ATABSIZE; i++) { - app = &atab[i]; - while (*app) { - ap = *app; - if (ap->flag & ALIASINUSE) { - *ap->name = '\0'; - app = &(*app)->next; - } else { - *app = ap->next; - freealias(ap); - } - } - } - aliases = 0; - INTON; -} - -struct alias * -lookupalias(const char *name, int check) -{ - struct alias *ap; - - if (aliases == 0) - return (NULL); - for (ap = *hashalias(name); ap; ap = ap->next) { - if (equal(name, ap->name)) { - if (check && (ap->flag & ALIASINUSE)) - return (NULL); - return (ap); - } - } - - return (NULL); -} - -static int -comparealiases(const void *p1, const void *p2) -{ - const struct alias *const *a1 = p1; - const struct alias *const *a2 = p2; - - return strcmp((*a1)->name, (*a2)->name); -} - -static void -printalias(const struct alias *a) -{ - out1fmt("%s=", a->name); - out1qstr(a->val); - out1c('\n'); -} - -static void -printaliases(void) -{ - int i, j; - struct alias **sorted, *ap; - - INTOFF; - sorted = ckmalloc(aliases * sizeof(*sorted)); - j = 0; - for (i = 0; i < ATABSIZE; i++) - for (ap = atab[i]; ap; ap = ap->next) - if (*ap->name != '\0') - sorted[j++] = ap; - qsort(sorted, aliases, sizeof(*sorted), comparealiases); - for (i = 0; i < aliases; i++) { - printalias(sorted[i]); - if (int_pending()) - break; - } - ckfree(sorted); - INTON; -} - -int -aliascmd(int argc __unused, char **argv __unused) -{ - char *n, *v; - int ret = 0; - struct alias *ap; - - nextopt(""); - - if (*argptr == NULL) { - printaliases(); - return (0); - } - while ((n = *argptr++) != NULL) { - if ((v = strchr(n+1, '=')) == NULL) /* n+1: funny ksh stuff */ - if ((ap = lookupalias(n, 0)) == NULL) { - warning("%s: not found", n); - ret = 1; - } else - printalias(ap); - else { - *v++ = '\0'; - setalias(n, v); - } - } - - return (ret); -} - -int -unaliascmd(int argc __unused, char **argv __unused) -{ - int i; - - while ((i = nextopt("a")) != '\0') { - if (i == 'a') { - rmaliases(); - return (0); - } - } - for (i = 0; *argptr; argptr++) - i |= unalias(*argptr); - - return (i); -} - -static struct alias ** -hashalias(const char *p) -{ - unsigned int hashval; - - hashval = (unsigned char)*p << 4; - while (*p) - hashval+= *p++; - return &atab[hashval % ATABSIZE]; -} diff --git a/bin/1sh/alias.h b/bin/1sh/alias.h deleted file mode 100644 index 625d1a50..00000000 --- a/bin/1sh/alias.h +++ /dev/null @@ -1,45 +0,0 @@ -/*- - * Copyright (c) 1993 - * The Regents of the University of California. All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * Kenneth Almquist. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)alias.h 8.2 (Berkeley) 5/4/95 - * $FreeBSD: releng/12.1/bin/sh/alias.h 314436 2017-02-28 23:42:47Z imp $ - */ - -#define ALIASINUSE 1 - -struct alias { - struct alias *next; - char *name; - char *val; - int flag; -}; - -struct alias *lookupalias(const char *, int); diff --git a/bin/1sh/arith.h b/bin/1sh/arith.h deleted file mode 100644 index ecaad30f..00000000 --- a/bin/1sh/arith.h +++ /dev/null @@ -1,37 +0,0 @@ -/*- - * Copyright (c) 1995 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)arith.h 1.1 (Berkeley) 5/4/95 - * $FreeBSD: releng/12.1/bin/sh/arith.h 315511 2017-03-18 20:41:07Z jilles $ - */ - -#include "shell.h" - -#define DIGITS(var) (3 + (2 + CHAR_BIT * sizeof((var))) / 3) - -arith_t arith(const char *); diff --git a/bin/1sh/arith_yacc.c b/bin/1sh/arith_yacc.c deleted file mode 100644 index 57285831..00000000 --- a/bin/1sh/arith_yacc.c +++ /dev/null @@ -1,381 +0,0 @@ -/*- - * Copyright (c) 1993 - * The Regents of the University of California. All rights reserved. - * Copyright (c) 2007 - * Herbert Xu <herbert@gondor.apana.org.au>. All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * Kenneth Almquist. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include <sys/cdefs.h> -/* $FreeBSD: releng/12.1/bin/sh/arith_yacc.c 345117 2019-03-13 21:53:10Z jilles $ */ - -#include <limits.h> -#include <errno.h> -#include <inttypes.h> -#include <stdlib.h> -#include <stdio.h> -#include "arith.h" -#include "arith_yacc.h" -#include "expand.h" -#include "shell.h" -#include "error.h" -#include "memalloc.h" -#include "output.h" -#include "options.h" -#include "var.h" - -#if ARITH_BOR + 11 != ARITH_BORASS || ARITH_ASS + 11 != ARITH_EQ -#error Arithmetic tokens are out of order. -#endif - -static const char *arith_startbuf; - -const char *arith_buf; -union yystype yylval; - -static int last_token; - -#define ARITH_PRECEDENCE(op, prec) [op - ARITH_BINOP_MIN] = prec - -static const char prec[ARITH_BINOP_MAX - ARITH_BINOP_MIN] = { - ARITH_PRECEDENCE(ARITH_MUL, 0), - ARITH_PRECEDENCE(ARITH_DIV, 0), - ARITH_PRECEDENCE(ARITH_REM, 0), - ARITH_PRECEDENCE(ARITH_ADD, 1), - ARITH_PRECEDENCE(ARITH_SUB, 1), - ARITH_PRECEDENCE(ARITH_LSHIFT, 2), - ARITH_PRECEDENCE(ARITH_RSHIFT, 2), - ARITH_PRECEDENCE(ARITH_LT, 3), - ARITH_PRECEDENCE(ARITH_LE, 3), - ARITH_PRECEDENCE(ARITH_GT, 3), - ARITH_PRECEDENCE(ARITH_GE, 3), - ARITH_PRECEDENCE(ARITH_EQ, 4), - ARITH_PRECEDENCE(ARITH_NE, 4), - ARITH_PRECEDENCE(ARITH_BAND, 5), - ARITH_PRECEDENCE(ARITH_BXOR, 6), - ARITH_PRECEDENCE(ARITH_BOR, 7), -}; - -#define ARITH_MAX_PREC 8 - -int letcmd(int, char **); - -static __attribute__((noreturn)) void yyerror(const char *s) -{ - error("arithmetic expression: %s: \"%s\"", s, arith_startbuf); - /* NOTREACHED */ -} - -static arith_t arith_lookupvarint(char *varname) -{ - const char *str; - char *p; - arith_t result; - - str = lookupvar(varname); - if (uflag && str == NULL) - yyerror("variable not set"); - if (str == NULL || *str == '\0') - str = "0"; - errno = 0; - result = strtoarith_t(str, &p); - if (errno != 0 || *p != '\0') - yyerror("variable conversion error"); - return result; -} - -static inline int arith_prec(int op) -{ - return prec[op - ARITH_BINOP_MIN]; -} - -static inline int higher_prec(int op1, int op2) -{ - return arith_prec(op1) < arith_prec(op2); -} - -static arith_t do_binop(int op, arith_t a, arith_t b) -{ - - switch (op) { - default: - case ARITH_REM: - case ARITH_DIV: - if (!b) - yyerror("division by zero"); - if (a == ARITH_MIN && b == -1) - yyerror("divide error"); - return op == ARITH_REM ? a % b : a / b; - case ARITH_MUL: - return (uintmax_t)a * (uintmax_t)b; - case ARITH_ADD: - return (uintmax_t)a + (uintmax_t)b; - case ARITH_SUB: - return (uintmax_t)a - (uintmax_t)b; - case ARITH_LSHIFT: - return (uintmax_t)a << (b & (sizeof(uintmax_t) * CHAR_BIT - 1)); - case ARITH_RSHIFT: - return a >> (b & (sizeof(uintmax_t) * CHAR_BIT - 1)); - case ARITH_LT: - return a < b; - case ARITH_LE: - return a <= b; - case ARITH_GT: - return a > b; - case ARITH_GE: - return a >= b; - case ARITH_EQ: - return a == b; - case ARITH_NE: - return a != b; - case ARITH_BAND: - return a & b; - case ARITH_BXOR: - return a ^ b; - case ARITH_BOR: - return a | b; - } -} - -static arith_t assignment(int var, int noeval); - -static arith_t primary(int token, union yystype *val, int op, int noeval) -{ - arith_t result; - -again: - switch (token) { - case ARITH_LPAREN: - result = assignment(op, noeval); - if (last_token != ARITH_RPAREN) - yyerror("expecting ')'"); - last_token = yylex(); - return result; - case ARITH_NUM: - last_token = op; - return val->val; - case ARITH_VAR: - last_token = op; - return noeval ? val->val : arith_lookupvarint(val->name); - case ARITH_ADD: - token = op; - *val = yylval; - op = yylex(); - goto again; - case ARITH_SUB: - *val = yylval; - return -primary(op, val, yylex(), noeval); - case ARITH_NOT: - *val = yylval; - return !primary(op, val, yylex(), noeval); - case ARITH_BNOT: - *val = yylval; - return ~primary(op, val, yylex(), noeval); - default: - yyerror("expecting primary"); - } -} - -static arith_t binop2(arith_t a, int op, int precedence, int noeval) -{ - for (;;) { - union yystype val; - arith_t b; - int op2; - int token; - - token = yylex(); - val = yylval; - - b = primary(token, &val, yylex(), noeval); - - op2 = last_token; - if (op2 >= ARITH_BINOP_MIN && op2 < ARITH_BINOP_MAX && - higher_prec(op2, op)) { - b = binop2(b, op2, arith_prec(op), noeval); - op2 = last_token; - } - - a = noeval ? b : do_binop(op, a, b); - - if (op2 < ARITH_BINOP_MIN || op2 >= ARITH_BINOP_MAX || - arith_prec(op2) >= precedence) - return a; - - op = op2; - } -} - -static arith_t binop(int token, union yystype *val, int op, int noeval) -{ - arith_t a = primary(token, val, op, noeval); - - op = last_token; - if (op < ARITH_BINOP_MIN || op >= ARITH_BINOP_MAX) - return a; - - return binop2(a, op, ARITH_MAX_PREC, noeval); -} - -static arith_t and(int token, union yystype *val, int op, int noeval) -{ - arith_t a = binop(token, val, op, noeval); - arith_t b; - - op = last_token; - if (op != ARITH_AND) - return a; - - token = yylex(); - *val = yylval; - - b = and(token, val, yylex(), noeval | !a); - - return a && b; -} - -static arith_t or(int token, union yystype *val, int op, int noeval) -{ - arith_t a = and(token, val, op, noeval); - arith_t b; - - op = last_token; - if (op != ARITH_OR) - return a; - - token = yylex(); - *val = yylval; - - b = or(token, val, yylex(), noeval | !!a); - - return a || b; -} - -static arith_t cond(int token, union yystype *val, int op, int noeval) -{ - arith_t a = or(token, val, op, noeval); - arith_t b; - arith_t c; - - if (last_token != ARITH_QMARK) - return a; - - b = assignment(yylex(), noeval | !a); - - if (last_token != ARITH_COLON) - yyerror("expecting ':'"); - - token = yylex(); - *val = yylval; - - c = cond(token, val, yylex(), noeval | !!a); - - return a ? b : c; -} - -static arith_t assignment(int var, int noeval) -{ - union yystype val = yylval; - int op = yylex(); - arith_t result; - char sresult[DIGITS(result) + 1]; - - if (var != ARITH_VAR) - return cond(var, &val, op, noeval); - - if (op != ARITH_ASS && (op < ARITH_ASS_MIN || op >= ARITH_ASS_MAX)) - return cond(var, &val, op, noeval); - - result = assignment(yylex(), noeval); - if (noeval) - return result; - - if (op != ARITH_ASS) - result = do_binop(op - 11, arith_lookupvarint(val.name), result); - snprintf(sresult, sizeof(sresult), ARITH_FORMAT_STR, result); - setvar(val.name, sresult, 0); - return result; -} - -arith_t arith(const char *s) -{ - struct stackmark smark; - arith_t result; - - setstackmark(&smark); - - arith_buf = arith_startbuf = s; - - result = assignment(yylex(), 0); - - if (last_token) - yyerror("expecting EOF"); - - popstackmark(&smark); - - return result; -} - -/* - * The exp(1) builtin. - */ -int -letcmd(int argc, char **argv) -{ - const char *p; - char *concat; - char **ap; - arith_t i; - - if (argc > 1) { - p = argv[1]; - if (argc > 2) { - /* - * Concatenate arguments. - */ - STARTSTACKSTR(concat); - ap = argv + 2; - for (;;) { - while (*p) - STPUTC(*p++, concat); - if ((p = *ap++) == NULL) - break; - STPUTC(' ', concat); - } - STPUTC('\0', concat); - p = grabstackstr(concat); - } - } else - p = ""; - - i = arith(p); - - out1fmt(ARITH_FORMAT_STR "\n", i); - return !i; -} diff --git a/bin/1sh/arith_yacc.h b/bin/1sh/arith_yacc.h deleted file mode 100644 index 433481bb..00000000 --- a/bin/1sh/arith_yacc.h +++ /dev/null @@ -1,94 +0,0 @@ -/*- - * Copyright (c) 1993 - * The Regents of the University of California. All rights reserved. - * Copyright (c) 2007 - * Herbert Xu <herbert@gondor.apana.org.au>. All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * Kenneth Almquist. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $FreeBSD: releng/12.1/bin/sh/arith_yacc.h 345117 2019-03-13 21:53:10Z jilles $ - */ - -#define ARITH_ASS 1 - -#define ARITH_OR 2 -#define ARITH_AND 3 -#define ARITH_BAD 4 -#define ARITH_NUM 5 -#define ARITH_VAR 6 -#define ARITH_NOT 7 - -#define ARITH_BINOP_MIN 8 -#define ARITH_LE 8 -#define ARITH_GE 9 -#define ARITH_LT 10 -#define ARITH_GT 11 -#define ARITH_EQ 12 -#define ARITH_REM 13 -#define ARITH_BAND 14 -#define ARITH_LSHIFT 15 -#define ARITH_RSHIFT 16 -#define ARITH_MUL 17 -#define ARITH_ADD 18 -#define ARITH_BOR 19 -#define ARITH_SUB 20 -#define ARITH_BXOR 21 -#define ARITH_DIV 22 -#define ARITH_NE 23 -#define ARITH_BINOP_MAX 24 - -#define ARITH_ASS_MIN 24 -#define ARITH_REMASS 24 -#define ARITH_BANDASS 25 -#define ARITH_LSHIFTASS 26 -#define ARITH_RSHIFTASS 27 -#define ARITH_MULASS 28 -#define ARITH_ADDASS 29 -#define ARITH_BORASS 30 -#define ARITH_SUBASS 31 -#define ARITH_BXORASS 32 -#define ARITH_DIVASS 33 -#define ARITH_ASS_MAX 34 - -#define ARITH_LPAREN 34 -#define ARITH_RPAREN 35 -#define ARITH_BNOT 36 -#define ARITH_QMARK 37 -#define ARITH_COLON 38 - -extern const char *arith_buf; - -union yystype { - arith_t val; - char *name; -}; - -extern union yystype yylval; - -arith_t strtoarith_t(const char *restrict nptr, char **restrict endptr); -int yylex(void); diff --git a/bin/1sh/arith_yylex.c b/bin/1sh/arith_yylex.c deleted file mode 100644 index da3a4f70..00000000 --- a/bin/1sh/arith_yylex.c +++ /dev/null @@ -1,276 +0,0 @@ -/*- - * Copyright (c) 2002 - * Herbert Xu. - * Copyright (c) 1993 - * The Regents of the University of California. All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * Kenneth Almquist. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include <sys/cdefs.h> -/* $FreeBSD: releng/12.1/bin/sh/arith_yylex.c 345117 2019-03-13 21:53:10Z jilles $ */ - -#include <ctype.h> -#include <errno.h> -#include <inttypes.h> -#include <stdlib.h> -#include <string.h> -#include "shell.h" -#include "arith_yacc.h" -#include "expand.h" -#include "error.h" -#include "memalloc.h" -#include "parser.h" -#include "syntax.h" - -#if ARITH_BOR + 11 != ARITH_BORASS || ARITH_ASS + 11 != ARITH_EQ -#error Arithmetic tokens are out of order. -#endif - -arith_t -strtoarith_t(const char *restrict nptr, char **restrict endptr) -{ - arith_t val; - - while (isspace((unsigned char)*nptr)) - nptr++; - switch (*nptr) { - case '-': - return strtoimax(nptr, endptr, 0); - case '0': - return (arith_t)strtoumax(nptr, endptr, 0); - default: - val = (arith_t)strtoumax(nptr, endptr, 0); - if (val >= 0) - return val; - else if (val == ARITH_MIN) { - errno = ERANGE; - return ARITH_MIN; - } else { - errno = ERANGE; - return ARITH_MAX; - } - } -} - -int -yylex(void) -{ - int value; - const char *buf = arith_buf; - char *end; - const char *p; - - for (;;) { - value = *buf; - switch (value) { - case ' ': - case '\t': - case '\n': - buf++; - continue; - default: - return ARITH_BAD; - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': - yylval.val = strtoarith_t(buf, &end); - arith_buf = end; - return ARITH_NUM; - case 'A': - case 'B': - case 'C': - case 'D': - case 'E': - case 'F': - case 'G': - case 'H': - case 'I': - case 'J': - case 'K': - case 'L': - case 'M': - case 'N': - case 'O': - case 'P': - case 'Q': - case 'R': - case 'S': - case 'T': - case 'U': - case 'V': - case 'W': - case 'X': - case 'Y': - case 'Z': - case '_': - case 'a': - case 'b': - case 'c': - case 'd': - case 'e': - case 'f': - case 'g': - case 'h': - case 'i': - case 'j': - case 'k': - case 'l': - case 'm': - case 'n': - case 'o': - case 'p': - case 'q': - case 'r': - case 's': - case 't': - case 'u': - case 'v': - case 'w': - case 'x': - case 'y': - case 'z': - p = buf; - while (buf++, is_in_name(*buf)) - ; - yylval.name = stalloc(buf - p + 1); - memcpy(yylval.name, p, buf - p); - yylval.name[buf - p] = '\0'; - value = ARITH_VAR; - goto out; - case '=': - value += ARITH_ASS - '='; -checkeq: - buf++; -checkeqcur: - if (*buf != '=') - goto out; - value += 11; - break; - case '>': - switch (*++buf) { - case '=': - value += ARITH_GE - '>'; - break; - case '>': - value += ARITH_RSHIFT - '>'; - goto checkeq; - default: - value += ARITH_GT - '>'; - goto out; - } - break; - case '<': - switch (*++buf) { - case '=': - value += ARITH_LE - '<'; - break; - case '<': - value += ARITH_LSHIFT - '<'; - goto checkeq; - default: - value += ARITH_LT - '<'; - goto out; - } - break; - case '|': - if (*++buf != '|') { - value += ARITH_BOR - '|'; - goto checkeqcur; - } - value += ARITH_OR - '|'; - break; - case '&': - if (*++buf != '&') { - value += ARITH_BAND - '&'; - goto checkeqcur; - } - value += ARITH_AND - '&'; - break; - case '!': - if (*++buf != '=') { - value += ARITH_NOT - '!'; - goto out; - } - value += ARITH_NE - '!'; - break; - case 0: - goto out; - case '(': - value += ARITH_LPAREN - '('; - break; - case ')': - value += ARITH_RPAREN - ')'; - break; - case '*': - value += ARITH_MUL - '*'; - goto checkeq; - case '/': - value += ARITH_DIV - '/'; - goto checkeq; - case '%': - value += ARITH_REM - '%'; - goto checkeq; - case '+': - if (buf[1] == '+') - return ARITH_BAD; - value += ARITH_ADD - '+'; - goto checkeq; - case '-': - if (buf[1] == '-') - return ARITH_BAD; - value += ARITH_SUB - '-'; - goto checkeq; - case '~': - value += ARITH_BNOT - '~'; - break; - case '^': - value += ARITH_BXOR - '^'; - goto checkeq; - case '?': - value += ARITH_QMARK - '?'; - break; - case ':': - value += ARITH_COLON - ':'; - break; - } - break; - } - - buf++; -out: - arith_buf = buf; - return value; -} diff --git a/bin/1sh/bltin.h b/bin/1sh/bltin.h deleted file mode 100644 index 3d2cb4d3..00000000 --- a/bin/1sh/bltin.h +++ /dev/null @@ -1,81 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-3-Clause - * - * Copyright (c) 1991, 1993 - * The Regents of the University of California. All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * Kenneth Almquist. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)bltin.h 8.2 (Berkeley) 5/4/95 - * $FreeBSD: releng/12.1/bin/sh/bltin/bltin.h 326025 2017-11-20 19:49:47Z pfg $ - */ - -/* - * This file is included by programs which are optionally built into the - * shell. If SHELL is defined, we try to map the standard UNIX library - * routines to ash routines using defines. - */ - -#include "shell.h" -#include "mystring.h" -#ifdef SHELL -#include "error.h" -#include "output.h" -#include "builtins.h" -#define FILE struct output -#undef stdout -#define stdout out1 -#undef stderr -#define stderr out2 -#define printf out1fmt -#undef putc -#define putc(c, file) outc(c, file) -#undef putchar -#define putchar(c) out1c(c) -#define fprintf outfmt -#define fputs outstr -#define fwrite(ptr, size, nmemb, file) outbin(ptr, (size) * (nmemb), file) -#define fflush flushout -#define INITARGS(argv) -#define warnx warning -#define warn(fmt, ...) warning(fmt ": %s", __VA_ARGS__, strerror(errno)) -#define errx(exitstatus, ...) error(__VA_ARGS__) - -#else -#undef NULL -#include <stdio.h> -#undef main -#define INITARGS(argv) if ((commandname = argv[0]) == NULL) {fputs("Argc is zero\n", stderr); exit(2);} else -#endif - -#include <unistd.h> - -pointer stalloc(int); -int killjob(const char *, int); - -extern char *commandname; diff --git a/bin/1sh/builtins.def b/bin/1sh/builtins.def deleted file mode 100644 index 5986a5a6..00000000 --- a/bin/1sh/builtins.def +++ /dev/null @@ -1,96 +0,0 @@ -#!/bin/sh - - -#- -# Copyright (c) 1991, 1993 -# The Regents of the University of California. All rights reserved. -# -# This code is derived from software contributed to Berkeley by -# Kenneth Almquist. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in the -# documentation and/or other materials provided with the distribution. -# 3. Neither the name of the University nor the names of its contributors -# may be used to endorse or promote products derived from this software -# without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND -# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -# ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE -# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -# SUCH DAMAGE. -# -# @(#)builtins.def 8.4 (Berkeley) 5/4/95 -# $FreeBSD: releng/12.1/bin/sh/builtins.def 319576 2017-06-04 21:02:48Z bdrewery $ - -# -# This file lists all the builtin commands. The first column is the name -# of a C routine. -# The -j flag specifies that this command is to be excluded from systems -# without job control. -# The -h flag specifies that this command is to be excluded from systems -# based on the NO_HISTORY compile-time symbol. -# The -n flag specifies that this command can safely be run in the same -# process when it is the only command in a command substitution. Some -# commands have special logic defined in safe_builtin(). -# The -s flag specifies that this is a POSIX 'special built-in' command. -# The rest of the line specifies the command name or names used to run the -# command. The entry for bltincmd, which is run when the user does not specify -# a command, must come first. -# -# NOTE: bltincmd must come first! - -bltincmd -n builtin -aliascmd alias -bgcmd -j bg -bindcmd bind -breakcmd -s break -s continue -cdcmd cd chdir -commandcmd -n command -dotcmd -s . -echocmd -n echo -evalcmd -s eval -execcmd -s exec -exitcmd -s exit -letcmd let -exportcmd -s export -s readonly -#exprcmd expr -falsecmd -n false -fgcmd -j fg -freebsd_wordexpcmd freebsd_wordexp -getoptscmd getopts -hashcmd hash -histcmd -h fc -jobidcmd -n jobid -jobscmd -n jobs -killcmd -n kill -localcmd local -printfcmd -n printf -pwdcmd -n pwd -readcmd read -returncmd -s return -setcmd -s set -setvarcmd setvar -shiftcmd -s shift -testcmd -n test [ -timescmd -n -s times -trapcmd -s trap -truecmd -n -s : true -typecmd -n type -ulimitcmd ulimit -umaskcmd umask -unaliascmd unalias -unsetcmd -s unset -waitcmd wait -wordexpcmd wordexp diff --git a/bin/1sh/cd.c b/bin/1sh/cd.c deleted file mode 100644 index 61bb60cf..00000000 --- a/bin/1sh/cd.c +++ /dev/null @@ -1,430 +0,0 @@ -/*- - * Copyright (c) 1991, 1993 - * The Regents of the University of California. All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * Kenneth Almquist. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#ifndef lint -#if 0 -static char sccsid[] = "@(#)cd.c 8.2 (Berkeley) 5/4/95"; -#endif -#endif /* not lint */ -#include <sys/cdefs.h> -/* $FreeBSD: releng/12.1/bin/sh/cd.c 336320 2018-07-15 21:55:17Z jilles $ */ - -#include <sys/types.h> -#include <sys/stat.h> -#include <stdlib.h> -#include <string.h> -#include <unistd.h> -#include <errno.h> -#include <limits.h> - -/* - * The cd and pwd commands. - */ - -#include "shell.h" -#include "var.h" -#include "nodes.h" /* for jobs.h */ -#include "jobs.h" -#include "options.h" -#include "output.h" -#include "memalloc.h" -#include "error.h" -#include "exec.h" -#include "redir.h" -#include "mystring.h" -#include "show.h" -#include "cd.h" -#include "builtins.h" - -static int cdlogical(char *); -static int cdphysical(char *); -static int docd(char *, int, int); -static char *getcomponent(char **); -static char *findcwd(char *); -static void updatepwd(char *); -static char *getpwd(void); -static char *getpwd2(void); - -static char *curdir = NULL; /* current working directory */ - -int -cdcmd(int argc __unused, char **argv __unused) -{ - const char *dest; - const char *path; - char *p; - struct stat statb; - int ch, phys, print = 0, getcwderr = 0; - int rc; - int errno1 = ENOENT; - - phys = Pflag; - while ((ch = nextopt("eLP")) != '\0') { - switch (ch) { - case 'e': - getcwderr = 1; - break; - case 'L': - phys = 0; - break; - case 'P': - phys = 1; - break; - } - } - - if (*argptr != NULL && argptr[1] != NULL) - error("too many arguments"); - - if ((dest = *argptr) == NULL && (dest = bltinlookup("HOME", 1)) == NULL) - error("HOME not set"); - if (*dest == '\0') - dest = "."; - if (dest[0] == '-' && dest[1] == '\0') { - dest = bltinlookup("OLDPWD", 1); - if (dest == NULL) - error("OLDPWD not set"); - print = 1; - } - if (dest[0] == '/' || - (dest[0] == '.' && (dest[1] == '/' || dest[1] == '\0')) || - (dest[0] == '.' && dest[1] == '.' && (dest[2] == '/' || dest[2] == '\0')) || - (path = bltinlookup("CDPATH", 1)) == NULL) - path = ""; - while ((p = padvance(&path, NULL, dest)) != NULL) { - if (stat(p, &statb) < 0) { - if (errno != ENOENT) - errno1 = errno; - } else if (!S_ISDIR(statb.st_mode)) - errno1 = ENOTDIR; - else { - if (!print) { - /* - * XXX - rethink - */ - if (p[0] == '.' && p[1] == '/' && p[2] != '\0') - print = strcmp(p + 2, dest); - else - print = strcmp(p, dest); - } - rc = docd(p, print, phys); - if (rc >= 0) - return getcwderr ? rc : 0; - if (errno != ENOENT) - errno1 = errno; - } - } - error("%s: %s", dest, strerror(errno1)); - /*NOTREACHED*/ - return 0; -} - - -/* - * Actually change the directory. In an interactive shell, print the - * directory name if "print" is nonzero. - */ -static int -docd(char *dest, int print, int phys) -{ - int rc; - - TRACE(("docd(\"%s\", %d, %d) called\n", dest, print, phys)); - - /* If logical cd fails, fall back to physical. */ - if ((phys || (rc = cdlogical(dest)) < 0) && (rc = cdphysical(dest)) < 0) - return (-1); - - if (print && iflag && curdir) { - out1fmt("%s\n", curdir); - /* - * Ignore write errors to preserve the invariant that the - * current directory is changed iff the exit status is 0 - * (or 1 if -e was given and the full pathname could not be - * determined). - */ - flushout(out1); - outclearerror(out1); - } - - return (rc); -} - -static int -cdlogical(char *dest) -{ - char *p; - char *q; - char *component; - char *path; - struct stat statb; - int first; - int badstat; - - /* - * Check each component of the path. If we find a symlink or - * something we can't stat, clear curdir to force a getcwd() - * next time we get the value of the current directory. - */ - badstat = 0; - path = stsavestr(dest); - STARTSTACKSTR(p); - if (*dest == '/') { - STPUTC('/', p); - path++; - } - first = 1; - while ((q = getcomponent(&path)) != NULL) { - if (q[0] == '\0' || (q[0] == '.' && q[1] == '\0')) - continue; - if (! first) - STPUTC('/', p); - first = 0; - component = q; - STPUTS(q, p); - if (equal(component, "..")) - continue; - STACKSTRNUL(p); - if (lstat(stackblock(), &statb) < 0) { - badstat = 1; - break; - } - } - - INTOFF; - if ((p = findcwd(badstat ? NULL : dest)) == NULL || chdir(p) < 0) { - INTON; - return (-1); - } - updatepwd(p); - INTON; - return (0); -} - -static int -cdphysical(char *dest) -{ - char *p; - int rc = 0; - - INTOFF; - if (chdir(dest) < 0) { - INTON; - return (-1); - } - p = findcwd(NULL); - if (p == NULL) { - warning("warning: failed to get name of current directory"); - rc = 1; - } - updatepwd(p); - INTON; - return (rc); -} - -/* - * Get the next component of the path name pointed to by *path. - * This routine overwrites *path and the string pointed to by it. - */ -static char * -getcomponent(char **path) -{ - char *p; - char *start; - - if ((p = *path) == NULL) - return NULL; - start = *path; - while (*p != '/' && *p != '\0') - p++; - if (*p == '\0') { - *path = NULL; - } else { - *p++ = '\0'; - *path = p; - } - return start; -} - - -static char * -findcwd(char *dir) -{ - char *new; - char *p; - char *path; - - /* - * If our argument is NULL, we don't know the current directory - * any more because we traversed a symbolic link or something - * we couldn't stat(). - */ - if (dir == NULL || curdir == NULL) - return getpwd2(); - path = stsavestr(dir); - STARTSTACKSTR(new); - if (*dir != '/') { - STPUTS(curdir, new); - if (STTOPC(new) == '/') - STUNPUTC(new); - } - while ((p = getcomponent(&path)) != NULL) { - if (equal(p, "..")) { - while (new > stackblock() && (STUNPUTC(new), *new) != '/'); - } else if (*p != '\0' && ! equal(p, ".")) { - STPUTC('/', new); - STPUTS(p, new); - } - } - if (new == stackblock()) - STPUTC('/', new); - STACKSTRNUL(new); - return stackblock(); -} - -/* - * Update curdir (the name of the current directory) in response to a - * cd command. We also call hashcd to let the routines in exec.c know - * that the current directory has changed. - */ -static void -updatepwd(char *dir) -{ - char *prevdir; - - hashcd(); /* update command hash table */ - - setvar("PWD", dir, VEXPORT); - setvar("OLDPWD", curdir, VEXPORT); - prevdir = curdir; - curdir = dir ? savestr(dir) : NULL; - ckfree(prevdir); -} - -int -pwdcmd(int argc __unused, char **argv __unused) -{ - char *p; - int ch, phys; - - phys = Pflag; - while ((ch = nextopt("LP")) != '\0') { - switch (ch) { - case 'L': - phys = 0; - break; - case 'P': - phys = 1; - break; - } - } - - if (*argptr != NULL) - error("too many arguments"); - - if (!phys && getpwd()) { - out1str(curdir); - out1c('\n'); - } else { - if ((p = getpwd2()) == NULL) - error(".: %s", strerror(errno)); - out1str(p); - out1c('\n'); - } - - return 0; -} - -/* - * Get the current directory and cache the result in curdir. - */ -static char * -getpwd(void) -{ - char *p; - - if (curdir) - return curdir; - - p = getpwd2(); - if (p != NULL) - curdir = savestr(p); - - return curdir; -} - -#define MAXPWD 256 - -/* - * Return the current directory. - */ -static char * -getpwd2(void) -{ - char *pwd; - int i; - - for (i = MAXPWD;; i *= 2) { - pwd = stalloc(i); - if (getcwd(pwd, i) != NULL) - return pwd; - stunalloc(pwd); - if (errno != ERANGE) - break; - } - - return NULL; -} - -/* - * Initialize PWD in a new shell. - * If the shell is interactive, we need to warn if this fails. - */ -void -pwd_init(int warn) -{ - char *pwd; - struct stat stdot, stpwd; - - pwd = lookupvar("PWD"); - if (pwd && *pwd == '/' && stat(".", &stdot) != -1 && - stat(pwd, &stpwd) != -1 && - stdot.st_dev == stpwd.st_dev && - stdot.st_ino == stpwd.st_ino) { - if (curdir) - ckfree(curdir); - curdir = savestr(pwd); - } - if (getpwd() == NULL && warn) - out2fmt_flush("sh: cannot determine working directory\n"); - setvar("PWD", curdir, VEXPORT); -} diff --git a/bin/1sh/cd.h b/bin/1sh/cd.h deleted file mode 100644 index dfa5c3e5..00000000 --- a/bin/1sh/cd.h +++ /dev/null @@ -1,32 +0,0 @@ -/*- - * Copyright (c) 1995 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $FreeBSD: releng/12.1/bin/sh/cd.h 314436 2017-02-28 23:42:47Z imp $ - */ - -void pwd_init(int); diff --git a/bin/1sh/echo.c b/bin/1sh/echo.c deleted file mode 100644 index 5fd50f59..00000000 --- a/bin/1sh/echo.c +++ /dev/null @@ -1,109 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-3-Clause - * - * Copyright (c) 1991, 1993 - * The Regents of the University of California. All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * Kenneth Almquist. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)echo.c 8.2 (Berkeley) 5/4/95 - */ - -#include <sys/cdefs.h> -/* $FreeBSD: releng/12.1/bin/sh/bltin/echo.c 326025 2017-11-20 19:49:47Z pfg $ */ - -/* - * Echo command. - */ - -#define main echocmd - -#include "bltin.h" - -/* #define eflag 1 */ - -int -main(int argc, char *argv[]) -{ - char **ap; - char *p; - char c; - int count; - int nflag = 0; -#ifndef eflag - int eflag = 0; -#endif - - ap = argv; - if (argc) - ap++; - if ((p = *ap) != NULL) { - if (equal(p, "-n")) { - nflag++; - ap++; - } else if (equal(p, "-e")) { -#ifndef eflag - eflag++; -#endif - ap++; - } - } - while ((p = *ap++) != NULL) { - while ((c = *p++) != '\0') { - if (c == '\\' && eflag) { - switch (*p++) { - case 'a': c = '\a'; break; - case 'b': c = '\b'; break; - case 'c': return 0; /* exit */ - case 'e': c = '\033'; break; - case 'f': c = '\f'; break; - case 'n': c = '\n'; break; - case 'r': c = '\r'; break; - case 't': c = '\t'; break; - case 'v': c = '\v'; break; - case '\\': break; /* c = '\\' */ - case '0': - c = 0; - count = 3; - while (--count >= 0 && (unsigned)(*p - '0') < 8) - c = (c << 3) + (*p++ - '0'); - break; - default: - p--; - break; - } - } - putchar(c); - } - if (*ap) - putchar(' '); - } - if (! nflag) - putchar('\n'); - return 0; -} diff --git a/bin/1sh/error.c b/bin/1sh/error.c deleted file mode 100644 index 57c10fae..00000000 --- a/bin/1sh/error.c +++ /dev/null @@ -1,199 +0,0 @@ -/*- - * Copyright (c) 1991, 1993 - * The Regents of the University of California. All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * Kenneth Almquist. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#ifndef lint -#if 0 -static char sccsid[] = "@(#)error.c 8.2 (Berkeley) 5/4/95"; -#endif -#endif /* not lint */ -#include <sys/cdefs.h> -/* $FreeBSD: releng/12.1/bin/sh/error.c 314436 2017-02-28 23:42:47Z imp $ */ - -/* - * Errors and exceptions. - */ - -#include "shell.h" -#include "eval.h" -#include "main.h" -#include "options.h" -#include "output.h" -#include "error.h" -#include "nodes.h" /* show.h needs nodes.h */ -#include "show.h" -#include "trap.h" -#include <signal.h> -#include <stdlib.h> -#include <unistd.h> -#include <errno.h> - - -/* - * Code to handle exceptions in C. - */ - -struct jmploc *handler; -volatile sig_atomic_t exception; -volatile sig_atomic_t suppressint; -volatile sig_atomic_t intpending; - - -static void exverror(int, const char *, va_list) __attribute__((format(printf, 2, 0))) __attribute__((noreturn)); - -/* - * Called to raise an exception. Since C doesn't include exceptions, we - * just do a longjmp to the exception handler. The type of exception is - * stored in the global variable "exception". - * - * Interrupts are disabled; they should be reenabled when the exception is - * caught. - */ - -void -exraise(int e) -{ - INTOFF; - if (handler == NULL) - abort(); - exception = e; - longjmp(handler->loc, 1); -} - - -/* - * Called from trap.c when a SIGINT is received and not suppressed, or when - * an interrupt is pending and interrupts are re-enabled using INTON. - * (If the user specifies that SIGINT is to be trapped or ignored using the - * trap builtin, then this routine is not called.) Suppressint is nonzero - * when interrupts are held using the INTOFF macro. If SIGINTs are not - * suppressed and the shell is not a root shell, then we want to be - * terminated if we get here, as if we were terminated directly by a SIGINT. - * Arrange for this here. - */ - -void -onint(void) -{ - sigset_t sigs; - - intpending = 0; - sigemptyset(&sigs); - sigprocmask(SIG_SETMASK, &sigs, NULL); - - /* - * This doesn't seem to be needed, since main() emits a newline. - */ -#if 0 - if (tcgetpgrp(0) == getpid()) - write(STDERR_FILENO, "\n", 1); -#endif - if (rootshell && iflag) - exraise(EXINT); - else { - signal(SIGINT, SIG_DFL); - kill(getpid(), SIGINT); - _exit(128 + SIGINT); - } -} - - -static void -vwarning(const char *msg, va_list ap) -{ - if (commandname) - outfmt(out2, "%s: ", commandname); - else if (arg0) - outfmt(out2, "%s: ", arg0); - doformat(out2, msg, ap); - out2fmt_flush("\n"); -} - - -void -warning(const char *msg, ...) -{ - va_list ap; - va_start(ap, msg); - vwarning(msg, ap); - va_end(ap); -} - - -/* - * Exverror is called to raise the error exception. If the first argument - * is not NULL then error prints an error message using printf style - * formatting. It then raises the error exception. - */ -static void -exverror(int cond, const char *msg, va_list ap) -{ - /* - * An interrupt trumps an error. Certain places catch error - * exceptions or transform them to a plain nonzero exit code - * in child processes, and if an error exception can be handled, - * an interrupt can be handled as well. - * - * exraise() will disable interrupts for the exception handler. - */ - FORCEINTON; - -#ifdef DEBUG - if (msg) - TRACE(("exverror(%d, \"%s\") pid=%d\n", cond, msg, getpid())); - else - TRACE(("exverror(%d, NULL) pid=%d\n", cond, getpid())); -#endif - if (msg) - vwarning(msg, ap); - flushall(); - exraise(cond); -} - - -void -error(const char *msg, ...) -{ - va_list ap; - va_start(ap, msg); - exverror(EXERROR, msg, ap); - va_end(ap); -} - - -void -exerror(int cond, const char *msg, ...) -{ - va_list ap; - va_start(ap, msg); - exverror(cond, msg, ap); - va_end(ap); -} diff --git a/bin/1sh/error.h b/bin/1sh/error.h deleted file mode 100644 index 0401598f..00000000 --- a/bin/1sh/error.h +++ /dev/null @@ -1,95 +0,0 @@ -/*- - * Copyright (c) 1991, 1993 - * The Regents of the University of California. All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * Kenneth Almquist. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)error.h 8.2 (Berkeley) 5/4/95 - * $FreeBSD: releng/12.1/bin/sh/error.h 319591 2017-06-04 21:58:02Z jilles $ - */ - -/* - * We enclose jmp_buf in a structure so that we can declare pointers to - * jump locations. The global variable handler contains the location to - * jump to when an exception occurs, and the global variable exception - * contains a code identifying the exception. To implement nested - * exception handlers, the user should save the value of handler on entry - * to an inner scope, set handler to point to a jmploc structure for the - * inner scope, and restore handler on exit from the scope. - */ - -#include <setjmp.h> -#include <signal.h> - -struct jmploc { - jmp_buf loc; -}; - -extern struct jmploc *handler; -extern volatile sig_atomic_t exception; - -/* exceptions */ -#define EXINT 0 /* SIGINT received */ -#define EXERROR 1 /* a generic error */ -#define EXEXEC 2 /* command execution failed */ -#define EXEXIT 3 /* call exitshell(exitstatus) */ - - -/* - * These macros allow the user to suspend the handling of interrupt signals - * over a period of time. This is similar to SIGHOLD to or sigblock, but - * much more efficient and portable. (But hacking the kernel is so much - * more fun than worrying about efficiency and portability. :-)) - */ - -extern volatile sig_atomic_t suppressint; -extern volatile sig_atomic_t intpending; - -#define INTOFF suppressint++ -#define INTON { if (--suppressint == 0 && intpending) onint(); } -#define is_int_on() suppressint -#define SETINTON(s) do { suppressint = (s); if (suppressint == 0 && intpending) onint(); } while (0) -#define FORCEINTON {suppressint = 0; if (intpending) onint();} -#define SET_PENDING_INT intpending = 1 -#define CLEAR_PENDING_INT intpending = 0 -#define int_pending() intpending - -void exraise(int) __attribute__((noreturn)); -void onint(void) __attribute__((noreturn)); -void warning(const char *, ...) __attribute__((format(printf, 1, 2))); -void error(const char *, ...) __attribute__((format(printf, 1, 2))) __attribute__((noreturn)); -void exerror(int, const char *, ...) __attribute__((format(printf, 2, 3))) __attribute__((noreturn)); - - -/* - * BSD setjmp saves the signal mask, which violates ANSI C and takes time, - * so we use _setjmp instead. - */ - -#define setjmp(jmploc) _setjmp(jmploc) -#define longjmp(jmploc, val) _longjmp(jmploc, val) diff --git a/bin/1sh/eval.c b/bin/1sh/eval.c deleted file mode 100644 index f4baf39e..00000000 --- a/bin/1sh/eval.c +++ /dev/null @@ -1,1381 +0,0 @@ -/*- - * Copyright (c) 1993 - * The Regents of the University of California. All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * Kenneth Almquist. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#ifndef lint -#if 0 -static char sccsid[] = "@(#)eval.c 8.9 (Berkeley) 6/8/95"; -#endif -#endif /* not lint */ -#include <sys/cdefs.h> -/* $FreeBSD: releng/12.1/bin/sh/eval.c 327212 2017-12-26 16:23:18Z jilles $ */ - -#include <paths.h> -#include <signal.h> -#include <stdlib.h> -#include <unistd.h> -#include <sys/resource.h> -#include <errno.h> - -/* - * Evaluate a command. - */ - -#include "shell.h" -#include "nodes.h" -#include "syntax.h" -#include "expand.h" -#include "parser.h" -#include "jobs.h" -#include "eval.h" -#include "builtins.h" -#include "options.h" -#include "exec.h" -#include "redir.h" -#include "input.h" -#include "output.h" -#include "trap.h" -#include "var.h" -#include "memalloc.h" -#include "error.h" -#include "show.h" -#include "mystring.h" -#ifndef NO_HISTORY -#include "myhistedit.h" -#endif - - -int evalskip; /* set if we are skipping commands */ -int skipcount; /* number of levels to skip */ -static int loopnest; /* current loop nesting level */ -int funcnest; /* depth of function calls */ -static int builtin_flags; /* evalcommand flags for builtins */ - - -char *commandname; -struct arglist *cmdenviron; -int exitstatus; /* exit status of last command */ -int oexitstatus; /* saved exit status */ - - -static void evalloop(union node *, int); -static void evalfor(union node *, int); -static union node *evalcase(union node *); -static void evalsubshell(union node *, int); -static void evalredir(union node *, int); -static void exphere(union node *, struct arglist *); -static void expredir(union node *); -static void evalpipe(union node *); -static int is_valid_fast_cmdsubst(union node *n); -static void evalcommand(union node *, int, struct backcmd *); -static void prehash(union node *); - - -/* - * Called to reset things after an exception. - */ - -void -reseteval(void) -{ - evalskip = 0; - loopnest = 0; -} - - -/* - * The eval command. - */ - -int -evalcmd(int argc, char **argv) -{ - char *p; - char *concat; - char **ap; - - if (argc > 1) { - p = argv[1]; - if (argc > 2) { - STARTSTACKSTR(concat); - ap = argv + 2; - for (;;) { - STPUTS(p, concat); - if ((p = *ap++) == NULL) - break; - STPUTC(' ', concat); - } - STPUTC('\0', concat); - p = grabstackstr(concat); - } - evalstring(p, builtin_flags); - } else - exitstatus = 0; - return exitstatus; -} - - -/* - * Execute a command or commands contained in a string. - */ - -void -evalstring(const char *s, int flags) -{ - union node *n; - struct stackmark smark; - int flags_exit; - int any; - - flags_exit = flags & EV_EXIT; - flags &= ~EV_EXIT; - any = 0; - setstackmark(&smark); - setinputstring(s, 1); - while ((n = parsecmd(0)) != NEOF) { - if (n != NULL && !nflag) { - if (flags_exit && preadateof()) - evaltree(n, flags | EV_EXIT); - else - evaltree(n, flags); - any = 1; - if (evalskip) - break; - } - popstackmark(&smark); - setstackmark(&smark); - } - popfile(); - popstackmark(&smark); - if (!any) - exitstatus = 0; - if (flags_exit) - exraise(EXEXIT); -} - - -/* - * Evaluate a parse tree. The value is left in the global variable - * exitstatus. - */ - -void -evaltree(union node *n, int flags) -{ - int do_etest; - union node *next; - struct stackmark smark; - - setstackmark(&smark); - do_etest = 0; - if (n == NULL) { - TRACE(("evaltree(NULL) called\n")); - exitstatus = 0; - goto out; - } - do { - next = NULL; -#ifndef NO_HISTORY - displayhist = 1; /* show history substitutions done with fc */ -#endif - TRACE(("evaltree(%p: %d) called\n", (void *)n, n->type)); - switch (n->type) { - case NSEMI: - evaltree(n->nbinary.ch1, flags & ~EV_EXIT); - if (evalskip) - goto out; - next = n->nbinary.ch2; - break; - case NAND: - evaltree(n->nbinary.ch1, EV_TESTED); - if (evalskip || exitstatus != 0) { - goto out; - } - next = n->nbinary.ch2; - break; - case NOR: - evaltree(n->nbinary.ch1, EV_TESTED); - if (evalskip || exitstatus == 0) - goto out; - next = n->nbinary.ch2; - break; - case NREDIR: - evalredir(n, flags); - break; - case NSUBSHELL: - evalsubshell(n, flags); - do_etest = !(flags & EV_TESTED); - break; - case NBACKGND: - evalsubshell(n, flags); - break; - case NIF: { - evaltree(n->nif.test, EV_TESTED); - if (evalskip) - goto out; - if (exitstatus == 0) - next = n->nif.ifpart; - else if (n->nif.elsepart) - next = n->nif.elsepart; - else - exitstatus = 0; - break; - } - case NWHILE: - case NUNTIL: - evalloop(n, flags & ~EV_EXIT); - break; - case NFOR: - evalfor(n, flags & ~EV_EXIT); - break; - case NCASE: - next = evalcase(n); - break; - case NCLIST: - next = n->nclist.body; - break; - case NCLISTFALLTHRU: - if (n->nclist.body) { - evaltree(n->nclist.body, flags & ~EV_EXIT); - if (evalskip) - goto out; - } - next = n->nclist.next; - break; - case NDEFUN: - defun(n->narg.text, n->narg.next); - exitstatus = 0; - break; - case NNOT: - evaltree(n->nnot.com, EV_TESTED); - if (evalskip) - goto out; - exitstatus = !exitstatus; - break; - - case NPIPE: - evalpipe(n); - do_etest = !(flags & EV_TESTED); - break; - case NCMD: - evalcommand(n, flags, (struct backcmd *)NULL); - do_etest = !(flags & EV_TESTED); - break; - default: - out1fmt("Node type = %d\n", n->type); - flushout(&output); - break; - } - n = next; - popstackmark(&smark); - setstackmark(&smark); - } while (n != NULL); -out: - popstackmark(&smark); - if (pendingsig) - dotrap(); - if (eflag && exitstatus != 0 && do_etest) - exitshell(exitstatus); - if (flags & EV_EXIT) - exraise(EXEXIT); -} - - -static void -evalloop(union node *n, int flags) -{ - int status; - - loopnest++; - status = 0; - for (;;) { - if (!evalskip) - evaltree(n->nbinary.ch1, EV_TESTED); - if (evalskip) { - if (evalskip == SKIPCONT && --skipcount <= 0) { - evalskip = 0; - continue; - } - if (evalskip == SKIPBREAK && --skipcount <= 0) - evalskip = 0; - if (evalskip == SKIPRETURN) - status = exitstatus; - break; - } - if (n->type == NWHILE) { - if (exitstatus != 0) - break; - } else { - if (exitstatus == 0) - break; - } - evaltree(n->nbinary.ch2, flags); - status = exitstatus; - } - loopnest--; - exitstatus = status; -} - - - -static void -evalfor(union node *n, int flags) -{ - struct arglist arglist; - union node *argp; - int i; - int status; - - emptyarglist(&arglist); - for (argp = n->nfor.args ; argp ; argp = argp->narg.next) { - oexitstatus = exitstatus; - expandarg(argp, &arglist, EXP_FULL | EXP_TILDE); - } - - loopnest++; - status = 0; - for (i = 0; i < arglist.count; i++) { - setvar(n->nfor.var, arglist.args[i], 0); - evaltree(n->nfor.body, flags); - status = exitstatus; - if (evalskip) { - if (evalskip == SKIPCONT && --skipcount <= 0) { - evalskip = 0; - continue; - } - if (evalskip == SKIPBREAK && --skipcount <= 0) - evalskip = 0; - break; - } - } - loopnest--; - exitstatus = status; -} - - -/* - * Evaluate a case statement, returning the selected tree. - * - * The exit status needs care to get right. - */ - -static union node * -evalcase(union node *n) -{ - union node *cp; - union node *patp; - struct arglist arglist; - - emptyarglist(&arglist); - oexitstatus = exitstatus; - expandarg(n->ncase.expr, &arglist, EXP_TILDE); - for (cp = n->ncase.cases ; cp ; cp = cp->nclist.next) { - for (patp = cp->nclist.pattern ; patp ; patp = patp->narg.next) { - if (casematch(patp, arglist.args[0])) { - while (cp->nclist.next && - cp->type == NCLISTFALLTHRU && - cp->nclist.body == NULL) - cp = cp->nclist.next; - if (cp->nclist.next && - cp->type == NCLISTFALLTHRU) - return (cp); - if (cp->nclist.body == NULL) - exitstatus = 0; - return (cp->nclist.body); - } - } - } - exitstatus = 0; - return (NULL); -} - - - -/* - * Kick off a subshell to evaluate a tree. - */ - -static void -evalsubshell(union node *n, int flags) -{ - struct job *jp; - int backgnd = (n->type == NBACKGND); - - oexitstatus = exitstatus; - expredir(n->nredir.redirect); - if ((!backgnd && flags & EV_EXIT && !have_traps()) || - forkshell(jp = makejob(n, 1), n, backgnd) == 0) { - if (backgnd) - flags &=~ EV_TESTED; - redirect(n->nredir.redirect, 0); - evaltree(n->nredir.n, flags | EV_EXIT); /* never returns */ - } else if (! backgnd) { - INTOFF; - exitstatus = waitforjob(jp, (int *)NULL); - INTON; - } else - exitstatus = 0; -} - - -/* - * Evaluate a redirected compound command. - */ - -static void -evalredir(union node *n, int flags) -{ - struct jmploc jmploc; - struct jmploc *savehandler; - volatile int in_redirect = 1; - - oexitstatus = exitstatus; - expredir(n->nredir.redirect); - savehandler = handler; - if (setjmp(jmploc.loc)) { - int e; - - handler = savehandler; - e = exception; - popredir(); - if (e == EXERROR || e == EXEXEC) { - if (in_redirect) { - exitstatus = 2; - FORCEINTON; - return; - } - } - longjmp(handler->loc, 1); - } else { - INTOFF; - handler = &jmploc; - redirect(n->nredir.redirect, REDIR_PUSH); - in_redirect = 0; - INTON; - evaltree(n->nredir.n, flags); - } - INTOFF; - handler = savehandler; - popredir(); - INTON; -} - - -static void -exphere(union node *redir, struct arglist *fn) -{ - struct jmploc jmploc; - struct jmploc *savehandler; - struct localvar *savelocalvars; - int need_longjmp = 0; - unsigned char saveoptreset; - - redir->nhere.expdoc = ""; - savelocalvars = localvars; - localvars = NULL; - saveoptreset = shellparam.reset; - forcelocal++; - savehandler = handler; - if (setjmp(jmploc.loc)) - need_longjmp = exception != EXERROR && exception != EXEXEC; - else { - handler = &jmploc; - expandarg(redir->nhere.doc, fn, 0); - redir->nhere.expdoc = fn->args[0]; - INTOFF; - } - handler = savehandler; - forcelocal--; - poplocalvars(); - localvars = savelocalvars; - shellparam.reset = saveoptreset; - if (need_longjmp) - longjmp(handler->loc, 1); - INTON; -} - - -/* - * Compute the names of the files in a redirection list. - */ - -static void -expredir(union node *n) -{ - union node *redir; - - for (redir = n ; redir ; redir = redir->nfile.next) { - struct arglist fn; - emptyarglist(&fn); - switch (redir->type) { - case NFROM: - case NTO: - case NFROMTO: - case NAPPEND: - case NCLOBBER: - expandarg(redir->nfile.fname, &fn, EXP_TILDE); - redir->nfile.expfname = fn.args[0]; - break; - case NFROMFD: - case NTOFD: - if (redir->ndup.vname) { - expandarg(redir->ndup.vname, &fn, EXP_TILDE); - fixredir(redir, fn.args[0], 1); - } - break; - case NXHERE: - exphere(redir, &fn); - break; - } - } -} - - - -/* - * Evaluate a pipeline. All the processes in the pipeline are children - * of the process creating the pipeline. (This differs from some versions - * of the shell, which make the last process in a pipeline the parent - * of all the rest.) - */ - -static void -evalpipe(union node *n) -{ - struct job *jp; - struct nodelist *lp; - int pipelen; - int prevfd; - int pip[2]; - - TRACE(("evalpipe(%p) called\n", (void *)n)); - pipelen = 0; - for (lp = n->npipe.cmdlist ; lp ; lp = lp->next) - pipelen++; - INTOFF; - jp = makejob(n, pipelen); - prevfd = -1; - for (lp = n->npipe.cmdlist ; lp ; lp = lp->next) { - prehash(lp->n); - pip[1] = -1; - if (lp->next) { - if (pipe(pip) < 0) { - if (prevfd >= 0) - close(prevfd); - error("Pipe call failed: %s", strerror(errno)); - } - } - if (forkshell(jp, lp->n, n->npipe.backgnd) == 0) { - INTON; - if (prevfd > 0) { - dup2(prevfd, 0); - close(prevfd); - } - if (pip[1] >= 0) { - if (!(prevfd >= 0 && pip[0] == 0)) - close(pip[0]); - if (pip[1] != 1) { - dup2(pip[1], 1); - close(pip[1]); - } - } - evaltree(lp->n, EV_EXIT); - } - if (prevfd >= 0) - close(prevfd); - prevfd = pip[0]; - if (pip[1] != -1) - close(pip[1]); - } - INTON; - if (n->npipe.backgnd == 0) { - INTOFF; - exitstatus = waitforjob(jp, (int *)NULL); - TRACE(("evalpipe: job done exit status %d\n", exitstatus)); - INTON; - } else - exitstatus = 0; -} - - - -static int -is_valid_fast_cmdsubst(union node *n) -{ - - return (n->type == NCMD); -} - -/* - * Execute a command inside back quotes. If it's a builtin command, we - * want to save its output in a block obtained from malloc. Otherwise - * we fork off a subprocess and get the output of the command via a pipe. - * Should be called with interrupts off. - */ - -void -evalbackcmd(union node *n, struct backcmd *result) -{ - int pip[2]; - struct job *jp; - struct stackmark smark; - struct jmploc jmploc; - struct jmploc *savehandler; - struct localvar *savelocalvars; - unsigned char saveoptreset; - - result->fd = -1; - result->buf = NULL; - result->nleft = 0; - result->jp = NULL; - if (n == NULL) { - exitstatus = 0; - return; - } - setstackmark(&smark); - exitstatus = oexitstatus; - if (is_valid_fast_cmdsubst(n)) { - savelocalvars = localvars; - localvars = NULL; - saveoptreset = shellparam.reset; - forcelocal++; - savehandler = handler; - if (setjmp(jmploc.loc)) { - if (exception == EXERROR || exception == EXEXEC) - exitstatus = 2; - else if (exception != 0) { - handler = savehandler; - forcelocal--; - poplocalvars(); - localvars = savelocalvars; - shellparam.reset = saveoptreset; - longjmp(handler->loc, 1); - } - } else { - handler = &jmploc; - evalcommand(n, EV_BACKCMD, result); - } - handler = savehandler; - forcelocal--; - poplocalvars(); - localvars = savelocalvars; - shellparam.reset = saveoptreset; - } else { - if (pipe(pip) < 0) - error("Pipe call failed: %s", strerror(errno)); - jp = makejob(n, 1); - if (forkshell(jp, n, FORK_NOJOB) == 0) { - FORCEINTON; - close(pip[0]); - if (pip[1] != 1) { - dup2(pip[1], 1); - close(pip[1]); - } - evaltree(n, EV_EXIT); - } - close(pip[1]); - result->fd = pip[0]; - result->jp = jp; - } - popstackmark(&smark); - TRACE(("evalbackcmd done: fd=%d buf=%p nleft=%d jp=%p\n", - result->fd, result->buf, result->nleft, result->jp)); -} - -static int -mustexpandto(const char *argtext, const char *mask) -{ - for (;;) { - if (*argtext == CTLQUOTEMARK || *argtext == CTLQUOTEEND) { - argtext++; - continue; - } - if (*argtext == CTLESC) - argtext++; - else if (BASESYNTAX[(int)*argtext] == CCTL) - return (0); - if (*argtext != *mask) - return (0); - if (*argtext == '\0') - return (1); - argtext++; - mask++; - } -} - -static int -isdeclarationcmd(struct narg *arg) -{ - int have_command = 0; - - if (arg == NULL) - return (0); - while (mustexpandto(arg->text, "command")) { - have_command = 1; - arg = &arg->next->narg; - if (arg == NULL) - return (0); - /* - * To also allow "command -p" and "command --" as part of - * a declaration command, add code here. - * We do not do this, as ksh does not do it either and it - * is not required by POSIX. - */ - } - return (mustexpandto(arg->text, "export") || - mustexpandto(arg->text, "readonly") || - (mustexpandto(arg->text, "local") && - (have_command || !isfunc("local")))); -} - -static void -xtracecommand(struct arglist *varlist, int argc, char **argv) -{ - char sep = 0; - const char *text, *p, *ps4; - int i; - - ps4 = expandstr(ps4val()); - out2str(ps4 != NULL ? ps4 : ps4val()); - for (i = 0; i < varlist->count; i++) { - text = varlist->args[i]; - if (sep != 0) - out2c(' '); - p = strchr(text, '='); - if (p != NULL) { - p++; - outbin(text, p - text, out2); - out2qstr(p); - } else - out2qstr(text); - sep = ' '; - } - for (i = 0; i < argc; i++) { - text = argv[i]; - if (sep != 0) - out2c(' '); - out2qstr(text); - sep = ' '; - } - out2c('\n'); - flushout(&errout); -} - -/* - * Check if a builtin can safely be executed in the same process, - * even though it should be in a subshell (command substitution). - * Note that jobid, jobs, times and trap can show information not - * available in a child process; this is deliberate. - * The arguments should already have been expanded. - */ -static int -safe_builtin(int idx, int argc, char **argv) -{ - /* Generated from builtins.def. */ - if (safe_builtin_always(idx)) - return (1); - if (idx == EXPORTCMD || idx == TRAPCMD || idx == ULIMITCMD || - idx == UMASKCMD) - return (argc <= 1 || (argc == 2 && argv[1][0] == '-')); - if (idx == SETCMD) - return (argc <= 1 || (argc == 2 && (argv[1][0] == '-' || - argv[1][0] == '+') && argv[1][1] == 'o' && - argv[1][2] == '\0')); - return (0); -} - -/* - * Execute a simple command. - * Note: This may or may not return if (flags & EV_EXIT). - */ - -static void -evalcommand(union node *cmd, int flags, struct backcmd *backcmd) -{ - union node *argp; - struct arglist arglist; - struct arglist varlist; - char **argv; - int argc; - char **envp; - int varflag; - int mode; - int pip[2]; - struct cmdentry cmdentry; - struct job *jp; - struct jmploc jmploc; - struct jmploc *savehandler; - char *savecmdname; - struct shparam saveparam; - struct localvar *savelocalvars; - struct parsefile *savetopfile; - volatile int e; - char *lastarg; - int signaled; - int do_clearcmdentry; - const char *path = pathval(); - int i; - - /* First expand the arguments. */ - TRACE(("evalcommand(%p, %d) called\n", (void *)cmd, flags)); - emptyarglist(&arglist); - emptyarglist(&varlist); - varflag = 1; - jp = NULL; - do_clearcmdentry = 0; - oexitstatus = exitstatus; - exitstatus = 0; - /* Add one slot at the beginning for tryexec(). */ - appendarglist(&arglist, nullstr); - for (argp = cmd->ncmd.args ; argp ; argp = argp->narg.next) { - if (varflag && isassignment(argp->narg.text)) { - expandarg(argp, varflag == 1 ? &varlist : &arglist, - EXP_VARTILDE); - continue; - } else if (varflag == 1) - varflag = isdeclarationcmd(&argp->narg) ? 2 : 0; - expandarg(argp, &arglist, EXP_FULL | EXP_TILDE); - } - appendarglist(&arglist, nullstr); - expredir(cmd->ncmd.redirect); - argc = arglist.count - 2; - argv = &arglist.args[1]; - - argv[argc] = NULL; - lastarg = NULL; - if (iflag && funcnest == 0 && argc > 0) - lastarg = argv[argc - 1]; - - /* Print the command if xflag is set. */ - if (xflag) - xtracecommand(&varlist, argc, argv); - - /* Now locate the command. */ - if (argc == 0) { - /* Variable assignment(s) without command */ - cmdentry.cmdtype = CMDBUILTIN; - cmdentry.u.index = BLTINCMD; - cmdentry.special = 0; - } else { - static const char PATH[] = "PATH="; - int cmd_flags = 0, bltinonly = 0; - - /* - * Modify the command lookup path, if a PATH= assignment - * is present - */ - for (i = 0; i < varlist.count; i++) - if (strncmp(varlist.args[i], PATH, sizeof(PATH) - 1) == 0) { - path = varlist.args[i] + sizeof(PATH) - 1; - /* - * On `PATH=... command`, we need to make - * sure that the command isn't using the - * non-updated hash table of the outer PATH - * setting and we need to make sure that - * the hash table isn't filled with items - * from the temporary setting. - * - * It would be better to forbit using and - * updating the table while this command - * runs, by the command finding mechanism - * is heavily integrated with hash handling, - * so we just delete the hash before and after - * the command runs. Partly deleting like - * changepatch() does doesn't seem worth the - * bookinging effort, since most such runs add - * directories in front of the new PATH. - */ - clearcmdentry(); - do_clearcmdentry = 1; - } - - for (;;) { - if (bltinonly) { - cmdentry.u.index = find_builtin(*argv, &cmdentry.special); - if (cmdentry.u.index < 0) { - cmdentry.u.index = BLTINCMD; - argv--; - argc++; - break; - } - } else - find_command(argv[0], &cmdentry, cmd_flags, path); - /* implement the bltin and command builtins here */ - if (cmdentry.cmdtype != CMDBUILTIN) - break; - if (cmdentry.u.index == BLTINCMD) { - if (argc == 1) - break; - argv++; - argc--; - bltinonly = 1; - } else if (cmdentry.u.index == COMMANDCMD) { - if (argc == 1) - break; - if (!strcmp(argv[1], "-p")) { - if (argc == 2) - break; - if (argv[2][0] == '-') { - if (strcmp(argv[2], "--")) - break; - if (argc == 3) - break; - argv += 3; - argc -= 3; - } else { - argv += 2; - argc -= 2; - } - path = _PATH_STDPATH; - clearcmdentry(); - do_clearcmdentry = 1; - } else if (!strcmp(argv[1], "--")) { - if (argc == 2) - break; - argv += 2; - argc -= 2; - } else if (argv[1][0] == '-') - break; - else { - argv++; - argc--; - } - cmd_flags |= DO_NOFUNC; - bltinonly = 0; - } else - break; - } - /* - * Special builtins lose their special properties when - * called via 'command'. - */ - if (cmd_flags & DO_NOFUNC) - cmdentry.special = 0; - } - - /* Fork off a child process if necessary. */ - if (((cmdentry.cmdtype == CMDNORMAL || cmdentry.cmdtype == CMDUNKNOWN) - && ((flags & EV_EXIT) == 0 || have_traps())) - || ((flags & EV_BACKCMD) != 0 - && (cmdentry.cmdtype != CMDBUILTIN || - !safe_builtin(cmdentry.u.index, argc, argv)))) { - jp = makejob(cmd, 1); - mode = FORK_FG; - if (flags & EV_BACKCMD) { - mode = FORK_NOJOB; - if (pipe(pip) < 0) - error("Pipe call failed: %s", strerror(errno)); - } - if (cmdentry.cmdtype == CMDNORMAL && - cmd->ncmd.redirect == NULL && - varlist.count == 0 && - (mode == FORK_FG || mode == FORK_NOJOB) && - !disvforkset() && !iflag && !mflag) { - vforkexecshell(jp, argv, environment(), path, - cmdentry.u.index, flags & EV_BACKCMD ? pip : NULL); - goto parent; - } - if (forkshell(jp, cmd, mode) != 0) - goto parent; /* at end of routine */ - if (flags & EV_BACKCMD) { - FORCEINTON; - close(pip[0]); - if (pip[1] != 1) { - dup2(pip[1], 1); - close(pip[1]); - } - flags &= ~EV_BACKCMD; - } - flags |= EV_EXIT; - } - - /* This is the child process if a fork occurred. */ - /* Execute the command. */ - if (cmdentry.cmdtype == CMDFUNCTION) { -#ifdef DEBUG - trputs("Shell function: "); trargs(argv); -#endif - saveparam = shellparam; - shellparam.malloc = 0; - shellparam.reset = 1; - shellparam.nparam = argc - 1; - shellparam.p = argv + 1; - shellparam.optp = NULL; - shellparam.optnext = NULL; - INTOFF; - savelocalvars = localvars; - localvars = NULL; - reffunc(cmdentry.u.func); - savehandler = handler; - if (setjmp(jmploc.loc)) { - popredir(); - unreffunc(cmdentry.u.func); - poplocalvars(); - localvars = savelocalvars; - freeparam(&shellparam); - shellparam = saveparam; - funcnest--; - handler = savehandler; - longjmp(handler->loc, 1); - } - handler = &jmploc; - funcnest++; - redirect(cmd->ncmd.redirect, REDIR_PUSH); - INTON; - for (i = 0; i < varlist.count; i++) - mklocal(varlist.args[i]); - exitstatus = oexitstatus; - evaltree(getfuncnode(cmdentry.u.func), - flags & (EV_TESTED | EV_EXIT)); - INTOFF; - unreffunc(cmdentry.u.func); - poplocalvars(); - localvars = savelocalvars; - freeparam(&shellparam); - shellparam = saveparam; - handler = savehandler; - funcnest--; - popredir(); - INTON; - if (evalskip == SKIPRETURN) { - evalskip = 0; - skipcount = 0; - } - if (jp) - exitshell(exitstatus); - } else if (cmdentry.cmdtype == CMDBUILTIN) { -#ifdef DEBUG - trputs("builtin command: "); trargs(argv); -#endif - mode = (cmdentry.u.index == EXECCMD)? 0 : REDIR_PUSH; - if (flags == EV_BACKCMD) { - memout.nextc = memout.buf; - mode |= REDIR_BACKQ; - } - savecmdname = commandname; - savetopfile = getcurrentfile(); - cmdenviron = &varlist; - e = -1; - savehandler = handler; - if (setjmp(jmploc.loc)) { - e = exception; - if (e == EXINT) - exitstatus = SIGINT+128; - else if (e != EXEXIT) - exitstatus = 2; - goto cmddone; - } - handler = &jmploc; - redirect(cmd->ncmd.redirect, mode); - outclearerror(out1); - /* - * If there is no command word, redirection errors should - * not be fatal but assignment errors should. - */ - if (argc == 0) - cmdentry.special = 1; - listsetvar(cmdenviron, cmdentry.special ? 0 : VNOSET); - if (argc > 0) - bltinsetlocale(); - commandname = argv[0]; - argptr = argv + 1; - nextopt_optptr = NULL; /* initialize nextopt */ - builtin_flags = flags; - exitstatus = (*builtinfunc[cmdentry.u.index])(argc, argv); - flushall(); - if (outiserror(out1)) { - warning("write error on stdout"); - if (exitstatus == 0 || exitstatus == 1) - exitstatus = 2; - } -cmddone: - if (argc > 0) - bltinunsetlocale(); - cmdenviron = NULL; - out1 = &output; - out2 = &errout; - freestdout(); - handler = savehandler; - commandname = savecmdname; - if (jp) - exitshell(exitstatus); - if (flags == EV_BACKCMD) { - backcmd->buf = memout.buf; - backcmd->nleft = memout.buf != NULL ? - memout.nextc - memout.buf : 0; - memout.buf = NULL; - memout.nextc = NULL; - memout.bufend = NULL; - memout.bufsize = 64; - } - if (cmdentry.u.index != EXECCMD) - popredir(); - if (e != -1) { - if ((e != EXERROR && e != EXEXEC) - || cmdentry.special) - exraise(e); - popfilesupto(savetopfile); - if (flags != EV_BACKCMD) - FORCEINTON; - } - } else { -#ifdef DEBUG - trputs("normal command: "); trargs(argv); -#endif - redirect(cmd->ncmd.redirect, 0); - for (i = 0; i < varlist.count; i++) - setvareq(varlist.args[i], VEXPORT|VSTACK); - envp = environment(); - shellexec(argv, envp, path, cmdentry.u.index); - /*NOTREACHED*/ - } - goto out; - -parent: /* parent process gets here (if we forked) */ - if (mode == FORK_FG) { /* argument to fork */ - INTOFF; - exitstatus = waitforjob(jp, &signaled); - INTON; - if (iflag && loopnest > 0 && signaled) { - evalskip = SKIPBREAK; - skipcount = loopnest; - } - } else if (mode == FORK_NOJOB) { - backcmd->fd = pip[0]; - close(pip[1]); - backcmd->jp = jp; - } - -out: - if (lastarg) - setvar("_", lastarg, 0); - if (do_clearcmdentry) - clearcmdentry(); -} - - - -/* - * Search for a command. This is called before we fork so that the - * location of the command will be available in the parent as well as - * the child. The check for "goodname" is an overly conservative - * check that the name will not be subject to expansion. - */ - -static void -prehash(union node *n) -{ - struct cmdentry entry; - - if (n && n->type == NCMD && n->ncmd.args) - if (goodname(n->ncmd.args->narg.text)) - find_command(n->ncmd.args->narg.text, &entry, 0, - pathval()); -} - - - -/* - * Builtin commands. Builtin commands whose functions are closely - * tied to evaluation are implemented here. - */ - -/* - * No command given, a bltin command with no arguments, or a bltin command - * with an invalid name. - */ - -int -bltincmd(int argc, char **argv) -{ - if (argc > 1) { - out2fmt_flush("%s: not found\n", argv[1]); - return 127; - } - /* - * Preserve exitstatus of a previous possible command substitution - * as POSIX mandates - */ - return exitstatus; -} - - -/* - * Handle break and continue commands. Break, continue, and return are - * all handled by setting the evalskip flag. The evaluation routines - * above all check this flag, and if it is set they start skipping - * commands rather than executing them. The variable skipcount is - * the number of loops to break/continue, or the number of function - * levels to return. (The latter is always 1.) It should probably - * be an error to break out of more loops than exist, but it isn't - * in the standard shell so we don't make it one here. - */ - -int -breakcmd(int argc, char **argv) -{ - long n; - char *end; - - if (argc > 1) { - /* Allow arbitrarily large numbers. */ - n = strtol(argv[1], &end, 10); - if (!is_digit(argv[1][0]) || *end != '\0') - error("Illegal number: %s", argv[1]); - } else - n = 1; - if (n > loopnest) - n = loopnest; - if (n > 0) { - evalskip = (**argv == 'c')? SKIPCONT : SKIPBREAK; - skipcount = n; - } - return 0; -} - -/* - * The `command' command. - */ -int -commandcmd(int argc __unused, char **argv __unused) -{ - const char *path; - int ch; - int cmd = -1; - - path = bltinlookup("PATH", 1); - - while ((ch = nextopt("pvV")) != '\0') { - switch (ch) { - case 'p': - path = _PATH_STDPATH; - break; - case 'v': - cmd = TYPECMD_SMALLV; - break; - case 'V': - cmd = TYPECMD_BIGV; - break; - } - } - - if (cmd != -1) { - if (*argptr == NULL || argptr[1] != NULL) - error("wrong number of arguments"); - return typecmd_impl(2, argptr - 1, cmd, path); - } - if (*argptr != NULL) - error("commandcmd bad call"); - - /* - * Do nothing successfully if no command was specified; - * ksh also does this. - */ - return 0; -} - - -/* - * The return command. - */ - -int -returncmd(int argc, char **argv) -{ - int ret = argc > 1 ? number(argv[1]) : oexitstatus; - - evalskip = SKIPRETURN; - skipcount = 1; - return ret; -} - - -int -falsecmd(int argc __unused, char **argv __unused) -{ - return 1; -} - - -int -truecmd(int argc __unused, char **argv __unused) -{ - return 0; -} - - -int -execcmd(int argc, char **argv) -{ - int i; - - /* - * Because we have historically not supported any options, - * only treat "--" specially. - */ - if (argc > 1 && strcmp(argv[1], "--") == 0) - argc--, argv++; - if (argc > 1) { - iflag = 0; /* exit on error */ - mflag = 0; - optschanged(); - for (i = 0; i < cmdenviron->count; i++) - setvareq(cmdenviron->args[i], VEXPORT|VSTACK); - shellexec(argv + 1, environment(), pathval(), 0); - - } - return 0; -} - - -int -timescmd(int argc __unused, char **argv __unused) -{ - struct rusage ru; - long shumins, shsmins, chumins, chsmins; - double shusecs, shssecs, chusecs, chssecs; - - if (getrusage(RUSAGE_SELF, &ru) < 0) - return 1; - shumins = ru.ru_utime.tv_sec / 60; - shusecs = ru.ru_utime.tv_sec % 60 + ru.ru_utime.tv_usec / 1000000.; - shsmins = ru.ru_stime.tv_sec / 60; - shssecs = ru.ru_stime.tv_sec % 60 + ru.ru_stime.tv_usec / 1000000.; - if (getrusage(RUSAGE_CHILDREN, &ru) < 0) - return 1; - chumins = ru.ru_utime.tv_sec / 60; - chusecs = ru.ru_utime.tv_sec % 60 + ru.ru_utime.tv_usec / 1000000.; - chsmins = ru.ru_stime.tv_sec / 60; - chssecs = ru.ru_stime.tv_sec % 60 + ru.ru_stime.tv_usec / 1000000.; - out1fmt("%ldm%.3fs %ldm%.3fs\n%ldm%.3fs %ldm%.3fs\n", shumins, - shusecs, shsmins, shssecs, chumins, chusecs, chsmins, chssecs); - return 0; -} diff --git a/bin/1sh/eval.h b/bin/1sh/eval.h deleted file mode 100644 index d413ccd5..00000000 --- a/bin/1sh/eval.h +++ /dev/null @@ -1,70 +0,0 @@ -/*- - * Copyright (c) 1991, 1993 - * The Regents of the University of California. All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * Kenneth Almquist. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)eval.h 8.2 (Berkeley) 5/4/95 - * $FreeBSD: releng/12.1/bin/sh/eval.h 314436 2017-02-28 23:42:47Z imp $ - */ - -extern char *commandname; /* currently executing command */ -extern int exitstatus; /* exit status of last command */ -extern int oexitstatus; /* saved exit status */ -extern struct arglist *cmdenviron; /* environment for builtin command */ - - -struct backcmd { /* result of evalbackcmd */ - int fd; /* file descriptor to read from */ - char *buf; /* buffer */ - int nleft; /* number of chars in buffer */ - struct job *jp; /* job structure for command */ -}; - -void reseteval(void); - -/* flags in argument to evaltree/evalstring */ -#define EV_EXIT 01 /* exit after evaluating tree */ -#define EV_TESTED 02 /* exit status is checked; ignore -e flag */ -#define EV_BACKCMD 04 /* command executing within back quotes */ - -void evalstring(const char *, int); -union node; /* BLETCH for ansi C */ -void evaltree(union node *, int); -void evalbackcmd(union node *, struct backcmd *); - -/* in_function returns nonzero if we are currently evaluating a function */ -#define in_function() funcnest -extern int funcnest; -extern int evalskip; -extern int skipcount; - -/* reasons for skipping commands (see comment on breakcmd routine) */ -#define SKIPBREAK 1 -#define SKIPCONT 2 -#define SKIPRETURN 3 diff --git a/bin/1sh/exec.c b/bin/1sh/exec.c deleted file mode 100644 index 81efa565..00000000 --- a/bin/1sh/exec.c +++ /dev/null @@ -1,784 +0,0 @@ -/*- - * Copyright (c) 1991, 1993 - * The Regents of the University of California. All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * Kenneth Almquist. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#ifndef lint -#if 0 -static char sccsid[] = "@(#)exec.c 8.4 (Berkeley) 6/8/95"; -#endif -#endif /* not lint */ -#include <sys/cdefs.h> -/* $FreeBSD: releng/12.1/bin/sh/exec.c 336320 2018-07-15 21:55:17Z jilles $ */ - -#include <sys/types.h> -#include <sys/stat.h> -#include <unistd.h> -#include <fcntl.h> -#include <errno.h> -#include <paths.h> -#include <stdlib.h> - -/* - * When commands are first encountered, they are entered in a hash table. - * This ensures that a full path search will not have to be done for them - * on each invocation. - * - * We should investigate converting to a linear search, even though that - * would make the command name "hash" a misnomer. - */ - -#include "shell.h" -#include "main.h" -#include "nodes.h" -#include "parser.h" -#include "redir.h" -#include "eval.h" -#include "exec.h" -#include "builtins.h" -#include "var.h" -#include "options.h" -#include "input.h" -#include "output.h" -#include "syntax.h" -#include "memalloc.h" -#include "error.h" -#include "mystring.h" -#include "show.h" -#include "jobs.h" -#include "alias.h" - - -#define CMDTABLESIZE 31 /* should be prime */ - - - -struct tblentry { - struct tblentry *next; /* next entry in hash chain */ - union param param; /* definition of builtin function */ - int special; /* flag for special builtin commands */ - signed char cmdtype; /* index identifying command */ - char cmdname[]; /* name of command */ -}; - - -static struct tblentry *cmdtable[CMDTABLESIZE]; -static int cmdtable_cd = 0; /* cmdtable contains cd-dependent entries */ -int exerrno = 0; /* Last exec error */ - - -static void tryexec(char *, char **, char **); -static void printentry(struct tblentry *, int); -static struct tblentry *cmdlookup(const char *, int); -static void delete_cmd_entry(void); -static void addcmdentry(const char *, struct cmdentry *); - - - -/* - * Exec a program. Never returns. If you change this routine, you may - * have to change the find_command routine as well. - * - * The argv array may be changed and element argv[-1] should be writable. - */ - -void -shellexec(char **argv, char **envp, const char *path, int idx) -{ - char *cmdname; - const char *opt; - int e; - - if (strchr(argv[0], '/') != NULL) { - tryexec(argv[0], argv, envp); - e = errno; - } else { - e = ENOENT; - while ((cmdname = padvance(&path, &opt, argv[0])) != NULL) { - if (--idx < 0 && opt == NULL) { - tryexec(cmdname, argv, envp); - if (errno != ENOENT && errno != ENOTDIR) - e = errno; - if (e == ENOEXEC) - break; - } - stunalloc(cmdname); - } - } - - /* Map to POSIX errors */ - if (e == ENOENT || e == ENOTDIR) { - exerrno = 127; - exerror(EXEXEC, "%s: not found", argv[0]); - } else { - exerrno = 126; - exerror(EXEXEC, "%s: %s", argv[0], strerror(e)); - } -} - - -static void -tryexec(char *cmd, char **argv, char **envp) -{ - int e, in; - ssize_t n; - char buf[256]; - - execve(cmd, argv, envp); - e = errno; - if (e == ENOEXEC) { - INTOFF; - in = open(cmd, O_RDONLY | O_NONBLOCK); - if (in != -1) { - n = pread(in, buf, sizeof buf, 0); - close(in); - if (n > 0 && memchr(buf, '\0', n) != NULL) { - errno = ENOEXEC; - return; - } - } - *argv = cmd; - *--argv = (char *)(_PATH_BSHELL); - execve(_PATH_BSHELL, argv, envp); - } - errno = e; -} - -/* - * Do a path search. The variable path (passed by reference) should be - * set to the start of the path before the first call; padvance will update - * this value as it proceeds. Successive calls to padvance will return - * the possible path expansions in sequence. If popt is not NULL, options - * are processed: if an option (indicated by a percent sign) appears in - * the path entry then *popt will be set to point to it; else *popt will be - * set to NULL. If popt is NULL, percent signs are not special. - */ - -char * -padvance(const char **path, const char **popt, const char *name) -{ - const char *p, *start; - char *q; - size_t len, namelen; - - if (*path == NULL) - return NULL; - start = *path; - if (popt != NULL) - for (p = start; *p && *p != ':' && *p != '%'; p++) - ; /* nothing */ - else - for (p = start; *p && *p != ':'; p++) - ; /* nothing */ - namelen = strlen(name); - len = p - start + namelen + 2; /* "2" is for '/' and '\0' */ - STARTSTACKSTR(q); - CHECKSTRSPACE(len, q); - if (p != start) { - memcpy(q, start, p - start); - q += p - start; - *q++ = '/'; - } - memcpy(q, name, namelen + 1); - if (popt != NULL) { - if (*p == '%') { - *popt = ++p; - while (*p && *p != ':') p++; - } else - *popt = NULL; - } - if (*p == ':') - *path = p + 1; - else - *path = NULL; - return stalloc(len); -} - - - -/*** Command hashing code ***/ - - -int -hashcmd(int argc __unused, char **argv __unused) -{ - struct tblentry **pp; - struct tblentry *cmdp; - int c; - int verbose; - struct cmdentry entry; - char *name; - int errors; - - errors = 0; - verbose = 0; - while ((c = nextopt("rv")) != '\0') { - if (c == 'r') { - clearcmdentry(); - } else if (c == 'v') { - verbose++; - } - } - if (*argptr == NULL) { - for (pp = cmdtable ; pp < &cmdtable[CMDTABLESIZE] ; pp++) { - for (cmdp = *pp ; cmdp ; cmdp = cmdp->next) { - if (cmdp->cmdtype == CMDNORMAL) - printentry(cmdp, verbose); - } - } - return 0; - } - while ((name = *argptr) != NULL) { - if ((cmdp = cmdlookup(name, 0)) != NULL - && cmdp->cmdtype == CMDNORMAL) - delete_cmd_entry(); - find_command(name, &entry, DO_ERR, pathval()); - if (entry.cmdtype == CMDUNKNOWN) - errors = 1; - else if (verbose) { - cmdp = cmdlookup(name, 0); - if (cmdp != NULL) - printentry(cmdp, verbose); - else { - outfmt(out2, "%s: not found\n", name); - errors = 1; - } - flushall(); - } - argptr++; - } - return errors; -} - - -static void -printentry(struct tblentry *cmdp, int verbose) -{ - int idx; - const char *path, *opt; - char *name; - - if (cmdp->cmdtype == CMDNORMAL) { - idx = cmdp->param.index; - path = pathval(); - do { - name = padvance(&path, &opt, cmdp->cmdname); - stunalloc(name); - } while (--idx >= 0); - out1str(name); - } else if (cmdp->cmdtype == CMDBUILTIN) { - out1fmt("builtin %s", cmdp->cmdname); - } else if (cmdp->cmdtype == CMDFUNCTION) { - out1fmt("function %s", cmdp->cmdname); - if (verbose) { - INTOFF; - name = commandtext(getfuncnode(cmdp->param.func)); - out1c(' '); - out1str(name); - ckfree(name); - INTON; - } -#ifdef DEBUG - } else { - error("internal error: cmdtype %d", cmdp->cmdtype); -#endif - } - out1c('\n'); -} - - - -/* - * Resolve a command name. If you change this routine, you may have to - * change the shellexec routine as well. - */ - -void -find_command(const char *name, struct cmdentry *entry, int act, - const char *path) -{ - struct tblentry *cmdp, loc_cmd; - int idx; - const char *opt; - char *fullname; - struct stat statb; - int e; - int i; - int spec; - int cd; - - /* If name contains a slash, don't use the hash table */ - if (strchr(name, '/') != NULL) { - entry->cmdtype = CMDNORMAL; - entry->u.index = 0; - entry->special = 0; - return; - } - - cd = 0; - - /* If name is in the table, we're done */ - if ((cmdp = cmdlookup(name, 0)) != NULL) { - if (cmdp->cmdtype == CMDFUNCTION && act & DO_NOFUNC) - cmdp = NULL; - else - goto success; - } - - /* Check for builtin next */ - if ((i = find_builtin(name, &spec)) >= 0) { - INTOFF; - cmdp = cmdlookup(name, 1); - if (cmdp->cmdtype == CMDFUNCTION) - cmdp = &loc_cmd; - cmdp->cmdtype = CMDBUILTIN; - cmdp->param.index = i; - cmdp->special = spec; - INTON; - goto success; - } - - /* We have to search path. */ - - e = ENOENT; - idx = -1; - for (;(fullname = padvance(&path, &opt, name)) != NULL; - stunalloc(fullname)) { - idx++; - if (opt) { - if (strncmp(opt, "func", 4) == 0) { - /* handled below */ - } else { - continue; /* ignore unimplemented options */ - } - } - if (fullname[0] != '/') - cd = 1; - if (stat(fullname, &statb) < 0) { - if (errno != ENOENT && errno != ENOTDIR) - e = errno; - continue; - } - e = EACCES; /* if we fail, this will be the error */ - if (!S_ISREG(statb.st_mode)) - continue; - if (opt) { /* this is a %func directory */ - readcmdfile(fullname); - if ((cmdp = cmdlookup(name, 0)) == NULL || cmdp->cmdtype != CMDFUNCTION) - error("%s not defined in %s", name, fullname); - stunalloc(fullname); - goto success; - } -#ifdef notdef - if (statb.st_uid == geteuid()) { - if ((statb.st_mode & 0100) == 0) - goto loop; - } else if (statb.st_gid == getegid()) { - if ((statb.st_mode & 010) == 0) - goto loop; - } else { - if ((statb.st_mode & 01) == 0) - goto loop; - } -#endif - TRACE(("searchexec \"%s\" returns \"%s\"\n", name, fullname)); - INTOFF; - stunalloc(fullname); - cmdp = cmdlookup(name, 1); - if (cmdp->cmdtype == CMDFUNCTION) - cmdp = &loc_cmd; - cmdp->cmdtype = CMDNORMAL; - cmdp->param.index = idx; - cmdp->special = 0; - INTON; - goto success; - } - - if (act & DO_ERR) { - if (e == ENOENT || e == ENOTDIR) - outfmt(out2, "%s: not found\n", name); - else - outfmt(out2, "%s: %s\n", name, strerror(e)); - } - entry->cmdtype = CMDUNKNOWN; - entry->u.index = 0; - entry->special = 0; - return; - -success: - if (cd) - cmdtable_cd = 1; - entry->cmdtype = cmdp->cmdtype; - entry->u = cmdp->param; - entry->special = cmdp->special; -} - - - -/* - * Search the table of builtin commands. - */ - -int -find_builtin(const char *name, int *special) -{ - const unsigned char *bp; - size_t len; - - len = strlen(name); - for (bp = builtincmd ; *bp ; bp += 2 + bp[0]) { - if (bp[0] == len && memcmp(bp + 2, name, len) == 0) { - *special = (bp[1] & BUILTIN_SPECIAL) != 0; - return bp[1] & ~BUILTIN_SPECIAL; - } - } - return -1; -} - - - -/* - * Called when a cd is done. If any entry in cmdtable depends on the current - * directory, simply clear cmdtable completely. - */ - -void -hashcd(void) -{ - if (cmdtable_cd) - clearcmdentry(); -} - - - -/* - * Called before PATH is changed. The argument is the new value of PATH; - * pathval() still returns the old value at this point. Called with - * interrupts off. - */ - -void -changepath(const char *newval __unused) -{ - clearcmdentry(); -} - - -/* - * Clear out cached utility locations. - */ - -void -clearcmdentry(void) -{ - struct tblentry **tblp; - struct tblentry **pp; - struct tblentry *cmdp; - - INTOFF; - for (tblp = cmdtable ; tblp < &cmdtable[CMDTABLESIZE] ; tblp++) { - pp = tblp; - while ((cmdp = *pp) != NULL) { - if (cmdp->cmdtype == CMDNORMAL) { - *pp = cmdp->next; - ckfree(cmdp); - } else { - pp = &cmdp->next; - } - } - } - cmdtable_cd = 0; - INTON; -} - - -/* - * Locate a command in the command hash table. If "add" is nonzero, - * add the command to the table if it is not already present. The - * variable "lastcmdentry" is set to point to the address of the link - * pointing to the entry, so that delete_cmd_entry can delete the - * entry. - */ - -static struct tblentry **lastcmdentry; - - -static struct tblentry * -cmdlookup(const char *name, int add) -{ - unsigned int hashval; - const char *p; - struct tblentry *cmdp; - struct tblentry **pp; - size_t len; - - p = name; - hashval = (unsigned char)*p << 4; - while (*p) - hashval += *p++; - pp = &cmdtable[hashval % CMDTABLESIZE]; - for (cmdp = *pp ; cmdp ; cmdp = cmdp->next) { - if (equal(cmdp->cmdname, name)) - break; - pp = &cmdp->next; - } - if (add && cmdp == NULL) { - INTOFF; - len = strlen(name); - cmdp = *pp = ckmalloc(sizeof (struct tblentry) + len + 1); - cmdp->next = NULL; - cmdp->cmdtype = CMDUNKNOWN; - memcpy(cmdp->cmdname, name, len + 1); - INTON; - } - lastcmdentry = pp; - return cmdp; -} - -/* - * Delete the command entry returned on the last lookup. - */ - -static void -delete_cmd_entry(void) -{ - struct tblentry *cmdp; - - INTOFF; - cmdp = *lastcmdentry; - *lastcmdentry = cmdp->next; - ckfree(cmdp); - INTON; -} - - - -/* - * Add a new command entry, replacing any existing command entry for - * the same name. - */ - -static void -addcmdentry(const char *name, struct cmdentry *entry) -{ - struct tblentry *cmdp; - - INTOFF; - cmdp = cmdlookup(name, 1); - if (cmdp->cmdtype == CMDFUNCTION) { - unreffunc(cmdp->param.func); - } - cmdp->cmdtype = entry->cmdtype; - cmdp->param = entry->u; - cmdp->special = entry->special; - INTON; -} - - -/* - * Define a shell function. - */ - -void -defun(const char *name, union node *func) -{ - struct cmdentry entry; - - INTOFF; - entry.cmdtype = CMDFUNCTION; - entry.u.func = copyfunc(func); - entry.special = 0; - addcmdentry(name, &entry); - INTON; -} - - -/* - * Delete a function if it exists. - * Called with interrupts off. - */ - -int -unsetfunc(const char *name) -{ - struct tblentry *cmdp; - - if ((cmdp = cmdlookup(name, 0)) != NULL && cmdp->cmdtype == CMDFUNCTION) { - unreffunc(cmdp->param.func); - delete_cmd_entry(); - return (0); - } - return (0); -} - - -/* - * Check if a function by a certain name exists. - */ -int -isfunc(const char *name) -{ - struct tblentry *cmdp; - cmdp = cmdlookup(name, 0); - return (cmdp != NULL && cmdp->cmdtype == CMDFUNCTION); -} - - -/* - * Shared code for the following builtin commands: - * type, command -v, command -V - */ - -int -typecmd_impl(int argc, char **argv, int cmd, const char *path) -{ - struct cmdentry entry; - struct tblentry *cmdp; - const char *const *pp; - struct alias *ap; - int i; - int error1 = 0; - - if (path != pathval()) - clearcmdentry(); - - for (i = 1; i < argc; i++) { - /* First look at the keywords */ - for (pp = parsekwd; *pp; pp++) - if (**pp == *argv[i] && equal(*pp, argv[i])) - break; - - if (*pp) { - if (cmd == TYPECMD_SMALLV) - out1fmt("%s\n", argv[i]); - else - out1fmt("%s is a shell keyword\n", argv[i]); - continue; - } - - /* Then look at the aliases */ - if ((ap = lookupalias(argv[i], 1)) != NULL) { - if (cmd == TYPECMD_SMALLV) { - out1fmt("alias %s=", argv[i]); - out1qstr(ap->val); - outcslow('\n', out1); - } else - out1fmt("%s is an alias for %s\n", argv[i], - ap->val); - continue; - } - - /* Then check if it is a tracked alias */ - if ((cmdp = cmdlookup(argv[i], 0)) != NULL) { - entry.cmdtype = cmdp->cmdtype; - entry.u = cmdp->param; - entry.special = cmdp->special; - } - else { - /* Finally use brute force */ - find_command(argv[i], &entry, 0, path); - } - - switch (entry.cmdtype) { - case CMDNORMAL: { - if (strchr(argv[i], '/') == NULL) { - const char *path2 = path; - const char *opt2; - char *name; - int j = entry.u.index; - do { - name = padvance(&path2, &opt2, argv[i]); - stunalloc(name); - } while (--j >= 0); - if (cmd == TYPECMD_SMALLV) - out1fmt("%s\n", name); - else - out1fmt("%s is%s %s\n", argv[i], - (cmdp && cmd == TYPECMD_TYPE) ? - " a tracked alias for" : "", - name); - } else { - if (faccessat(AT_FDCWD, argv[i], X_OK, AT_EACCESS) == 0) { - if (cmd == TYPECMD_SMALLV) - out1fmt("%s\n", argv[i]); - else - out1fmt("%s is %s\n", argv[i], - argv[i]); - } else { - if (cmd != TYPECMD_SMALLV) - outfmt(out2, "%s: %s\n", - argv[i], strerror(errno)); - error1 |= 127; - } - } - break; - } - case CMDFUNCTION: - if (cmd == TYPECMD_SMALLV) - out1fmt("%s\n", argv[i]); - else - out1fmt("%s is a shell function\n", argv[i]); - break; - - case CMDBUILTIN: - if (cmd == TYPECMD_SMALLV) - out1fmt("%s\n", argv[i]); - else if (entry.special) - out1fmt("%s is a special shell builtin\n", - argv[i]); - else - out1fmt("%s is a shell builtin\n", argv[i]); - break; - - default: - if (cmd != TYPECMD_SMALLV) - outfmt(out2, "%s: not found\n", argv[i]); - error1 |= 127; - break; - } - } - - if (path != pathval()) - clearcmdentry(); - - return error1; -} - -/* - * Locate and print what a word is... - */ - -int -typecmd(int argc, char **argv) -{ - if (argc > 2 && strcmp(argv[1], "--") == 0) - argc--, argv++; - return typecmd_impl(argc, argv, TYPECMD_TYPE, bltinlookup("PATH", 1)); -} diff --git a/bin/1sh/exec.h b/bin/1sh/exec.h deleted file mode 100644 index f93c14c2..00000000 --- a/bin/1sh/exec.h +++ /dev/null @@ -1,76 +0,0 @@ -/*- - * Copyright (c) 1991, 1993 - * The Regents of the University of California. All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * Kenneth Almquist. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)exec.h 8.3 (Berkeley) 6/8/95 - * $FreeBSD: releng/12.1/bin/sh/exec.h 336320 2018-07-15 21:55:17Z jilles $ - */ - -/* values of cmdtype */ -#define CMDUNKNOWN -1 /* no entry in table for command */ -#define CMDNORMAL 0 /* command is an executable program */ -#define CMDBUILTIN 1 /* command is a shell builtin */ -#define CMDFUNCTION 2 /* command is a shell function */ - -/* values for typecmd_impl's third parameter */ -enum { - TYPECMD_SMALLV, /* command -v */ - TYPECMD_BIGV, /* command -V */ - TYPECMD_TYPE /* type */ -}; - -union node; -struct cmdentry { - int cmdtype; - union param { - int index; - struct funcdef *func; - } u; - int special; -}; - - -/* action to find_command() */ -#define DO_ERR 0x01 /* prints errors */ -#define DO_NOFUNC 0x02 /* don't return shell functions, for command */ - -extern int exerrno; /* last exec error */ - -void shellexec(char **, char **, const char *, int) __attribute__((noreturn)); -char *padvance(const char **, const char **, const char *); -void find_command(const char *, struct cmdentry *, int, const char *); -int find_builtin(const char *, int *); -void hashcd(void); -void changepath(const char *); -void defun(const char *, union node *); -int unsetfunc(const char *); -int isfunc(const char *); -int typecmd_impl(int, char **, int, const char *); -void clearcmdentry(void); diff --git a/bin/1sh/expand.c b/bin/1sh/expand.c deleted file mode 100644 index 3bdd0733..00000000 --- a/bin/1sh/expand.c +++ /dev/null @@ -1,1553 +0,0 @@ -/*- - * Copyright (c) 1991, 1993 - * The Regents of the University of California. All rights reserved. - * Copyright (c) 1997-2005 - * Herbert Xu <herbert@gondor.apana.org.au>. All rights reserved. - * Copyright (c) 2010-2015 - * Jilles Tjoelker <jilles@stack.nl>. All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * Kenneth Almquist. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#ifndef lint -#if 0 -static char sccsid[] = "@(#)expand.c 8.5 (Berkeley) 5/15/95"; -#endif -#endif /* not lint */ -#include <sys/cdefs.h> -/* $FreeBSD: releng/12.1/bin/sh/expand.c 341767 2018-12-09 19:14:21Z jilles $ */ - -#include <sys/types.h> -#include <sys/time.h> -#include <sys/stat.h> -#include <dirent.h> -#include <errno.h> -#include <inttypes.h> -#include <limits.h> -#include <pwd.h> -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <unistd.h> -#include <wchar.h> -#include <wctype.h> - -/* - * Routines to expand arguments to commands. We have to deal with - * backquotes, shell variables, and file metacharacters. - */ - -#include "shell.h" -#include "main.h" -#include "nodes.h" -#include "eval.h" -#include "expand.h" -#include "syntax.h" -#include "parser.h" -#include "jobs.h" -#include "options.h" -#include "var.h" -#include "input.h" -#include "output.h" -#include "memalloc.h" -#include "error.h" -#include "mystring.h" -#include "arith.h" -#include "show.h" -#include "builtins.h" - -enum wordstate { WORD_IDLE, WORD_WS_DELIMITED, WORD_QUOTEMARK }; - -struct worddest { - struct arglist *list; - enum wordstate state; -}; - -static char *expdest; /* output of current string */ - -static const char *argstr(const char *, struct nodelist **restrict, int, - struct worddest *); -static const char *exptilde(const char *, int); -static const char *expari(const char *, struct nodelist **restrict, int, - struct worddest *); -static void expbackq(union node *, int, int, struct worddest *); -static const char *subevalvar_trim(const char *, struct nodelist **restrict, - int, int, int); -static const char *subevalvar_misc(const char *, struct nodelist **restrict, - const char *, int, int, int); -static const char *evalvar(const char *, struct nodelist **restrict, int, - struct worddest *); -static int varisset(const char *, int); -static void strtodest(const char *, int, int, int, struct worddest *); -static void reprocess(int, int, int, int, struct worddest *); -static void varvalue(const char *, int, int, int, struct worddest *); -static void expandmeta(char *, struct arglist *); -static void expmeta(char *, char *, struct arglist *); -static int expsortcmp(const void *, const void *); -static int patmatch(const char *, const char *); -static void cvtnum(int, char *); -static int collate_range_cmp(wchar_t, wchar_t); - -void -emptyarglist(struct arglist *list) -{ - - list->args = list->smallarg; - list->count = 0; - list->capacity = sizeof(list->smallarg) / sizeof(list->smallarg[0]); -} - -void -appendarglist(struct arglist *list, char *str) -{ - char **newargs; - int newcapacity; - - if (list->count >= list->capacity) { - newcapacity = list->capacity * 2; - if (newcapacity < 16) - newcapacity = 16; - if (newcapacity > INT_MAX / (int)sizeof(newargs[0])) - error("Too many entries in arglist"); - newargs = stalloc(newcapacity * sizeof(newargs[0])); - memcpy(newargs, list->args, list->count * sizeof(newargs[0])); - list->args = newargs; - list->capacity = newcapacity; - } - list->args[list->count++] = str; -} - -static int -collate_range_cmp(wchar_t c1, wchar_t c2) -{ - wchar_t s1[2], s2[2]; - - s1[0] = c1; - s1[1] = L'\0'; - s2[0] = c2; - s2[1] = L'\0'; - return (wcscoll(s1, s2)); -} - -static char * -stputs_quotes(const char *data, const char *syntax, char *p) -{ - while (*data) { - CHECKSTRSPACE(2, p); - if (syntax[(int)*data] == CCTL) - USTPUTC(CTLESC, p); - USTPUTC(*data++, p); - } - return (p); -} -#define STPUTS_QUOTES(data, syntax, p) p = stputs_quotes((data), syntax, p) - -static char * -nextword(char c, int flag, char *p, struct worddest *dst) -{ - int is_ws; - - is_ws = c == '\t' || c == '\n' || c == ' '; - if (p != stackblock() || (is_ws ? dst->state == WORD_QUOTEMARK : - dst->state != WORD_WS_DELIMITED) || c == '\0') { - STPUTC('\0', p); - if (flag & EXP_GLOB) - expandmeta(grabstackstr(p), dst->list); - else - appendarglist(dst->list, grabstackstr(p)); - dst->state = is_ws ? WORD_WS_DELIMITED : WORD_IDLE; - } else if (!is_ws && dst->state == WORD_WS_DELIMITED) - dst->state = WORD_IDLE; - /* Reserve space while the stack string is empty. */ - appendarglist(dst->list, NULL); - dst->list->count--; - STARTSTACKSTR(p); - return p; -} -#define NEXTWORD(c, flag, p, dstlist) p = nextword(c, flag, p, dstlist) - -static char * -stputs_split(const char *data, const char *syntax, int flag, char *p, - struct worddest *dst) -{ - const char *ifs; - char c; - - ifs = ifsset() ? ifsval() : " \t\n"; - while (*data) { - CHECKSTRSPACE(2, p); - c = *data++; - if (strchr(ifs, c) != NULL) { - NEXTWORD(c, flag, p, dst); - continue; - } - if (flag & EXP_GLOB && syntax[(int)c] == CCTL) - USTPUTC(CTLESC, p); - USTPUTC(c, p); - } - return (p); -} -#define STPUTS_SPLIT(data, syntax, flag, p, dst) p = stputs_split((data), syntax, flag, p, dst) - -/* - * Perform expansions on an argument, placing the resulting list of arguments - * in arglist. Parameter expansion, command substitution and arithmetic - * expansion are always performed; additional expansions can be requested - * via flag (EXP_*). - * The result is left in the stack string. - * When arglist is NULL, perform here document expansion. - * - * When doing something that may cause this to be re-entered, make sure - * the stack string is empty via grabstackstr() and do not assume expdest - * remains valid. - */ -void -expandarg(union node *arg, struct arglist *arglist, int flag) -{ - struct worddest exparg; - struct nodelist *argbackq; - - if (fflag) - flag &= ~EXP_GLOB; - argbackq = arg->narg.backquote; - exparg.list = arglist; - exparg.state = WORD_IDLE; - STARTSTACKSTR(expdest); - argstr(arg->narg.text, &argbackq, flag, &exparg); - if (arglist == NULL) { - STACKSTRNUL(expdest); - return; /* here document expanded */ - } - if ((flag & EXP_SPLIT) == 0 || expdest != stackblock() || - exparg.state == WORD_QUOTEMARK) { - STPUTC('\0', expdest); - if (flag & EXP_SPLIT) { - if (flag & EXP_GLOB) - expandmeta(grabstackstr(expdest), exparg.list); - else - appendarglist(exparg.list, grabstackstr(expdest)); - } - } - if ((flag & EXP_SPLIT) == 0) - appendarglist(arglist, grabstackstr(expdest)); -} - - - -/* - * Perform parameter expansion, command substitution and arithmetic - * expansion, and tilde expansion if requested via EXP_TILDE/EXP_VARTILDE. - * Processing ends at a CTLENDVAR or CTLENDARI character as well as '\0'. - * This is used to expand word in ${var+word} etc. - * If EXP_GLOB or EXP_CASE are set, keep and/or generate CTLESC - * characters to allow for further processing. - * - * If EXP_SPLIT is set, dst receives any complete words produced. - */ -static const char * -argstr(const char *p, struct nodelist **restrict argbackq, int flag, - struct worddest *dst) -{ - char c; - int quotes = flag & (EXP_GLOB | EXP_CASE); /* do CTLESC */ - int firsteq = 1; - int split_lit; - int lit_quoted; - - split_lit = flag & EXP_SPLIT_LIT; - lit_quoted = flag & EXP_LIT_QUOTED; - flag &= ~(EXP_SPLIT_LIT | EXP_LIT_QUOTED); - if (*p == '~' && (flag & (EXP_TILDE | EXP_VARTILDE))) - p = exptilde(p, flag); - for (;;) { - CHECKSTRSPACE(2, expdest); - switch (c = *p++) { - case '\0': - return (p - 1); - case CTLENDVAR: - case CTLENDARI: - return (p); - case CTLQUOTEMARK: - lit_quoted = 1; - /* "$@" syntax adherence hack */ - if (p[0] == CTLVAR && (p[1] & VSQUOTE) != 0 && - p[2] == '@' && p[3] == '=') - break; - if ((flag & EXP_SPLIT) != 0 && expdest == stackblock()) - dst->state = WORD_QUOTEMARK; - break; - case CTLQUOTEEND: - lit_quoted = 0; - break; - case CTLESC: - c = *p++; - if (split_lit && !lit_quoted && - strchr(ifsset() ? ifsval() : " \t\n", c) != NULL) { - NEXTWORD(c, flag, expdest, dst); - break; - } - if (quotes) - USTPUTC(CTLESC, expdest); - USTPUTC(c, expdest); - break; - case CTLVAR: - p = evalvar(p, argbackq, flag, dst); - break; - case CTLBACKQ: - case CTLBACKQ|CTLQUOTE: - expbackq((*argbackq)->n, c & CTLQUOTE, flag, dst); - *argbackq = (*argbackq)->next; - break; - case CTLARI: - p = expari(p, argbackq, flag, dst); - break; - case ':': - case '=': - /* - * sort of a hack - expand tildes in variable - * assignments (after the first '=' and after ':'s). - */ - if (split_lit && !lit_quoted && - strchr(ifsset() ? ifsval() : " \t\n", c) != NULL) { - NEXTWORD(c, flag, expdest, dst); - break; - } - USTPUTC(c, expdest); - if (flag & EXP_VARTILDE && *p == '~' && - (c != '=' || firsteq)) { - if (c == '=') - firsteq = 0; - p = exptilde(p, flag); - } - break; - default: - if (split_lit && !lit_quoted && - strchr(ifsset() ? ifsval() : " \t\n", c) != NULL) { - NEXTWORD(c, flag, expdest, dst); - break; - } - USTPUTC(c, expdest); - } - } -} - -/* - * Perform tilde expansion, placing the result in the stack string and - * returning the next position in the input string to process. - */ -static const char * -exptilde(const char *p, int flag) -{ - char c; - const char *startp = p; - const char *user; - struct passwd *pw; - char *home; - int len; - - for (;;) { - c = *p; - switch(c) { - case CTLESC: /* This means CTL* are always considered quoted. */ - case CTLVAR: - case CTLBACKQ: - case CTLBACKQ | CTLQUOTE: - case CTLARI: - case CTLENDARI: - case CTLQUOTEMARK: - return (startp); - case ':': - if ((flag & EXP_VARTILDE) == 0) - break; - /* FALLTHROUGH */ - case '\0': - case '/': - case CTLENDVAR: - len = p - startp - 1; - STPUTBIN(startp + 1, len, expdest); - STACKSTRNUL(expdest); - user = expdest - len; - if (*user == '\0') { - home = lookupvar("HOME"); - } else { - pw = getpwnam(user); - home = pw != NULL ? pw->pw_dir : NULL; - } - STADJUST(-len, expdest); - if (home == NULL || *home == '\0') - return (startp); - strtodest(home, flag, VSNORMAL, 1, NULL); - return (p); - } - p++; - } -} - - -/* - * Expand arithmetic expression. - */ -static const char * -expari(const char *p, struct nodelist **restrict argbackq, int flag, - struct worddest *dst) -{ - char *q, *start; - arith_t result; - int begoff; - int quoted; - int adj; - - quoted = *p++ == '"'; - begoff = expdest - stackblock(); - p = argstr(p, argbackq, 0, NULL); - STPUTC('\0', expdest); - start = stackblock() + begoff; - - q = grabstackstr(expdest); - result = arith(start); - ungrabstackstr(q, expdest); - - start = stackblock() + begoff; - adj = start - expdest; - STADJUST(adj, expdest); - - CHECKSTRSPACE((int)(DIGITS(result) + 1), expdest); - fmtstr(expdest, DIGITS(result), ARITH_FORMAT_STR, result); - adj = strlen(expdest); - STADJUST(adj, expdest); - /* - * If this is quoted, a '-' must not indicate a range in [...]. - * If this is not quoted, splitting may occur. - */ - if (quoted ? - result < 0 && begoff > 1 && flag & (EXP_GLOB | EXP_CASE) : - flag & EXP_SPLIT) - reprocess(expdest - adj - stackblock(), flag, VSNORMAL, quoted, - dst); - return p; -} - - -/* - * Perform command substitution. - */ -static void -expbackq(union node *cmd, int quoted, int flag, struct worddest *dst) -{ - struct backcmd in; - int i; - char buf[128]; - char *p; - char *dest = expdest; - char lastc; - char const *syntax = quoted? DQSYNTAX : BASESYNTAX; - int quotes = flag & (EXP_GLOB | EXP_CASE); - size_t nnl; - const char *ifs; - int startloc; - - INTOFF; - p = grabstackstr(dest); - evalbackcmd(cmd, &in); - ungrabstackstr(p, dest); - - p = in.buf; - startloc = dest - stackblock(); - nnl = 0; - if (!quoted && flag & EXP_SPLIT) - ifs = ifsset() ? ifsval() : " \t\n"; - else - ifs = ""; - /* Remove trailing newlines */ - for (;;) { - if (--in.nleft < 0) { - if (in.fd < 0) - break; - while ((i = read(in.fd, buf, sizeof buf)) < 0 && errno == EINTR) - ; - TRACE(("expbackq: read returns %d\n", i)); - if (i <= 0) - break; - p = buf; - in.nleft = i - 1; - } - lastc = *p++; - if (lastc == '\0') - continue; - if (nnl > 0 && lastc != '\n') { - NEXTWORD('\n', flag, dest, dst); - nnl = 0; - } - if (strchr(ifs, lastc) != NULL) { - if (lastc == '\n') - nnl++; - else - NEXTWORD(lastc, flag, dest, dst); - } else { - CHECKSTRSPACE(2, dest); - if (quotes && syntax[(int)lastc] == CCTL) - USTPUTC(CTLESC, dest); - USTPUTC(lastc, dest); - } - } - while (dest > stackblock() + startloc && STTOPC(dest) == '\n') - STUNPUTC(dest); - - if (in.fd >= 0) - close(in.fd); - if (in.buf) - ckfree(in.buf); - if (in.jp) { - p = grabstackstr(dest); - exitstatus = waitforjob(in.jp, (int *)NULL); - ungrabstackstr(p, dest); - } - TRACE(("expbackq: done\n")); - expdest = dest; - INTON; -} - - - -static void -recordleft(const char *str, const char *loc, char *startp) -{ - int amount; - - amount = ((str - 1) - (loc - startp)) - expdest; - STADJUST(amount, expdest); - while (loc != str - 1) - *startp++ = *loc++; -} - -static const char * -subevalvar_trim(const char *p, struct nodelist **restrict argbackq, int strloc, - int subtype, int startloc) -{ - char *startp; - char *loc = NULL; - char *str; - int c = 0; - int amount; - - p = argstr(p, argbackq, EXP_CASE | EXP_TILDE, NULL); - STACKSTRNUL(expdest); - startp = stackblock() + startloc; - str = stackblock() + strloc; - - switch (subtype) { - case VSTRIMLEFT: - for (loc = startp; loc < str; loc++) { - c = *loc; - *loc = '\0'; - if (patmatch(str, startp)) { - *loc = c; - recordleft(str, loc, startp); - return p; - } - *loc = c; - } - break; - - case VSTRIMLEFTMAX: - for (loc = str - 1; loc >= startp;) { - c = *loc; - *loc = '\0'; - if (patmatch(str, startp)) { - *loc = c; - recordleft(str, loc, startp); - return p; - } - *loc = c; - loc--; - } - break; - - case VSTRIMRIGHT: - for (loc = str - 1; loc >= startp;) { - if (patmatch(str, loc)) { - amount = loc - expdest; - STADJUST(amount, expdest); - return p; - } - loc--; - } - break; - - case VSTRIMRIGHTMAX: - for (loc = startp; loc < str - 1; loc++) { - if (patmatch(str, loc)) { - amount = loc - expdest; - STADJUST(amount, expdest); - return p; - } - } - break; - - - default: - abort(); - } - amount = (expdest - stackblock() - strloc) + 1; - STADJUST(-amount, expdest); - return p; -} - - -static const char * -subevalvar_misc(const char *p, struct nodelist **restrict argbackq, - const char *var, int subtype, int startloc, int varflags) -{ - const char *end; - char *startp; - int amount; - - end = argstr(p, argbackq, EXP_TILDE, NULL); - STACKSTRNUL(expdest); - startp = stackblock() + startloc; - - switch (subtype) { - case VSASSIGN: - setvar(var, startp, 0); - amount = startp - expdest; - STADJUST(amount, expdest); - return end; - - case VSQUESTION: - if (*p != CTLENDVAR) { - outfmt(out2, "%s\n", startp); - error((char *)NULL); - } - error("%.*s: parameter %snot set", (int)(p - var - 1), - var, (varflags & VSNUL) ? "null or " : ""); - - default: - abort(); - } -} - - -/* - * Expand a variable, and return a pointer to the next character in the - * input string. - */ - -static const char * -evalvar(const char *p, struct nodelist **restrict argbackq, int flag, - struct worddest *dst) -{ - int subtype; - int varflags; - const char *var; - const char *val; - int patloc; - int c; - int set; - int special; - int startloc; - int varlen; - int varlenb; - char buf[21]; - - varflags = (unsigned char)*p++; - subtype = varflags & VSTYPE; - var = p; - special = 0; - if (! is_name(*p)) - special = 1; - p = strchr(p, '=') + 1; - if (varflags & VSLINENO) { - set = 1; - special = 1; - val = NULL; - } else if (special) { - set = varisset(var, varflags & VSNUL); - val = NULL; - } else { - val = bltinlookup(var, 1); - if (val == NULL || ((varflags & VSNUL) && val[0] == '\0')) { - val = NULL; - set = 0; - } else - set = 1; - } - varlen = 0; - startloc = expdest - stackblock(); - if (!set && uflag && *var != '@' && *var != '*') { - switch (subtype) { - case VSNORMAL: - case VSTRIMLEFT: - case VSTRIMLEFTMAX: - case VSTRIMRIGHT: - case VSTRIMRIGHTMAX: - case VSLENGTH: - error("%.*s: parameter not set", (int)(p - var - 1), - var); - } - } - if (set && subtype != VSPLUS) { - /* insert the value of the variable */ - if (special) { - if (varflags & VSLINENO) { - if (p - var > (ptrdiff_t)sizeof(buf)) - abort(); - memcpy(buf, var, p - var - 1); - buf[p - var - 1] = '\0'; - strtodest(buf, flag, subtype, - varflags & VSQUOTE, dst); - } else - varvalue(var, varflags & VSQUOTE, subtype, flag, - dst); - if (subtype == VSLENGTH) { - varlenb = expdest - stackblock() - startloc; - varlen = varlenb; - if (localeisutf8) { - val = stackblock() + startloc; - for (;val != expdest; val++) - if ((*val & 0xC0) == 0x80) - varlen--; - } - STADJUST(-varlenb, expdest); - } - } else { - if (subtype == VSLENGTH) { - for (;*val; val++) - if (!localeisutf8 || - (*val & 0xC0) != 0x80) - varlen++; - } - else - strtodest(val, flag, subtype, - varflags & VSQUOTE, dst); - } - } - - if (subtype == VSPLUS) - set = ! set; - - switch (subtype) { - case VSLENGTH: - cvtnum(varlen, buf); - strtodest(buf, flag, VSNORMAL, varflags & VSQUOTE, dst); - break; - - case VSNORMAL: - return p; - - case VSPLUS: - case VSMINUS: - if (!set) { - return argstr(p, argbackq, - flag | (flag & EXP_SPLIT ? EXP_SPLIT_LIT : 0) | - (varflags & VSQUOTE ? EXP_LIT_QUOTED : 0), dst); - } - break; - - case VSTRIMLEFT: - case VSTRIMLEFTMAX: - case VSTRIMRIGHT: - case VSTRIMRIGHTMAX: - if (!set) - break; - /* - * Terminate the string and start recording the pattern - * right after it - */ - STPUTC('\0', expdest); - patloc = expdest - stackblock(); - p = subevalvar_trim(p, argbackq, patloc, subtype, startloc); - reprocess(startloc, flag, VSNORMAL, varflags & VSQUOTE, dst); - if (flag & EXP_SPLIT && *var == '@' && varflags & VSQUOTE) - dst->state = WORD_QUOTEMARK; - return p; - - case VSASSIGN: - case VSQUESTION: - if (!set) { - p = subevalvar_misc(p, argbackq, var, subtype, - startloc, varflags); - /* assert(subtype == VSASSIGN); */ - val = lookupvar(var); - strtodest(val, flag, subtype, varflags & VSQUOTE, dst); - return p; - } - break; - - case VSERROR: - c = p - var - 1; - error("${%.*s%s}: Bad substitution", c, var, - (c > 0 && *p != CTLENDVAR) ? "..." : ""); - - default: - abort(); - } - - { /* skip to end of alternative */ - int nesting = 1; - for (;;) { - if ((c = *p++) == CTLESC) - p++; - else if (c == CTLBACKQ || c == (CTLBACKQ|CTLQUOTE)) - *argbackq = (*argbackq)->next; - else if (c == CTLVAR) { - if ((*p++ & VSTYPE) != VSNORMAL) - nesting++; - } else if (c == CTLENDVAR) { - if (--nesting == 0) - break; - } - } - } - return p; -} - - - -/* - * Test whether a special or positional parameter is set. - */ - -static int -varisset(const char *name, int nulok) -{ - - if (*name == '!') - return backgndpidset(); - else if (*name == '@' || *name == '*') { - if (*shellparam.p == NULL) - return 0; - - if (nulok) { - char **av; - - for (av = shellparam.p; *av; av++) - if (**av != '\0') - return 1; - return 0; - } - } else if (is_digit(*name)) { - char *ap; - long num; - - errno = 0; - num = strtol(name, NULL, 10); - if (errno != 0 || num > shellparam.nparam) - return 0; - - if (num == 0) - ap = arg0; - else - ap = shellparam.p[num - 1]; - - if (nulok && (ap == NULL || *ap == '\0')) - return 0; - } - return 1; -} - -static void -strtodest(const char *p, int flag, int subtype, int quoted, - struct worddest *dst) -{ - if (subtype == VSLENGTH || subtype == VSTRIMLEFT || - subtype == VSTRIMLEFTMAX || subtype == VSTRIMRIGHT || - subtype == VSTRIMRIGHTMAX) - STPUTS(p, expdest); - else if (flag & EXP_SPLIT && !quoted && dst != NULL) - STPUTS_SPLIT(p, BASESYNTAX, flag, expdest, dst); - else if (flag & (EXP_GLOB | EXP_CASE)) - STPUTS_QUOTES(p, quoted ? DQSYNTAX : BASESYNTAX, expdest); - else - STPUTS(p, expdest); -} - -static void -reprocess(int startloc, int flag, int subtype, int quoted, - struct worddest *dst) -{ - static char *buf = NULL; - static size_t buflen = 0; - char *startp; - size_t len, zpos, zlen; - - startp = stackblock() + startloc; - len = expdest - startp; - if (len >= SIZE_MAX / 2 || len > PTRDIFF_MAX) - abort(); - INTOFF; - if (len >= buflen) { - ckfree(buf); - buf = NULL; - } - if (buflen < 128) - buflen = 128; - while (len >= buflen) - buflen <<= 1; - if (buf == NULL) - buf = ckmalloc(buflen); - INTON; - memcpy(buf, startp, len); - buf[len] = '\0'; - STADJUST(-(ptrdiff_t)len, expdest); - for (zpos = 0;;) { - zlen = strlen(buf + zpos); - strtodest(buf + zpos, flag, subtype, quoted, dst); - zpos += zlen + 1; - if (zpos == len + 1) - break; - if (flag & EXP_SPLIT && (quoted || (zlen > 0 && zpos < len))) - NEXTWORD('\0', flag, expdest, dst); - } -} - -/* - * Add the value of a special or positional parameter to the stack string. - */ - -static void -varvalue(const char *name, int quoted, int subtype, int flag, - struct worddest *dst) -{ - int num; - char *p; - int i; - int splitlater; - char sep[2]; - char **ap; - char buf[(NSHORTOPTS > 10 ? NSHORTOPTS : 10) + 1]; - - if (subtype == VSLENGTH) - flag &= ~EXP_FULL; - splitlater = subtype == VSTRIMLEFT || subtype == VSTRIMLEFTMAX || - subtype == VSTRIMRIGHT || subtype == VSTRIMRIGHTMAX; - - switch (*name) { - case '$': - num = rootpid; - break; - case '?': - num = oexitstatus; - break; - case '#': - num = shellparam.nparam; - break; - case '!': - num = backgndpidval(); - break; - case '-': - p = buf; - for (i = 0 ; i < NSHORTOPTS ; i++) { - if (optval[i]) - *p++ = optletter[i]; - } - *p = '\0'; - strtodest(buf, flag, subtype, quoted, dst); - return; - case '@': - if (flag & EXP_SPLIT && quoted) { - for (ap = shellparam.p ; (p = *ap++) != NULL ; ) { - strtodest(p, flag, subtype, quoted, dst); - if (*ap) { - if (splitlater) - STPUTC('\0', expdest); - else - NEXTWORD('\0', flag, expdest, - dst); - } - } - if (shellparam.nparam > 0) - dst->state = WORD_QUOTEMARK; - return; - } - /* FALLTHROUGH */ - case '*': - if (ifsset()) - sep[0] = ifsval()[0]; - else - sep[0] = ' '; - sep[1] = '\0'; - for (ap = shellparam.p ; (p = *ap++) != NULL ; ) { - strtodest(p, flag, subtype, quoted, dst); - if (!*ap) - break; - if (sep[0]) - strtodest(sep, flag, subtype, quoted, dst); - else if (flag & EXP_SPLIT && !quoted && **ap != '\0') { - if (splitlater) - STPUTC('\0', expdest); - else - NEXTWORD('\0', flag, expdest, dst); - } - } - return; - default: - if (is_digit(*name)) { - num = atoi(name); - if (num == 0) - p = arg0; - else if (num > 0 && num <= shellparam.nparam) - p = shellparam.p[num - 1]; - else - return; - strtodest(p, flag, subtype, quoted, dst); - } - return; - } - cvtnum(num, buf); - strtodest(buf, flag, subtype, quoted, dst); -} - - - -static char expdir[PATH_MAX]; -#define expdir_end (expdir + sizeof(expdir)) - -/* - * Perform pathname generation and remove control characters. - * At this point, the only control characters should be CTLESC. - * The results are stored in the list dstlist. - */ -static void -expandmeta(char *pattern, struct arglist *dstlist) -{ - char *p; - int firstmatch; - char c; - - firstmatch = dstlist->count; - p = pattern; - for (; (c = *p) != '\0'; p++) { - /* fast check for meta chars */ - if (c == '*' || c == '?' || c == '[') { - INTOFF; - expmeta(expdir, pattern, dstlist); - INTON; - break; - } - } - if (dstlist->count == firstmatch) { - /* - * no matches - */ - rmescapes(pattern); - appendarglist(dstlist, pattern); - } else { - qsort(&dstlist->args[firstmatch], - dstlist->count - firstmatch, - sizeof(dstlist->args[0]), expsortcmp); - } -} - - -/* - * Do metacharacter (i.e. *, ?, [...]) expansion. - */ - -static void -expmeta(char *enddir, char *name, struct arglist *arglist) -{ - const char *p; - const char *q; - const char *start; - char *endname; - int metaflag; - struct stat statb; - DIR *dirp; - struct dirent *dp; - int atend; - int matchdot; - int esc; - int namlen; - - metaflag = 0; - start = name; - for (p = name; esc = 0, *p; p += esc + 1) { - if (*p == '*' || *p == '?') - metaflag = 1; - else if (*p == '[') { - q = p + 1; - if (*q == '!' || *q == '^') - q++; - for (;;) { - if (*q == CTLESC) - q++; - if (*q == '/' || *q == '\0') - break; - if (*++q == ']') { - metaflag = 1; - break; - } - } - } else if (*p == '\0') - break; - else { - if (*p == CTLESC) - esc++; - if (p[esc] == '/') { - if (metaflag) - break; - start = p + esc + 1; - } - } - } - if (metaflag == 0) { /* we've reached the end of the file name */ - if (enddir != expdir) - metaflag++; - for (p = name ; ; p++) { - if (*p == CTLESC) - p++; - *enddir++ = *p; - if (*p == '\0') - break; - if (enddir == expdir_end) - return; - } - if (metaflag == 0 || lstat(expdir, &statb) >= 0) - appendarglist(arglist, stsavestr(expdir)); - return; - } - endname = name + (p - name); - if (start != name) { - p = name; - while (p < start) { - if (*p == CTLESC) - p++; - *enddir++ = *p++; - if (enddir == expdir_end) - return; - } - } - if (enddir == expdir) { - p = "."; - } else if (enddir == expdir + 1 && *expdir == '/') { - p = "/"; - } else { - p = expdir; - enddir[-1] = '\0'; - } - if ((dirp = opendir(p)) == NULL) - return; - if (enddir != expdir) - enddir[-1] = '/'; - if (*endname == 0) { - atend = 1; - } else { - atend = 0; - *endname = '\0'; - endname += esc + 1; - } - matchdot = 0; - p = start; - if (*p == CTLESC) - p++; - if (*p == '.') - matchdot++; - while (! int_pending() && (dp = readdir(dirp)) != NULL) { - if (dp->d_name[0] == '.' && ! matchdot) - continue; - if (patmatch(start, dp->d_name)) { - namlen = dp->d_namlen; - if (enddir + namlen + 1 > expdir_end) - continue; - memcpy(enddir, dp->d_name, namlen + 1); - if (atend) - appendarglist(arglist, stsavestr(expdir)); - else { - if (dp->d_type != DT_UNKNOWN && - dp->d_type != DT_DIR && - dp->d_type != DT_LNK) - continue; - if (enddir + namlen + 2 > expdir_end) - continue; - enddir[namlen] = '/'; - enddir[namlen + 1] = '\0'; - expmeta(enddir + namlen + 1, endname, arglist); - } - } - } - closedir(dirp); - if (! atend) - endname[-esc - 1] = esc ? CTLESC : '/'; -} - - -static int -expsortcmp(const void *p1, const void *p2) -{ - const char *s1 = *(const char * const *)p1; - const char *s2 = *(const char * const *)p2; - - return (strcoll(s1, s2)); -} - - - -static wchar_t -get_wc(const char **p) -{ - wchar_t c; - int chrlen; - - chrlen = mbtowc(&c, *p, 4); - if (chrlen == 0) - return 0; - else if (chrlen == -1) - c = 0; - else - *p += chrlen; - return c; -} - - -/* - * See if a character matches a character class, starting at the first colon - * of "[:class:]". - * If a valid character class is recognized, a pointer to the next character - * after the final closing bracket is stored into *end, otherwise a null - * pointer is stored into *end. - */ -static int -match_charclass(const char *p, wchar_t chr, const char **end) -{ - char name[20]; - const char *nameend; - wctype_t cclass; - - *end = NULL; - p++; - nameend = strstr(p, ":]"); - if (nameend == NULL || (size_t)(nameend - p) >= sizeof(name) || - nameend == p) - return 0; - memcpy(name, p, nameend - p); - name[nameend - p] = '\0'; - *end = nameend + 2; - cclass = wctype(name); - /* An unknown class matches nothing but is valid nevertheless. */ - if (cclass == 0) - return 0; - return iswctype(chr, cclass); -} - - -/* - * Returns true if the pattern matches the string. - */ - -static int -patmatch(const char *pattern, const char *string) -{ - const char *p, *q, *end; - const char *bt_p, *bt_q; - char c; - wchar_t wc, wc2; - - p = pattern; - q = string; - bt_p = NULL; - bt_q = NULL; - for (;;) { - switch (c = *p++) { - case '\0': - if (*q != '\0') - goto backtrack; - return 1; - case CTLESC: - if (*q++ != *p++) - goto backtrack; - break; - case '?': - if (*q == '\0') - return 0; - if (localeisutf8) { - wc = get_wc(&q); - /* - * A '?' does not match invalid UTF-8 but a - * '*' does, so backtrack. - */ - if (wc == 0) - goto backtrack; - } else - q++; - break; - case '*': - c = *p; - while (c == '*') - c = *++p; - /* - * If the pattern ends here, we know the string - * matches without needing to look at the rest of it. - */ - if (c == '\0') - return 1; - /* - * First try the shortest match for the '*' that - * could work. We can forget any earlier '*' since - * there is no way having it match more characters - * can help us, given that we are already here. - */ - bt_p = p; - bt_q = q; - break; - case '[': { - const char *savep, *saveq; - int invert, found; - wchar_t chr; - - savep = p, saveq = q; - invert = 0; - if (*p == '!' || *p == '^') { - invert++; - p++; - } - found = 0; - if (*q == '\0') - return 0; - if (localeisutf8) { - chr = get_wc(&q); - if (chr == 0) - goto backtrack; - } else - chr = (unsigned char)*q++; - c = *p++; - do { - if (c == '\0') { - p = savep, q = saveq; - c = '['; - goto dft; - } - if (c == '[' && *p == ':') { - found |= match_charclass(p, chr, &end); - if (end != NULL) { - p = end; - continue; - } - } - if (c == CTLESC) - c = *p++; - if (localeisutf8 && c & 0x80) { - p--; - wc = get_wc(&p); - if (wc == 0) /* bad utf-8 */ - return 0; - } else - wc = (unsigned char)c; - if (*p == '-' && p[1] != ']') { - p++; - if (*p == CTLESC) - p++; - if (localeisutf8) { - wc2 = get_wc(&p); - if (wc2 == 0) /* bad utf-8 */ - return 0; - } else - wc2 = (unsigned char)*p++; - if ( collate_range_cmp(chr, wc) >= 0 - && collate_range_cmp(chr, wc2) <= 0 - ) - found = 1; - } else { - if (chr == wc) - found = 1; - } - } while ((c = *p++) != ']'); - if (found == invert) - goto backtrack; - break; - } -dft: default: - if (*q == '\0') - return 0; - if (*q++ == c) - break; -backtrack: - /* - * If we have a mismatch (other than hitting the end - * of the string), go back to the last '*' seen and - * have it match one additional character. - */ - if (bt_p == NULL) - return 0; - if (*bt_q == '\0') - return 0; - bt_q++; - p = bt_p; - q = bt_q; - break; - } - } -} - - - -/* - * Remove any CTLESC and CTLQUOTEMARK characters from a string. - */ - -void -rmescapes(char *str) -{ - char *p, *q; - - p = str; - while (*p != CTLESC && *p != CTLQUOTEMARK && *p != CTLQUOTEEND) { - if (*p++ == '\0') - return; - } - q = p; - while (*p) { - if (*p == CTLQUOTEMARK || *p == CTLQUOTEEND) { - p++; - continue; - } - if (*p == CTLESC) - p++; - *q++ = *p++; - } - *q = '\0'; -} - - - -/* - * See if a pattern matches in a case statement. - */ - -int -casematch(union node *pattern, const char *val) -{ - struct stackmark smark; - struct nodelist *argbackq; - int result; - char *p; - - setstackmark(&smark); - argbackq = pattern->narg.backquote; - STARTSTACKSTR(expdest); - argstr(pattern->narg.text, &argbackq, EXP_TILDE | EXP_CASE, NULL); - STPUTC('\0', expdest); - p = grabstackstr(expdest); - result = patmatch(p, val); - popstackmark(&smark); - return result; -} - -/* - * Our own itoa(). - */ - -static void -cvtnum(int num, char *buf) -{ - char temp[32]; - int neg = num < 0; - char *p = temp + 31; - - temp[31] = '\0'; - - do { - *--p = num % 10 + '0'; - } while ((num /= 10) != 0); - - if (neg) - *--p = '-'; - - memcpy(buf, p, temp + 32 - p); -} - -/* - * Do most of the work for wordexp(3). - */ - -int -wordexpcmd(int argc, char **argv) -{ - size_t len; - int i; - - out1fmt("%08x", argc - 1); - for (i = 1, len = 0; i < argc; i++) - len += strlen(argv[i]); - out1fmt("%08x", (int)len); - for (i = 1; i < argc; i++) - outbin(argv[i], strlen(argv[i]) + 1, out1); - return (0); -} - -/* - * Do most of the work for wordexp(3), new version. - */ - -int -freebsd_wordexpcmd(int argc __unused, char **argv __unused) -{ - struct arglist arglist; - union node *args, *n; - size_t len; - int ch; - int protected = 0; - int fd = -1; - int i; - - while ((ch = nextopt("f:p")) != '\0') { - switch (ch) { - case 'f': - fd = number(shoptarg); - break; - case 'p': - protected = 1; - break; - } - } - if (*argptr != NULL) - error("wrong number of arguments"); - if (fd < 0) - error("missing fd"); - INTOFF; - setinputfd(fd, 1); - INTON; - args = parsewordexp(); - popfile(); /* will also close fd */ - if (protected) - for (n = args; n != NULL; n = n->narg.next) { - if (n->narg.backquote != NULL) { - outcslow('C', out1); - error("command substitution disabled"); - } - } - outcslow(' ', out1); - emptyarglist(&arglist); - for (n = args; n != NULL; n = n->narg.next) - expandarg(n, &arglist, EXP_FULL | EXP_TILDE); - for (i = 0, len = 0; i < arglist.count; i++) - len += strlen(arglist.args[i]); - out1fmt("%016x %016zx", arglist.count, len); - for (i = 0; i < arglist.count; i++) - outbin(arglist.args[i], strlen(arglist.args[i]) + 1, out1); - return (0); -} diff --git a/bin/1sh/expand.h b/bin/1sh/expand.h deleted file mode 100644 index 2bd9bbd9..00000000 --- a/bin/1sh/expand.h +++ /dev/null @@ -1,62 +0,0 @@ -/*- - * Copyright (c) 1991, 1993 - * The Regents of the University of California. All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * Kenneth Almquist. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)expand.h 8.2 (Berkeley) 5/4/95 - * $FreeBSD: releng/12.1/bin/sh/expand.h 314436 2017-02-28 23:42:47Z imp $ - */ - -struct arglist { - char **args; - int count; - int capacity; - char *smallarg[1]; -}; - -/* - * expandarg() flags - */ -#define EXP_SPLIT 0x1 /* perform word splitting */ -#define EXP_TILDE 0x2 /* do normal tilde expansion */ -#define EXP_VARTILDE 0x4 /* expand tildes in an assignment */ -#define EXP_CASE 0x10 /* keeps quotes around for CASE pattern */ -#define EXP_SPLIT_LIT 0x20 /* IFS split literal text ${v+-a b c} */ -#define EXP_LIT_QUOTED 0x40 /* for EXP_SPLIT_LIT, start off quoted */ -#define EXP_GLOB 0x80 /* perform file globbing */ - -#define EXP_FULL (EXP_SPLIT | EXP_GLOB) - - -void emptyarglist(struct arglist *); -void appendarglist(struct arglist *, char *); -union node; -void expandarg(union node *, struct arglist *, int); -void rmescapes(char *); -int casematch(union node *, const char *); diff --git a/bin/1sh/histedit.c b/bin/1sh/histedit.c deleted file mode 100644 index e0bda06e..00000000 --- a/bin/1sh/histedit.c +++ /dev/null @@ -1,558 +0,0 @@ -/*- - * Copyright (c) 1993 - * The Regents of the University of California. All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * Kenneth Almquist. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#ifndef lint -#if 0 -static char sccsid[] = "@(#)histedit.c 8.2 (Berkeley) 5/4/95"; -#endif -#endif /* not lint */ -#include <sys/cdefs.h> -/* $FreeBSD: releng/12.1/bin/sh/histedit.c 345613 2019-03-27 21:53:44Z jilles $ */ - -#include <sys/param.h> -#include <limits.h> -#include <paths.h> -#include <stdio.h> -#include <stdlib.h> -#include <unistd.h> -/* - * Editline and history functions (and glue). - */ -#include "shell.h" -#include "parser.h" -#include "var.h" -#include "options.h" -#include "main.h" -#include "output.h" -#include "mystring.h" -#ifndef NO_HISTORY -#include "myhistedit.h" -#include "error.h" -#include "eval.h" -#include "memalloc.h" -#include "builtins.h" - -#define MAXHISTLOOPS 4 /* max recursions through fc */ -#define DEFEDITOR "ed" /* default editor *should* be $EDITOR */ - -History *hist; /* history cookie */ -EditLine *el; /* editline cookie */ -int displayhist; -static FILE *el_in, *el_out, *el_err; - -static void history_load(const char *hf); -static void history_save(const char *hf); - -static char *fc_replace(const char *, char *, char *); -static int not_fcnumber(const char *); -static int str_to_event(const char *, int); - -/* - * Set history and editing status. Called whenever the status may - * have changed (figures out what to do). - */ -void -histedit(void) -{ - -#define editing (Eflag || Vflag) - - if (iflag) { - if (!hist) { - /* - * turn history on - */ - INTOFF; - hist = history_init(); - INTON; - - if (hist != NULL) { - sethistsize(histsizeval()); - sethistfile(histfileval()); - } else - out2fmt_flush("sh: can't initialize history\n"); - } - if (editing && !el && isatty(0)) { /* && isatty(2) ??? */ - /* - * turn editing on - */ - char *term; - - INTOFF; - if (el_in == NULL) - el_in = fdopen(0, "r"); - if (el_err == NULL) - el_err = fdopen(1, "w"); - if (el_out == NULL) - el_out = fdopen(2, "w"); - if (el_in == NULL || el_err == NULL || el_out == NULL) - goto bad; - term = lookupvar("TERM"); - if (term) - setenv("TERM", term, 1); - else - unsetenv("TERM"); - el = el_init(arg0, el_in, el_out, el_err); - if (el != NULL) { - if (hist) - el_set(el, EL_HIST, history, hist); - el_set(el, EL_PROMPT, getprompt); - el_set(el, EL_RPROMPT, getrprompt); - el_set(el, EL_ADDFN, "sh-complete", - "Filename completion", - _el_fn_complete); - } else { -bad: - out2fmt_flush("sh: can't initialize editing\n"); - } - INTON; - } else if (!editing && el) { - INTOFF; - el_end(el); - el = NULL; - INTON; - } - if (el) { - el_source(el, NULL); - if (Vflag) - el_set(el, EL_EDITOR, "vi"); - else if (Eflag) - el_set(el, EL_EDITOR, "emacs"); - el_set(el, EL_BIND, "^I", "sh-complete", NULL); - } - } else { - INTOFF; - if (el) { /* no editing if not interactive */ - el_end(el); - el = NULL; - } - if (hist) { - if (*histfileval() != '\0') - history_save(histfileval()); - history_end(hist); - hist = NULL; - } - INTON; - } -} - - -void -sethistfile(const char *hf) -{ - if (hist != NULL && hf != NULL && *hf != '\0') - history_load(hf); -} - - -static void -history_load(const char *hf) -{ - HistEvent he; - - if (history(hist, &he, H_LOAD, hf) == -1) - warning("%s: %s", he.str, hf); -} - - -static void -history_save(const char *hf) -{ - HistEvent he; - - if (history(hist, &he, H_SAVE, hf) == -1) - warning("%s: %s", he.str, hf); -} - - -void -sethistsize(const char *hs) -{ - int histsize; - HistEvent he; - - if (hist != NULL) { - if (hs == NULL || !is_number(hs)) - histsize = 100; - else - histsize = atoi(hs); - history(hist, &he, H_SETSIZE, histsize); - history(hist, &he, H_SETUNIQUE, 1); - } -} - -void -setterm(const char *term) -{ - if (rootshell && el != NULL && term != NULL) - el_set(el, EL_TERMINAL, term); -} - -int -histcmd(int argc, char **argv __unused) -{ - int ch; - const char *editor = NULL; - HistEvent he; - int lflg = 0, nflg = 0, rflg = 0, sflg = 0; - int i, retval; - const char *firststr, *laststr; - int first, last, direction; - char *pat = NULL, *repl = NULL; - static int active = 0; - struct jmploc jmploc; - struct jmploc *savehandler; - char editfilestr[PATH_MAX]; - char *volatile editfile; - FILE *efp = NULL; - int oldhistnum; - - if (hist == NULL) - error("history not active"); - - if (argc == 1) - error("missing history argument"); - - while (not_fcnumber(*argptr) && (ch = nextopt("e:lnrs")) != '\0') - switch ((char)ch) { - case 'e': - editor = shoptarg; - break; - case 'l': - lflg = 1; - break; - case 'n': - nflg = 1; - break; - case 'r': - rflg = 1; - break; - case 's': - sflg = 1; - break; - } - - savehandler = handler; - /* - * If executing... - */ - if (lflg == 0 || editor || sflg) { - lflg = 0; /* ignore */ - editfile = NULL; - /* - * Catch interrupts to reset active counter and - * cleanup temp files. - */ - if (setjmp(jmploc.loc)) { - active = 0; - if (editfile) - unlink(editfile); - handler = savehandler; - longjmp(handler->loc, 1); - } - handler = &jmploc; - if (++active > MAXHISTLOOPS) { - active = 0; - displayhist = 0; - error("called recursively too many times"); - } - /* - * Set editor. - */ - if (sflg == 0) { - if (editor == NULL && - (editor = bltinlookup("FCEDIT", 1)) == NULL && - (editor = bltinlookup("EDITOR", 1)) == NULL) - editor = DEFEDITOR; - if (editor[0] == '-' && editor[1] == '\0') { - sflg = 1; /* no edit */ - editor = NULL; - } - } - } - - /* - * If executing, parse [old=new] now - */ - if (lflg == 0 && *argptr != NULL && - ((repl = strchr(*argptr, '=')) != NULL)) { - pat = *argptr; - *repl++ = '\0'; - argptr++; - } - /* - * determine [first] and [last] - */ - if (*argptr == NULL) { - firststr = lflg ? "-16" : "-1"; - laststr = "-1"; - } else if (argptr[1] == NULL) { - firststr = argptr[0]; - laststr = lflg ? "-1" : argptr[0]; - } else if (argptr[2] == NULL) { - firststr = argptr[0]; - laststr = argptr[1]; - } else - error("too many arguments"); - /* - * Turn into event numbers. - */ - first = str_to_event(firststr, 0); - last = str_to_event(laststr, 1); - - if (rflg) { - i = last; - last = first; - first = i; - } - /* - * XXX - this should not depend on the event numbers - * always increasing. Add sequence numbers or offset - * to the history element in next (diskbased) release. - */ - direction = first < last ? H_PREV : H_NEXT; - - /* - * If editing, grab a temp file. - */ - if (editor) { - int fd; - INTOFF; /* easier */ - sprintf(editfilestr, "%s/_shXXXXXX", _PATH_TMP); - if ((fd = mkstemp(editfilestr)) < 0) - error("can't create temporary file %s", editfile); - editfile = editfilestr; - if ((efp = fdopen(fd, "w")) == NULL) { - close(fd); - error("Out of space"); - } - } - - /* - * Loop through selected history events. If listing or executing, - * do it now. Otherwise, put into temp file and call the editor - * after. - * - * The history interface needs rethinking, as the following - * convolutions will demonstrate. - */ - history(hist, &he, H_FIRST); - retval = history(hist, &he, H_NEXT_EVENT, first); - for (;retval != -1; retval = history(hist, &he, direction)) { - if (lflg) { - if (!nflg) - out1fmt("%5d ", he.num); - out1str(he.str); - } else { - const char *s = pat ? - fc_replace(he.str, pat, repl) : he.str; - - if (sflg) { - if (displayhist) { - out2str(s); - flushout(out2); - } - evalstring(s, 0); - if (displayhist && hist) { - /* - * XXX what about recursive and - * relative histnums. - */ - oldhistnum = he.num; - history(hist, &he, H_ENTER, s); - /* - * XXX H_ENTER moves the internal - * cursor, set it back to the current - * entry. - */ - history(hist, &he, - H_NEXT_EVENT, oldhistnum); - } - } else - fputs(s, efp); - } - /* - * At end? (if we were to lose last, we'd sure be - * messed up). - */ - if (he.num == last) - break; - } - if (editor) { - char *editcmd; - - fclose(efp); - INTON; - editcmd = stalloc(strlen(editor) + strlen(editfile) + 2); - sprintf(editcmd, "%s %s", editor, editfile); - evalstring(editcmd, 0); /* XXX - should use no JC command */ - readcmdfile(editfile); /* XXX - should read back - quick tst */ - unlink(editfile); - } - - if (lflg == 0 && active > 0) - --active; - if (displayhist) - displayhist = 0; - handler = savehandler; - return 0; -} - -static char * -fc_replace(const char *s, char *p, char *r) -{ - char *dest; - int plen = strlen(p); - - STARTSTACKSTR(dest); - while (*s) { - if (*s == *p && strncmp(s, p, plen) == 0) { - STPUTS(r, dest); - s += plen; - *p = '\0'; /* so no more matches */ - } else - STPUTC(*s++, dest); - } - STPUTC('\0', dest); - dest = grabstackstr(dest); - - return (dest); -} - -static int -not_fcnumber(const char *s) -{ - if (s == NULL) - return (0); - if (*s == '-') - s++; - return (!is_number(s)); -} - -static int -str_to_event(const char *str, int last) -{ - HistEvent he; - const char *s = str; - int relative = 0; - int i, retval; - - retval = history(hist, &he, H_FIRST); - switch (*s) { - case '-': - relative = 1; - /*FALLTHROUGH*/ - case '+': - s++; - } - if (is_number(s)) { - i = atoi(s); - if (relative) { - while (retval != -1 && i--) { - retval = history(hist, &he, H_NEXT); - } - if (retval == -1) - retval = history(hist, &he, H_LAST); - } else { - retval = history(hist, &he, H_NEXT_EVENT, i); - if (retval == -1) { - /* - * the notion of first and last is - * backwards to that of the history package - */ - retval = history(hist, &he, last ? H_FIRST : H_LAST); - } - } - if (retval == -1) - error("history number %s not found (internal error)", - str); - } else { - /* - * pattern - */ - retval = history(hist, &he, H_PREV_STR, str); - if (retval == -1) - error("history pattern not found: %s", str); - } - return (he.num); -} - -int -bindcmd(int argc, char **argv) -{ - int ret; - FILE *old; - FILE *out; - - if (el == NULL) - error("line editing is disabled"); - - INTOFF; - - out = out1fp(); - if (out == NULL) - error("Out of space"); - - el_get(el, EL_GETFP, 1, &old); - el_set(el, EL_SETFP, 1, out); - - ret = el_parse(el, argc, (const char **)(argv)); - - el_set(el, EL_SETFP, 1, old); - - fclose(out); - - INTON; - - return ret; -} - -#else -#include "error.h" - -int -histcmd(int argc, char **argv) -{ - - error("not compiled with history support"); - /*NOTREACHED*/ - return (0); -} - -int -bindcmd(int argc, char **argv) -{ - - error("not compiled with line editing support"); - return (0); -} -#endif diff --git a/bin/1sh/input.c b/bin/1sh/input.c deleted file mode 100644 index 37f689a5..00000000 --- a/bin/1sh/input.c +++ /dev/null @@ -1,520 +0,0 @@ -/*- - * Copyright (c) 1991, 1993 - * The Regents of the University of California. All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * Kenneth Almquist. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#ifndef lint -#if 0 -static char sccsid[] = "@(#)input.c 8.3 (Berkeley) 6/9/95"; -#endif -#endif /* not lint */ -#include <sys/cdefs.h> -/* $FreeBSD: releng/12.1/bin/sh/input.c 314436 2017-02-28 23:42:47Z imp $ */ - -#include <stdio.h> /* defines BUFSIZ */ -#include <fcntl.h> -#include <errno.h> -#include <unistd.h> -#include <stdlib.h> -#include <string.h> - -/* - * This file implements the input routines used by the parser. - */ - -#include "shell.h" -#include "redir.h" -#include "syntax.h" -#include "input.h" -#include "output.h" -#include "options.h" -#include "memalloc.h" -#include "error.h" -#include "alias.h" -#include "parser.h" -#include "myhistedit.h" -#include "trap.h" - -#define EOF_NLEFT -99 /* value of parsenleft when EOF pushed back */ - -struct strpush { - struct strpush *prev; /* preceding string on stack */ - const char *prevstring; - int prevnleft; - int prevlleft; - struct alias *ap; /* if push was associated with an alias */ -}; - -/* - * The parsefile structure pointed to by the global variable parsefile - * contains information about the current file being read. - */ - -struct parsefile { - struct parsefile *prev; /* preceding file on stack */ - int linno; /* current line */ - int fd; /* file descriptor (or -1 if string) */ - int nleft; /* number of chars left in this line */ - int lleft; /* number of lines left in this buffer */ - const char *nextc; /* next char in buffer */ - char *buf; /* input buffer */ - struct strpush *strpush; /* for pushing strings at this level */ - struct strpush basestrpush; /* so pushing one is fast */ -}; - - -int plinno = 1; /* input line number */ -int parsenleft; /* copy of parsefile->nleft */ -static int parselleft; /* copy of parsefile->lleft */ -const char *parsenextc; /* copy of parsefile->nextc */ -static char basebuf[BUFSIZ + 1];/* buffer for top level input file */ -static struct parsefile basepf = { /* top level input file */ - .nextc = basebuf, - .buf = basebuf -}; -static struct parsefile *parsefile = &basepf; /* current input file */ -int whichprompt; /* 1 == PS1, 2 == PS2 */ - -EditLine *el; /* cookie for editline package */ - -static void pushfile(void); -static int preadfd(void); -static void popstring(void); - -void -resetinput(void) -{ - popallfiles(); - parselleft = parsenleft = 0; /* clear input buffer */ -} - - - -/* - * Read a character from the script, returning PEOF on end of file. - * Nul characters in the input are silently discarded. - */ - -int -pgetc(void) -{ - return pgetc_macro(); -} - - -static int -preadfd(void) -{ - int nr; - parsenextc = parsefile->buf; - -retry: -#ifndef NO_HISTORY - if (parsefile->fd == 0 && el) { - static const char *rl_cp; - static int el_len; - - if (rl_cp == NULL) { - el_resize(el); - rl_cp = el_gets(el, &el_len); - } - if (rl_cp == NULL) - nr = el_len == 0 ? 0 : -1; - else { - nr = el_len; - if (nr > BUFSIZ) - nr = BUFSIZ; - memcpy(parsefile->buf, rl_cp, nr); - if (nr != el_len) { - el_len -= nr; - rl_cp += nr; - } else - rl_cp = NULL; - } - } else -#endif - nr = read(parsefile->fd, parsefile->buf, BUFSIZ); - - if (nr <= 0) { - if (nr < 0) { - if (errno == EINTR) - goto retry; - if (parsefile->fd == 0 && errno == EWOULDBLOCK) { - int flags = fcntl(0, F_GETFL, 0); - if (flags >= 0 && flags & O_NONBLOCK) { - flags &=~ O_NONBLOCK; - if (fcntl(0, F_SETFL, flags) >= 0) { - out2fmt_flush("sh: turning off NDELAY mode\n"); - goto retry; - } - } - } - } - nr = -1; - } - return nr; -} - -/* - * Refill the input buffer and return the next input character: - * - * 1) If a string was pushed back on the input, pop it; - * 2) If an EOF was pushed back (parsenleft == EOF_NLEFT) or we are reading - * from a string so we can't refill the buffer, return EOF. - * 3) If there is more in this buffer, use it else call read to fill it. - * 4) Process input up to the next newline, deleting nul characters. - */ - -int -preadbuffer(void) -{ - char *p, *q, *r, *end; - char savec; - - while (parsefile->strpush) { - /* - * Add a space to the end of an alias to ensure that the - * alias remains in use while parsing its last word. - * This avoids alias recursions. - */ - if (parsenleft == -1 && parsefile->strpush->ap != NULL) - return ' '; - popstring(); - if (--parsenleft >= 0) - return (*parsenextc++); - } - if (parsenleft == EOF_NLEFT || parsefile->buf == NULL) - return PEOF; - -again: - if (parselleft <= 0) { - if ((parselleft = preadfd()) == -1) { - parselleft = parsenleft = EOF_NLEFT; - return PEOF; - } - } - - p = parsefile->buf + (parsenextc - parsefile->buf); - end = p + parselleft; - *end = '\0'; - q = strchr(p, '\n'); - if (!q) q = strchr(p, '\0'); - if (q != end && *q == '\0') { - /* delete nul characters */ - for (r = q; q != end; q++) { - if (*q != '\0') - *r++ = *q; - } - parselleft -= end - r; - if (parselleft == 0) - goto again; - end = p + parselleft; - *end = '\0'; - q = strchr(p, '\n'); - if (!q) q = strchr(p, '\0'); - } - if (q == end) { - parsenleft = parselleft; - parselleft = 0; - } else /* *q == '\n' */ { - q++; - parsenleft = q - parsenextc; - parselleft -= parsenleft; - } - parsenleft--; - - savec = *q; - *q = '\0'; - -#ifndef NO_HISTORY - if (parsefile->fd == 0 && hist && - parsenextc[strspn(parsenextc, " \t\n")] != '\0') { - HistEvent he; - INTOFF; - history(hist, &he, whichprompt == 1 ? H_ENTER : H_ADD, - parsenextc); - INTON; - } -#endif - - if (vflag) { - out2str(parsenextc); - flushout(out2); - } - - *q = savec; - - return *parsenextc++; -} - -/* - * Returns if we are certain we are at EOF. Does not cause any more input - * to be read from the outside world. - */ - -int -preadateof(void) -{ - if (parsenleft > 0) - return 0; - if (parsefile->strpush) - return 0; - if (parsenleft == EOF_NLEFT || parsefile->buf == NULL) - return 1; - return 0; -} - -/* - * Undo the last call to pgetc. Only one character may be pushed back. - * PEOF may be pushed back. - */ - -void -pungetc(void) -{ - parsenleft++; - parsenextc--; -} - -/* - * Push a string back onto the input at this current parsefile level. - * We handle aliases this way. - */ -void -pushstring(const char *s, int len, struct alias *ap) -{ - struct strpush *sp; - - INTOFF; -/*out2fmt_flush("*** calling pushstring: %s, %d\n", s, len);*/ - if (parsefile->strpush) { - sp = ckmalloc(sizeof (struct strpush)); - sp->prev = parsefile->strpush; - parsefile->strpush = sp; - } else - sp = parsefile->strpush = &(parsefile->basestrpush); - sp->prevstring = parsenextc; - sp->prevnleft = parsenleft; - sp->prevlleft = parselleft; - sp->ap = ap; - if (ap) - ap->flag |= ALIASINUSE; - parsenextc = s; - parsenleft = len; - INTON; -} - -static void -popstring(void) -{ - struct strpush *sp = parsefile->strpush; - - INTOFF; - if (sp->ap) { - if (parsenextc != sp->ap->val && - (parsenextc[-1] == ' ' || parsenextc[-1] == '\t')) - forcealias(); - sp->ap->flag &= ~ALIASINUSE; - } - parsenextc = sp->prevstring; - parsenleft = sp->prevnleft; - parselleft = sp->prevlleft; -/*out2fmt_flush("*** calling popstring: restoring to '%s'\n", parsenextc);*/ - parsefile->strpush = sp->prev; - if (sp != &(parsefile->basestrpush)) - ckfree(sp); - INTON; -} - -/* - * Set the input to take input from a file. If push is set, push the - * old input onto the stack first. - */ - -void -setinputfile(const char *fname, int push) -{ - int fd; - int fd2; - - INTOFF; - if ((fd = open(fname, O_RDONLY | O_CLOEXEC)) < 0) - error("cannot open %s: %s", fname, strerror(errno)); - if (fd < 10) { - fd2 = fcntl(fd, F_DUPFD_CLOEXEC, 10); - close(fd); - if (fd2 < 0) - error("Out of file descriptors"); - fd = fd2; - } - setinputfd(fd, push); - INTON; -} - - -/* - * Like setinputfile, but takes an open file descriptor (which should have - * its FD_CLOEXEC flag already set). Call this with interrupts off. - */ - -void -setinputfd(int fd, int push) -{ - if (push) { - pushfile(); - parsefile->buf = ckmalloc(BUFSIZ + 1); - } - if (parsefile->fd > 0) - close(parsefile->fd); - parsefile->fd = fd; - if (parsefile->buf == NULL) - parsefile->buf = ckmalloc(BUFSIZ + 1); - parselleft = parsenleft = 0; - plinno = 1; -} - - -/* - * Like setinputfile, but takes input from a string. - */ - -void -setinputstring(const char *string, int push) -{ - INTOFF; - if (push) - pushfile(); - parsenextc = string; - parselleft = parsenleft = strlen(string); - parsefile->buf = NULL; - plinno = 1; - INTON; -} - - - -/* - * To handle the "." command, a stack of input files is used. Pushfile - * adds a new entry to the stack and popfile restores the previous level. - */ - -static void -pushfile(void) -{ - struct parsefile *pf; - - parsefile->nleft = parsenleft; - parsefile->lleft = parselleft; - parsefile->nextc = parsenextc; - parsefile->linno = plinno; - pf = (struct parsefile *)ckmalloc(sizeof (struct parsefile)); - pf->prev = parsefile; - pf->fd = -1; - pf->strpush = NULL; - pf->basestrpush.prev = NULL; - parsefile = pf; -} - - -void -popfile(void) -{ - struct parsefile *pf = parsefile; - - INTOFF; - if (pf->fd >= 0) - close(pf->fd); - if (pf->buf) - ckfree(pf->buf); - while (pf->strpush) - popstring(); - parsefile = pf->prev; - ckfree(pf); - parsenleft = parsefile->nleft; - parselleft = parsefile->lleft; - parsenextc = parsefile->nextc; - plinno = parsefile->linno; - INTON; -} - - -/* - * Return current file (to go back to it later using popfilesupto()). - */ - -struct parsefile * -getcurrentfile(void) -{ - return parsefile; -} - - -/* - * Pop files until the given file is on top again. Useful for regular - * builtins that read shell commands from files or strings. - * If the given file is not an active file, an error is raised. - */ - -void -popfilesupto(struct parsefile *file) -{ - while (parsefile != file && parsefile != &basepf) - popfile(); - if (parsefile != file) - error("popfilesupto() misused"); -} - -/* - * Return to top level. - */ - -void -popallfiles(void) -{ - while (parsefile != &basepf) - popfile(); -} - - - -/* - * Close the file(s) that the shell is reading commands from. Called - * after a fork is done. - */ - -void -closescript(void) -{ - popallfiles(); - if (parsefile->fd > 0) { - close(parsefile->fd); - parsefile->fd = 0; - } -} diff --git a/bin/1sh/input.h b/bin/1sh/input.h deleted file mode 100644 index 1d0047cc..00000000 --- a/bin/1sh/input.h +++ /dev/null @@ -1,65 +0,0 @@ -/*- - * Copyright (c) 1991, 1993 - * The Regents of the University of California. All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * Kenneth Almquist. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)input.h 8.2 (Berkeley) 5/4/95 - * $FreeBSD: releng/12.1/bin/sh/input.h 314436 2017-02-28 23:42:47Z imp $ - */ - -/* PEOF (the end of file marker) is defined in syntax.h */ - -/* - * The input line number. Input.c just defines this variable, and saves - * and restores it when files are pushed and popped. The user of this - * package must set its value. - */ -extern int plinno; -extern int parsenleft; /* number of characters left in input buffer */ -extern const char *parsenextc; /* next character in input buffer */ - -struct alias; -struct parsefile; - -void resetinput(void); -int pgetc(void); -int preadbuffer(void); -int preadateof(void); -void pungetc(void); -void pushstring(const char *, int, struct alias *); -void setinputfile(const char *, int); -void setinputfd(int, int); -void setinputstring(const char *, int); -void popfile(void); -struct parsefile *getcurrentfile(void); -void popfilesupto(struct parsefile *); -void popallfiles(void); -void closescript(void); - -#define pgetc_macro() (--parsenleft >= 0? *parsenextc++ : preadbuffer()) diff --git a/bin/1sh/jobs.c b/bin/1sh/jobs.c deleted file mode 100644 index 492251e0..00000000 --- a/bin/1sh/jobs.c +++ /dev/null @@ -1,1569 +0,0 @@ -/*- - * Copyright (c) 1991, 1993 - * The Regents of the University of California. All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * Kenneth Almquist. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#ifndef lint -#if 0 -static char sccsid[] = "@(#)jobs.c 8.5 (Berkeley) 5/4/95"; -#endif -#endif /* not lint */ -#include <sys/cdefs.h> -/* $FreeBSD: releng/12.1/bin/sh/jobs.c 345487 2019-03-24 22:10:26Z jilles $ */ - -#include <sys/ioctl.h> -#include <sys/param.h> -#include <sys/resource.h> -#include <sys/time.h> -#include <sys/wait.h> -#include <errno.h> -#include <fcntl.h> -#include <paths.h> -#include <signal.h> -#include <stddef.h> -#include <stdlib.h> -#include <unistd.h> - -#include "shell.h" -#if JOBS -#include <termios.h> -#undef CEOF /* syntax.h redefines this */ -#endif -#include "redir.h" -#include "exec.h" -#include "show.h" -#include "main.h" -#include "parser.h" -#include "nodes.h" -#include "jobs.h" -#include "options.h" -#include "trap.h" -#include "syntax.h" -#include "input.h" -#include "output.h" -#include "memalloc.h" -#include "error.h" -#include "mystring.h" -#include "var.h" -#include "builtins.h" - - -/* - * A job structure contains information about a job. A job is either a - * single process or a set of processes contained in a pipeline. In the - * latter case, pidlist will be non-NULL, and will point to a -1 terminated - * array of pids. - */ - -struct procstat { - pid_t pid; /* process id */ - int status; /* status flags (defined above) */ - char *cmd; /* text of command being run */ -}; - - -/* states */ -#define JOBSTOPPED 1 /* all procs are stopped */ -#define JOBDONE 2 /* all procs are completed */ - - -struct job { - struct procstat ps0; /* status of process */ - struct procstat *ps; /* status or processes when more than one */ - short nprocs; /* number of processes */ - pid_t pgrp; /* process group of this job */ - char state; /* true if job is finished */ - char used; /* true if this entry is in used */ - char changed; /* true if status has changed */ - char foreground; /* true if running in the foreground */ - char remembered; /* true if $! referenced */ - char pipefail; /* pass any non-zero status */ -#if JOBS - char jobctl; /* job running under job control */ - struct job *next; /* job used after this one */ -#endif -}; - - -static struct job *jobtab; /* array of jobs */ -static int njobs; /* size of array */ -static pid_t backgndpid = -1; /* pid of last background process */ -static struct job *bgjob = NULL; /* last background process */ -#if JOBS -static struct job *jobmru; /* most recently used job list */ -static pid_t initialpgrp; /* pgrp of shell on invocation */ -#endif -static int ttyfd = -1; - -/* mode flags for dowait */ -#define DOWAIT_BLOCK 0x1 /* wait until a child exits */ -#define DOWAIT_SIG 0x2 /* if DOWAIT_BLOCK, abort on signal */ -#define DOWAIT_SIG_TRAP 0x4 /* if DOWAIT_SIG, abort on trapped signal only */ - -#if JOBS -static void restartjob(struct job *); -#endif -static void freejob(struct job *); -static int waitcmdloop(struct job *); -static struct job *getjob_nonotfound(const char *); -static struct job *getjob(const char *); -pid_t killjob(const char *, int); -static pid_t dowait(int, struct job *); -static void checkzombies(void); -static void cmdtxt(union node *); -static void cmdputs(const char *); -#if JOBS -static void setcurjob(struct job *); -static void deljob(struct job *); -static struct job *getcurjob(struct job *); -#endif -static int getjobstatus(const struct job *); -static void printjobcmd(struct job *); -static void showjob(struct job *, int); - - -/* - * Turn job control on and off. - */ - -static int jobctl; - -#if JOBS -static void -jobctl_notty(void) -{ - if (ttyfd >= 0) { - close(ttyfd); - ttyfd = -1; - } - if (!iflag) { - setsignal(SIGTSTP); - setsignal(SIGTTOU); - setsignal(SIGTTIN); - jobctl = 1; - return; - } - out2fmt_flush("sh: can't access tty; job control turned off\n"); - mflag = 0; -} - -void -setjobctl(int on) -{ - int i; - - if (on == jobctl || rootshell == 0) - return; - if (on) { - if (ttyfd != -1) - close(ttyfd); - if ((ttyfd = open(_PATH_TTY, O_RDWR | O_CLOEXEC)) < 0) { - i = 0; - while (i <= 2 && !isatty(i)) - i++; - if (i > 2 || - (ttyfd = fcntl(i, F_DUPFD_CLOEXEC, 10)) < 0) { - jobctl_notty(); - return; - } - } - if (ttyfd < 10) { - /* - * Keep our TTY file descriptor out of the way of - * the user's redirections. - */ - if ((i = fcntl(ttyfd, F_DUPFD_CLOEXEC, 10)) < 0) { - jobctl_notty(); - return; - } - close(ttyfd); - ttyfd = i; - } - do { /* while we are in the background */ - initialpgrp = tcgetpgrp(ttyfd); - if (initialpgrp < 0) { - jobctl_notty(); - return; - } - if (initialpgrp != getpgrp()) { - if (!iflag) { - initialpgrp = -1; - jobctl_notty(); - return; - } - kill(0, SIGTTIN); - continue; - } - } while (0); - setsignal(SIGTSTP); - setsignal(SIGTTOU); - setsignal(SIGTTIN); - setpgid(0, rootpid); - tcsetpgrp(ttyfd, rootpid); - } else { /* turning job control off */ - setpgid(0, initialpgrp); - if (ttyfd >= 0) { - tcsetpgrp(ttyfd, initialpgrp); - close(ttyfd); - ttyfd = -1; - } - setsignal(SIGTSTP); - setsignal(SIGTTOU); - setsignal(SIGTTIN); - } - jobctl = on; -} -#endif - - -#if JOBS -int -fgcmd(int argc __unused, char **argv __unused) -{ - struct job *jp; - pid_t pgrp; - int status; - - nextopt(""); - jp = getjob(*argptr); - if (jp->jobctl == 0) - error("job not created under job control"); - printjobcmd(jp); - flushout(&output); - pgrp = jp->ps[0].pid; - if (ttyfd >= 0) - tcsetpgrp(ttyfd, pgrp); - restartjob(jp); - jp->foreground = 1; - INTOFF; - status = waitforjob(jp, (int *)NULL); - INTON; - return status; -} - - -int -bgcmd(int argc __unused, char **argv __unused) -{ - struct job *jp; - - nextopt(""); - do { - jp = getjob(*argptr); - if (jp->jobctl == 0) - error("job not created under job control"); - if (jp->state == JOBDONE) - continue; - restartjob(jp); - jp->foreground = 0; - out1fmt("[%td] ", jp - jobtab + 1); - printjobcmd(jp); - } while (*argptr != NULL && *++argptr != NULL); - return 0; -} - - -static void -restartjob(struct job *jp) -{ - struct procstat *ps; - int i; - - if (jp->state == JOBDONE) - return; - setcurjob(jp); - INTOFF; - kill(-jp->ps[0].pid, SIGCONT); - for (ps = jp->ps, i = jp->nprocs ; --i >= 0 ; ps++) { - if (WIFSTOPPED(ps->status)) { - ps->status = -1; - jp->state = 0; - } - } - INTON; -} -#endif - - -int -jobscmd(int argc __unused, char *argv[] __unused) -{ - char *id; - int ch, mode; - - mode = SHOWJOBS_DEFAULT; - while ((ch = nextopt("lps")) != '\0') { - switch (ch) { - case 'l': - mode = SHOWJOBS_VERBOSE; - break; - case 'p': - mode = SHOWJOBS_PGIDS; - break; - case 's': - mode = SHOWJOBS_PIDS; - break; - } - } - - if (*argptr == NULL) - showjobs(0, mode); - else - while ((id = *argptr++) != NULL) - showjob(getjob(id), mode); - - return (0); -} - -static int getjobstatus(const struct job *jp) -{ - int i, status; - - if (!jp->pipefail) - return (jp->ps[jp->nprocs - 1].status); - for (i = jp->nprocs - 1; i >= 0; i--) { - status = jp->ps[i].status; - if (status != 0) - return (status); - } - return (0); -} - -static void -printjobcmd(struct job *jp) -{ - struct procstat *ps; - int i; - - for (ps = jp->ps, i = jp->nprocs ; --i >= 0 ; ps++) { - out1str(ps->cmd); - if (i > 0) - out1str(" | "); - } - out1c('\n'); -} - -static void -showjob(struct job *jp, int mode) -{ - char s[64]; - char statebuf[16]; - const char *statestr, *coredump; - struct procstat *ps; - struct job *j; - int col, curr, i, jobno, prev, procno, status; - char c; - - procno = (mode == SHOWJOBS_PGIDS) ? 1 : jp->nprocs; - jobno = jp - jobtab + 1; - curr = prev = 0; -#if JOBS - if ((j = getcurjob(NULL)) != NULL) { - curr = j - jobtab + 1; - if ((j = getcurjob(j)) != NULL) - prev = j - jobtab + 1; - } -#endif - coredump = ""; - status = getjobstatus(jp); - if (jp->state == 0) { - statestr = "Running"; -#if JOBS - } else if (jp->state == JOBSTOPPED) { - ps = jp->ps + jp->nprocs - 1; - while (!WIFSTOPPED(ps->status) && ps > jp->ps) - ps--; - if (WIFSTOPPED(ps->status)) - i = WSTOPSIG(ps->status); - else - i = -1; - statestr = strsignal(i); - if (statestr == NULL) - statestr = "Suspended"; -#endif - } else if (WIFEXITED(status)) { - if (WEXITSTATUS(status) == 0) - statestr = "Done"; - else { - fmtstr(statebuf, sizeof(statebuf), "Done(%d)", - WEXITSTATUS(status)); - statestr = statebuf; - } - } else { - i = WTERMSIG(status); - statestr = strsignal(i); - if (statestr == NULL) - statestr = "Unknown signal"; - if (WCOREDUMP(status)) - coredump = " (core dumped)"; - } - - for (ps = jp->ps ; procno > 0 ; ps++, procno--) { /* for each process */ - if (mode == SHOWJOBS_PIDS || mode == SHOWJOBS_PGIDS) { - out1fmt("%d\n", (int)ps->pid); - continue; - } - if (mode != SHOWJOBS_VERBOSE && ps != jp->ps) - continue; - if (jobno == curr && ps == jp->ps) - c = '+'; - else if (jobno == prev && ps == jp->ps) - c = '-'; - else - c = ' '; - if (ps == jp->ps) - fmtstr(s, 64, "[%d] %c ", jobno, c); - else - fmtstr(s, 64, " %c ", c); - out1str(s); - col = strlen(s); - if (mode == SHOWJOBS_VERBOSE) { - fmtstr(s, 64, "%d ", (int)ps->pid); - out1str(s); - col += strlen(s); - } - if (ps == jp->ps) { - out1str(statestr); - out1str(coredump); - col += strlen(statestr) + strlen(coredump); - } - do { - out1c(' '); - col++; - } while (col < 30); - if (mode == SHOWJOBS_VERBOSE) { - out1str(ps->cmd); - out1c('\n'); - } else - printjobcmd(jp); - } -} - -/* - * Print a list of jobs. If "change" is nonzero, only print jobs whose - * statuses have changed since the last call to showjobs. - * - * If the shell is interrupted in the process of creating a job, the - * result may be a job structure containing zero processes. Such structures - * will be freed here. - */ - -void -showjobs(int change, int mode) -{ - int jobno; - struct job *jp; - - TRACE(("showjobs(%d) called\n", change)); - checkzombies(); - for (jobno = 1, jp = jobtab ; jobno <= njobs ; jobno++, jp++) { - if (! jp->used) - continue; - if (jp->nprocs == 0) { - freejob(jp); - continue; - } - if (change && ! jp->changed) - continue; - showjob(jp, mode); - if (mode == SHOWJOBS_DEFAULT || mode == SHOWJOBS_VERBOSE) { - jp->changed = 0; - /* Hack: discard jobs for which $! has not been - * referenced in interactive mode when they terminate. - */ - if (jp->state == JOBDONE && !jp->remembered && - (iflag || jp != bgjob)) { - freejob(jp); - } - } - } -} - - -/* - * Mark a job structure as unused. - */ - -static void -freejob(struct job *jp) -{ - struct procstat *ps; - int i; - - INTOFF; - if (bgjob == jp) - bgjob = NULL; - for (i = jp->nprocs, ps = jp->ps ; --i >= 0 ; ps++) { - if (ps->cmd != nullstr) - ckfree(ps->cmd); - } - if (jp->ps != &jp->ps0) - ckfree(jp->ps); - jp->used = 0; -#if JOBS - deljob(jp); -#endif - INTON; -} - - - -int -waitcmd(int argc __unused, char **argv __unused) -{ - struct job *job; - int retval; - - nextopt(""); - if (*argptr == NULL) - return (waitcmdloop(NULL)); - - do { - job = getjob_nonotfound(*argptr); - if (job == NULL) - retval = 127; - else - retval = waitcmdloop(job); - argptr++; - } while (*argptr != NULL); - - return (retval); -} - -static int -waitcmdloop(struct job *job) -{ - int status, retval, sig; - struct job *jp; - - /* - * Loop until a process is terminated or stopped, or a SIGINT is - * received. - */ - - do { - if (job != NULL) { - if (job->state == JOBDONE) { - status = getjobstatus(job); - if (WIFEXITED(status)) - retval = WEXITSTATUS(status); - else - retval = WTERMSIG(status) + 128; - if (! iflag || ! job->changed) - freejob(job); - else { - job->remembered = 0; - if (job == bgjob) - bgjob = NULL; - } - return retval; - } - } else { - for (jp = jobtab ; jp < jobtab + njobs; jp++) - if (jp->used && jp->state == JOBDONE) { - if (! iflag || ! jp->changed) - freejob(jp); - else { - jp->remembered = 0; - if (jp == bgjob) - bgjob = NULL; - } - } - for (jp = jobtab ; ; jp++) { - if (jp >= jobtab + njobs) { /* no running procs */ - return 0; - } - if (jp->used && jp->state == 0) - break; - } - } - } while (dowait(DOWAIT_BLOCK | DOWAIT_SIG, (struct job *)NULL) != -1); - - sig = pendingsig_waitcmd; - pendingsig_waitcmd = 0; - return sig + 128; -} - - - -int -jobidcmd(int argc __unused, char **argv __unused) -{ - struct job *jp; - int i; - - nextopt(""); - jp = getjob(*argptr); - for (i = 0 ; i < jp->nprocs ; ) { - out1fmt("%d", (int)jp->ps[i].pid); - out1c(++i < jp->nprocs? ' ' : '\n'); - } - return 0; -} - - - -/* - * Convert a job name to a job structure. - */ - -static struct job * -getjob_nonotfound(const char *name) -{ - int jobno; - struct job *found, *jp; - size_t namelen; - pid_t pid; - int i; - - if (name == NULL) { -#if JOBS - name = "%+"; -#else - error("No current job"); -#endif - } - if (name[0] == '%') { - if (is_digit(name[1])) { - jobno = number(name + 1); - if (jobno > 0 && jobno <= njobs - && jobtab[jobno - 1].used != 0) - return &jobtab[jobno - 1]; -#if JOBS - } else if ((name[1] == '%' || name[1] == '+') && - name[2] == '\0') { - if ((jp = getcurjob(NULL)) == NULL) - error("No current job"); - return (jp); - } else if (name[1] == '-' && name[2] == '\0') { - if ((jp = getcurjob(NULL)) == NULL || - (jp = getcurjob(jp)) == NULL) - error("No previous job"); - return (jp); -#endif - } else if (name[1] == '?') { - found = NULL; - for (jp = jobtab, i = njobs ; --i >= 0 ; jp++) { - if (jp->used && jp->nprocs > 0 - && strstr(jp->ps[0].cmd, name + 2) != NULL) { - if (found) - error("%s: ambiguous", name); - found = jp; - } - } - if (found != NULL) - return (found); - } else { - namelen = strlen(name); - found = NULL; - for (jp = jobtab, i = njobs ; --i >= 0 ; jp++) { - if (jp->used && jp->nprocs > 0 - && strncmp(jp->ps[0].cmd, name + 1, - namelen - 1) == 0) { - if (found) - error("%s: ambiguous", name); - found = jp; - } - } - if (found) - return found; - } - } else if (is_number(name)) { - pid = (pid_t)number(name); - for (jp = jobtab, i = njobs ; --i >= 0 ; jp++) { - if (jp->used && jp->nprocs > 0 - && jp->ps[jp->nprocs - 1].pid == pid) - return jp; - } - } - return NULL; -} - - -static struct job * -getjob(const char *name) -{ - struct job *jp; - - jp = getjob_nonotfound(name); - if (jp == NULL) - error("No such job: %s", name); - return (jp); -} - - -int -killjob(const char *name, int sig) -{ - struct job *jp; - int i, ret; - - jp = getjob(name); - if (jp->state == JOBDONE) - return 0; - if (jp->jobctl) - return kill(-jp->ps[0].pid, sig); - ret = -1; - errno = ESRCH; - for (i = 0; i < jp->nprocs; i++) - if (jp->ps[i].status == -1 || WIFSTOPPED(jp->ps[i].status)) { - if (kill(jp->ps[i].pid, sig) == 0) - ret = 0; - } else - ret = 0; - return ret; -} - -/* - * Return a new job structure, - */ - -struct job * -makejob(union node *node __unused, int nprocs) -{ - int i; - struct job *jp; - - for (i = njobs, jp = jobtab ; ; jp++) { - if (--i < 0) { - INTOFF; - if (njobs == 0) { - jobtab = ckmalloc(4 * sizeof jobtab[0]); -#if JOBS - jobmru = NULL; -#endif - } else { - jp = ckmalloc((njobs + 4) * sizeof jobtab[0]); - memcpy(jp, jobtab, njobs * sizeof jp[0]); -#if JOBS - /* Relocate `next' pointers and list head */ - if (jobmru != NULL) - jobmru = &jp[jobmru - jobtab]; - for (i = 0; i < njobs; i++) - if (jp[i].next != NULL) - jp[i].next = &jp[jp[i].next - - jobtab]; -#endif - if (bgjob != NULL) - bgjob = &jp[bgjob - jobtab]; - /* Relocate `ps' pointers */ - for (i = 0; i < njobs; i++) - if (jp[i].ps == &jobtab[i].ps0) - jp[i].ps = &jp[i].ps0; - ckfree(jobtab); - jobtab = jp; - } - jp = jobtab + njobs; - for (i = 4 ; --i >= 0 ; jobtab[njobs++].used = 0) - ; - INTON; - break; - } - if (jp->used == 0) - break; - } - INTOFF; - jp->state = 0; - jp->used = 1; - jp->changed = 0; - jp->nprocs = 0; - jp->foreground = 0; - jp->remembered = 0; - jp->pipefail = pipefailflag; -#if JOBS - jp->jobctl = jobctl; - jp->next = NULL; -#endif - if (nprocs > 1) { - jp->ps = ckmalloc(nprocs * sizeof (struct procstat)); - } else { - jp->ps = &jp->ps0; - } - INTON; - TRACE(("makejob(%p, %d) returns %%%td\n", (void *)node, nprocs, - jp - jobtab + 1)); - return jp; -} - -#if JOBS -static void -setcurjob(struct job *cj) -{ - struct job *jp, *prev; - - for (prev = NULL, jp = jobmru; jp != NULL; prev = jp, jp = jp->next) { - if (jp == cj) { - if (prev != NULL) - prev->next = jp->next; - else - jobmru = jp->next; - jp->next = jobmru; - jobmru = cj; - return; - } - } - cj->next = jobmru; - jobmru = cj; -} - -static void -deljob(struct job *j) -{ - struct job *jp, *prev; - - for (prev = NULL, jp = jobmru; jp != NULL; prev = jp, jp = jp->next) { - if (jp == j) { - if (prev != NULL) - prev->next = jp->next; - else - jobmru = jp->next; - return; - } - } -} - -/* - * Return the most recently used job that isn't `nj', and preferably one - * that is stopped. - */ -static struct job * -getcurjob(struct job *nj) -{ - struct job *jp; - - /* Try to find a stopped one.. */ - for (jp = jobmru; jp != NULL; jp = jp->next) - if (jp->used && jp != nj && jp->state == JOBSTOPPED) - return (jp); - /* Otherwise the most recently used job that isn't `nj' */ - for (jp = jobmru; jp != NULL; jp = jp->next) - if (jp->used && jp != nj) - return (jp); - - return (NULL); -} - -#endif - -/* - * Fork of a subshell. If we are doing job control, give the subshell its - * own process group. Jp is a job structure that the job is to be added to. - * N is the command that will be evaluated by the child. Both jp and n may - * be NULL. The mode parameter can be one of the following: - * FORK_FG - Fork off a foreground process. - * FORK_BG - Fork off a background process. - * FORK_NOJOB - Like FORK_FG, but don't give the process its own - * process group even if job control is on. - * - * When job control is turned off, background processes have their standard - * input redirected to /dev/null (except for the second and later processes - * in a pipeline). - */ - -pid_t -forkshell(struct job *jp, union node *n, int mode) -{ - pid_t pid; - pid_t pgrp; - - TRACE(("forkshell(%%%td, %p, %d) called\n", jp - jobtab, (void *)n, - mode)); - INTOFF; - if (mode == FORK_BG && (jp == NULL || jp->nprocs == 0)) - checkzombies(); - flushall(); - pid = fork(); - if (pid == -1) { - TRACE(("Fork failed, errno=%d\n", errno)); - INTON; - error("Cannot fork: %s", strerror(errno)); - } - if (pid == 0) { - struct job *p; - int wasroot; - int i; - - TRACE(("Child shell %d\n", (int)getpid())); - wasroot = rootshell; - rootshell = 0; - handler = &main_handler; - closescript(); - INTON; - forcelocal = 0; - clear_traps(); -#if JOBS - jobctl = 0; /* do job control only in root shell */ - if (wasroot && mode != FORK_NOJOB && mflag) { - if (jp == NULL || jp->nprocs == 0) - pgrp = getpid(); - else - pgrp = jp->ps[0].pid; - if (setpgid(0, pgrp) == 0 && mode == FORK_FG && - ttyfd >= 0) { - /*** this causes superfluous TIOCSPGRPS ***/ - if (tcsetpgrp(ttyfd, pgrp) < 0) - error("tcsetpgrp failed, errno=%d", errno); - } - setsignal(SIGTSTP); - setsignal(SIGTTOU); - } else if (mode == FORK_BG) { - ignoresig(SIGINT); - ignoresig(SIGQUIT); - if ((jp == NULL || jp->nprocs == 0) && - ! fd0_redirected_p ()) { - close(0); - if (open(_PATH_DEVNULL, O_RDONLY) != 0) - error("cannot open %s: %s", - _PATH_DEVNULL, strerror(errno)); - } - } -#else - if (mode == FORK_BG) { - ignoresig(SIGINT); - ignoresig(SIGQUIT); - if ((jp == NULL || jp->nprocs == 0) && - ! fd0_redirected_p ()) { - close(0); - if (open(_PATH_DEVNULL, O_RDONLY) != 0) - error("cannot open %s: %s", - _PATH_DEVNULL, strerror(errno)); - } - } -#endif - INTOFF; - for (i = njobs, p = jobtab ; --i >= 0 ; p++) - if (p->used) - freejob(p); - INTON; - if (wasroot && iflag) { - setsignal(SIGINT); - setsignal(SIGQUIT); - setsignal(SIGTERM); - } - return pid; - } - if (rootshell && mode != FORK_NOJOB && mflag) { - if (jp == NULL || jp->nprocs == 0) - pgrp = pid; - else - pgrp = jp->ps[0].pid; - setpgid(pid, pgrp); - } - if (mode == FORK_BG) { - if (bgjob != NULL && bgjob->state == JOBDONE && - !bgjob->remembered && !iflag) - freejob(bgjob); - backgndpid = pid; /* set $! */ - bgjob = jp; - } - if (jp) { - struct procstat *ps = &jp->ps[jp->nprocs++]; - ps->pid = pid; - ps->status = -1; - ps->cmd = nullstr; - if (iflag && rootshell && n) - ps->cmd = commandtext(n); - jp->foreground = mode == FORK_FG; -#if JOBS - setcurjob(jp); -#endif - } - INTON; - TRACE(("In parent shell: child = %d\n", (int)pid)); - return pid; -} - - -pid_t -vforkexecshell(struct job *jp, char **argv, char **envp, const char *path, int idx, int pip[2]) -{ - pid_t pid; - struct jmploc jmploc; - struct jmploc *savehandler; - - TRACE(("vforkexecshell(%%%td, %s, %p) called\n", jp - jobtab, argv[0], - (void *)pip)); - INTOFF; - flushall(); - savehandler = handler; - pid = vfork(); - if (pid == -1) { - TRACE(("Vfork failed, errno=%d\n", errno)); - INTON; - error("Cannot fork: %s", strerror(errno)); - } - if (pid == 0) { - TRACE(("Child shell %d\n", (int)getpid())); - if (setjmp(jmploc.loc)) - _exit(exception == EXEXEC ? exerrno : 2); - if (pip != NULL) { - close(pip[0]); - if (pip[1] != 1) { - dup2(pip[1], 1); - close(pip[1]); - } - } - handler = &jmploc; - shellexec(argv, envp, path, idx); - } - handler = savehandler; - if (jp) { - struct procstat *ps = &jp->ps[jp->nprocs++]; - ps->pid = pid; - ps->status = -1; - ps->cmd = nullstr; - jp->foreground = 1; -#if JOBS - setcurjob(jp); -#endif - } - INTON; - TRACE(("In parent shell: child = %d\n", (int)pid)); - return pid; -} - - -/* - * Wait for job to finish. - * - * Under job control we have the problem that while a child process is - * running interrupts generated by the user are sent to the child but not - * to the shell. This means that an infinite loop started by an inter- - * active user may be hard to kill. With job control turned off, an - * interactive user may place an interactive program inside a loop. If - * the interactive program catches interrupts, the user doesn't want - * these interrupts to also abort the loop. The approach we take here - * is to have the shell ignore interrupt signals while waiting for a - * foreground process to terminate, and then send itself an interrupt - * signal if the child process was terminated by an interrupt signal. - * Unfortunately, some programs want to do a bit of cleanup and then - * exit on interrupt; unless these processes terminate themselves by - * sending a signal to themselves (instead of calling exit) they will - * confuse this approach. - */ - -int -waitforjob(struct job *jp, int *signaled) -{ -#if JOBS - int propagate_int = jp->jobctl && jp->foreground; -#endif - int status; - int st; - - INTOFF; - TRACE(("waitforjob(%%%td) called\n", jp - jobtab + 1)); - while (jp->state == 0) - if (dowait(DOWAIT_BLOCK | (Tflag ? DOWAIT_SIG | - DOWAIT_SIG_TRAP : 0), jp) == -1) - dotrap(); -#if JOBS - if (jp->jobctl) { - if (ttyfd >= 0 && tcsetpgrp(ttyfd, rootpid) < 0) - error("tcsetpgrp failed, errno=%d\n", errno); - } - if (jp->state == JOBSTOPPED) - setcurjob(jp); -#endif - status = getjobstatus(jp); - if (signaled != NULL) - *signaled = WIFSIGNALED(status); - /* convert to 8 bits */ - if (WIFEXITED(status)) - st = WEXITSTATUS(status); -#if JOBS - else if (WIFSTOPPED(status)) - st = WSTOPSIG(status) + 128; -#endif - else - st = WTERMSIG(status) + 128; - if (! JOBS || jp->state == JOBDONE) - freejob(jp); - if (int_pending()) { - if (!WIFSIGNALED(status) || WTERMSIG(status) != SIGINT) - CLEAR_PENDING_INT; - } -#if JOBS - else if (rootshell && propagate_int && - WIFSIGNALED(status) && WTERMSIG(status) == SIGINT) - kill(getpid(), SIGINT); -#endif - INTON; - return st; -} - - -static void -dummy_handler(int sig __unused) -{ -} - -/* - * Wait for a process to terminate. - */ - -static pid_t -dowait(int mode, struct job *job) -{ - struct sigaction sa, osa; - sigset_t mask, omask; - pid_t pid; - int status; - struct procstat *sp; - struct job *jp; - struct job *thisjob; - const char *sigstr; - int done; - int stopped; - int sig; - int coredump; - int wflags; - int restore_sigchld; - - TRACE(("dowait(%d, %p) called\n", mode, job)); - restore_sigchld = 0; - if ((mode & DOWAIT_SIG) != 0) { - sigfillset(&mask); - sigprocmask(SIG_BLOCK, &mask, &omask); - INTOFF; - if (!issigchldtrapped()) { - restore_sigchld = 1; - sa.sa_handler = dummy_handler; - sa.sa_flags = 0; - sigemptyset(&sa.sa_mask); - sigaction(SIGCHLD, &sa, &osa); - } - } - do { -#if JOBS - if (iflag) - wflags = WUNTRACED | WCONTINUED; - else -#endif - wflags = 0; - if ((mode & (DOWAIT_BLOCK | DOWAIT_SIG)) != DOWAIT_BLOCK) - wflags |= WNOHANG; - pid = wait3(&status, wflags, (struct rusage *)NULL); - TRACE(("wait returns %d, status=%d\n", (int)pid, status)); - if (pid == 0 && (mode & DOWAIT_SIG) != 0) { - pid = -1; - if (((mode & DOWAIT_SIG_TRAP) != 0 ? - pendingsig : pendingsig_waitcmd) != 0) { - errno = EINTR; - break; - } - sigsuspend(&omask); - if (int_pending()) - break; - } - } while (pid == -1 && errno == EINTR); - if (pid == -1 && errno == ECHILD && job != NULL) - job->state = JOBDONE; - if ((mode & DOWAIT_SIG) != 0) { - if (restore_sigchld) - sigaction(SIGCHLD, &osa, NULL); - sigprocmask(SIG_SETMASK, &omask, NULL); - INTON; - } - if (pid <= 0) - return pid; - INTOFF; - thisjob = NULL; - for (jp = jobtab ; jp < jobtab + njobs ; jp++) { - if (jp->used && jp->nprocs > 0) { - done = 1; - stopped = 1; - for (sp = jp->ps ; sp < jp->ps + jp->nprocs ; sp++) { - if (sp->pid == -1) - continue; - if (sp->pid == pid && (sp->status == -1 || - WIFSTOPPED(sp->status))) { - TRACE(("Changing status of proc %d from 0x%x to 0x%x\n", - (int)pid, sp->status, - status)); - if (WIFCONTINUED(status)) { - sp->status = -1; - jp->state = 0; - } else - sp->status = status; - thisjob = jp; - } - if (sp->status == -1) - stopped = 0; - else if (WIFSTOPPED(sp->status)) - done = 0; - } - if (stopped) { /* stopped or done */ - int state = done? JOBDONE : JOBSTOPPED; - if (jp->state != state) { - TRACE(("Job %td: changing state from %d to %d\n", jp - jobtab + 1, jp->state, state)); - jp->state = state; - if (jp != job) { - if (done && !jp->remembered && - !iflag && jp != bgjob) - freejob(jp); -#if JOBS - else if (done) - deljob(jp); -#endif - } - } - } - } - } - INTON; - if (!thisjob || thisjob->state == 0) - ; - else if ((!rootshell || !iflag || thisjob == job) && - thisjob->foreground && thisjob->state != JOBSTOPPED) { - sig = 0; - coredump = 0; - for (sp = thisjob->ps; sp < thisjob->ps + thisjob->nprocs; sp++) - if (WIFSIGNALED(sp->status)) { - sig = WTERMSIG(sp->status); - coredump = WCOREDUMP(sp->status); - } - if (sig > 0 && sig != SIGINT && sig != SIGPIPE) { - sigstr = strsignal(sig); - if (sigstr != NULL) - out2str(sigstr); - else - out2str("Unknown signal"); - if (coredump) - out2str(" (core dumped)"); - out2c('\n'); - flushout(out2); - } - } else { - TRACE(("Not printing status, rootshell=%d, job=%p\n", rootshell, job)); - thisjob->changed = 1; - } - return pid; -} - - - -/* - * return 1 if there are stopped jobs, otherwise 0 - */ -int job_warning = 0; -int -stoppedjobs(void) -{ - int jobno; - struct job *jp; - - if (job_warning) - return (0); - for (jobno = 1, jp = jobtab; jobno <= njobs; jobno++, jp++) { - if (jp->used == 0) - continue; - if (jp->state == JOBSTOPPED) { - out2fmt_flush("You have stopped jobs.\n"); - job_warning = 2; - return (1); - } - } - - return (0); -} - - -static void -checkzombies(void) -{ - while (njobs > 0 && dowait(0, NULL) > 0) - ; -} - - -int -backgndpidset(void) -{ - return backgndpid != -1; -} - - -pid_t -backgndpidval(void) -{ - if (bgjob != NULL && !forcelocal) - bgjob->remembered = 1; - return backgndpid; -} - -/* - * Return a string identifying a command (to be printed by the - * jobs command. - */ - -static char *cmdnextc; -static int cmdnleft; -#define MAXCMDTEXT 200 - -char * -commandtext(union node *n) -{ - char *name; - - cmdnextc = name = ckmalloc(MAXCMDTEXT); - cmdnleft = MAXCMDTEXT - 4; - cmdtxt(n); - *cmdnextc = '\0'; - return name; -} - - -static void -cmdtxtdogroup(union node *n) -{ - cmdputs("; do "); - cmdtxt(n); - cmdputs("; done"); -} - - -static void -cmdtxtredir(union node *n, const char *op, int deffd) -{ - char s[2]; - - if (n->nfile.fd != deffd) { - s[0] = n->nfile.fd + '0'; - s[1] = '\0'; - cmdputs(s); - } - cmdputs(op); - if (n->type == NTOFD || n->type == NFROMFD) { - if (n->ndup.dupfd >= 0) - s[0] = n->ndup.dupfd + '0'; - else - s[0] = '-'; - s[1] = '\0'; - cmdputs(s); - } else { - cmdtxt(n->nfile.fname); - } -} - - -static void -cmdtxt(union node *n) -{ - union node *np; - struct nodelist *lp; - - if (n == NULL) - return; - switch (n->type) { - case NSEMI: - cmdtxt(n->nbinary.ch1); - cmdputs("; "); - cmdtxt(n->nbinary.ch2); - break; - case NAND: - cmdtxt(n->nbinary.ch1); - cmdputs(" && "); - cmdtxt(n->nbinary.ch2); - break; - case NOR: - cmdtxt(n->nbinary.ch1); - cmdputs(" || "); - cmdtxt(n->nbinary.ch2); - break; - case NPIPE: - for (lp = n->npipe.cmdlist ; lp ; lp = lp->next) { - cmdtxt(lp->n); - if (lp->next) - cmdputs(" | "); - } - break; - case NSUBSHELL: - cmdputs("("); - cmdtxt(n->nredir.n); - cmdputs(")"); - break; - case NREDIR: - case NBACKGND: - cmdtxt(n->nredir.n); - break; - case NIF: - cmdputs("if "); - cmdtxt(n->nif.test); - cmdputs("; then "); - cmdtxt(n->nif.ifpart); - cmdputs("..."); - break; - case NWHILE: - cmdputs("while "); - cmdtxt(n->nbinary.ch1); - cmdtxtdogroup(n->nbinary.ch2); - break; - case NUNTIL: - cmdputs("until "); - cmdtxt(n->nbinary.ch1); - cmdtxtdogroup(n->nbinary.ch2); - break; - case NFOR: - cmdputs("for "); - cmdputs(n->nfor.var); - cmdputs(" in ..."); - break; - case NCASE: - cmdputs("case "); - cmdputs(n->ncase.expr->narg.text); - cmdputs(" in ..."); - break; - case NDEFUN: - cmdputs(n->narg.text); - cmdputs("() ..."); - break; - case NNOT: - cmdputs("! "); - cmdtxt(n->nnot.com); - break; - case NCMD: - for (np = n->ncmd.args ; np ; np = np->narg.next) { - cmdtxt(np); - if (np->narg.next) - cmdputs(" "); - } - for (np = n->ncmd.redirect ; np ; np = np->nfile.next) { - cmdputs(" "); - cmdtxt(np); - } - break; - case NARG: - cmdputs(n->narg.text); - break; - case NTO: - cmdtxtredir(n, ">", 1); - break; - case NAPPEND: - cmdtxtredir(n, ">>", 1); - break; - case NTOFD: - cmdtxtredir(n, ">&", 1); - break; - case NCLOBBER: - cmdtxtredir(n, ">|", 1); - break; - case NFROM: - cmdtxtredir(n, "<", 0); - break; - case NFROMTO: - cmdtxtredir(n, "<>", 0); - break; - case NFROMFD: - cmdtxtredir(n, "<&", 0); - break; - case NHERE: - case NXHERE: - cmdputs("<<..."); - break; - default: - cmdputs("???"); - break; - } -} - - - -static void -cmdputs(const char *s) -{ - const char *p; - char *q; - char c; - int subtype = 0; - - if (cmdnleft <= 0) - return; - p = s; - q = cmdnextc; - while ((c = *p++) != '\0') { - if (c == CTLESC) - *q++ = *p++; - else if (c == CTLVAR) { - *q++ = '$'; - if (--cmdnleft > 0) - *q++ = '{'; - subtype = *p++; - if ((subtype & VSTYPE) == VSLENGTH && --cmdnleft > 0) - *q++ = '#'; - } else if (c == '=' && subtype != 0) { - *q = "}-+?=##%%\0X"[(subtype & VSTYPE) - VSNORMAL]; - if (*q) - q++; - else - cmdnleft++; - if (((subtype & VSTYPE) == VSTRIMLEFTMAX || - (subtype & VSTYPE) == VSTRIMRIGHTMAX) && - --cmdnleft > 0) - *q = q[-1], q++; - subtype = 0; - } else if (c == CTLENDVAR) { - *q++ = '}'; - } else if (c == CTLBACKQ || c == CTLBACKQ+CTLQUOTE) { - cmdnleft -= 5; - if (cmdnleft > 0) { - *q++ = '$'; - *q++ = '('; - *q++ = '.'; - *q++ = '.'; - *q++ = '.'; - *q++ = ')'; - } - } else if (c == CTLARI) { - cmdnleft -= 2; - if (cmdnleft > 0) { - *q++ = '$'; - *q++ = '('; - *q++ = '('; - } - p++; - } else if (c == CTLENDARI) { - if (--cmdnleft > 0) { - *q++ = ')'; - *q++ = ')'; - } - } else if (c == CTLQUOTEMARK || c == CTLQUOTEEND) - cmdnleft++; /* ignore */ - else - *q++ = c; - if (--cmdnleft <= 0) { - *q++ = '.'; - *q++ = '.'; - *q++ = '.'; - break; - } - } - cmdnextc = q; -} diff --git a/bin/1sh/jobs.h b/bin/1sh/jobs.h deleted file mode 100644 index 98c2eb5c..00000000 --- a/bin/1sh/jobs.h +++ /dev/null @@ -1,67 +0,0 @@ -/*- - * Copyright (c) 1991, 1993 - * The Regents of the University of California. All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * Kenneth Almquist. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)jobs.h 8.2 (Berkeley) 5/4/95 - * $FreeBSD: releng/12.1/bin/sh/jobs.h 327475 2018-01-01 22:31:52Z jilles $ - */ - -/* Mode argument to forkshell. Don't change FORK_FG or FORK_BG. */ -#define FORK_FG 0 -#define FORK_BG 1 -#define FORK_NOJOB 2 - -#include <signal.h> /* for sig_atomic_t */ - -struct job; - -enum { - SHOWJOBS_DEFAULT, /* job number, status, command */ - SHOWJOBS_VERBOSE, /* job number, PID, status, command */ - SHOWJOBS_PIDS, /* PID only */ - SHOWJOBS_PGIDS /* PID of the group leader only */ -}; - -extern int job_warning; /* user was warned about stopped jobs */ - -void setjobctl(int); -void showjobs(int, int); -struct job *makejob(union node *, int); -pid_t forkshell(struct job *, union node *, int); -pid_t vforkexecshell(struct job *, char **, char **, const char *, int, int []); -int waitforjob(struct job *, int *); -int stoppedjobs(void); -int backgndpidset(void); -pid_t backgndpidval(void); -char *commandtext(union node *); - -#if ! JOBS -#define setjobctl(on) /* do nothing */ -#endif diff --git a/bin/1sh/kill.c b/bin/1sh/kill.c deleted file mode 100644 index 6003fa9d..00000000 --- a/bin/1sh/kill.c +++ /dev/null @@ -1,215 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-3-Clause - * - * Copyright (c) 1988, 1993, 1994 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ -/* - * Important: This file is used both as a standalone program /bin/kill and - * as a builtin for /bin/sh (#define SHELL). - */ - -#if 0 -#ifndef lint -static char const copyright[] = -"@(#) Copyright (c) 1988, 1993, 1994\n\ - The Regents of the University of California. All rights reserved.\n"; -#endif /* not lint */ - -#ifndef lint -static char sccsid[] = "@(#)kill.c 8.4 (Berkeley) 4/28/95"; -#endif /* not lint */ -#endif -#include <sys/cdefs.h> -/* $FreeBSD: releng/12.1/bin/kill/kill.c 326025 2017-11-20 19:49:47Z pfg $ */ - -#include <ctype.h> -#include <err.h> -#include <errno.h> -#include <signal.h> -#include <stdio.h> -#include <stdlib.h> -#include <string.h> - -#ifdef SHELL -#define main killcmd -#include "bltin.h" -#endif - -static void nosig(const char *); -static void printsignals(FILE *); -static int signame_to_signum(const char *); -static void usage(void); - -int -main(int argc, char *argv[]) -{ - long pidl; - pid_t pid; - int errors, numsig, ret; - char *ep; - - if (argc < 2) - usage(); - - numsig = SIGTERM; - - argc--, argv++; - if (!strcmp(*argv, "-l")) { - argc--, argv++; - if (argc > 1) - usage(); - if (argc == 1) { - if (!isdigit(**argv)) - usage(); - numsig = strtol(*argv, &ep, 10); - if (!**argv || *ep) - errx(2, "illegal signal number: %s", *argv); - if (numsig >= 128) - numsig -= 128; - if (numsig <= 0 || numsig >= NSIG) - nosig(*argv); - printf("%s\n", sys_signame[numsig]); - return (0); - } - printsignals(stdout); - return (0); - } - - if (!strcmp(*argv, "-s")) { - argc--, argv++; - if (argc < 1) { - warnx("option requires an argument -- s"); - usage(); - } - if (strcmp(*argv, "0")) { - if ((numsig = signame_to_signum(*argv)) < 0) - nosig(*argv); - } else - numsig = 0; - argc--, argv++; - } else if (**argv == '-' && *(*argv + 1) != '-') { - ++*argv; - if (isalpha(**argv)) { - if ((numsig = signame_to_signum(*argv)) < 0) - nosig(*argv); - } else if (isdigit(**argv)) { - numsig = strtol(*argv, &ep, 10); - if (!**argv || *ep) - errx(2, "illegal signal number: %s", *argv); - if (numsig < 0) - nosig(*argv); - } else - nosig(*argv); - argc--, argv++; - } - - if (argc > 0 && strncmp(*argv, "--", 2) == 0) - argc--, argv++; - - if (argc == 0) - usage(); - - for (errors = 0; argc; argc--, argv++) { -#ifdef SHELL - if (**argv == '%') - ret = killjob(*argv, numsig); - else -#endif - { - pidl = strtol(*argv, &ep, 10); - /* Check for overflow of pid_t. */ - pid = (pid_t)pidl; - if (!**argv || *ep || pid != pidl) - errx(2, "illegal process id: %s", *argv); - ret = kill(pid, numsig); - } - if (ret == -1) { - warn("%s", *argv); - errors = 1; - } - } - - return (errors); -} - -static int -signame_to_signum(const char *sig) -{ - int n; - - if (strncasecmp(sig, "SIG", 3) == 0) - sig += 3; - for (n = 1; n < NSIG; n++) { - if (!strcasecmp(sys_signame[n], sig)) - return (n); - } - return (-1); -} - -static void -nosig(const char *name) -{ - - warnx("unknown signal %s; valid signals:", name); - printsignals(stderr); -#ifdef SHELL - error(NULL); -#else - exit(2); -#endif -} - -static void -printsignals(FILE *fp) -{ - int n; - - for (n = 1; n < NSIG; n++) { - (void)fprintf(fp, "%s", sys_signame[n]); - if (n == (NSIG / 2) || n == (NSIG - 1)) - (void)fprintf(fp, "\n"); - else - (void)fprintf(fp, " "); - } -} - -static void -usage(void) -{ - - (void)fprintf(stderr, "%s\n%s\n%s\n%s\n", - "usage: kill [-s signal_name] pid ...", - " kill -l [exit_status]", - " kill -signal_name pid ...", - " kill -signal_number pid ..."); -#ifdef SHELL - error(NULL); -#else - exit(2); -#endif -} diff --git a/bin/1sh/mail.c b/bin/1sh/mail.c deleted file mode 100644 index adf54a06..00000000 --- a/bin/1sh/mail.c +++ /dev/null @@ -1,120 +0,0 @@ -/*- - * Copyright (c) 1991, 1993 - * The Regents of the University of California. All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * Kenneth Almquist. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#ifndef lint -#if 0 -static char sccsid[] = "@(#)mail.c 8.2 (Berkeley) 5/4/95"; -#endif -#endif /* not lint */ -#include <sys/cdefs.h> -/* $FreeBSD: releng/12.1/bin/sh/mail.c 336303 2018-07-15 09:14:30Z jilles $ */ - -/* - * Routines to check for mail. (Perhaps make part of main.c?) - */ - -#include "shell.h" -#include "mail.h" -#include "var.h" -#include "output.h" -#include "memalloc.h" -#include "error.h" -#include <sys/types.h> -#include <sys/stat.h> -#include <stdlib.h> - - -#define MAXMBOXES 10 - - -static int nmboxes; /* number of mailboxes */ -static time_t mailtime[MAXMBOXES]; /* times of mailboxes */ - - - -/* - * Print appropriate message(s) if mail has arrived. If the argument is - * nozero, then the value of MAIL has changed, so we just update the - * values. - */ - -void -chkmail(int silent) -{ - int i; - char *mpath; - char *p; - char *msg; - struct stackmark smark; - struct stat statb; - - if (silent) - nmboxes = 10; - if (nmboxes == 0) - return; - setstackmark(&smark); - mpath = stsavestr(mpathset()? mpathval() : mailval()); - for (i = 0 ; i < nmboxes ; i++) { - p = mpath; - if (*p == '\0') - break; - mpath = strchr(p, ':'); - if (!mpath) mpath = strchr(p, '\0'); - if (*mpath != '\0') { - *mpath++ = '\0'; - if (p == mpath - 1) - continue; - } - msg = strchr(p, '%'); - if (msg != NULL) - *msg++ = '\0'; -#ifdef notdef /* this is what the System V shell claims to do (it lies) */ - if (stat(p, &statb) < 0) - statb.st_mtime = 0; - if (statb.st_mtime > mailtime[i] && ! silent) { - out2str(msg? msg : "you have mail"); - out2c('\n'); - } - mailtime[i] = statb.st_mtime; -#else /* this is what it should do */ - if (stat(p, &statb) < 0) - statb.st_size = 0; - if (statb.st_size > mailtime[i] && ! silent) { - out2str(msg? msg : "you have mail"); - out2c('\n'); - } - mailtime[i] = statb.st_size; -#endif - } - nmboxes = i; - popstackmark(&smark); -} diff --git a/bin/1sh/mail.h b/bin/1sh/mail.h deleted file mode 100644 index bc124ba3..00000000 --- a/bin/1sh/mail.h +++ /dev/null @@ -1,38 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-3-Clause - * - * Copyright (c) 1991, 1993 - * The Regents of the University of California. All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * Kenneth Almquist. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)mail.h 8.2 (Berkeley) 5/4/95 - * $FreeBSD: releng/12.1/bin/sh/mail.h 326025 2017-11-20 19:49:47Z pfg $ - */ - -void chkmail(int); diff --git a/bin/1sh/main.c b/bin/1sh/main.c deleted file mode 100644 index 3f0bc1da..00000000 --- a/bin/1sh/main.c +++ /dev/null @@ -1,356 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-3-Clause - * - * Copyright (c) 1991, 1993 - * The Regents of the University of California. All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * Kenneth Almquist. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#if 0 -static char const copyright[] = -"@(#) Copyright (c) 1991, 1993\n\ - The Regents of the University of California. All rights reserved.\n"; -#endif - -#ifndef lint -#if 0 -static char sccsid[] = "@(#)main.c 8.6 (Berkeley) 5/28/95"; -#endif -#endif /* not lint */ -#include <sys/cdefs.h> -/* $FreeBSD: releng/12.1/bin/sh/main.c 336320 2018-07-15 21:55:17Z jilles $ */ - -#include <stdio.h> -#include <signal.h> -#include <sys/stat.h> -#include <unistd.h> -#include <fcntl.h> -#include <locale.h> -#include <errno.h> - -#include "shell.h" -#include "main.h" -#include "mail.h" -#include "options.h" -#include "output.h" -#include "parser.h" -#include "nodes.h" -#include "expand.h" -#include "eval.h" -#include "jobs.h" -#include "input.h" -#include "trap.h" -#include "var.h" -#include "show.h" -#include "memalloc.h" -#include "error.h" -#include "mystring.h" -#include "exec.h" -#include "cd.h" -#include "redir.h" -#include "builtins.h" - -int rootpid; -int rootshell; -struct jmploc main_handler; -int localeisutf8, initial_localeisutf8; - -static void reset(void); -static void cmdloop(int); -static void read_profile(const char *); -static char *find_dot_file(char *); - -/* - * Main routine. We initialize things, parse the arguments, execute - * profiles if we're a login shell, and then call cmdloop to execute - * commands. The setjmp call sets up the location to jump to when an - * exception occurs. When an exception occurs the variable "state" - * is used to figure out how far we had gotten. - */ - -int -main(int argc, char *argv[]) -{ - struct stackmark smark, smark2; - volatile int state; - char *shinit; - - (void) setlocale(LC_ALL, ""); - initcharset(); - state = 0; - if (setjmp(main_handler.loc)) { - switch (exception) { - case EXEXEC: - exitstatus = exerrno; - break; - - case EXERROR: - exitstatus = 2; - break; - - default: - break; - } - - if (state == 0 || iflag == 0 || ! rootshell || - exception == EXEXIT) - exitshell(exitstatus); - reset(); - if (exception == EXINT) - out2fmt_flush("\n"); - popstackmark(&smark); - FORCEINTON; /* enable interrupts */ - if (state == 1) - goto state1; - else if (state == 2) - goto state2; - else if (state == 3) - goto state3; - else - goto state4; - } - handler = &main_handler; -#ifdef DEBUG - opentrace(); - trputs("Shell args: "); trargs(argv); -#endif - rootpid = getpid(); - rootshell = 1; - INTOFF; - initvar(); - setstackmark(&smark); - setstackmark(&smark2); - procargs(argc, argv); - pwd_init(iflag); - INTON; - if (iflag) - chkmail(1); - if (argv[0] && argv[0][0] == '-') { - state = 1; - read_profile("/etc/profile"); -state1: - state = 2; - if (privileged == 0) - read_profile("${HOME-}/.profile"); - else - read_profile("/etc/suid_profile"); - } -state2: - state = 3; - if (!privileged && iflag) { - if ((shinit = lookupvar("ENV")) != NULL && *shinit != '\0') { - state = 3; - read_profile(shinit); - } - } -state3: - state = 4; - popstackmark(&smark2); - if (minusc) { - evalstring(minusc, sflag ? 0 : EV_EXIT); - } -state4: - if (sflag || minusc == NULL) { - cmdloop(1); - } - iflag = 0; - optschanged(); - exitshell(exitstatus); - /*NOTREACHED*/ - return 0; -} - -static void -reset(void) -{ - reseteval(); - resetinput(); -} - -/* - * Read and execute commands. "Top" is nonzero for the top level command - * loop; it turns on prompting if the shell is interactive. - */ - -static void -cmdloop(int top) -{ - union node *n; - struct stackmark smark; - int inter; - int numeof = 0; - - TRACE(("cmdloop(%d) called\n", top)); - setstackmark(&smark); - for (;;) { - if (pendingsig) - dotrap(); - inter = 0; - if (iflag && top) { - inter++; - showjobs(1, SHOWJOBS_DEFAULT); - chkmail(0); - flushout(&output); - } - n = parsecmd(inter); - /* showtree(n); DEBUG */ - if (n == NEOF) { - if (!top || numeof >= 50) - break; - if (!stoppedjobs()) { - if (!Iflag) - break; - out2fmt_flush("\nUse \"exit\" to leave shell.\n"); - } - numeof++; - } else if (n != NULL && nflag == 0) { - job_warning = (job_warning == 2) ? 1 : 0; - numeof = 0; - evaltree(n, 0); - } - popstackmark(&smark); - setstackmark(&smark); - if (evalskip != 0) { - if (evalskip == SKIPRETURN) - evalskip = 0; - break; - } - } - popstackmark(&smark); -} - - - -/* - * Read /etc/profile or .profile. Return on error. - */ - -static void -read_profile(const char *name) -{ - int fd; - const char *expandedname; - - expandedname = expandstr(name); - if (expandedname == NULL) - return; - INTOFF; - if ((fd = open(expandedname, O_RDONLY | O_CLOEXEC)) >= 0) - setinputfd(fd, 1); - INTON; - if (fd < 0) - return; - cmdloop(0); - popfile(); -} - - - -/* - * Read a file containing shell functions. - */ - -void -readcmdfile(const char *name) -{ - setinputfile(name, 1); - cmdloop(0); - popfile(); -} - - - -/* - * Take commands from a file. To be compatible we should do a path - * search for the file, which is necessary to find sub-commands. - */ - - -static char * -find_dot_file(char *basename) -{ - char *fullname; - const char *opt; - const char *path = pathval(); - struct stat statb; - - /* don't try this for absolute or relative paths */ - if( strchr(basename, '/')) - return basename; - - while ((fullname = padvance(&path, &opt, basename)) != NULL) { - if ((stat(fullname, &statb) == 0) && S_ISREG(statb.st_mode)) { - /* - * Don't bother freeing here, since it will - * be freed by the caller. - */ - return fullname; - } - stunalloc(fullname); - } - return basename; -} - -int -dotcmd(int argc, char **argv) -{ - char *filename, *fullname; - - if (argc < 2) - error("missing filename"); - - exitstatus = 0; - - /* - * Because we have historically not supported any options, - * only treat "--" specially. - */ - filename = argc > 2 && strcmp(argv[1], "--") == 0 ? argv[2] : argv[1]; - - fullname = find_dot_file(filename); - setinputfile(fullname, 1); - commandname = fullname; - cmdloop(0); - popfile(); - return exitstatus; -} - - -int -exitcmd(int argc, char **argv) -{ - if (stoppedjobs()) - return 0; - iflag = 0; - optschanged(); - if (argc > 1) - exitshell(number(argv[1])); - else - exitshell_savedstatus(); -} diff --git a/bin/1sh/main.h b/bin/1sh/main.h deleted file mode 100644 index 329a5c8b..00000000 --- a/bin/1sh/main.h +++ /dev/null @@ -1,42 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-3-Clause - * - * Copyright (c) 1991, 1993 - * The Regents of the University of California. All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * Kenneth Almquist. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)main.h 8.2 (Berkeley) 5/4/95 - * $FreeBSD: releng/12.1/bin/sh/main.h 326025 2017-11-20 19:49:47Z pfg $ - */ - -extern int rootpid; /* pid of main shell */ -extern int rootshell; /* true if we aren't a child of the main shell */ -extern struct jmploc main_handler; /* top level exception handler */ - -void readcmdfile(const char *); diff --git a/bin/1sh/memalloc.c b/bin/1sh/memalloc.c deleted file mode 100644 index c53521ad..00000000 --- a/bin/1sh/memalloc.c +++ /dev/null @@ -1,344 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-3-Clause - * - * Copyright (c) 1991, 1993 - * The Regents of the University of California. All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * Kenneth Almquist. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#ifndef lint -#if 0 -static char sccsid[] = "@(#)memalloc.c 8.3 (Berkeley) 5/4/95"; -#endif -#endif /* not lint */ -#include <sys/cdefs.h> -/* $FreeBSD: releng/12.1/bin/sh/memalloc.c 326025 2017-11-20 19:49:47Z pfg $ */ - -#include <sys/param.h> -#include "shell.h" -#include "output.h" -#include "memalloc.h" -#include "error.h" -#include "mystring.h" -#include "expand.h" -#include <stdlib.h> -#include <unistd.h> - -/* - * Like malloc, but returns an error when out of space. - */ - -pointer -ckmalloc(size_t nbytes) -{ - pointer p; - - INTOFF; - p = malloc(nbytes); - INTON; - if (p == NULL) - error("Out of space"); - return p; -} - - -/* - * Same for realloc. - */ - -pointer -ckrealloc(pointer p, int nbytes) -{ - INTOFF; - p = realloc(p, nbytes); - INTON; - if (p == NULL) - error("Out of space"); - return p; -} - -void -ckfree(pointer p) -{ - INTOFF; - free(p); - INTON; -} - - -/* - * Make a copy of a string in safe storage. - */ - -char * -savestr(const char *s) -{ - char *p; - size_t len; - - len = strlen(s); - p = ckmalloc(len + 1); - memcpy(p, s, len + 1); - return p; -} - - -/* - * Parse trees for commands are allocated in lifo order, so we use a stack - * to make this more efficient, and also to avoid all sorts of exception - * handling code to handle interrupts in the middle of a parse. - * - * The size 496 was chosen because with 16-byte alignment the total size - * for the allocated block is 512. - */ - -#define MINSIZE 496 /* minimum size of a block. */ - - -struct stack_block { - struct stack_block *prev; - /* Data follows */ -}; -#define SPACE(sp) ((char*)(sp) + ALIGN(sizeof(struct stack_block))) - -static struct stack_block *stackp; -char *stacknxt; -int stacknleft; -char *sstrend; - - -static void -stnewblock(int nbytes) -{ - struct stack_block *sp; - int allocsize; - - if (nbytes < MINSIZE) - nbytes = MINSIZE; - - allocsize = ALIGN(sizeof(struct stack_block)) + ALIGN(nbytes); - - INTOFF; - sp = ckmalloc(allocsize); - sp->prev = stackp; - stacknxt = SPACE(sp); - stacknleft = allocsize - (stacknxt - (char*)sp); - sstrend = stacknxt + stacknleft; - stackp = sp; - INTON; -} - - -pointer -stalloc(int nbytes) -{ - char *p; - - nbytes = ALIGN(nbytes); - if (nbytes > stacknleft) - stnewblock(nbytes); - p = stacknxt; - stacknxt += nbytes; - stacknleft -= nbytes; - return p; -} - - -void -stunalloc(pointer p) -{ - if (p == NULL) { /*DEBUG */ - write(STDERR_FILENO, "stunalloc\n", 10); - abort(); - } - stacknleft += stacknxt - (char *)p; - stacknxt = p; -} - - -char * -stsavestr(const char *s) -{ - char *p; - size_t len; - - len = strlen(s); - p = stalloc(len + 1); - memcpy(p, s, len + 1); - return p; -} - - -void -setstackmark(struct stackmark *mark) -{ - mark->stackp = stackp; - mark->stacknxt = stacknxt; - mark->stacknleft = stacknleft; - /* Ensure this block stays in place. */ - if (stackp != NULL && stacknxt == SPACE(stackp)) - stalloc(1); -} - - -void -popstackmark(struct stackmark *mark) -{ - struct stack_block *sp; - - INTOFF; - while (stackp != mark->stackp) { - sp = stackp; - stackp = sp->prev; - ckfree(sp); - } - stacknxt = mark->stacknxt; - stacknleft = mark->stacknleft; - sstrend = stacknxt + stacknleft; - INTON; -} - - -/* - * When the parser reads in a string, it wants to stick the string on the - * stack and only adjust the stack pointer when it knows how big the - * string is. Stackblock (defined in stack.h) returns a pointer to a block - * of space on top of the stack and stackblocklen returns the length of - * this block. Growstackblock will grow this space by at least one byte, - * possibly moving it (like realloc). Grabstackblock actually allocates the - * part of the block that has been used. - */ - -static void -growstackblock(int min) -{ - char *p; - int newlen; - char *oldspace; - int oldlen; - struct stack_block *sp; - struct stack_block *oldstackp; - - if (min < stacknleft) - min = stacknleft; - if ((unsigned int)min >= - INT_MAX / 2 - ALIGN(sizeof(struct stack_block))) - error("Out of space"); - min += stacknleft; - min += ALIGN(sizeof(struct stack_block)); - newlen = 512; - while (newlen < min) - newlen <<= 1; - oldspace = stacknxt; - oldlen = stacknleft; - - if (stackp != NULL && stacknxt == SPACE(stackp)) { - INTOFF; - oldstackp = stackp; - stackp = oldstackp->prev; - sp = ckrealloc((pointer)oldstackp, newlen); - sp->prev = stackp; - stackp = sp; - stacknxt = SPACE(sp); - stacknleft = newlen - (stacknxt - (char*)sp); - sstrend = stacknxt + stacknleft; - INTON; - } else { - newlen -= ALIGN(sizeof(struct stack_block)); - p = stalloc(newlen); - if (oldlen != 0) - memcpy(p, oldspace, oldlen); - stunalloc(p); - } -} - - - -/* - * The following routines are somewhat easier to use that the above. - * The user declares a variable of type STACKSTR, which may be declared - * to be a register. The macro STARTSTACKSTR initializes things. Then - * the user uses the macro STPUTC to add characters to the string. In - * effect, STPUTC(c, p) is the same as *p++ = c except that the stack is - * grown as necessary. When the user is done, she can just leave the - * string there and refer to it using stackblock(). Or she can allocate - * the space for it using grabstackstr(). If it is necessary to allow - * someone else to use the stack temporarily and then continue to grow - * the string, the user should use grabstack to allocate the space, and - * then call ungrabstr(p) to return to the previous mode of operation. - * - * USTPUTC is like STPUTC except that it doesn't check for overflow. - * CHECKSTACKSPACE can be called before USTPUTC to ensure that there - * is space for at least one character. - */ - -static char * -growstrstackblock(int n, int min) -{ - growstackblock(min); - return stackblock() + n; -} - -char * -growstackstr(void) -{ - int len; - - len = stackblocksize(); - return (growstrstackblock(len, 0)); -} - - -/* - * Called from CHECKSTRSPACE. - */ - -char * -makestrspace(int min, char *p) -{ - int len; - - len = p - stackblock(); - return (growstrstackblock(len, min)); -} - - -char * -stputbin(const char *data, size_t len, char *p) -{ - CHECKSTRSPACE(len, p); - memcpy(p, data, len); - return (p + len); -} - -char * -stputs(const char *data, char *p) -{ - return (stputbin(data, strlen(data), p)); -} diff --git a/bin/1sh/memalloc.h b/bin/1sh/memalloc.h deleted file mode 100644 index f3acc03d..00000000 --- a/bin/1sh/memalloc.h +++ /dev/null @@ -1,88 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-3-Clause - * - * Copyright (c) 1991, 1993 - * The Regents of the University of California. All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * Kenneth Almquist. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)memalloc.h 8.2 (Berkeley) 5/4/95 - * $FreeBSD: releng/12.1/bin/sh/memalloc.h 326025 2017-11-20 19:49:47Z pfg $ - */ - -#include <string.h> - -struct stackmark { - struct stack_block *stackp; - char *stacknxt; - int stacknleft; -}; - - -extern char *stacknxt; -extern int stacknleft; -extern char *sstrend; - -pointer ckmalloc(size_t); -pointer ckrealloc(pointer, int); -void ckfree(pointer); -char *savestr(const char *); -pointer stalloc(int); -void stunalloc(pointer); -char *stsavestr(const char *); -void setstackmark(struct stackmark *); -void popstackmark(struct stackmark *); -char *growstackstr(void); -char *makestrspace(int, char *); -char *stputbin(const char *data, size_t len, char *p); -char *stputs(const char *data, char *p); - - - -#define stackblock() stacknxt -#define stackblocksize() stacknleft -#define grabstackblock(n) stalloc(n) -#define STARTSTACKSTR(p) p = stackblock() -#define STPUTC(c, p) do { if (p == sstrend) p = growstackstr(); *p++ = (c); } while(0) -#define CHECKSTRSPACE(n, p) { if ((size_t)(sstrend - p) < n) p = makestrspace(n, p); } -#define USTPUTC(c, p) (*p++ = (c)) -/* - * STACKSTRNUL's use is where we want to be able to turn a stack - * (non-sentinel, character counting string) into a C string, - * and later pretend the NUL is not there. - * Note: Because of STACKSTRNUL's semantics, STACKSTRNUL cannot be used - * on a stack that will grabstackstr()ed. - */ -#define STACKSTRNUL(p) (p == sstrend ? (p = growstackstr(), *p = '\0') : (*p = '\0')) -#define STUNPUTC(p) (--p) -#define STTOPC(p) p[-1] -#define STADJUST(amount, p) (p += (amount)) -#define grabstackstr(p) stalloc((char *)p - stackblock()) -#define ungrabstackstr(s, p) stunalloc((s)) -#define STPUTBIN(s, len, p) p = stputbin((s), (len), p) -#define STPUTS(s, p) p = stputs((s), p) diff --git a/bin/1sh/miscbltin.c b/bin/1sh/miscbltin.c deleted file mode 100644 index 66329850..00000000 --- a/bin/1sh/miscbltin.c +++ /dev/null @@ -1,534 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-3-Clause - * - * Copyright (c) 1991, 1993 - * The Regents of the University of California. All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * Kenneth Almquist. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#ifndef lint -#if 0 -static char sccsid[] = "@(#)miscbltin.c 8.4 (Berkeley) 5/4/95"; -#endif -#endif /* not lint */ -#include <sys/cdefs.h> -/* $FreeBSD: releng/12.1/bin/sh/miscbltin.c 326025 2017-11-20 19:49:47Z pfg $ */ - -/* - * Miscellaneous builtins. - */ - -#include <sys/types.h> -#include <sys/stat.h> -#include <sys/time.h> -#include <sys/resource.h> -#include <unistd.h> -#include <errno.h> -#include <stdint.h> -#include <stdio.h> -#include <stdlib.h> - -#include "shell.h" -#include "options.h" -#include "var.h" -#include "output.h" -#include "memalloc.h" -#include "error.h" -#include "mystring.h" -#include "syntax.h" -#include "trap.h" - -#undef eflag - -int readcmd(int, char **); -int umaskcmd(int, char **); -int ulimitcmd(int, char **); - -/* - * The read builtin. The -r option causes backslashes to be treated like - * ordinary characters. - * - * This uses unbuffered input, which may be avoidable in some cases. - * - * Note that if IFS=' :' then read x y should work so that: - * 'a b' x='a', y='b' - * ' a b ' x='a', y='b' - * ':b' x='', y='b' - * ':' x='', y='' - * '::' x='', y='' - * ': :' x='', y='' - * ':::' x='', y='::' - * ':b c:' x='', y='b c:' - */ - -int -readcmd(int argc __unused, char **argv __unused) -{ - char **ap; - int backslash; - char c; - int rflag; - char *prompt; - const char *ifs; - char *p; - int startword; - int status; - int i; - int is_ifs; - int saveall = 0; - ptrdiff_t lastnonifs, lastnonifsws; - struct timeval tv; - char *tvptr; - fd_set ifds; - ssize_t nread; - int sig; - - rflag = 0; - prompt = NULL; - tv.tv_sec = -1; - tv.tv_usec = 0; - while ((i = nextopt("erp:t:")) != '\0') { - switch(i) { - case 'p': - prompt = shoptarg; - break; - case 'e': - break; - case 'r': - rflag = 1; - break; - case 't': - tv.tv_sec = strtol(shoptarg, &tvptr, 0); - if (tvptr == shoptarg) - error("timeout value"); - switch(*tvptr) { - case 0: - case 's': - break; - case 'h': - tv.tv_sec *= 60; - /* FALLTHROUGH */ - case 'm': - tv.tv_sec *= 60; - break; - default: - error("timeout unit"); - } - break; - } - } - if (prompt && isatty(0)) { - out2str(prompt); - flushall(); - } - if (*(ap = argptr) == NULL) - error("arg count"); - if ((ifs = bltinlookup("IFS", 1)) == NULL) - ifs = " \t\n"; - - if (tv.tv_sec >= 0) { - /* - * Wait for something to become available. - */ - FD_ZERO(&ifds); - FD_SET(0, &ifds); - status = select(1, &ifds, NULL, NULL, &tv); - /* - * If there's nothing ready, return an error. - */ - if (status <= 0) { - sig = pendingsig; - return (128 + (sig != 0 ? sig : SIGALRM)); - } - } - - status = 0; - startword = 2; - backslash = 0; - STARTSTACKSTR(p); - lastnonifs = lastnonifsws = -1; - for (;;) { - nread = read(STDIN_FILENO, &c, 1); - if (nread == -1) { - if (errno == EINTR) { - sig = pendingsig; - if (sig == 0) - continue; - status = 128 + sig; - break; - } - warning("read error: %s", strerror(errno)); - status = 2; - break; - } else if (nread != 1) { - status = 1; - break; - } - if (c == '\0') - continue; - CHECKSTRSPACE(1, p); - if (backslash) { - backslash = 0; - if (c != '\n') { - startword = 0; - lastnonifs = lastnonifsws = p - stackblock(); - USTPUTC(c, p); - } - continue; - } - if (!rflag && c == '\\') { - backslash++; - continue; - } - if (c == '\n') - break; - if (strchr(ifs, c)) - is_ifs = strchr(" \t\n", c) ? 1 : 2; - else - is_ifs = 0; - - if (startword != 0) { - if (is_ifs == 1) { - /* Ignore leading IFS whitespace */ - if (saveall) - USTPUTC(c, p); - continue; - } - if (is_ifs == 2 && startword == 1) { - /* Only one non-whitespace IFS per word */ - startword = 2; - if (saveall) { - lastnonifsws = p - stackblock(); - USTPUTC(c, p); - } - continue; - } - } - - if (is_ifs == 0) { - /* append this character to the current variable */ - startword = 0; - if (saveall) - /* Not just a spare terminator */ - saveall++; - lastnonifs = lastnonifsws = p - stackblock(); - USTPUTC(c, p); - continue; - } - - /* end of variable... */ - startword = is_ifs; - - if (ap[1] == NULL) { - /* Last variable needs all IFS chars */ - saveall++; - if (is_ifs == 2) - lastnonifsws = p - stackblock(); - USTPUTC(c, p); - continue; - } - - STACKSTRNUL(p); - setvar(*ap, stackblock(), 0); - ap++; - STARTSTACKSTR(p); - lastnonifs = lastnonifsws = -1; - } - STACKSTRNUL(p); - - /* - * Remove trailing IFS chars: always remove whitespace, don't remove - * non-whitespace unless it was naked - */ - if (saveall <= 1) - lastnonifsws = lastnonifs; - stackblock()[lastnonifsws + 1] = '\0'; - setvar(*ap, stackblock(), 0); - - /* Set any remaining args to "" */ - while (*++ap != NULL) - setvar(*ap, "", 0); - return status; -} - - - -int -umaskcmd(int argc __unused, char **argv __unused) -{ - char *ap; - int mask; - int i; - int symbolic_mode = 0; - - while ((i = nextopt("S")) != '\0') { - symbolic_mode = 1; - } - - INTOFF; - mask = umask(0); - umask(mask); - INTON; - - if ((ap = *argptr) == NULL) { - if (symbolic_mode) { - char u[4], g[4], o[4]; - - i = 0; - if ((mask & S_IRUSR) == 0) - u[i++] = 'r'; - if ((mask & S_IWUSR) == 0) - u[i++] = 'w'; - if ((mask & S_IXUSR) == 0) - u[i++] = 'x'; - u[i] = '\0'; - - i = 0; - if ((mask & S_IRGRP) == 0) - g[i++] = 'r'; - if ((mask & S_IWGRP) == 0) - g[i++] = 'w'; - if ((mask & S_IXGRP) == 0) - g[i++] = 'x'; - g[i] = '\0'; - - i = 0; - if ((mask & S_IROTH) == 0) - o[i++] = 'r'; - if ((mask & S_IWOTH) == 0) - o[i++] = 'w'; - if ((mask & S_IXOTH) == 0) - o[i++] = 'x'; - o[i] = '\0'; - - out1fmt("u=%s,g=%s,o=%s\n", u, g, o); - } else { - out1fmt("%.4o\n", mask); - } - } else { - if (is_digit(*ap)) { - mask = 0; - do { - if (*ap >= '8' || *ap < '0') - error("Illegal number: %s", *argptr); - mask = (mask << 3) + (*ap - '0'); - } while (*++ap != '\0'); - umask(mask); - } else { - void *set; - INTOFF; - if ((set = setmode (ap)) == NULL) - error("Illegal number: %s", ap); - - mask = getmode (set, ~mask & 0777); - umask(~mask & 0777); - free(set); - INTON; - } - } - return 0; -} - -/* - * ulimit builtin - * - * This code, originally by Doug Gwyn, Doug Kingston, Eric Gisin, and - * Michael Rendell was ripped from pdksh 5.0.8 and hacked for use with - * ash by J.T. Conklin. - * - * Public domain. - */ - -struct limits { - const char *name; - const char *units; - int cmd; - short factor; /* multiply by to get rlim_{cur,max} values */ - char option; -}; - -static const struct limits limits[] = { -#ifdef RLIMIT_CPU - { "cpu time", "seconds", RLIMIT_CPU, 1, 't' }, -#endif -#ifdef RLIMIT_FSIZE - { "file size", "512-blocks", RLIMIT_FSIZE, 512, 'f' }, -#endif -#ifdef RLIMIT_DATA - { "data seg size", "kbytes", RLIMIT_DATA, 1024, 'd' }, -#endif -#ifdef RLIMIT_STACK - { "stack size", "kbytes", RLIMIT_STACK, 1024, 's' }, -#endif -#ifdef RLIMIT_CORE - { "core file size", "512-blocks", RLIMIT_CORE, 512, 'c' }, -#endif -#ifdef RLIMIT_RSS - { "max memory size", "kbytes", RLIMIT_RSS, 1024, 'm' }, -#endif -#ifdef RLIMIT_MEMLOCK - { "locked memory", "kbytes", RLIMIT_MEMLOCK, 1024, 'l' }, -#endif -#ifdef RLIMIT_NPROC - { "max user processes", (char *)0, RLIMIT_NPROC, 1, 'u' }, -#endif -#ifdef RLIMIT_NOFILE - { "open files", (char *)0, RLIMIT_NOFILE, 1, 'n' }, -#endif -#ifdef RLIMIT_VMEM - { "virtual mem size", "kbytes", RLIMIT_VMEM, 1024, 'v' }, -#endif -#ifdef RLIMIT_SWAP - { "swap limit", "kbytes", RLIMIT_SWAP, 1024, 'w' }, -#endif -#ifdef RLIMIT_SBSIZE - { "socket buffer size", "bytes", RLIMIT_SBSIZE, 1, 'b' }, -#endif -#ifdef RLIMIT_NPTS - { "pseudo-terminals", (char *)0, RLIMIT_NPTS, 1, 'p' }, -#endif -#ifdef RLIMIT_KQUEUES - { "kqueues", (char *)0, RLIMIT_KQUEUES, 1, 'k' }, -#endif -#ifdef RLIMIT_UMTXP - { "umtx shared locks", (char *)0, RLIMIT_UMTXP, 1, 'o' }, -#endif - { (char *) 0, (char *)0, 0, 0, '\0' } -}; - -enum limithow { SOFT = 0x1, HARD = 0x2 }; - -static void -printlimit(enum limithow how, const struct rlimit *limit, - const struct limits *l) -{ - rlim_t val = 0; - - if (how & SOFT) - val = limit->rlim_cur; - else if (how & HARD) - val = limit->rlim_max; - if (val == RLIM_INFINITY) - out1str("unlimited\n"); - else - { - val /= l->factor; - out1fmt("%jd\n", (intmax_t)val); - } -} - -int -ulimitcmd(int argc __unused, char **argv __unused) -{ - rlim_t val = 0; - enum limithow how = SOFT | HARD; - const struct limits *l; - int set, all = 0; - int optc, what; - struct rlimit limit; - - what = 'f'; - while ((optc = nextopt("HSatfdsmcnuvlbpwko")) != '\0') - switch (optc) { - case 'H': - how = HARD; - break; - case 'S': - how = SOFT; - break; - case 'a': - all = 1; - break; - default: - what = optc; - } - - for (l = limits; l->name && l->option != what; l++) - ; - if (!l->name) - error("internal error (%c)", what); - - set = *argptr ? 1 : 0; - if (set) { - char *p = *argptr; - - if (all || argptr[1]) - error("too many arguments"); - if (strcmp(p, "unlimited") == 0) - val = RLIM_INFINITY; - else { - char *end; - uintmax_t uval; - - if (*p < '0' || *p > '9') - error("bad number"); - errno = 0; - uval = strtoumax(p, &end, 10); - if (errno != 0 || *end != '\0') - error("bad number"); - if (uval > UINTMAX_MAX / l->factor) - error("bad number"); - uval *= l->factor; - val = (rlim_t)uval; - if (val < 0 || (uintmax_t)val != uval || - val == RLIM_INFINITY) - error("bad number"); - } - } - if (all) { - for (l = limits; l->name; l++) { - char optbuf[40]; - if (getrlimit(l->cmd, &limit) < 0) - error("can't get limit: %s", strerror(errno)); - - if (l->units) - snprintf(optbuf, sizeof(optbuf), - "(%s, -%c) ", l->units, l->option); - else - snprintf(optbuf, sizeof(optbuf), - "(-%c) ", l->option); - out1fmt("%-18s %18s ", l->name, optbuf); - printlimit(how, &limit, l); - } - return 0; - } - - if (getrlimit(l->cmd, &limit) < 0) - error("can't get limit: %s", strerror(errno)); - if (set) { - if (how & SOFT) - limit.rlim_cur = val; - if (how & HARD) - limit.rlim_max = val; - if (setrlimit(l->cmd, &limit) < 0) - error("bad limit: %s", strerror(errno)); - } else - printlimit(how, &limit, l); - return 0; -} diff --git a/bin/1sh/mkbuiltins b/bin/1sh/mkbuiltins deleted file mode 100755 index cbcf0ec1..00000000 --- a/bin/1sh/mkbuiltins +++ /dev/null @@ -1,137 +0,0 @@ -#!/bin/sh - - -#- -# Copyright (c) 1991, 1993 -# The Regents of the University of California. All rights reserved. -# -# This code is derived from software contributed to Berkeley by -# Kenneth Almquist. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in the -# documentation and/or other materials provided with the distribution. -# 3. Neither the name of the University nor the names of its contributors -# may be used to endorse or promote products derived from this software -# without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND -# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -# ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE -# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -# SUCH DAMAGE. -# -# @(#)mkbuiltins 8.2 (Berkeley) 5/4/95 -# $FreeBSD: releng/12.1/bin/sh/mkbuiltins 328934 2018-02-06 15:41:35Z arichardson $ - -temp=`mktemp` -havehist=1 -if [ "X$1" = "X-h" ]; then - havehist=0 - shift -fi -srcdir=$1 -havejobs=0 -if grep '^#define[ ]*JOBS[ ]*1' $srcdir/shell.h > /dev/null -then havejobs=1 -fi -exec > builtins.c -cat <<\! -/* - * This file was generated by the mkbuiltins program. - */ - -#include <stdlib.h> -#include "shell.h" -#include "builtins.h" - -! -awk '/^[^#]/ {if(('$havejobs' || $2 != "-j") && ('$havehist' || $2 != "-h")) \ - print $0}' $srcdir/builtins.def | sed 's/-[hj]//' > $temp -echo 'int (*const builtinfunc[])(int, char **) = {' -awk '/^[^#]/ { printf "\t%s,\n", $1}' $temp -echo '}; - -const unsigned char builtincmd[] = {' -awk '{ for (i = 2 ; i <= NF ; i++) { - if ($i == "-s") { - spc = 1; - } else if ($i == "-n") { - # Handled later for builtins.h - continue - } else { - printf "\t\"\\%03o\\%03o%s\"\n", length($i), (spc ? 128 : 0) + NR-1, $i - spc = 0; - } - }}' $temp -echo '};' - -exec > builtins.h -cat <<\! -/* - * This file was generated by the mkbuiltins program. - */ - -#include <sys/cdefs.h> -! -tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ < $temp | - awk '{ printf "#define %s %d\n", $1, NR-1}' -echo ' -#define BUILTIN_SPECIAL 0x80 - -extern int (*const builtinfunc[])(int, char **); -extern const unsigned char builtincmd[]; -' -awk '{ printf "int %s(int, char **);\n", $1}' $temp - -# Build safe_builtin_always() -cat <<EOF - -static inline int -safe_builtin_always(int idx) -{ -EOF -awk ' -BEGIN { printed = 0 } -{ - for (i = 2 ; i <= NF ; i++) { - if ($i == "-s") { - continue - } else if ($i == "-n") { - nofork = 1; - } else { - if (nofork == 0) { - continue - } - if (printed == 1) { - printf " || \n\t " - } else { - printf "\tif (" - } - printf "idx == " toupper($1) - printed = 1 - nofork = 0; - # Only need to check each once - break - } - } -}' $temp - -cat << EOF -) - return (1); - return(0); -} -EOF - -rm -f $temp diff --git a/bin/1sh/mknodes.c b/bin/1sh/mknodes.c deleted file mode 100644 index 9ec4dfbd..00000000 --- a/bin/1sh/mknodes.c +++ /dev/null @@ -1,461 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-3-Clause - * - * Copyright (c) 1991, 1993 - * The Regents of the University of California. All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * Kenneth Almquist. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#if 0 -#ifndef lint -static char const copyright[] = -"@(#) Copyright (c) 1991, 1993\n\ - The Regents of the University of California. All rights reserved.\n"; -#endif /* not lint */ - -#ifndef lint -static char sccsid[] = "@(#)mknodes.c 8.2 (Berkeley) 5/4/95"; -#endif /* not lint */ -#endif -#include <sys/cdefs.h> -/* $FreeBSD: releng/12.1/bin/sh/mknodes.c 326025 2017-11-20 19:49:47Z pfg $ */ - -/* - * This program reads the nodetypes file and nodes.c.pat file. It generates - * the files nodes.h and nodes.c. - */ - -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <errno.h> -#include <stdarg.h> - -#define MAXTYPES 50 /* max number of node types */ -#define MAXFIELDS 20 /* max fields in a structure */ -#define BUFLEN 100 /* size of character buffers */ - -/* field types */ -#define T_NODE 1 /* union node *field */ -#define T_NODELIST 2 /* struct nodelist *field */ -#define T_STRING 3 -#define T_INT 4 /* int field */ -#define T_OTHER 5 /* other */ -#define T_TEMP 6 /* don't copy this field */ - - -struct field { /* a structure field */ - char *name; /* name of field */ - int type; /* type of field */ - char *decl; /* declaration of field */ -}; - - -struct str { /* struct representing a node structure */ - char *tag; /* structure tag */ - int nfields; /* number of fields in the structure */ - struct field field[MAXFIELDS]; /* the fields of the structure */ - int done; /* set if fully parsed */ -}; - - -static int ntypes; /* number of node types */ -static char *nodename[MAXTYPES]; /* names of the nodes */ -static struct str *nodestr[MAXTYPES]; /* type of structure used by the node */ -static int nstr; /* number of structures */ -static struct str str[MAXTYPES]; /* the structures */ -static struct str *curstr; /* current structure */ -static char line[1024]; -static int linno; -static char *linep; - -static void parsenode(void); -static void parsefield(void); -static void output(char *); -static void outsizes(FILE *); -static void outfunc(FILE *, int); -static void indent(int, FILE *); -static int nextfield(char *); -static void skipbl(void); -static int readline(FILE *); -static void error(const char *, ...) __attribute__((format(printf, 1, 2))) __attribute__((noreturn)); -static char *savestr(const char *); - - -int -main(int argc, char *argv[]) -{ - FILE *infp; - - if (argc != 3) - error("usage: mknodes file"); - if ((infp = fopen(argv[1], "r")) == NULL) - error("Can't open %s: %s", argv[1], strerror(errno)); - while (readline(infp)) { - if (line[0] == ' ' || line[0] == '\t') - parsefield(); - else if (line[0] != '\0') - parsenode(); - } - fclose(infp); - output(argv[2]); - exit(0); -} - - - -static void -parsenode(void) -{ - char name[BUFLEN]; - char tag[BUFLEN]; - struct str *sp; - - if (curstr && curstr->nfields > 0) - curstr->done = 1; - nextfield(name); - if (! nextfield(tag)) - error("Tag expected"); - if (*linep != '\0') - error("Garbage at end of line"); - nodename[ntypes] = savestr(name); - for (sp = str ; sp < str + nstr ; sp++) { - if (strcmp(sp->tag, tag) == 0) - break; - } - if (sp >= str + nstr) { - sp->tag = savestr(tag); - sp->nfields = 0; - curstr = sp; - nstr++; - } - nodestr[ntypes] = sp; - ntypes++; -} - - -static void -parsefield(void) -{ - char name[BUFLEN]; - char type[BUFLEN]; - char decl[2 * BUFLEN]; - struct field *fp; - - if (curstr == NULL || curstr->done) - error("No current structure to add field to"); - if (! nextfield(name)) - error("No field name"); - if (! nextfield(type)) - error("No field type"); - fp = &curstr->field[curstr->nfields]; - fp->name = savestr(name); - if (strcmp(type, "nodeptr") == 0) { - fp->type = T_NODE; - sprintf(decl, "union node *%s", name); - } else if (strcmp(type, "nodelist") == 0) { - fp->type = T_NODELIST; - sprintf(decl, "struct nodelist *%s", name); - } else if (strcmp(type, "string") == 0) { - fp->type = T_STRING; - sprintf(decl, "char *%s", name); - } else if (strcmp(type, "int") == 0) { - fp->type = T_INT; - sprintf(decl, "int %s", name); - } else if (strcmp(type, "other") == 0) { - fp->type = T_OTHER; - } else if (strcmp(type, "temp") == 0) { - fp->type = T_TEMP; - } else { - error("Unknown type %s", type); - } - if (fp->type == T_OTHER || fp->type == T_TEMP) { - skipbl(); - fp->decl = savestr(linep); - } else { - if (*linep) - error("Garbage at end of line"); - fp->decl = savestr(decl); - } - curstr->nfields++; -} - - -static const char writer[] = "\ -/*\n\ - * This file was generated by the mknodes program.\n\ - */\n\ -\n"; - -static void -output(char *file) -{ - FILE *hfile; - FILE *cfile; - FILE *patfile; - int i; - struct str *sp; - struct field *fp; - char *p; - - if ((patfile = fopen(file, "r")) == NULL) - error("Can't open %s: %s", file, strerror(errno)); - if ((hfile = fopen("nodes.h", "w")) == NULL) - error("Can't create nodes.h: %s", strerror(errno)); - if ((cfile = fopen("nodes.c", "w")) == NULL) - error("Can't create nodes.c"); - fputs(writer, hfile); - for (i = 0 ; i < ntypes ; i++) - fprintf(hfile, "#define %s %d\n", nodename[i], i); - fputs("\n\n\n", hfile); - for (sp = str ; sp < &str[nstr] ; sp++) { - fprintf(hfile, "struct %s {\n", sp->tag); - for (i = sp->nfields, fp = sp->field ; --i >= 0 ; fp++) { - fprintf(hfile, " %s;\n", fp->decl); - } - fputs("};\n\n\n", hfile); - } - fputs("union node {\n", hfile); - fprintf(hfile, " int type;\n"); - for (sp = str ; sp < &str[nstr] ; sp++) { - fprintf(hfile, " struct %s %s;\n", sp->tag, sp->tag); - } - fputs("};\n\n\n", hfile); - fputs("struct nodelist {\n", hfile); - fputs("\tstruct nodelist *next;\n", hfile); - fputs("\tunion node *n;\n", hfile); - fputs("};\n\n\n", hfile); - fputs("struct funcdef;\n", hfile); - fputs("struct funcdef *copyfunc(union node *);\n", hfile); - fputs("union node *getfuncnode(struct funcdef *);\n", hfile); - fputs("void reffunc(struct funcdef *);\n", hfile); - fputs("void unreffunc(struct funcdef *);\n", hfile); - if (ferror(hfile)) - error("Can't write to nodes.h"); - if (fclose(hfile)) - error("Can't close nodes.h"); - - fputs(writer, cfile); - while (fgets(line, sizeof line, patfile) != NULL) { - for (p = line ; *p == ' ' || *p == '\t' ; p++); - if (strcmp(p, "%SIZES\n") == 0) - outsizes(cfile); - else if (strcmp(p, "%CALCSIZE\n") == 0) - outfunc(cfile, 1); - else if (strcmp(p, "%COPY\n") == 0) - outfunc(cfile, 0); - else - fputs(line, cfile); - } - fclose(patfile); - if (ferror(cfile)) - error("Can't write to nodes.c"); - if (fclose(cfile)) - error("Can't close nodes.c"); -} - - - -static void -outsizes(FILE *cfile) -{ - int i; - - fprintf(cfile, "static const short nodesize[%d] = {\n", ntypes); - for (i = 0 ; i < ntypes ; i++) { - fprintf(cfile, " ALIGN(sizeof (struct %s)),\n", nodestr[i]->tag); - } - fprintf(cfile, "};\n"); -} - - -static void -outfunc(FILE *cfile, int calcsize) -{ - struct str *sp; - struct field *fp; - int i; - - fputs(" if (n == NULL)\n", cfile); - if (calcsize) - fputs(" return;\n", cfile); - else - fputs(" return NULL;\n", cfile); - if (calcsize) - fputs(" result->blocksize += nodesize[n->type];\n", cfile); - else { - fputs(" new = state->block;\n", cfile); - fputs(" state->block = (char *)state->block + nodesize[n->type];\n", cfile); - } - fputs(" switch (n->type) {\n", cfile); - for (sp = str ; sp < &str[nstr] ; sp++) { - for (i = 0 ; i < ntypes ; i++) { - if (nodestr[i] == sp) - fprintf(cfile, " case %s:\n", nodename[i]); - } - for (i = sp->nfields ; --i >= 1 ; ) { - fp = &sp->field[i]; - switch (fp->type) { - case T_NODE: - if (calcsize) { - indent(12, cfile); - fprintf(cfile, "calcsize(n->%s.%s, result);\n", - sp->tag, fp->name); - } else { - indent(12, cfile); - fprintf(cfile, "new->%s.%s = copynode(n->%s.%s, state);\n", - sp->tag, fp->name, sp->tag, fp->name); - } - break; - case T_NODELIST: - if (calcsize) { - indent(12, cfile); - fprintf(cfile, "sizenodelist(n->%s.%s, result);\n", - sp->tag, fp->name); - } else { - indent(12, cfile); - fprintf(cfile, "new->%s.%s = copynodelist(n->%s.%s, state);\n", - sp->tag, fp->name, sp->tag, fp->name); - } - break; - case T_STRING: - if (calcsize) { - indent(12, cfile); - fprintf(cfile, "result->stringsize += strlen(n->%s.%s) + 1;\n", - sp->tag, fp->name); - } else { - indent(12, cfile); - fprintf(cfile, "new->%s.%s = nodesavestr(n->%s.%s, state);\n", - sp->tag, fp->name, sp->tag, fp->name); - } - break; - case T_INT: - case T_OTHER: - if (! calcsize) { - indent(12, cfile); - fprintf(cfile, "new->%s.%s = n->%s.%s;\n", - sp->tag, fp->name, sp->tag, fp->name); - } - break; - } - } - indent(12, cfile); - fputs("break;\n", cfile); - } - fputs(" };\n", cfile); - if (! calcsize) - fputs(" new->type = n->type;\n", cfile); -} - - -static void -indent(int amount, FILE *fp) -{ - while (amount >= 8) { - putc('\t', fp); - amount -= 8; - } - while (--amount >= 0) { - putc(' ', fp); - } -} - - -static int -nextfield(char *buf) -{ - char *p, *q; - - p = linep; - while (*p == ' ' || *p == '\t') - p++; - q = buf; - while (*p != ' ' && *p != '\t' && *p != '\0') - *q++ = *p++; - *q = '\0'; - linep = p; - return (q > buf); -} - - -static void -skipbl(void) -{ - while (*linep == ' ' || *linep == '\t') - linep++; -} - - -static int -readline(FILE *infp) -{ - char *p; - - if (fgets(line, 1024, infp) == NULL) - return 0; - for (p = line ; *p != '#' && *p != '\n' && *p != '\0' ; p++); - while (p > line && (p[-1] == ' ' || p[-1] == '\t')) - p--; - *p = '\0'; - linep = line; - linno++; - if (p - line > BUFLEN) - error("Line too long"); - return 1; -} - - - -static void -error(const char *msg, ...) -{ - va_list va; - va_start(va, msg); - - (void) fprintf(stderr, "line %d: ", linno); - (void) vfprintf(stderr, msg, va); - (void) fputc('\n', stderr); - - va_end(va); - - exit(2); -} - - - -static char * -savestr(const char *s) -{ - char *p; - - if ((p = malloc(strlen(s) + 1)) == NULL) - error("Out of space"); - (void) strcpy(p, s); - return p; -} diff --git a/bin/1sh/mksyntax.c b/bin/1sh/mksyntax.c deleted file mode 100644 index b61378a9..00000000 --- a/bin/1sh/mksyntax.c +++ /dev/null @@ -1,332 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-3-Clause - * - * Copyright (c) 1991, 1993 - * The Regents of the University of California. All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * Kenneth Almquist. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#if 0 -#ifndef lint -static char const copyright[] = -"@(#) Copyright (c) 1991, 1993\n\ - The Regents of the University of California. All rights reserved.\n"; -#endif /* not lint */ - -#ifndef lint -static char sccsid[] = "@(#)mksyntax.c 8.2 (Berkeley) 5/4/95"; -#endif /* not lint */ -#endif -#include <sys/cdefs.h> -/* $FreeBSD: releng/12.1/bin/sh/mksyntax.c 334008 2018-05-21 21:52:48Z jilles $ */ - -/* - * This program creates syntax.h and syntax.c. - */ - -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include "parser.h" - - -struct synclass { - const char *name; - const char *comment; -}; - -/* Syntax classes */ -static const struct synclass synclass[] = { - { "CWORD", "character is nothing special" }, - { "CNL", "newline character" }, - { "CQNL", "newline character in quotes" }, - { "CBACK", "a backslash character" }, - { "CSBACK", "a backslash character in single quotes" }, - { "CSQUOTE", "single quote" }, - { "CDQUOTE", "double quote" }, - { "CENDQUOTE", "a terminating quote" }, - { "CBQUOTE", "backwards single quote" }, - { "CVAR", "a dollar sign" }, - { "CENDVAR", "a '}' character" }, - { "CLP", "a left paren in arithmetic" }, - { "CRP", "a right paren in arithmetic" }, - { "CEOF", "end of file" }, - { "CCTL", "like CWORD, except it must be escaped" }, - { "CSPCL", "these terminate a word" }, - { "CIGN", "character should be ignored" }, - { NULL, NULL } -}; - - -/* - * Syntax classes for is_ functions. Warning: if you add new classes - * you may have to change the definition of the is_in_name macro. - */ -static const struct synclass is_entry[] = { - { "ISDIGIT", "a digit" }, - { "ISUPPER", "an upper case letter" }, - { "ISLOWER", "a lower case letter" }, - { "ISUNDER", "an underscore" }, - { "ISSPECL", "the name of a special parameter" }, - { NULL, NULL } -}; - -static const char writer[] = "\ -/*\n\ - * This file was generated by the mksyntax program.\n\ - */\n\ -\n"; - - -static FILE *cfile; -static FILE *hfile; - -static void add_default(void); -static void finish(void); -static void init(const char *); -static void add(const char *, const char *); -static void output_type_macros(void); - -int -main(int argc __unused, char **argv __unused) -{ - int i; - char buf[80]; - int pos; - - /* Create output files */ - if ((cfile = fopen("syntax.c", "w")) == NULL) { - perror("syntax.c"); - exit(2); - } - if ((hfile = fopen("syntax.h", "w")) == NULL) { - perror("syntax.h"); - exit(2); - } - fputs(writer, hfile); - fputs(writer, cfile); - - fputs("#include <sys/cdefs.h>\n", hfile); - fputs("#include <limits.h>\n\n", hfile); - - /* Generate the #define statements in the header file */ - fputs("/* Syntax classes */\n", hfile); - for (i = 0 ; synclass[i].name ; i++) { - sprintf(buf, "#define %s %d", synclass[i].name, i); - fputs(buf, hfile); - for (pos = strlen(buf) ; pos < 32 ; pos = (pos + 8) & ~07) - putc('\t', hfile); - fprintf(hfile, "/* %s */\n", synclass[i].comment); - } - putc('\n', hfile); - fputs("/* Syntax classes for is_ functions */\n", hfile); - for (i = 0 ; is_entry[i].name ; i++) { - sprintf(buf, "#define %s %#o", is_entry[i].name, 1 << i); - fputs(buf, hfile); - for (pos = strlen(buf) ; pos < 32 ; pos = (pos + 8) & ~07) - putc('\t', hfile); - fprintf(hfile, "/* %s */\n", is_entry[i].comment); - } - putc('\n', hfile); - fputs("#define SYNBASE (1 - CHAR_MIN)\n", hfile); - fputs("#define PEOF -SYNBASE\n\n", hfile); - putc('\n', hfile); - fputs("#define BASESYNTAX (basesyntax + SYNBASE)\n", hfile); - fputs("#define DQSYNTAX (dqsyntax + SYNBASE)\n", hfile); - fputs("#define SQSYNTAX (sqsyntax + SYNBASE)\n", hfile); - fputs("#define ARISYNTAX (arisyntax + SYNBASE)\n", hfile); - putc('\n', hfile); - output_type_macros(); /* is_digit, etc. */ - putc('\n', hfile); - - /* Generate the syntax tables. */ - fputs("#include \"parser.h\"\n", cfile); - fputs("#include \"shell.h\"\n", cfile); - fputs("#include \"syntax.h\"\n\n", cfile); - - fputs("/* syntax table used when not in quotes */\n", cfile); - init("basesyntax"); - add_default(); - add("\n", "CNL"); - add("\\", "CBACK"); - add("'", "CSQUOTE"); - add("\"", "CDQUOTE"); - add("`", "CBQUOTE"); - add("$", "CVAR"); - add("}", "CENDVAR"); - add("<>();&| \t", "CSPCL"); - finish(); - - fputs("\n/* syntax table used when in double quotes */\n", cfile); - init("dqsyntax"); - add_default(); - add("\n", "CQNL"); - add("\\", "CBACK"); - add("\"", "CENDQUOTE"); - add("`", "CBQUOTE"); - add("$", "CVAR"); - add("}", "CENDVAR"); - /* ':/' for tilde expansion, '-^]' for [a\-x] pattern ranges */ - add("!*?[]=~:/-^", "CCTL"); - finish(); - - fputs("\n/* syntax table used when in single quotes */\n", cfile); - init("sqsyntax"); - add_default(); - add("\n", "CQNL"); - add("\\", "CSBACK"); - add("'", "CENDQUOTE"); - /* ':/' for tilde expansion, '-^]' for [a\-x] pattern ranges */ - add("!*?[]=~:/-^", "CCTL"); - finish(); - - fputs("\n/* syntax table used when in arithmetic */\n", cfile); - init("arisyntax"); - add_default(); - add("\n", "CQNL"); - add("\\", "CBACK"); - add("`", "CBQUOTE"); - add("\"", "CIGN"); - add("$", "CVAR"); - add("}", "CENDVAR"); - add("(", "CLP"); - add(")", "CRP"); - finish(); - - fputs("\n/* character classification table */\n", cfile); - init("is_type"); - add("0123456789", "ISDIGIT"); - add("abcdefghijklmnopqrstuvwxyz", "ISLOWER"); - add("ABCDEFGHIJKLMNOPQRSTUVWXYZ", "ISUPPER"); - add("_", "ISUNDER"); - add("#?$!-*@", "ISSPECL"); - finish(); - - exit(0); -} - - -/* - * Output the header and declaration of a syntax table. - */ - -static void -init(const char *name) -{ - fprintf(hfile, "extern const char %s[];\n", name); - fprintf(cfile, "const char %s[SYNBASE + CHAR_MAX + 1] = {\n", name); -} - - -static void -add_one(const char *key, const char *type) -{ - fprintf(cfile, "\t[SYNBASE + %s] = %s,\n", key, type); -} - - -/* - * Add default values to the syntax table. - */ - -static void -add_default(void) -{ - add_one("PEOF", "CEOF"); - add_one("CTLESC", "CCTL"); - add_one("CTLVAR", "CCTL"); - add_one("CTLENDVAR", "CCTL"); - add_one("CTLBACKQ", "CCTL"); - add_one("CTLBACKQ + CTLQUOTE", "CCTL"); - add_one("CTLARI", "CCTL"); - add_one("CTLENDARI", "CCTL"); - add_one("CTLQUOTEMARK", "CCTL"); - add_one("CTLQUOTEEND", "CCTL"); -} - - -/* - * Output the footer of a syntax table. - */ - -static void -finish(void) -{ - fputs("};\n", cfile); -} - - -/* - * Add entries to the syntax table. - */ - -static void -add(const char *p, const char *type) -{ - for (; *p; ++p) { - char c = *p; - switch (c) { - case '\t': c = 't'; break; - case '\n': c = 'n'; break; - case '\'': c = '\''; break; - case '\\': c = '\\'; break; - - default: - fprintf(cfile, "\t[SYNBASE + '%c'] = %s,\n", c, type); - continue; - } - fprintf(cfile, "\t[SYNBASE + '\\%c'] = %s,\n", c, type); - } -} - - -/* - * Output character classification macros (e.g. is_digit). If digits are - * contiguous, we can test for them quickly. - */ - -static const char *macro[] = { - "#define is_digit(c)\t((unsigned int)((c) - '0') <= 9)", - "#define is_eof(c)\t((c) == PEOF)", - "#define is_alpha(c)\t((is_type+SYNBASE)[(int)c] & (ISUPPER|ISLOWER))", - "#define is_name(c)\t((is_type+SYNBASE)[(int)c] & (ISUPPER|ISLOWER|ISUNDER))", - "#define is_in_name(c)\t((is_type+SYNBASE)[(int)c] & (ISUPPER|ISLOWER|ISUNDER|ISDIGIT))", - "#define is_special(c)\t((is_type+SYNBASE)[(int)c] & (ISSPECL|ISDIGIT))", - "#define digit_val(c)\t((c) - '0')", - NULL -}; - -static void -output_type_macros(void) -{ - const char **pp; - - for (pp = macro ; *pp ; pp++) - fprintf(hfile, "%s\n", *pp); -} diff --git a/bin/1sh/mktokens b/bin/1sh/mktokens deleted file mode 100644 index f0d80cc5..00000000 --- a/bin/1sh/mktokens +++ /dev/null @@ -1,93 +0,0 @@ -#!/bin/sh - - -#- -# Copyright (c) 1991, 1993 -# The Regents of the University of California. All rights reserved. -# -# This code is derived from software contributed to Berkeley by -# Kenneth Almquist. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in the -# documentation and/or other materials provided with the distribution. -# 3. Neither the name of the University nor the names of its contributors -# may be used to endorse or promote products derived from this software -# without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND -# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -# ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE -# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -# SUCH DAMAGE. -# -# @(#)mktokens 8.1 (Berkeley) 5/31/93 -# $FreeBSD: releng/12.1/bin/sh/mktokens 328934 2018-02-06 15:41:35Z arichardson $ - -# The following is a list of tokens. The second column is nonzero if the -# token marks the end of a list. The third column is the name to print in -# error messages. - -temp=`mktemp` -cat > $temp <<\! -TEOF 1 end of file -TNL 0 newline -TSEMI 0 ";" -TBACKGND 0 "&" -TAND 0 "&&" -TOR 0 "||" -TPIPE 0 "|" -TLP 0 "(" -TRP 1 ")" -TENDCASE 1 ";;" -TFALLTHRU 1 ";&" -TREDIR 0 redirection -TWORD 0 word -TIF 0 "if" -TTHEN 1 "then" -TELSE 1 "else" -TELIF 1 "elif" -TFI 1 "fi" -TWHILE 0 "while" -TUNTIL 0 "until" -TFOR 0 "for" -TDO 1 "do" -TDONE 1 "done" -TBEGIN 0 "{" -TEND 1 "}" -TCASE 0 "case" -TESAC 1 "esac" -TNOT 0 "!" -! -nl=`wc -l $temp` -exec > token.h -awk '{print "#define " $1 " " NR-1}' $temp -echo ' -/* Array indicating which tokens mark the end of a list */ -static const char tokendlist[] = {' -awk '{print "\t" $2 ","}' $temp -echo '}; - -static const char *const tokname[] = {' -sed -e 's/"/\\"/g' \ - -e 's/[^ ]*[ ][ ]*[^ ]*[ ][ ]*\(.*\)/ "\1",/' \ - $temp -echo '}; -' -sed 's/"//g' $temp | awk ' -/TIF/{print "#define KWDOFFSET " NR-1; print ""; print "const char *const parsekwd[] = {"} -/TIF/,/neverfound/{print " \"" $3 "\","}' -echo ' 0 -};' - -rm $temp diff --git a/bin/1sh/myhistedit.h b/bin/1sh/myhistedit.h deleted file mode 100644 index e9a2be2c..00000000 --- a/bin/1sh/myhistedit.h +++ /dev/null @@ -1,45 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-3-Clause - * - * Copyright (c) 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)myhistedit.h 8.2 (Berkeley) 5/4/95 - * $FreeBSD: releng/12.1/bin/sh/myhistedit.h 326025 2017-11-20 19:49:47Z pfg $ - */ - -#include <histedit.h> - -extern History *hist; -extern EditLine *el; -extern int displayhist; - -void histedit(void); -void sethistfile(const char *); -void sethistsize(const char *); -void setterm(const char *); - diff --git a/bin/1sh/mystring.c b/bin/1sh/mystring.c deleted file mode 100644 index ddeea4c1..00000000 --- a/bin/1sh/mystring.c +++ /dev/null @@ -1,100 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-3-Clause - * - * Copyright (c) 1991, 1993 - * The Regents of the University of California. All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * Kenneth Almquist. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#ifndef lint -#if 0 -static char sccsid[] = "@(#)mystring.c 8.2 (Berkeley) 5/4/95"; -#endif -#endif /* not lint */ -#include <sys/cdefs.h> -/* $FreeBSD: releng/12.1/bin/sh/mystring.c 326025 2017-11-20 19:49:47Z pfg $ */ - -/* - * String functions. - * - * equal(s1, s2) Return true if strings are equal. - * number(s) Convert a string of digits to an integer. - * is_number(s) Return true if s is a string of digits. - */ - -#include <stdlib.h> -#include "shell.h" -#include "syntax.h" -#include "error.h" -#include "mystring.h" - - -char nullstr[1]; /* zero length string */ - -/* - * equal - #defined in mystring.h - */ - - -/* - * Convert a string of digits to an integer, printing an error message on - * failure. - */ - -int -number(const char *s) -{ - if (! is_number(s)) - error("Illegal number: %s", s); - return atoi(s); -} - - - -/* - * Check for a valid number. This should be elsewhere. - */ - -int -is_number(const char *p) -{ - const char *q; - - if (*p == '\0') - return 0; - while (*p == '0') - p++; - for (q = p; *q != '\0'; q++) - if (! is_digit(*q)) - return 0; - if (q - p > 10 || - (q - p == 10 && memcmp(p, "2147483647", 10) > 0)) - return 0; - return 1; -} diff --git a/bin/1sh/mystring.h b/bin/1sh/mystring.h deleted file mode 100644 index 9f4960e5..00000000 --- a/bin/1sh/mystring.h +++ /dev/null @@ -1,43 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-3-Clause - * - * Copyright (c) 1991, 1993 - * The Regents of the University of California. All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * Kenneth Almquist. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)mystring.h 8.2 (Berkeley) 5/4/95 - * $FreeBSD: releng/12.1/bin/sh/mystring.h 326025 2017-11-20 19:49:47Z pfg $ - */ - -#include <string.h> - -int number(const char *); -int is_number(const char *); - -#define equal(s1, s2) (strcmp(s1, s2) == 0) diff --git a/bin/1sh/nodes.c.pat b/bin/1sh/nodes.c.pat deleted file mode 100644 index b687b570..00000000 --- a/bin/1sh/nodes.c.pat +++ /dev/null @@ -1,193 +0,0 @@ -/*- - * Copyright (c) 1991, 1993 - * The Regents of the University of California. All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * Kenneth Almquist. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)nodes.c.pat 8.2 (Berkeley) 5/4/95 - * $FreeBSD: releng/12.1/bin/sh/nodes.c.pat 314436 2017-02-28 23:42:47Z imp $ - */ - -#include <sys/param.h> -#include <stdlib.h> -#include <stddef.h> -/* - * Routine for dealing with parsed shell commands. - */ - -#include "shell.h" -#include "nodes.h" -#include "memalloc.h" -#include "mystring.h" - - -struct nodesize { - int blocksize; /* size of structures in function */ - int stringsize; /* size of strings in node */ -}; - -struct nodecopystate { - pointer block; /* block to allocate function from */ - char *string; /* block to allocate strings from */ -}; - -%SIZES - - -static void calcsize(union node *, struct nodesize *); -static void sizenodelist(struct nodelist *, struct nodesize *); -static union node *copynode(union node *, struct nodecopystate *); -static struct nodelist *copynodelist(struct nodelist *, struct nodecopystate *); -static char *nodesavestr(const char *, struct nodecopystate *); - - -struct funcdef { - unsigned int refcount; - union node n; -}; - -/* - * Make a copy of a parse tree. - */ - -struct funcdef * -copyfunc(union node *n) -{ - struct nodesize sz; - struct nodecopystate st; - struct funcdef *fn; - - if (n == NULL) - return NULL; - sz.blocksize = offsetof(struct funcdef, n); - sz.stringsize = 0; - calcsize(n, &sz); - fn = ckmalloc(sz.blocksize + sz.stringsize); - fn->refcount = 1; - st.block = (char *)fn + offsetof(struct funcdef, n); - st.string = (char *)fn + sz.blocksize; - copynode(n, &st); - return fn; -} - - -union node * -getfuncnode(struct funcdef *fn) -{ - return fn == NULL ? NULL : &fn->n; -} - - -static void -calcsize(union node *n, struct nodesize *result) -{ - %CALCSIZE -} - - - -static void -sizenodelist(struct nodelist *lp, struct nodesize *result) -{ - while (lp) { - result->blocksize += ALIGN(sizeof(struct nodelist)); - calcsize(lp->n, result); - lp = lp->next; - } -} - - - -static union node * -copynode(union node *n, struct nodecopystate *state) -{ - union node *new; - - %COPY - return new; -} - - -static struct nodelist * -copynodelist(struct nodelist *lp, struct nodecopystate *state) -{ - struct nodelist *start; - struct nodelist **lpp; - - lpp = &start; - while (lp) { - *lpp = state->block; - state->block = (char *)state->block + - ALIGN(sizeof(struct nodelist)); - (*lpp)->n = copynode(lp->n, state); - lp = lp->next; - lpp = &(*lpp)->next; - } - *lpp = NULL; - return start; -} - - - -static char * -nodesavestr(const char *s, struct nodecopystate *state) -{ - const char *p = s; - char *q = state->string; - char *rtn = state->string; - - while ((*q++ = *p++) != '\0') - continue; - state->string = q; - return rtn; -} - - -void -reffunc(struct funcdef *fn) -{ - if (fn) - fn->refcount++; -} - - -/* - * Decrement the reference count of a function definition, freeing it - * if it falls to 0. - */ - -void -unreffunc(struct funcdef *fn) -{ - if (fn) { - fn->refcount--; - if (fn->refcount > 0) - return; - ckfree(fn); - } -} diff --git a/bin/1sh/nodetypes b/bin/1sh/nodetypes deleted file mode 100644 index 51facbe8..00000000 --- a/bin/1sh/nodetypes +++ /dev/null @@ -1,145 +0,0 @@ -#- -# Copyright (c) 1991, 1993 -# The Regents of the University of California. All rights reserved. -# -# This code is derived from software contributed to Berkeley by -# Kenneth Almquist. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in the -# documentation and/or other materials provided with the distribution. -# 3. Neither the name of the University nor the names of its contributors -# may be used to endorse or promote products derived from this software -# without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND -# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -# ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE -# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -# SUCH DAMAGE. -# -# @(#)nodetypes 8.2 (Berkeley) 5/4/95 -# $FreeBSD: releng/12.1/bin/sh/nodetypes 314436 2017-02-28 23:42:47Z imp $ - -# This file describes the nodes used in parse trees. Unindented lines -# contain a node type followed by a structure tag. Subsequent indented -# lines specify the fields of the structure. Several node types can share -# the same structure, in which case the fields of the structure should be -# specified only once. -# -# A field of a structure is described by the name of the field followed -# by a type. The currently implemented types are: -# nodeptr - a pointer to a node -# nodelist - a pointer to a list of nodes -# string - a pointer to a nul terminated string -# int - an integer -# other - any type that can be copied by assignment -# temp - a field that doesn't have to be copied when the node is copied -# The last two types should be followed by the text of a C declaration for -# the field. - -NSEMI nbinary # two commands separated by a semicolon - type int - ch1 nodeptr # the first child - ch2 nodeptr # the second child - -NCMD ncmd # a simple command - type int - args nodeptr # the arguments - redirect nodeptr # list of file redirections - -NPIPE npipe # a pipeline - type int - backgnd int # set to run pipeline in background - cmdlist nodelist # the commands in the pipeline - -NREDIR nredir # redirection (of a compex command) - type int - n nodeptr # the command - redirect nodeptr # list of file redirections - -NBACKGND nredir # run command in background -NSUBSHELL nredir # run command in a subshell - -NAND nbinary # the && operator -NOR nbinary # the || operator - -NIF nif # the if statement. Elif clauses are handled - type int # using multiple if nodes. - test nodeptr # if test - ifpart nodeptr # then ifpart - elsepart nodeptr # else elsepart - -NWHILE nbinary # the while statement. First child is the test -NUNTIL nbinary # the until statement - -NFOR nfor # the for statement - type int - args nodeptr # for var in args - body nodeptr # do body; done - var string # the for variable - -NCASE ncase # a case statement - type int - expr nodeptr # the word to switch on - cases nodeptr # the list of cases (NCLIST nodes) - -NCLIST nclist # a case ending with ;; - type int - next nodeptr # the next case in list - pattern nodeptr # list of patterns for this case - body nodeptr # code to execute for this case - -NCLISTFALLTHRU nclist # a case ending with ;& - -NDEFUN narg # define a function. The "next" field contains - # the body of the function. - -NARG narg # represents a word - type int - next nodeptr # next word in list - text string # the text of the word - backquote nodelist # list of commands in back quotes - -NTO nfile # fd> fname -NFROM nfile # fd< fname -NFROMTO nfile # fd<> fname -NAPPEND nfile # fd>> fname -NCLOBBER nfile # fd>| fname - type int - fd int # file descriptor being redirected - next nodeptr # next redirection in list - fname nodeptr # file name, in a NARG node - expfname temp char *expfname # actual file name - -NTOFD ndup # fd<&dupfd -NFROMFD ndup # fd>&dupfd - type int - fd int # file descriptor being redirected - next nodeptr # next redirection in list - dupfd int # file descriptor to duplicate - vname nodeptr # file name if fd>&$var - - -NHERE nhere # fd<<\! -NXHERE nhere # fd<<! - type int - fd int # file descriptor being redirected - next nodeptr # next redirection in list - doc nodeptr # input to command (NARG node) - expdoc temp const char *expdoc # actual document (for NXHERE) - -NNOT nnot # ! command (actually pipeline) - type int - com nodeptr diff --git a/bin/1sh/options.c b/bin/1sh/options.c deleted file mode 100644 index a1bb57ca..00000000 --- a/bin/1sh/options.c +++ /dev/null @@ -1,594 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-3-Clause - * - * Copyright (c) 1991, 1993 - * The Regents of the University of California. All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * Kenneth Almquist. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#ifndef lint -#if 0 -static char sccsid[] = "@(#)options.c 8.2 (Berkeley) 5/4/95"; -#endif -#endif /* not lint */ -#include <sys/cdefs.h> -/* $FreeBSD: releng/12.1/bin/sh/options.c 326025 2017-11-20 19:49:47Z pfg $ */ - -#include <signal.h> -#include <unistd.h> -#include <stdlib.h> - -#include "shell.h" -#define DEFINE_OPTIONS -#include "options.h" -#undef DEFINE_OPTIONS -#include "nodes.h" /* for other header files */ -#include "eval.h" -#include "jobs.h" -#include "input.h" -#include "output.h" -#include "trap.h" -#include "var.h" -#include "memalloc.h" -#include "error.h" -#include "mystring.h" -#include "builtins.h" -#ifndef NO_HISTORY -#include "myhistedit.h" -#endif - -char *arg0; /* value of $0 */ -struct shparam shellparam; /* current positional parameters */ -char **argptr; /* argument list for builtin commands */ -char *shoptarg; /* set by nextopt (like getopt) */ -char *nextopt_optptr; /* used by nextopt */ - -char *minusc; /* argument to -c option */ - - -static void options(int); -static void minus_o(char *, int); -static void setoption(int, int); -static void setoptionbyindex(int, int); -static void setparam(int, char **); -static int getopts(char *, char *, char **, char ***, char **); - - -/* - * Process the shell command line arguments. - */ - -void -procargs(int argc, char **argv) -{ - int i; - char *scriptname; - - argptr = argv; - if (argc > 0) - argptr++; - for (i = 0; i < NOPTS; i++) - optval[i] = 2; - privileged = (getuid() != geteuid() || getgid() != getegid()); - options(1); - if (*argptr == NULL && minusc == NULL) - sflag = 1; - if (iflag != 0 && sflag == 1 && isatty(0) && isatty(1)) { - iflag = 1; - if (Eflag == 2) - Eflag = 1; - } - if (mflag == 2) - mflag = iflag; - for (i = 0; i < NOPTS; i++) - if (optval[i] == 2) - optval[i] = 0; - arg0 = argv[0]; - if (sflag == 0 && minusc == NULL) { - scriptname = *argptr++; - setinputfile(scriptname, 0); - commandname = arg0 = scriptname; - } - /* POSIX 1003.2: first arg after -c cmd is $0, remainder $1... */ - if (argptr && minusc && *argptr) - arg0 = *argptr++; - - shellparam.p = argptr; - shellparam.reset = 1; - /* assert(shellparam.malloc == 0 && shellparam.nparam == 0); */ - while (*argptr) { - shellparam.nparam++; - argptr++; - } - optschanged(); -} - - -void -optschanged(void) -{ - setinteractive(); -#ifndef NO_HISTORY - histedit(); -#endif - setjobctl(mflag); -} - -/* - * Process shell options. The global variable argptr contains a pointer - * to the argument list; we advance it past the options. - * If cmdline is true, process the shell's argv; otherwise, process arguments - * to the set special builtin. - */ - -static void -options(int cmdline) -{ - char *kp, *p; - int val; - int c; - - if (cmdline) - minusc = NULL; - while ((p = *argptr) != NULL) { - argptr++; - if ((c = *p++) == '-') { - val = 1; - /* A "-" or "--" terminates options */ - if (p[0] == '\0') - goto end_options1; - if (p[0] == '-' && p[1] == '\0') - goto end_options2; - /** - * For the benefit of `#!' lines in shell scripts, - * treat a string of '-- *#.*' the same as '--'. - * This is needed so that a script starting with: - * #!/bin/sh -- # -*- perl -*- - * will continue to work after a change is made to - * kern/imgact_shell.c to NOT token-ize the options - * specified on a '#!' line. A bit of a kludge, - * but that trick is recommended in documentation - * for some scripting languages, and we might as - * well continue to support it. - */ - if (p[0] == '-') { - kp = p + 1; - while (*kp == ' ' || *kp == '\t') - kp++; - if (*kp == '#' || *kp == '\0') - goto end_options2; - } - } else if (c == '+') { - val = 0; - } else { - argptr--; - break; - } - while ((c = *p++) != '\0') { - if (c == 'c' && cmdline) { - char *q; - - q = *argptr++; - if (q == NULL || minusc != NULL) - error("Bad -c option"); - minusc = q; - } else if (c == 'o') { - minus_o(*argptr, val); - if (*argptr) - argptr++; - } else - setoption(c, val); - } - } - return; - - /* When processing `set', a single "-" means turn off -x and -v */ -end_options1: - if (!cmdline) { - xflag = vflag = 0; - return; - } - - /* - * When processing `set', a "--" means the remaining arguments - * replace the positional parameters in the active shell. If - * there are no remaining options, then all the positional - * parameters are cleared (equivalent to doing ``shift $#''). - */ -end_options2: - if (!cmdline) { - if (*argptr == NULL) - setparam(0, argptr); - return; - } - - /* - * At this point we are processing options given to 'sh' on a command - * line. If an end-of-options marker ("-" or "--") is followed by an - * arg of "#", then skip over all remaining arguments. Some scripting - * languages (e.g.: perl) document that /bin/sh will implement this - * behavior, and they recommend that users take advantage of it to - * solve certain issues that can come up when writing a perl script. - * Yes, this feature is in /bin/sh to help users write perl scripts. - */ - p = *argptr; - if (p != NULL && p[0] == '#' && p[1] == '\0') { - while (*argptr != NULL) - argptr++; - /* We need to keep the final argument */ - argptr--; - } -} - -static void -minus_o(char *name, int val) -{ - int i; - const unsigned char *on; - size_t len; - - if (name == NULL) { - if (val) { - /* "Pretty" output. */ - out1str("Current option settings\n"); - for (i = 0, on = optname; i < NOPTS; i++, on += *on + 1) - out1fmt("%-16.*s%s\n", *on, on + 1, - optval[i] ? "on" : "off"); - } else { - /* Output suitable for re-input to shell. */ - for (i = 0, on = optname; i < NOPTS; i++, on += *on + 1) - out1fmt("%s %co %.*s%s", - i % 6 == 0 ? "set" : "", - optval[i] ? '-' : '+', - *on, on + 1, - i % 6 == 5 || i == NOPTS - 1 ? "\n" : ""); - } - } else { - len = strlen(name); - for (i = 0, on = optname; i < NOPTS; i++, on += *on + 1) - if (*on == len && memcmp(on + 1, name, len) == 0) { - setoptionbyindex(i, val); - return; - } - error("Illegal option -o %s", name); - } -} - - -static void -setoptionbyindex(int idx, int val) -{ - if (&optval[idx] == &privileged && !val && privileged) { - if (setgid(getgid()) == -1) - error("setgid"); - if (setuid(getuid()) == -1) - error("setuid"); - } - optval[idx] = val; - if (val) { - /* #%$ hack for ksh semantics */ - if (&optval[idx] == &Vflag) - Eflag = 0; - else if (&optval[idx] == &Eflag) - Vflag = 0; - } -} - -static void -setoption(int flag, int val) -{ - int i; - - for (i = 0; i < NSHORTOPTS; i++) - if (optletter[i] == flag) { - setoptionbyindex(i, val); - return; - } - error("Illegal option -%c", flag); -} - - -/* - * Set the shell parameters. - */ - -static void -setparam(int argc, char **argv) -{ - char **newparam; - char **ap; - - ap = newparam = ckmalloc((argc + 1) * sizeof *ap); - while (*argv) { - *ap++ = savestr(*argv++); - } - *ap = NULL; - freeparam(&shellparam); - shellparam.malloc = 1; - shellparam.nparam = argc; - shellparam.p = newparam; - shellparam.optp = NULL; - shellparam.reset = 1; - shellparam.optnext = NULL; -} - - -/* - * Free the list of positional parameters. - */ - -void -freeparam(struct shparam *param) -{ - char **ap; - - if (param->malloc) { - for (ap = param->p ; *ap ; ap++) - ckfree(*ap); - ckfree(param->p); - } - if (param->optp) { - for (ap = param->optp ; *ap ; ap++) - ckfree(*ap); - ckfree(param->optp); - } -} - - - -/* - * The shift builtin command. - */ - -int -shiftcmd(int argc, char **argv) -{ - int i, n; - - n = 1; - if (argc > 1) - n = number(argv[1]); - if (n > shellparam.nparam) - return 1; - INTOFF; - shellparam.nparam -= n; - if (shellparam.malloc) - for (i = 0; i < n; i++) - ckfree(shellparam.p[i]); - memmove(shellparam.p, shellparam.p + n, - (shellparam.nparam + 1) * sizeof(shellparam.p[0])); - shellparam.reset = 1; - INTON; - return 0; -} - - - -/* - * The set builtin command. - */ - -int -setcmd(int argc, char **argv) -{ - if (argc == 1) - return showvarscmd(argc, argv); - INTOFF; - options(0); - optschanged(); - if (*argptr != NULL) { - setparam(argc - (argptr - argv), argptr); - } - INTON; - return 0; -} - - -void -getoptsreset(const char *value) -{ - while (*value == '0') - value++; - if (strcmp(value, "1") == 0) - shellparam.reset = 1; -} - -/* - * The getopts builtin. Shellparam.optnext points to the next argument - * to be processed. Shellparam.optptr points to the next character to - * be processed in the current argument. If shellparam.optnext is NULL, - * then it's the first time getopts has been called. - */ - -int -getoptscmd(int argc, char **argv) -{ - char **optbase = NULL, **ap; - int i; - - if (argc < 3) - error("usage: getopts optstring var [arg]"); - - if (shellparam.reset == 1) { - INTOFF; - if (shellparam.optp) { - for (ap = shellparam.optp ; *ap ; ap++) - ckfree(*ap); - ckfree(shellparam.optp); - shellparam.optp = NULL; - } - if (argc > 3) { - shellparam.optp = ckmalloc((argc - 2) * sizeof *ap); - memset(shellparam.optp, '\0', (argc - 2) * sizeof *ap); - for (i = 0; i < argc - 3; i++) - shellparam.optp[i] = savestr(argv[i + 3]); - } - INTON; - optbase = argc == 3 ? shellparam.p : shellparam.optp; - shellparam.optnext = optbase; - shellparam.optptr = NULL; - shellparam.reset = 0; - } else - optbase = shellparam.optp ? shellparam.optp : shellparam.p; - - return getopts(argv[1], argv[2], optbase, &shellparam.optnext, - &shellparam.optptr); -} - -static int -getopts(char *optstr, char *optvar, char **optfirst, char ***optnext, - char **optptr) -{ - char *p, *q; - char c = '?'; - int done = 0; - int ind = 0; - int err = 0; - char s[10]; - const char *newoptarg = NULL; - - if ((p = *optptr) == NULL || *p == '\0') { - /* Current word is done, advance */ - if (*optnext == NULL) - return 1; - p = **optnext; - if (p == NULL || *p != '-' || *++p == '\0') { -atend: - ind = *optnext - optfirst + 1; - *optnext = NULL; - p = NULL; - done = 1; - goto out; - } - (*optnext)++; - if (p[0] == '-' && p[1] == '\0') /* check for "--" */ - goto atend; - } - - c = *p++; - for (q = optstr; *q != c; ) { - if (*q == '\0') { - if (optstr[0] == ':') { - s[0] = c; - s[1] = '\0'; - newoptarg = s; - } - else - out2fmt_flush("Illegal option -%c\n", c); - c = '?'; - goto out; - } - if (*++q == ':') - q++; - } - - if (*++q == ':') { - if (*p == '\0' && (p = **optnext) == NULL) { - if (optstr[0] == ':') { - s[0] = c; - s[1] = '\0'; - newoptarg = s; - c = ':'; - } - else { - out2fmt_flush("No arg for -%c option\n", c); - c = '?'; - } - goto out; - } - - if (p == **optnext) - (*optnext)++; - newoptarg = p; - p = NULL; - } - -out: - if (*optnext != NULL) - ind = *optnext - optfirst + 1; - *optptr = p; - if (newoptarg != NULL) - err |= setvarsafe("OPTARG", newoptarg, 0); - else { - INTOFF; - err |= unsetvar("OPTARG"); - INTON; - } - fmtstr(s, sizeof(s), "%d", ind); - err |= setvarsafe("OPTIND", s, VNOFUNC); - s[0] = c; - s[1] = '\0'; - err |= setvarsafe(optvar, s, 0); - if (err) { - *optnext = NULL; - *optptr = NULL; - flushall(); - exraise(EXERROR); - } - return done; -} - -/* - * Standard option processing (a la getopt) for builtin routines. The - * only argument that is passed to nextopt is the option string; the - * other arguments are unnecessary. It returns the option, or '\0' on - * end of input. - */ - -int -nextopt(const char *optstring) -{ - char *p; - const char *q; - char c; - - if ((p = nextopt_optptr) == NULL || *p == '\0') { - p = *argptr; - if (p == NULL || *p != '-' || *++p == '\0') - return '\0'; - argptr++; - if (p[0] == '-' && p[1] == '\0') /* check for "--" */ - return '\0'; - } - c = *p++; - for (q = optstring ; *q != c ; ) { - if (*q == '\0') - error("Illegal option -%c", c); - if (*++q == ':') - q++; - } - if (*++q == ':') { - if (*p == '\0' && (p = *argptr++) == NULL) - error("No arg for -%c option", c); - shoptarg = p; - p = NULL; - } - nextopt_optptr = p; - return c; -} diff --git a/bin/1sh/options.h b/bin/1sh/options.h deleted file mode 100644 index 007ea312..00000000 --- a/bin/1sh/options.h +++ /dev/null @@ -1,117 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-3-Clause - * - * Copyright (c) 1991, 1993 - * The Regents of the University of California. All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * Kenneth Almquist. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)options.h 8.2 (Berkeley) 5/4/95 - * $FreeBSD: releng/12.1/bin/sh/options.h 345487 2019-03-24 22:10:26Z jilles $ - */ - -struct shparam { - int nparam; /* # of positional parameters (without $0) */ - unsigned char malloc; /* if parameter list dynamically allocated */ - unsigned char reset; /* if getopts has been reset */ - char **p; /* parameter list */ - char **optp; /* parameter list for getopts */ - char **optnext; /* next parameter to be processed by getopts */ - char *optptr; /* used by getopts */ -}; - - - -#define eflag optval[0] -#define fflag optval[1] -#define Iflag optval[2] -#define iflag optval[3] -#define mflag optval[4] -#define nflag optval[5] -#define sflag optval[6] -#define xflag optval[7] -#define vflag optval[8] -#define Vflag optval[9] -#define Eflag optval[10] -#define Cflag optval[11] -#define aflag optval[12] -#define bflag optval[13] -#define uflag optval[14] -#define privileged optval[15] -#define Tflag optval[16] -#define Pflag optval[17] -#define hflag optval[18] -#define nologflag optval[19] -#define pipefailflag optval[20] - -#define NSHORTOPTS 19 -#define NOPTS 21 - -extern char optval[NOPTS]; -extern const char optletter[NSHORTOPTS]; -#ifdef DEFINE_OPTIONS -char optval[NOPTS]; -const char optletter[NSHORTOPTS] = "efIimnsxvVECabupTPh"; -static const unsigned char optname[] = - "\007errexit" - "\006noglob" - "\011ignoreeof" - "\013interactive" - "\007monitor" - "\006noexec" - "\005stdin" - "\006xtrace" - "\007verbose" - "\002vi" - "\005emacs" - "\011noclobber" - "\011allexport" - "\006notify" - "\007nounset" - "\012privileged" - "\012trapsasync" - "\010physical" - "\010trackall" - "\005nolog" - "\010pipefail" -; -#endif - - -extern char *minusc; /* argument to -c option */ -extern char *arg0; /* $0 */ -extern struct shparam shellparam; /* $@ */ -extern char **argptr; /* argument list for builtin commands */ -extern char *shoptarg; /* set by nextopt */ -extern char *nextopt_optptr; /* used by nextopt */ - -void procargs(int, char **); -void optschanged(void); -void freeparam(struct shparam *); -int nextopt(const char *); -void getoptsreset(const char *); diff --git a/bin/1sh/output.c b/bin/1sh/output.c deleted file mode 100644 index af93ec6d..00000000 --- a/bin/1sh/output.c +++ /dev/null @@ -1,376 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-3-Clause - * - * Copyright (c) 1991, 1993 - * The Regents of the University of California. All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * Kenneth Almquist. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#ifndef lint -#if 0 -static char sccsid[] = "@(#)output.c 8.2 (Berkeley) 5/4/95"; -#endif -#endif /* not lint */ -#include <sys/cdefs.h> -/* $FreeBSD: releng/12.1/bin/sh/output.c 345613 2019-03-27 21:53:44Z jilles $ */ - -/* - * Shell output routines. We use our own output routines because: - * When a builtin command is interrupted we have to discard - * any pending output. - * When a builtin command appears in back quotes, we want to - * save the output of the command in a region obtained - * via malloc, rather than doing a fork and reading the - * output of the command via a pipe. - */ - -#include <stdio.h> /* defines BUFSIZ */ -#include <string.h> -#include <stdarg.h> -#include <errno.h> -#include <unistd.h> -#include <stdlib.h> -#include <wchar.h> -#include <wctype.h> - -#include "shell.h" -#include "syntax.h" -#include "output.h" -#include "memalloc.h" -#include "error.h" -#include "var.h" - - -#define OUTBUFSIZ BUFSIZ -#define MEM_OUT -2 /* output to dynamically allocated memory */ -#define OUTPUT_ERR 01 /* error occurred on output */ - -static int doformat_wr(void *, const char *, int); - -struct output output = {NULL, NULL, NULL, OUTBUFSIZ, 1, 0}; -struct output errout = {NULL, NULL, NULL, 256, 2, 0}; -struct output memout = {NULL, NULL, NULL, 64, MEM_OUT, 0}; -struct output *out1 = &output; -struct output *out2 = &errout; - -void -outcslow(int c, struct output *file) -{ - outc(c, file); -} - -void -out1str(const char *p) -{ - outstr(p, out1); -} - -void -out1qstr(const char *p) -{ - outqstr(p, out1); -} - -void -out2str(const char *p) -{ - outstr(p, out2); -} - -void -out2qstr(const char *p) -{ - outqstr(p, out2); -} - -void -outstr(const char *p, struct output *file) -{ - outbin(p, strlen(p), file); -} - -static void -byteseq(int ch, struct output *file) -{ - char seq[4]; - - seq[0] = '\\'; - seq[1] = (ch >> 6 & 0x3) + '0'; - seq[2] = (ch >> 3 & 0x7) + '0'; - seq[3] = (ch & 0x7) + '0'; - outbin(seq, 4, file); -} - -static void -outdqstr(const char *p, struct output *file) -{ - const char *end; - mbstate_t mbs; - size_t clen; - wchar_t wc; - - memset(&mbs, '\0', sizeof(mbs)); - end = p + strlen(p); - outstr("$'", file); - while ((clen = mbrtowc(&wc, p, end - p + 1, &mbs)) != 0) { - if (clen == (size_t)-2) { - while (p < end) - byteseq(*p++, file); - break; - } - if (clen == (size_t)-1) { - memset(&mbs, '\0', sizeof(mbs)); - byteseq(*p++, file); - continue; - } - if (wc == L'\n') - outcslow('\n', file), p++; - else if (wc == L'\r') - outstr("\\r", file), p++; - else if (wc == L'\t') - outstr("\\t", file), p++; - else if (!iswprint(wc)) { - for (; clen > 0; clen--) - byteseq(*p++, file); - } else { - if (wc == L'\'' || wc == L'\\') - outcslow('\\', file); - outbin(p, clen, file); - p += clen; - } - } - outcslow('\'', file); -} - -/* Like outstr(), but quote for re-input into the shell. */ -void -outqstr(const char *p, struct output *file) -{ - int i; - - if (p[0] == '\0') { - outstr("''", file); - return; - } - for (i = 0; p[i] != '\0'; i++) { - if ((p[i] > '\0' && p[i] < ' ' && p[i] != '\n') || - (p[i] & 0x80) != 0 || p[i] == '\'') { - outdqstr(p, file); - return; - } - } - - if (p[strcspn(p, "|&;<>()$`\\\" \n*?[~#=")] == '\0' || - strcmp(p, "[") == 0) { - outstr(p, file); - return; - } - - outcslow('\'', file); - outstr(p, file); - outcslow('\'', file); -} - -void -outbin(const void *data, size_t len, struct output *file) -{ - const char *p; - - p = data; - while (len-- > 0) - outc(*p++, file); -} - -void -emptyoutbuf(struct output *dest) -{ - int offset, newsize; - - if (dest->buf == NULL) { - INTOFF; - dest->buf = ckmalloc(dest->bufsize); - dest->nextc = dest->buf; - dest->bufend = dest->buf + dest->bufsize; - INTON; - } else if (dest->fd == MEM_OUT) { - offset = dest->nextc - dest->buf; - newsize = dest->bufsize << 1; - INTOFF; - dest->buf = ckrealloc(dest->buf, newsize); - dest->bufsize = newsize; - dest->bufend = dest->buf + newsize; - dest->nextc = dest->buf + offset; - INTON; - } else { - flushout(dest); - } -} - - -void -flushall(void) -{ - flushout(&output); - flushout(&errout); -} - - -void -flushout(struct output *dest) -{ - - if (dest->buf == NULL || dest->nextc == dest->buf || dest->fd < 0) - return; - if (xwrite(dest->fd, dest->buf, dest->nextc - dest->buf) < 0) - dest->flags |= OUTPUT_ERR; - dest->nextc = dest->buf; -} - - -void -freestdout(void) -{ - output.nextc = output.buf; -} - - -int -outiserror(struct output *file) -{ - return (file->flags & OUTPUT_ERR); -} - - -void -outclearerror(struct output *file) -{ - file->flags &= ~OUTPUT_ERR; -} - - -void -outfmt(struct output *file, const char *fmt, ...) -{ - va_list ap; - - va_start(ap, fmt); - doformat(file, fmt, ap); - va_end(ap); -} - - -void -out1fmt(const char *fmt, ...) -{ - va_list ap; - - va_start(ap, fmt); - doformat(out1, fmt, ap); - va_end(ap); -} - -void -out2fmt_flush(const char *fmt, ...) -{ - va_list ap; - - va_start(ap, fmt); - doformat(out2, fmt, ap); - va_end(ap); - flushout(out2); -} - -void -fmtstr(char *outbuf, int length, const char *fmt, ...) -{ - va_list ap; - - INTOFF; - va_start(ap, fmt); - vsnprintf(outbuf, length, fmt, ap); - va_end(ap); - INTON; -} - -static int -doformat_wr(void *cookie, const char *buf, int len) -{ - struct output *o; - - o = (struct output *)cookie; - outbin(buf, len, o); - - return (len); -} - -void -doformat(struct output *dest, const char *f, va_list ap) -{ - FILE *fp; - - if ((fp = fwopen(dest, doformat_wr)) != NULL) { - vfprintf(fp, f, ap); - fclose(fp); - } -} - -FILE * -out1fp(void) -{ - return fwopen(out1, doformat_wr); -} - -/* - * Version of write which resumes after a signal is caught. - */ - -int -xwrite(int fd, const char *buf, int nbytes) -{ - int ntry; - int i; - int n; - - n = nbytes; - ntry = 0; - for (;;) { - i = write(fd, buf, n); - if (i > 0) { - if ((n -= i) <= 0) - return nbytes; - buf += i; - ntry = 0; - } else if (i == 0) { - if (++ntry > 10) - return nbytes - n; - } else if (errno != EINTR) { - return -1; - } - } -} diff --git a/bin/1sh/output.h b/bin/1sh/output.h deleted file mode 100644 index 8d5ded6f..00000000 --- a/bin/1sh/output.h +++ /dev/null @@ -1,87 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-3-Clause - * - * Copyright (c) 1991, 1993 - * The Regents of the University of California. All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * Kenneth Almquist. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)output.h 8.2 (Berkeley) 5/4/95 - * $FreeBSD: releng/12.1/bin/sh/output.h 345613 2019-03-27 21:53:44Z jilles $ - */ - -#ifndef OUTPUT_INCL - -#include <stdarg.h> -#include <stddef.h> -#include <stdio.h> - -struct output { - char *nextc; - char *bufend; - char *buf; - int bufsize; - short fd; - short flags; -}; - -extern struct output output; /* to fd 1 */ -extern struct output errout; /* to fd 2 */ -extern struct output memout; -extern struct output *out1; /* &memout if backquote, otherwise &output */ -extern struct output *out2; /* &memout if backquote with 2>&1, otherwise - &errout */ - -void outcslow(int, struct output *); -void out1str(const char *); -void out1qstr(const char *); -void out2str(const char *); -void out2qstr(const char *); -void outstr(const char *, struct output *); -void outqstr(const char *, struct output *); -void outbin(const void *, size_t, struct output *); -void emptyoutbuf(struct output *); -void flushall(void); -void flushout(struct output *); -void freestdout(void); -int outiserror(struct output *); -void outclearerror(struct output *); -void outfmt(struct output *, const char *, ...) __attribute__((format(printf, 2, 3))); -void out1fmt(const char *, ...) __attribute__((format(printf, 1, 2))); -void out2fmt_flush(const char *, ...) __attribute__((format(printf, 1, 2))); -void fmtstr(char *, int, const char *, ...) __attribute__((format(printf, 3, 4))); -void doformat(struct output *, const char *, va_list) __attribute__((format(printf, 2, 0))); -FILE *out1fp(void); -int xwrite(int, const char *, int); - -#define outc(c, file) ((file)->nextc == (file)->bufend ? (emptyoutbuf(file), *(file)->nextc++ = (c)) : (*(file)->nextc++ = (c))) -#define out1c(c) outc(c, out1); -#define out2c(c) outcslow(c, out2); - -#define OUTPUT_INCL -#endif diff --git a/bin/1sh/parser.c b/bin/1sh/parser.c deleted file mode 100644 index b2f761c8..00000000 --- a/bin/1sh/parser.c +++ /dev/null @@ -1,2182 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-3-Clause - * - * Copyright (c) 1991, 1993 - * The Regents of the University of California. All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * Kenneth Almquist. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#ifndef lint -#if 0 -static char sccsid[] = "@(#)parser.c 8.7 (Berkeley) 5/16/95"; -#endif -#endif /* not lint */ -#include <sys/cdefs.h> -/* $FreeBSD: releng/12.1/bin/sh/parser.c 334008 2018-05-21 21:52:48Z jilles $ */ - -#include <stdlib.h> -#include <unistd.h> -#include <stdio.h> - -#include "shell.h" -#include "parser.h" -#include "nodes.h" -#include "expand.h" /* defines rmescapes() */ -#include "syntax.h" -#include "options.h" -#include "input.h" -#include "output.h" -#include "var.h" -#include "error.h" -#include "memalloc.h" -#include "mystring.h" -#include "alias.h" -#include "show.h" -#include "eval.h" -#include "exec.h" /* to check for special builtins */ -#ifndef NO_HISTORY -#include "myhistedit.h" -#endif - -/* - * Shell command parser. - */ - -#define PROMPTLEN 128 - -/* values of checkkwd variable */ -#define CHKALIAS 0x1 -#define CHKKWD 0x2 -#define CHKNL 0x4 - -/* values returned by readtoken */ -#include "token.h" - - - -struct heredoc { - struct heredoc *next; /* next here document in list */ - union node *here; /* redirection node */ - char *eofmark; /* string indicating end of input */ - int striptabs; /* if set, strip leading tabs */ -}; - -struct parser_temp { - struct parser_temp *next; - void *data; -}; - - -static struct heredoc *heredoclist; /* list of here documents to read */ -static int doprompt; /* if set, prompt the user */ -static int needprompt; /* true if interactive and at start of line */ -static int lasttoken; /* last token read */ -static int tokpushback; /* last token pushed back */ -static char *wordtext; /* text of last word returned by readtoken */ -static int checkkwd; -static struct nodelist *backquotelist; -static union node *redirnode; -static struct heredoc *heredoc; -static int quoteflag; /* set if (part of) last token was quoted */ -static int startlinno; /* line # where last token started */ -static int funclinno; /* line # where the current function started */ -static struct parser_temp *parser_temp; - -#define NOEOFMARK ((const char *)&heredoclist) - - -static union node *list(int); -static union node *andor(void); -static union node *pipeline(void); -static union node *command(void); -static union node *simplecmd(union node **, union node *); -static union node *makename(void); -static union node *makebinary(int type, union node *n1, union node *n2); -static void parsefname(void); -static void parseheredoc(void); -static int peektoken(void); -static int readtoken(void); -static int xxreadtoken(void); -static int readtoken1(int, const char *, const char *, int); -static int noexpand(char *); -static void consumetoken(int); -static void synexpect(int) __attribute__((noreturn)); -static void synerror(const char *) __attribute__((noreturn)); -static void setprompt(int); -static char *expandprompt(const char *); -static int pgetc_linecont(void); - - -static void * -parser_temp_alloc(size_t len) -{ - struct parser_temp *t; - - INTOFF; - t = ckmalloc(sizeof(*t)); - t->data = NULL; - t->next = parser_temp; - parser_temp = t; - t->data = ckmalloc(len); - INTON; - return t->data; -} - - -static void * -parser_temp_realloc(void *ptr, size_t len) -{ - struct parser_temp *t; - - INTOFF; - t = parser_temp; - if (ptr != t->data) - error("bug: parser_temp_realloc misused"); - t->data = ckrealloc(t->data, len); - INTON; - return t->data; -} - - -static void -parser_temp_free_upto(void *ptr) -{ - struct parser_temp *t; - int done = 0; - - INTOFF; - while (parser_temp != NULL && !done) { - t = parser_temp; - parser_temp = t->next; - done = t->data == ptr; - ckfree(t->data); - ckfree(t); - } - INTON; - if (!done) - error("bug: parser_temp_free_upto misused"); -} - - -static void -parser_temp_free_all(void) -{ - struct parser_temp *t; - - INTOFF; - while (parser_temp != NULL) { - t = parser_temp; - parser_temp = t->next; - ckfree(t->data); - ckfree(t); - } - INTON; -} - - -/* - * Read and parse a command. Returns NEOF on end of file. (NULL is a - * valid parse tree indicating a blank line.) - */ - -union node * -parsecmd(int interact) -{ - int t; - - /* This assumes the parser is not re-entered, - * which could happen if we add command substitution on PS1/PS2. - */ - parser_temp_free_all(); - heredoclist = NULL; - - tokpushback = 0; - checkkwd = 0; - doprompt = interact; - if (doprompt) - setprompt(1); - else - setprompt(0); - needprompt = 0; - t = readtoken(); - if (t == TEOF) - return NEOF; - if (t == TNL) - return NULL; - tokpushback++; - return list(1); -} - - -/* - * Read and parse words for wordexp. - * Returns a list of NARG nodes; NULL if there are no words. - */ -union node * -parsewordexp(void) -{ - union node *n, *first = NULL, **pnext; - int t; - - /* This assumes the parser is not re-entered, - * which could happen if we add command substitution on PS1/PS2. - */ - parser_temp_free_all(); - heredoclist = NULL; - - tokpushback = 0; - checkkwd = 0; - doprompt = 0; - setprompt(0); - needprompt = 0; - pnext = &first; - while ((t = readtoken()) != TEOF) { - if (t != TWORD) - synexpect(TWORD); - n = makename(); - *pnext = n; - pnext = &n->narg.next; - } - return first; -} - - -static union node * -list(int nlflag) -{ - union node *ntop, *n1, *n2, *n3; - int tok; - - checkkwd = CHKNL | CHKKWD | CHKALIAS; - if (!nlflag && tokendlist[peektoken()]) - return NULL; - ntop = n1 = NULL; - for (;;) { - n2 = andor(); - tok = readtoken(); - if (tok == TBACKGND) { - if (n2 != NULL && n2->type == NPIPE) { - n2->npipe.backgnd = 1; - } else if (n2 != NULL && n2->type == NREDIR) { - n2->type = NBACKGND; - } else { - n3 = (union node *)stalloc(sizeof (struct nredir)); - n3->type = NBACKGND; - n3->nredir.n = n2; - n3->nredir.redirect = NULL; - n2 = n3; - } - } - if (ntop == NULL) - ntop = n2; - else if (n1 == NULL) { - n1 = makebinary(NSEMI, ntop, n2); - ntop = n1; - } - else { - n3 = makebinary(NSEMI, n1->nbinary.ch2, n2); - n1->nbinary.ch2 = n3; - n1 = n3; - } - switch (tok) { - case TBACKGND: - case TSEMI: - tok = readtoken(); - /* FALLTHROUGH */ - case TNL: - if (tok == TNL) { - parseheredoc(); - if (nlflag) - return ntop; - } else if (tok == TEOF && nlflag) { - parseheredoc(); - return ntop; - } else { - tokpushback++; - } - checkkwd = CHKNL | CHKKWD | CHKALIAS; - if (!nlflag && tokendlist[peektoken()]) - return ntop; - break; - case TEOF: - if (heredoclist) - parseheredoc(); - else - pungetc(); /* push back EOF on input */ - return ntop; - default: - if (nlflag) - synexpect(-1); - tokpushback++; - return ntop; - } - } -} - - - -static union node * -andor(void) -{ - union node *n; - int t; - - n = pipeline(); - for (;;) { - if ((t = readtoken()) == TAND) { - t = NAND; - } else if (t == TOR) { - t = NOR; - } else { - tokpushback++; - return n; - } - n = makebinary(t, n, pipeline()); - } -} - - - -static union node * -pipeline(void) -{ - union node *n1, *n2, *pipenode; - struct nodelist *lp, *prev; - int negate, t; - - negate = 0; - checkkwd = CHKNL | CHKKWD | CHKALIAS; - TRACE(("pipeline: entered\n")); - while (readtoken() == TNOT) - negate = !negate; - tokpushback++; - n1 = command(); - if (readtoken() == TPIPE) { - pipenode = (union node *)stalloc(sizeof (struct npipe)); - pipenode->type = NPIPE; - pipenode->npipe.backgnd = 0; - lp = (struct nodelist *)stalloc(sizeof (struct nodelist)); - pipenode->npipe.cmdlist = lp; - lp->n = n1; - do { - prev = lp; - lp = (struct nodelist *)stalloc(sizeof (struct nodelist)); - checkkwd = CHKNL | CHKKWD | CHKALIAS; - t = readtoken(); - tokpushback++; - if (t == TNOT) - lp->n = pipeline(); - else - lp->n = command(); - prev->next = lp; - } while (readtoken() == TPIPE); - lp->next = NULL; - n1 = pipenode; - } - tokpushback++; - if (negate) { - n2 = (union node *)stalloc(sizeof (struct nnot)); - n2->type = NNOT; - n2->nnot.com = n1; - return n2; - } else - return n1; -} - - - -static union node * -command(void) -{ - union node *n1, *n2; - union node *ap, **app; - union node *cp, **cpp; - union node *redir, **rpp; - int t; - int is_subshell; - - checkkwd = CHKNL | CHKKWD | CHKALIAS; - is_subshell = 0; - redir = NULL; - n1 = NULL; - rpp = &redir; - - /* Check for redirection which may precede command */ - while (readtoken() == TREDIR) { - *rpp = n2 = redirnode; - rpp = &n2->nfile.next; - parsefname(); - } - tokpushback++; - - switch (readtoken()) { - case TIF: - n1 = (union node *)stalloc(sizeof (struct nif)); - n1->type = NIF; - if ((n1->nif.test = list(0)) == NULL) - synexpect(-1); - consumetoken(TTHEN); - n1->nif.ifpart = list(0); - n2 = n1; - while (readtoken() == TELIF) { - n2->nif.elsepart = (union node *)stalloc(sizeof (struct nif)); - n2 = n2->nif.elsepart; - n2->type = NIF; - if ((n2->nif.test = list(0)) == NULL) - synexpect(-1); - consumetoken(TTHEN); - n2->nif.ifpart = list(0); - } - if (lasttoken == TELSE) - n2->nif.elsepart = list(0); - else { - n2->nif.elsepart = NULL; - tokpushback++; - } - consumetoken(TFI); - checkkwd = CHKKWD | CHKALIAS; - break; - case TWHILE: - case TUNTIL: - t = lasttoken; - if ((n1 = list(0)) == NULL) - synexpect(-1); - consumetoken(TDO); - n1 = makebinary((t == TWHILE)? NWHILE : NUNTIL, n1, list(0)); - consumetoken(TDONE); - checkkwd = CHKKWD | CHKALIAS; - break; - case TFOR: - if (readtoken() != TWORD || quoteflag || ! goodname(wordtext)) - synerror("Bad for loop variable"); - n1 = (union node *)stalloc(sizeof (struct nfor)); - n1->type = NFOR; - n1->nfor.var = wordtext; - while (readtoken() == TNL) - ; - if (lasttoken == TWORD && ! quoteflag && equal(wordtext, "in")) { - app = ≈ - while (readtoken() == TWORD) { - n2 = makename(); - *app = n2; - app = &n2->narg.next; - } - *app = NULL; - n1->nfor.args = ap; - if (lasttoken != TNL && lasttoken != TSEMI) - synexpect(-1); - } else { - static char argvars[5] = { - CTLVAR, VSNORMAL|VSQUOTE, '@', '=', '\0' - }; - n2 = (union node *)stalloc(sizeof (struct narg)); - n2->type = NARG; - n2->narg.text = argvars; - n2->narg.backquote = NULL; - n2->narg.next = NULL; - n1->nfor.args = n2; - /* - * Newline or semicolon here is optional (but note - * that the original Bourne shell only allowed NL). - */ - if (lasttoken != TNL && lasttoken != TSEMI) - tokpushback++; - } - checkkwd = CHKNL | CHKKWD | CHKALIAS; - if ((t = readtoken()) == TDO) - t = TDONE; - else if (t == TBEGIN) - t = TEND; - else - synexpect(-1); - n1->nfor.body = list(0); - consumetoken(t); - checkkwd = CHKKWD | CHKALIAS; - break; - case TCASE: - n1 = (union node *)stalloc(sizeof (struct ncase)); - n1->type = NCASE; - consumetoken(TWORD); - n1->ncase.expr = makename(); - while (readtoken() == TNL); - if (lasttoken != TWORD || ! equal(wordtext, "in")) - synerror("expecting \"in\""); - cpp = &n1->ncase.cases; - checkkwd = CHKNL | CHKKWD, readtoken(); - while (lasttoken != TESAC) { - *cpp = cp = (union node *)stalloc(sizeof (struct nclist)); - cp->type = NCLIST; - app = &cp->nclist.pattern; - if (lasttoken == TLP) - readtoken(); - for (;;) { - *app = ap = makename(); - checkkwd = CHKNL | CHKKWD; - if (readtoken() != TPIPE) - break; - app = &ap->narg.next; - readtoken(); - } - ap->narg.next = NULL; - if (lasttoken != TRP) - synexpect(TRP); - cp->nclist.body = list(0); - - checkkwd = CHKNL | CHKKWD | CHKALIAS; - if ((t = readtoken()) != TESAC) { - if (t == TENDCASE) - ; - else if (t == TFALLTHRU) - cp->type = NCLISTFALLTHRU; - else - synexpect(TENDCASE); - checkkwd = CHKNL | CHKKWD, readtoken(); - } - cpp = &cp->nclist.next; - } - *cpp = NULL; - checkkwd = CHKKWD | CHKALIAS; - break; - case TLP: - n1 = (union node *)stalloc(sizeof (struct nredir)); - n1->type = NSUBSHELL; - n1->nredir.n = list(0); - n1->nredir.redirect = NULL; - consumetoken(TRP); - checkkwd = CHKKWD | CHKALIAS; - is_subshell = 1; - break; - case TBEGIN: - n1 = list(0); - consumetoken(TEND); - checkkwd = CHKKWD | CHKALIAS; - break; - /* A simple command must have at least one redirection or word. */ - case TBACKGND: - case TSEMI: - case TAND: - case TOR: - case TPIPE: - case TENDCASE: - case TFALLTHRU: - case TEOF: - case TNL: - case TRP: - if (!redir) - synexpect(-1); - case TWORD: - tokpushback++; - n1 = simplecmd(rpp, redir); - return n1; - default: - synexpect(-1); - } - - /* Now check for redirection which may follow command */ - while (readtoken() == TREDIR) { - *rpp = n2 = redirnode; - rpp = &n2->nfile.next; - parsefname(); - } - tokpushback++; - *rpp = NULL; - if (redir) { - if (!is_subshell) { - n2 = (union node *)stalloc(sizeof (struct nredir)); - n2->type = NREDIR; - n2->nredir.n = n1; - n1 = n2; - } - n1->nredir.redirect = redir; - } - - return n1; -} - - -static union node * -simplecmd(union node **rpp, union node *redir) -{ - union node *args, **app; - union node **orig_rpp = rpp; - union node *n = NULL; - int special; - int savecheckkwd; - - /* If we don't have any redirections already, then we must reset */ - /* rpp to be the address of the local redir variable. */ - if (redir == NULL) - rpp = &redir; - - args = NULL; - app = &args; - /* - * We save the incoming value, because we need this for shell - * functions. There can not be a redirect or an argument between - * the function name and the open parenthesis. - */ - orig_rpp = rpp; - - savecheckkwd = CHKALIAS; - - for (;;) { - checkkwd = savecheckkwd; - if (readtoken() == TWORD) { - n = makename(); - *app = n; - app = &n->narg.next; - if (savecheckkwd != 0 && !isassignment(wordtext)) - savecheckkwd = 0; - } else if (lasttoken == TREDIR) { - *rpp = n = redirnode; - rpp = &n->nfile.next; - parsefname(); /* read name of redirection file */ - } else if (lasttoken == TLP && app == &args->narg.next - && rpp == orig_rpp) { - /* We have a function */ - consumetoken(TRP); - funclinno = plinno; - /* - * - Require plain text. - * - Functions with '/' cannot be called. - * - Reject name=(). - * - Reject ksh extended glob patterns. - */ - if (!noexpand(n->narg.text) || quoteflag || - strchr(n->narg.text, '/') || - strchr("!%*+-=?@}~", - n->narg.text[strlen(n->narg.text) - 1])) - synerror("Bad function name"); - rmescapes(n->narg.text); - if (find_builtin(n->narg.text, &special) >= 0 && - special) - synerror("Cannot override a special builtin with a function"); - n->type = NDEFUN; - n->narg.next = command(); - funclinno = 0; - return n; - } else { - tokpushback++; - break; - } - } - *app = NULL; - *rpp = NULL; - n = (union node *)stalloc(sizeof (struct ncmd)); - n->type = NCMD; - n->ncmd.args = args; - n->ncmd.redirect = redir; - return n; -} - -static union node * -makename(void) -{ - union node *n; - - n = (union node *)stalloc(sizeof (struct narg)); - n->type = NARG; - n->narg.next = NULL; - n->narg.text = wordtext; - n->narg.backquote = backquotelist; - return n; -} - -static union node * -makebinary(int type, union node *n1, union node *n2) -{ - union node *n; - - n = (union node *)stalloc(sizeof (struct nbinary)); - n->type = type; - n->nbinary.ch1 = n1; - n->nbinary.ch2 = n2; - return (n); -} - -void -forcealias(void) -{ - checkkwd |= CHKALIAS; -} - -void -fixredir(union node *n, const char *text, int err) -{ - TRACE(("Fix redir %s %d\n", text, err)); - if (!err) - n->ndup.vname = NULL; - - if (is_digit(text[0]) && text[1] == '\0') - n->ndup.dupfd = digit_val(text[0]); - else if (text[0] == '-' && text[1] == '\0') - n->ndup.dupfd = -1; - else { - - if (err) - synerror("Bad fd number"); - else - n->ndup.vname = makename(); - } -} - - -static void -parsefname(void) -{ - union node *n = redirnode; - - consumetoken(TWORD); - if (n->type == NHERE) { - struct heredoc *here = heredoc; - struct heredoc *p; - - if (quoteflag == 0) - n->type = NXHERE; - TRACE(("Here document %d\n", n->type)); - if (here->striptabs) { - while (*wordtext == '\t') - wordtext++; - } - if (! noexpand(wordtext)) - synerror("Illegal eof marker for << redirection"); - rmescapes(wordtext); - here->eofmark = wordtext; - here->next = NULL; - if (heredoclist == NULL) - heredoclist = here; - else { - for (p = heredoclist ; p->next ; p = p->next); - p->next = here; - } - } else if (n->type == NTOFD || n->type == NFROMFD) { - fixredir(n, wordtext, 0); - } else { - n->nfile.fname = makename(); - } -} - - -/* - * Input any here documents. - */ - -static void -parseheredoc(void) -{ - struct heredoc *here; - union node *n; - - while (heredoclist) { - here = heredoclist; - heredoclist = here->next; - if (needprompt) { - setprompt(2); - needprompt = 0; - } - readtoken1(pgetc(), here->here->type == NHERE? SQSYNTAX : DQSYNTAX, - here->eofmark, here->striptabs); - n = makename(); - here->here->nhere.doc = n; - } -} - -static int -peektoken(void) -{ - int t; - - t = readtoken(); - tokpushback++; - return (t); -} - -static int -readtoken(void) -{ - int t; - struct alias *ap; -#ifdef DEBUG - int alreadyseen = tokpushback; -#endif - - top: - t = xxreadtoken(); - - /* - * eat newlines - */ - if (checkkwd & CHKNL) { - while (t == TNL) { - parseheredoc(); - t = xxreadtoken(); - } - } - - /* - * check for keywords and aliases - */ - if (t == TWORD && !quoteflag) - { - const char * const *pp; - - if (checkkwd & CHKKWD) - for (pp = parsekwd; *pp; pp++) { - if (**pp == *wordtext && equal(*pp, wordtext)) - { - lasttoken = t = pp - parsekwd + KWDOFFSET; - TRACE(("keyword %s recognized\n", tokname[t])); - goto out; - } - } - if (checkkwd & CHKALIAS && - (ap = lookupalias(wordtext, 1)) != NULL) { - pushstring(ap->val, strlen(ap->val), ap); - goto top; - } - } -out: - if (t != TNOT) - checkkwd = 0; - -#ifdef DEBUG - if (!alreadyseen) - TRACE(("token %s %s\n", tokname[t], t == TWORD ? wordtext : "")); - else - TRACE(("reread token %s %s\n", tokname[t], t == TWORD ? wordtext : "")); -#endif - return (t); -} - - -/* - * Read the next input token. - * If the token is a word, we set backquotelist to the list of cmds in - * backquotes. We set quoteflag to true if any part of the word was - * quoted. - * If the token is TREDIR, then we set redirnode to a structure containing - * the redirection. - * In all cases, the variable startlinno is set to the number of the line - * on which the token starts. - * - * [Change comment: here documents and internal procedures] - * [Readtoken shouldn't have any arguments. Perhaps we should make the - * word parsing code into a separate routine. In this case, readtoken - * doesn't need to have any internal procedures, but parseword does. - * We could also make parseoperator in essence the main routine, and - * have parseword (readtoken1?) handle both words and redirection.] - */ - -#define RETURN(token) return lasttoken = token - -static int -xxreadtoken(void) -{ - int c; - - if (tokpushback) { - tokpushback = 0; - return lasttoken; - } - if (needprompt) { - setprompt(2); - needprompt = 0; - } - startlinno = plinno; - for (;;) { /* until token or start of word found */ - c = pgetc_macro(); - switch (c) { - case ' ': case '\t': - continue; - case '#': - while ((c = pgetc()) != '\n' && c != PEOF); - pungetc(); - continue; - case '\\': - if (pgetc() == '\n') { - startlinno = ++plinno; - if (doprompt) - setprompt(2); - else - setprompt(0); - continue; - } - pungetc(); - /* FALLTHROUGH */ - default: - return readtoken1(c, BASESYNTAX, (char *)NULL, 0); - case '\n': - plinno++; - needprompt = doprompt; - RETURN(TNL); - case PEOF: - RETURN(TEOF); - case '&': - if (pgetc_linecont() == '&') - RETURN(TAND); - pungetc(); - RETURN(TBACKGND); - case '|': - if (pgetc_linecont() == '|') - RETURN(TOR); - pungetc(); - RETURN(TPIPE); - case ';': - c = pgetc_linecont(); - if (c == ';') - RETURN(TENDCASE); - else if (c == '&') - RETURN(TFALLTHRU); - pungetc(); - RETURN(TSEMI); - case '(': - RETURN(TLP); - case ')': - RETURN(TRP); - } - } -#undef RETURN -} - - -#define MAXNEST_static 8 -struct tokenstate -{ - const char *syntax; /* *SYNTAX */ - int parenlevel; /* levels of parentheses in arithmetic */ - enum tokenstate_category - { - TSTATE_TOP, - TSTATE_VAR_OLD, /* ${var+-=?}, inherits dquotes */ - TSTATE_VAR_NEW, /* other ${var...}, own dquote state */ - TSTATE_ARITH - } category; -}; - - -/* - * Check to see whether we are at the end of the here document. When this - * is called, c is set to the first character of the next input line. If - * we are at the end of the here document, this routine sets the c to PEOF. - * The new value of c is returned. - */ - -static int -checkend(int c, const char *eofmark, int striptabs) -{ - if (striptabs) { - while (c == '\t') - c = pgetc(); - } - if (c == *eofmark) { - int c2; - const char *q; - - for (q = eofmark + 1; c2 = pgetc(), *q != '\0' && c2 == *q; q++) - ; - if ((c2 == PEOF || c2 == '\n') && *q == '\0') { - c = PEOF; - if (c2 == '\n') { - plinno++; - needprompt = doprompt; - } - } else { - pungetc(); - pushstring(eofmark + 1, q - (eofmark + 1), NULL); - } - } else if (c == '\n' && *eofmark == '\0') { - c = PEOF; - plinno++; - needprompt = doprompt; - } - return (c); -} - - -/* - * Parse a redirection operator. The variable "out" points to a string - * specifying the fd to be redirected. The variable "c" contains the - * first character of the redirection operator. - */ - -static void -parseredir(char *out, int c) -{ - char fd = *out; - union node *np; - - np = (union node *)stalloc(sizeof (struct nfile)); - if (c == '>') { - np->nfile.fd = 1; - c = pgetc_linecont(); - if (c == '>') - np->type = NAPPEND; - else if (c == '&') - np->type = NTOFD; - else if (c == '|') - np->type = NCLOBBER; - else { - np->type = NTO; - pungetc(); - } - } else { /* c == '<' */ - np->nfile.fd = 0; - c = pgetc_linecont(); - if (c == '<') { - if (sizeof (struct nfile) != sizeof (struct nhere)) { - np = (union node *)stalloc(sizeof (struct nhere)); - np->nfile.fd = 0; - } - np->type = NHERE; - heredoc = (struct heredoc *)stalloc(sizeof (struct heredoc)); - heredoc->here = np; - if ((c = pgetc_linecont()) == '-') { - heredoc->striptabs = 1; - } else { - heredoc->striptabs = 0; - pungetc(); - } - } else if (c == '&') - np->type = NFROMFD; - else if (c == '>') - np->type = NFROMTO; - else { - np->type = NFROM; - pungetc(); - } - } - if (fd != '\0') - np->nfile.fd = digit_val(fd); - redirnode = np; -} - -/* - * Called to parse command substitutions. - */ - -static char * -parsebackq(char *out, struct nodelist **pbqlist, - int oldstyle, int dblquote, int quoted) -{ - struct nodelist **nlpp; - union node *n; - char *volatile str; - struct jmploc jmploc; - struct jmploc *const savehandler = handler; - size_t savelen; - int saveprompt; - const int bq_startlinno = plinno; - char *volatile ostr = NULL; - struct parsefile *const savetopfile = getcurrentfile(); - struct heredoc *const saveheredoclist = heredoclist; - struct heredoc *here; - - str = NULL; - if (setjmp(jmploc.loc)) { - popfilesupto(savetopfile); - if (str) - ckfree(str); - if (ostr) - ckfree(ostr); - heredoclist = saveheredoclist; - handler = savehandler; - if (exception == EXERROR) { - startlinno = bq_startlinno; - synerror("Error in command substitution"); - } - longjmp(handler->loc, 1); - } - INTOFF; - savelen = out - stackblock(); - if (savelen > 0) { - str = ckmalloc(savelen); - memcpy(str, stackblock(), savelen); - } - handler = &jmploc; - heredoclist = NULL; - INTON; - if (oldstyle) { - /* We must read until the closing backquote, giving special - treatment to some slashes, and then push the string and - reread it as input, interpreting it normally. */ - char *oout; - int c; - int olen; - - - STARTSTACKSTR(oout); - for (;;) { - if (needprompt) { - setprompt(2); - needprompt = 0; - } - CHECKSTRSPACE(2, oout); - c = pgetc_linecont(); - if (c == '`') - break; - switch (c) { - case '\\': - c = pgetc(); - if (c != '\\' && c != '`' && c != '$' - && (!dblquote || c != '"')) - USTPUTC('\\', oout); - break; - - case '\n': - plinno++; - needprompt = doprompt; - break; - - case PEOF: - startlinno = plinno; - synerror("EOF in backquote substitution"); - break; - - default: - break; - } - USTPUTC(c, oout); - } - USTPUTC('\0', oout); - olen = oout - stackblock(); - INTOFF; - ostr = ckmalloc(olen); - memcpy(ostr, stackblock(), olen); - setinputstring(ostr, 1); - INTON; - } - nlpp = pbqlist; - while (*nlpp) - nlpp = &(*nlpp)->next; - *nlpp = (struct nodelist *)stalloc(sizeof (struct nodelist)); - (*nlpp)->next = NULL; - - if (oldstyle) { - saveprompt = doprompt; - doprompt = 0; - } - - n = list(0); - - if (oldstyle) { - if (peektoken() != TEOF) - synexpect(-1); - doprompt = saveprompt; - } else - consumetoken(TRP); - - (*nlpp)->n = n; - if (oldstyle) { - /* - * Start reading from old file again, ignoring any pushed back - * tokens left from the backquote parsing - */ - popfile(); - tokpushback = 0; - } - STARTSTACKSTR(out); - CHECKSTRSPACE(savelen + 1, out); - INTOFF; - if (str) { - memcpy(out, str, savelen); - STADJUST(savelen, out); - ckfree(str); - str = NULL; - } - if (ostr) { - ckfree(ostr); - ostr = NULL; - } - here = saveheredoclist; - if (here != NULL) { - while (here->next != NULL) - here = here->next; - here->next = heredoclist; - heredoclist = saveheredoclist; - } - handler = savehandler; - INTON; - if (quoted) - USTPUTC(CTLBACKQ | CTLQUOTE, out); - else - USTPUTC(CTLBACKQ, out); - return out; -} - - -/* - * Called to parse a backslash escape sequence inside $'...'. - * The backslash has already been read. - */ -static char * -readcstyleesc(char *out) -{ - int c, vc, i, n; - unsigned int v; - - c = pgetc(); - switch (c) { - case '\0': - synerror("Unterminated quoted string"); - case '\n': - plinno++; - if (doprompt) - setprompt(2); - else - setprompt(0); - return out; - case '\\': - case '\'': - case '"': - v = c; - break; - case 'a': v = '\a'; break; - case 'b': v = '\b'; break; - case 'e': v = '\033'; break; - case 'f': v = '\f'; break; - case 'n': v = '\n'; break; - case 'r': v = '\r'; break; - case 't': v = '\t'; break; - case 'v': v = '\v'; break; - case 'x': - v = 0; - for (;;) { - c = pgetc(); - if (c >= '0' && c <= '9') - v = (v << 4) + c - '0'; - else if (c >= 'A' && c <= 'F') - v = (v << 4) + c - 'A' + 10; - else if (c >= 'a' && c <= 'f') - v = (v << 4) + c - 'a' + 10; - else - break; - } - pungetc(); - break; - case '0': case '1': case '2': case '3': - case '4': case '5': case '6': case '7': - v = c - '0'; - c = pgetc(); - if (c >= '0' && c <= '7') { - v <<= 3; - v += c - '0'; - c = pgetc(); - if (c >= '0' && c <= '7') { - v <<= 3; - v += c - '0'; - } else - pungetc(); - } else - pungetc(); - break; - case 'c': - c = pgetc(); - if (c < 0x3f || c > 0x7a || c == 0x60) - synerror("Bad escape sequence"); - if (c == '\\' && pgetc() != '\\') - synerror("Bad escape sequence"); - if (c == '?') - v = 127; - else - v = c & 0x1f; - break; - case 'u': - case 'U': - n = c == 'U' ? 8 : 4; - v = 0; - for (i = 0; i < n; i++) { - c = pgetc(); - if (c >= '0' && c <= '9') - v = (v << 4) + c - '0'; - else if (c >= 'A' && c <= 'F') - v = (v << 4) + c - 'A' + 10; - else if (c >= 'a' && c <= 'f') - v = (v << 4) + c - 'a' + 10; - else - synerror("Bad escape sequence"); - } - if (v == 0 || (v >= 0xd800 && v <= 0xdfff)) - synerror("Bad escape sequence"); - /* We really need iconv here. */ - if (initial_localeisutf8 && v > 127) { - CHECKSTRSPACE(4, out); - /* - * We cannot use wctomb() as the locale may have - * changed. - */ - if (v <= 0x7ff) { - USTPUTC(0xc0 | v >> 6, out); - USTPUTC(0x80 | (v & 0x3f), out); - return out; - } else if (v <= 0xffff) { - USTPUTC(0xe0 | v >> 12, out); - USTPUTC(0x80 | ((v >> 6) & 0x3f), out); - USTPUTC(0x80 | (v & 0x3f), out); - return out; - } else if (v <= 0x10ffff) { - USTPUTC(0xf0 | v >> 18, out); - USTPUTC(0x80 | ((v >> 12) & 0x3f), out); - USTPUTC(0x80 | ((v >> 6) & 0x3f), out); - USTPUTC(0x80 | (v & 0x3f), out); - return out; - } - } - if (v > 127) - v = '?'; - break; - default: - synerror("Bad escape sequence"); - } - vc = (char)v; - /* - * We can't handle NUL bytes. - * POSIX says we should skip till the closing quote. - */ - if (vc == '\0') { - while ((c = pgetc()) != '\'') { - if (c == '\\') - c = pgetc(); - if (c == PEOF) - synerror("Unterminated quoted string"); - if (c == '\n') { - plinno++; - if (doprompt) - setprompt(2); - else - setprompt(0); - } - } - pungetc(); - return out; - } - if (SQSYNTAX[vc] == CCTL) - USTPUTC(CTLESC, out); - USTPUTC(vc, out); - return out; -} - - -/* - * If eofmark is NULL, read a word or a redirection symbol. If eofmark - * is not NULL, read a here document. In the latter case, eofmark is the - * word which marks the end of the document and striptabs is true if - * leading tabs should be stripped from the document. The argument firstc - * is the first character of the input token or document. - * - * Because C does not have internal subroutines, I have simulated them - * using goto's to implement the subroutine linkage. The following macros - * will run code that appears at the end of readtoken1. - */ - -#define PARSESUB() {goto parsesub; parsesub_return:;} -#define PARSEARITH() {goto parsearith; parsearith_return:;} - -static int -readtoken1(int firstc, char const *initialsyntax, const char *eofmark, - int striptabs) -{ - int c = firstc; - char *out; - int len; - struct nodelist *bqlist; - int quotef; - int newvarnest; - int level; - int synentry; - struct tokenstate state_static[MAXNEST_static]; - int maxnest = MAXNEST_static; - struct tokenstate *state = state_static; - int sqiscstyle = 0; - - startlinno = plinno; - quotef = 0; - bqlist = NULL; - newvarnest = 0; - level = 0; - state[level].syntax = initialsyntax; - state[level].parenlevel = 0; - state[level].category = TSTATE_TOP; - - STARTSTACKSTR(out); - loop: { /* for each line, until end of word */ - if (eofmark && eofmark != NOEOFMARK) - /* set c to PEOF if at end of here document */ - c = checkend(c, eofmark, striptabs); - for (;;) { /* until end of line or end of word */ - CHECKSTRSPACE(4, out); /* permit 4 calls to USTPUTC */ - - synentry = state[level].syntax[c]; - - switch(synentry) { - case CNL: /* '\n' */ - if (level == 0) - goto endword; /* exit outer loop */ - /* FALLTHROUGH */ - case CQNL: - USTPUTC(c, out); - plinno++; - if (doprompt) - setprompt(2); - else - setprompt(0); - c = pgetc(); - goto loop; /* continue outer loop */ - case CSBACK: - if (sqiscstyle) { - out = readcstyleesc(out); - break; - } - /* FALLTHROUGH */ - case CWORD: - USTPUTC(c, out); - break; - case CCTL: - if (eofmark == NULL || initialsyntax != SQSYNTAX) - USTPUTC(CTLESC, out); - USTPUTC(c, out); - break; - case CBACK: /* backslash */ - c = pgetc(); - if (c == PEOF) { - USTPUTC('\\', out); - pungetc(); - } else if (c == '\n') { - plinno++; - if (doprompt) - setprompt(2); - else - setprompt(0); - } else { - if (state[level].syntax == DQSYNTAX && - c != '\\' && c != '`' && c != '$' && - (c != '"' || (eofmark != NULL && - newvarnest == 0)) && - (c != '}' || state[level].category != TSTATE_VAR_OLD)) - USTPUTC('\\', out); - if ((eofmark == NULL || - newvarnest > 0) && - state[level].syntax == BASESYNTAX) - USTPUTC(CTLQUOTEMARK, out); - if (SQSYNTAX[c] == CCTL) - USTPUTC(CTLESC, out); - USTPUTC(c, out); - if ((eofmark == NULL || - newvarnest > 0) && - state[level].syntax == BASESYNTAX && - state[level].category == TSTATE_VAR_OLD) - USTPUTC(CTLQUOTEEND, out); - quotef++; - } - break; - case CSQUOTE: - USTPUTC(CTLQUOTEMARK, out); - state[level].syntax = SQSYNTAX; - sqiscstyle = 0; - break; - case CDQUOTE: - USTPUTC(CTLQUOTEMARK, out); - state[level].syntax = DQSYNTAX; - break; - case CENDQUOTE: - if (eofmark != NULL && newvarnest == 0) - USTPUTC(c, out); - else { - if (state[level].category == TSTATE_VAR_OLD) - USTPUTC(CTLQUOTEEND, out); - state[level].syntax = BASESYNTAX; - quotef++; - } - break; - case CVAR: /* '$' */ - PARSESUB(); /* parse substitution */ - break; - case CENDVAR: /* '}' */ - if (level > 0 && - ((state[level].category == TSTATE_VAR_OLD && - state[level].syntax == - state[level - 1].syntax) || - (state[level].category == TSTATE_VAR_NEW && - state[level].syntax == BASESYNTAX))) { - if (state[level].category == TSTATE_VAR_NEW) - newvarnest--; - level--; - USTPUTC(CTLENDVAR, out); - } else { - USTPUTC(c, out); - } - break; - case CLP: /* '(' in arithmetic */ - state[level].parenlevel++; - USTPUTC(c, out); - break; - case CRP: /* ')' in arithmetic */ - if (state[level].parenlevel > 0) { - USTPUTC(c, out); - --state[level].parenlevel; - } else { - if (pgetc_linecont() == ')') { - if (level > 0 && - state[level].category == TSTATE_ARITH) { - level--; - USTPUTC(CTLENDARI, out); - } else - USTPUTC(')', out); - } else { - /* - * unbalanced parens - * (don't 2nd guess - no error) - */ - pungetc(); - USTPUTC(')', out); - } - } - break; - case CBQUOTE: /* '`' */ - out = parsebackq(out, &bqlist, 1, - state[level].syntax == DQSYNTAX && - (eofmark == NULL || newvarnest > 0), - state[level].syntax == DQSYNTAX || state[level].syntax == ARISYNTAX); - break; - case CEOF: - goto endword; /* exit outer loop */ - case CIGN: - break; - default: - if (level == 0) - goto endword; /* exit outer loop */ - USTPUTC(c, out); - } - c = pgetc_macro(); - } - } -endword: - if (state[level].syntax == ARISYNTAX) - synerror("Missing '))'"); - if (state[level].syntax != BASESYNTAX && eofmark == NULL) - synerror("Unterminated quoted string"); - if (state[level].category == TSTATE_VAR_OLD || - state[level].category == TSTATE_VAR_NEW) { - startlinno = plinno; - synerror("Missing '}'"); - } - if (state != state_static) - parser_temp_free_upto(state); - USTPUTC('\0', out); - len = out - stackblock(); - out = stackblock(); - if (eofmark == NULL) { - if ((c == '>' || c == '<') - && quotef == 0 - && len <= 2 - && (*out == '\0' || is_digit(*out))) { - parseredir(out, c); - return lasttoken = TREDIR; - } else { - pungetc(); - } - } - quoteflag = quotef; - backquotelist = bqlist; - grabstackblock(len); - wordtext = out; - return lasttoken = TWORD; -/* end of readtoken routine */ - - -/* - * Parse a substitution. At this point, we have read the dollar sign - * and nothing else. - */ - -parsesub: { - int subtype; - int typeloc; - int flags; - char *p; - static const char types[] = "}-+?="; - int linno; - int length; - int c1; - - c = pgetc_linecont(); - if (c == '(') { /* $(command) or $((arith)) */ - if (pgetc_linecont() == '(') { - PARSEARITH(); - } else { - pungetc(); - out = parsebackq(out, &bqlist, 0, - state[level].syntax == DQSYNTAX && - (eofmark == NULL || newvarnest > 0), - state[level].syntax == DQSYNTAX || - state[level].syntax == ARISYNTAX); - } - } else if (c == '{' || is_name(c) || is_special(c)) { - USTPUTC(CTLVAR, out); - typeloc = out - stackblock(); - USTPUTC(VSNORMAL, out); - subtype = VSNORMAL; - flags = 0; - if (c == '{') { - c = pgetc_linecont(); - subtype = 0; - } -varname: - if (!is_eof(c) && is_name(c)) { - length = 0; - do { - STPUTC(c, out); - c = pgetc_linecont(); - length++; - } while (!is_eof(c) && is_in_name(c)); - if (length == 6 && - strncmp(out - length, "LINENO", length) == 0) { - /* Replace the variable name with the - * current line number. */ - STADJUST(-6, out); - CHECKSTRSPACE(11, out); - linno = plinno; - if (funclinno != 0) - linno -= funclinno - 1; - length = snprintf(out, 11, "%d", linno); - if (length > 10) - length = 10; - out += length; - flags |= VSLINENO; - } - } else if (is_digit(c)) { - if (subtype != VSNORMAL) { - do { - STPUTC(c, out); - c = pgetc_linecont(); - } while (is_digit(c)); - } else { - USTPUTC(c, out); - c = pgetc_linecont(); - } - } else if (is_special(c)) { - c1 = c; - c = pgetc_linecont(); - if (subtype == 0 && c1 == '#') { - subtype = VSLENGTH; - if (strchr(types, c) == NULL && c != ':' && - c != '#' && c != '%') - goto varname; - c1 = c; - c = pgetc_linecont(); - if (c1 != '}' && c == '}') { - pungetc(); - c = c1; - goto varname; - } - pungetc(); - c = c1; - c1 = '#'; - subtype = 0; - } - USTPUTC(c1, out); - } else { - subtype = VSERROR; - if (c == '}') - pungetc(); - else if (c == '\n' || c == PEOF) - synerror("Unexpected end of line in substitution"); - else if (BASESYNTAX[c] != CCTL) - USTPUTC(c, out); - } - if (subtype == 0) { - switch (c) { - case ':': - flags |= VSNUL; - c = pgetc_linecont(); - /*FALLTHROUGH*/ - default: - p = strchr(types, c); - if (p == NULL) { - if (c == '\n' || c == PEOF) - synerror("Unexpected end of line in substitution"); - if (flags == VSNUL) - STPUTC(':', out); - if (BASESYNTAX[c] != CCTL) - STPUTC(c, out); - subtype = VSERROR; - } else - subtype = p - types + VSNORMAL; - break; - case '%': - case '#': - { - int cc = c; - subtype = c == '#' ? VSTRIMLEFT : - VSTRIMRIGHT; - c = pgetc_linecont(); - if (c == cc) - subtype++; - else - pungetc(); - break; - } - } - } else if (subtype != VSERROR) { - if (subtype == VSLENGTH && c != '}') - subtype = VSERROR; - pungetc(); - } - STPUTC('=', out); - if (state[level].syntax == DQSYNTAX || - state[level].syntax == ARISYNTAX) - flags |= VSQUOTE; - *(stackblock() + typeloc) = subtype | flags; - if (subtype != VSNORMAL) { - if (level + 1 >= maxnest) { - maxnest *= 2; - if (state == state_static) { - state = parser_temp_alloc( - maxnest * sizeof(*state)); - memcpy(state, state_static, - MAXNEST_static * sizeof(*state)); - } else - state = parser_temp_realloc(state, - maxnest * sizeof(*state)); - } - level++; - state[level].parenlevel = 0; - if (subtype == VSMINUS || subtype == VSPLUS || - subtype == VSQUESTION || subtype == VSASSIGN) { - /* - * For operators that were in the Bourne shell, - * inherit the double-quote state. - */ - state[level].syntax = state[level - 1].syntax; - state[level].category = TSTATE_VAR_OLD; - } else { - /* - * The other operators take a pattern, - * so go to BASESYNTAX. - * Also, ' and " are now special, even - * in here documents. - */ - state[level].syntax = BASESYNTAX; - state[level].category = TSTATE_VAR_NEW; - newvarnest++; - } - } - } else if (c == '\'' && state[level].syntax == BASESYNTAX) { - /* $'cstylequotes' */ - USTPUTC(CTLQUOTEMARK, out); - state[level].syntax = SQSYNTAX; - sqiscstyle = 1; - } else { - USTPUTC('$', out); - pungetc(); - } - goto parsesub_return; -} - - -/* - * Parse an arithmetic expansion (indicate start of one and set state) - */ -parsearith: { - - if (level + 1 >= maxnest) { - maxnest *= 2; - if (state == state_static) { - state = parser_temp_alloc( - maxnest * sizeof(*state)); - memcpy(state, state_static, - MAXNEST_static * sizeof(*state)); - } else - state = parser_temp_realloc(state, - maxnest * sizeof(*state)); - } - level++; - state[level].syntax = ARISYNTAX; - state[level].parenlevel = 0; - state[level].category = TSTATE_ARITH; - USTPUTC(CTLARI, out); - if (state[level - 1].syntax == DQSYNTAX) - USTPUTC('"',out); - else - USTPUTC(' ',out); - goto parsearith_return; -} - -} /* end of readtoken */ - - -/* - * Returns true if the text contains nothing to expand (no dollar signs - * or backquotes). - */ - -static int -noexpand(char *text) -{ - char *p; - char c; - - p = text; - while ((c = *p++) != '\0') { - if ( c == CTLQUOTEMARK) - continue; - if (c == CTLESC) - p++; - else if (BASESYNTAX[(int)c] == CCTL) - return 0; - } - return 1; -} - - -/* - * Return true if the argument is a legal variable name (a letter or - * underscore followed by zero or more letters, underscores, and digits). - */ - -int -goodname(const char *name) -{ - const char *p; - - p = name; - if (! is_name(*p)) - return 0; - while (*++p) { - if (! is_in_name(*p)) - return 0; - } - return 1; -} - - -int -isassignment(const char *p) -{ - if (!is_name(*p)) - return 0; - p++; - for (;;) { - if (*p == '=') - return 1; - else if (!is_in_name(*p)) - return 0; - p++; - } -} - - -static void -consumetoken(int token) -{ - if (readtoken() != token) - synexpect(token); -} - - -/* - * Called when an unexpected token is read during the parse. The argument - * is the token that is expected, or -1 if more than one type of token can - * occur at this point. - */ - -static void -synexpect(int token) -{ - char msg[64]; - - if (token >= 0) { - fmtstr(msg, 64, "%s unexpected (expecting %s)", - tokname[lasttoken], tokname[token]); - } else { - fmtstr(msg, 64, "%s unexpected", tokname[lasttoken]); - } - synerror(msg); -} - - -static void -synerror(const char *msg) -{ - if (commandname) - outfmt(out2, "%s: %d: ", commandname, startlinno); - else if (arg0) - outfmt(out2, "%s: ", arg0); - outfmt(out2, "Syntax error: %s\n", msg); - error((char *)NULL); -} - -static void -setprompt(int which) -{ - whichprompt = which; - if (which == 0) - return; - - if (which == 1 && *ps0val()) { - out2str(expandprompt(ps0val())); - flushout(out2); - } - -#ifndef NO_HISTORY - if (!el) -#endif - { - out2str(getprompt(NULL)); - flushout(out2); - } -} - -static int -pgetc_linecont(void) -{ - int c; - - while ((c = pgetc_macro()) == '\\') { - c = pgetc(); - if (c == '\n') { - plinno++; - if (doprompt) - setprompt(2); - else - setprompt(0); - } else { - pungetc(); - /* Allow the backslash to be pushed back. */ - pushstring("\\", 1, NULL); - return (pgetc()); - } - } - return (c); -} - -static char * -expandprompt(const char *fmt) { - static char ps[PROMPTLEN]; - const char *pwd, *home; - int i, trim; - - /* - * Format prompt string. - */ - for (i = 0; (i < PROMPTLEN - 1) && (*fmt != '\0'); i++, fmt++) - if (*fmt == '\\') - switch (*++fmt) { - - /* - * Hostname. - * - * \h specifies just the local hostname, - * \H specifies fully-qualified hostname. - */ - case 'h': - case 'H': - ps[i] = '\0'; - gethostname(&ps[i], PROMPTLEN - i - 1); - ps[PROMPTLEN - 1] = '\0'; - /* Skip to end of hostname. */ - trim = (*fmt == 'h') ? '.' : '\0'; - while ((ps[i] != '\0') && (ps[i] != trim)) - i++; - --i; - break; - - /* - * Working directory. - * - * \W specifies just the final component, - * \w specifies the entire path. - */ - case 'W': - case 'w': - pwd = lookupvar("PWD"); - home = lookupvar("HOME"); - if (pwd == NULL || *pwd == '\0') - pwd = "?"; - if (home == NULL || *home == '\0') - home = "?"; - if (*fmt == 'W' && - *pwd == '/' && pwd[1] != '\0' && - strcmp(pwd, home) != 0) { - strlcpy(&ps[i], strrchr(pwd, '/') + 1, - PROMPTLEN - i); - } else { - if (strncmp(pwd, home, strlen(home)) == 0) { - ps[i++] = '~'; - pwd += strlen(home); - } - strlcpy(&ps[i], pwd, PROMPTLEN - i); - } - /* Skip to end of path. */ - while (ps[i] != '\0') - i++; - --i; - break; - - /* - * Exit status if non-zero. - */ - case '?': - if (exitstatus != 0) { - snprintf(&ps[i], PROMPTLEN - i, "%d", exitstatus); - while (ps[i] != '\0') - i++; - } - i--; - break; - - /* - * Superuser status. - * - * '$' for normal users, '#' for root. - */ - case '$': - ps[i] = (geteuid() != 0) ? '$' : '#'; - break; - - /* - * A literal \. - */ - case '\\': - ps[i] = '\\'; - break; - - /* - * Emit unrecognized formats verbatim. - */ - default: - ps[i] = '\\'; - if (i < PROMPTLEN - 2) - ps[++i] = *fmt; - break; - } - else - ps[i] = *fmt; - ps[i] = '\0'; - return (ps); -} - -/* - * called by editline -- any expansions to the prompt - * should be added here. - */ -char * -getprompt(void *unused __unused) -{ - const char *fmt; - static char internal_error[] = "??"; - - /* - * Select prompt format. - */ - switch (whichprompt) { - case 0: - fmt = ""; - break; - case 1: - fmt = ps1val(); - break; - case 2: - fmt = ps2val(); - break; - default: - return internal_error; - } - - return expandprompt(fmt); -} - -char * -getrprompt(void *unused __unused) -{ - const char *fmt; - static char internal_error[] = "??"; - - /* - * Select prompt format. - */ - switch (whichprompt) { - case 0: - fmt = ""; - break; - case 1: - fmt = rps1val(); - break; - case 2: - fmt = rps2val(); - break; - default: - return internal_error; - } - - return expandprompt(fmt); -} - - -const char * -expandstr(const char *ps) -{ - union node n; - struct jmploc jmploc; - struct jmploc *const savehandler = handler; - const int saveprompt = doprompt; - struct parsefile *const savetopfile = getcurrentfile(); - struct parser_temp *const saveparser_temp = parser_temp; - const char *result = NULL; - - if (!setjmp(jmploc.loc)) { - handler = &jmploc; - parser_temp = NULL; - setinputstring(ps, 1); - doprompt = 0; - readtoken1(pgetc(), DQSYNTAX, NOEOFMARK, 0); - if (backquotelist != NULL) - error("Command substitution not allowed here"); - - n.narg.type = NARG; - n.narg.next = NULL; - n.narg.text = wordtext; - n.narg.backquote = backquotelist; - - expandarg(&n, NULL, 0); - result = stackblock(); - INTOFF; - } - handler = savehandler; - doprompt = saveprompt; - popfilesupto(savetopfile); - if (parser_temp != saveparser_temp) { - parser_temp_free_all(); - parser_temp = saveparser_temp; - } - if (result != NULL) { - INTON; - } else if (exception == EXINT) - raise(SIGINT); - return result; -} diff --git a/bin/1sh/parser.h b/bin/1sh/parser.h deleted file mode 100644 index 171bc994..00000000 --- a/bin/1sh/parser.h +++ /dev/null @@ -1,88 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-3-Clause - * - * Copyright (c) 1991, 1993 - * The Regents of the University of California. All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * Kenneth Almquist. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)parser.h 8.3 (Berkeley) 5/4/95 - * $FreeBSD: releng/12.1/bin/sh/parser.h 326025 2017-11-20 19:49:47Z pfg $ - */ - -/* control characters in argument strings */ -#define CTLESC '\300' -#define CTLVAR '\301' -#define CTLENDVAR '\371' -#define CTLBACKQ '\372' -#define CTLQUOTE 01 /* ored with CTLBACKQ code if in quotes */ -/* CTLBACKQ | CTLQUOTE == '\373' */ -#define CTLARI '\374' -#define CTLENDARI '\375' -#define CTLQUOTEMARK '\376' -#define CTLQUOTEEND '\377' /* only for ${v+-...} */ - -/* variable substitution byte (follows CTLVAR) */ -#define VSTYPE 0x0f /* type of variable substitution */ -#define VSNUL 0x10 /* colon--treat the empty string as unset */ -#define VSLINENO 0x20 /* expansion of $LINENO, the line number \ - follows immediately */ -#define VSQUOTE 0x80 /* inside double quotes--suppress splitting */ - -/* values of VSTYPE field */ -#define VSNORMAL 0x1 /* normal variable: $var or ${var} */ -#define VSMINUS 0x2 /* ${var-text} */ -#define VSPLUS 0x3 /* ${var+text} */ -#define VSQUESTION 0x4 /* ${var?message} */ -#define VSASSIGN 0x5 /* ${var=text} */ -#define VSTRIMLEFT 0x6 /* ${var#pattern} */ -#define VSTRIMLEFTMAX 0x7 /* ${var##pattern} */ -#define VSTRIMRIGHT 0x8 /* ${var%pattern} */ -#define VSTRIMRIGHTMAX 0x9 /* ${var%%pattern} */ -#define VSLENGTH 0xa /* ${#var} */ -#define VSERROR 0xb /* Syntax error, issue when expanded */ - - -/* - * NEOF is returned by parsecmd when it encounters an end of file. It - * must be distinct from NULL. - */ -#define NEOF ((union node *)-1) -extern int whichprompt; /* 1 == PS1, 2 == PS2 */ -extern const char *const parsekwd[]; - - -union node *parsecmd(int); -union node *parsewordexp(void); -void forcealias(void); -void fixredir(union node *, const char *, int); -int goodname(const char *); -int isassignment(const char *); -char *getprompt(void *); -char *getrprompt(void *); -const char *expandstr(const char *); diff --git a/bin/1sh/printf.c b/bin/1sh/printf.c deleted file mode 100644 index 2545fb62..00000000 --- a/bin/1sh/printf.c +++ /dev/null @@ -1,686 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-3-Clause - * - * Copyright 2018 Staysail Systems, Inc. <info@staysail.tech> - * Copyright 2014 Garrett D'Amore <garrett@damore.org> - * Copyright 2010 Nexenta Systems, Inc. All rights reserved. - * Copyright (c) 1989, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ -/* - * Important: This file is used both as a standalone program /usr/bin/printf - * and as a builtin for /bin/sh (#define SHELL). - */ - -#ifndef SHELL -#ifndef lint -static char const copyright[] = -"@(#) Copyright (c) 1989, 1993\n\ - The Regents of the University of California. All rights reserved.\n"; -#endif /* not lint */ -#endif - -#if 0 -static char const sccsid[] = "@(#)printf.c 8.1 (Berkeley) 7/20/93"; -static const char rcsid[] = - "$FreeBSD: releng/12.1/usr.bin/printf/printf.c 337618 2018-08-11 11:13:34Z jilles $"; -#endif - -#include <sys/types.h> - -#include <ctype.h> -#include <err.h> -#include <errno.h> -#include <inttypes.h> -#include <limits.h> -#include <locale.h> -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <unistd.h> -#include <wchar.h> - -#ifdef SHELL -#define main printfcmd -#include "bltin.h" -#include "options.h" -#endif - -#define PF(f, func) do { \ - if (havewidth) \ - if (haveprec) \ - (void)printf(f, fieldwidth, precision, func); \ - else \ - (void)printf(f, fieldwidth, func); \ - else if (haveprec) \ - (void)printf(f, precision, func); \ - else \ - (void)printf(f, func); \ -} while (0) - -static int asciicode(void); -static char *printf_doformat(char *, int *); -static int escape(char *, int, size_t *); -static int getchr(void); -static int getfloating(long double *, int); -static int getint(int *); -static int getnum(intmax_t *, uintmax_t *, int); -static const char - *getstr(void); -static char *mknum(char *, char); -static void usage(void); - -static const char digits[] = "0123456789"; - -static char end_fmt[1]; - -static int myargc; -static char **myargv; -static char **gargv; -static char **maxargv; - -int -main(int argc, char *argv[]) -{ - size_t len; - int end, rval; - char *format, *fmt, *start; -#ifndef SHELL - int ch; - - (void) setlocale(LC_ALL, ""); -#endif - -#ifdef SHELL - nextopt(""); - argc -= argptr - argv; - argv = argptr; -#else - while ((ch = getopt(argc, argv, "")) != -1) - switch (ch) { - case '?': - default: - usage(); - return (1); - } - argc -= optind; - argv += optind; -#endif - - if (argc < 1) { - usage(); - return (1); - } - -#ifdef SHELL - INTOFF; -#endif - /* - * Basic algorithm is to scan the format string for conversion - * specifications -- once one is found, find out if the field - * width or precision is a '*'; if it is, gather up value. Note, - * format strings are reused as necessary to use up the provided - * arguments, arguments of zero/null string are provided to use - * up the format string. - */ - fmt = format = *argv; - escape(fmt, 1, &len); /* backslash interpretation */ - rval = end = 0; - gargv = ++argv; - - for (;;) { - maxargv = gargv; - - myargv = gargv; - for (myargc = 0; gargv[myargc]; myargc++) - /* nop */; - start = fmt; - while (fmt < format + len) { - if (fmt[0] == '%') { - fwrite(start, 1, fmt - start, stdout); - if (fmt[1] == '%') { - /* %% prints a % */ - putchar('%'); - fmt += 2; - } else { - fmt = printf_doformat(fmt, &rval); - if (fmt == NULL || fmt == end_fmt) { -#ifdef SHELL - INTON; -#endif - return (fmt == NULL ? 1 : rval); - } - end = 0; - } - start = fmt; - } else - fmt++; - if (gargv > maxargv) - maxargv = gargv; - } - gargv = maxargv; - - if (end == 1) { - warnx("missing format character"); -#ifdef SHELL - INTON; -#endif - return (1); - } - fwrite(start, 1, fmt - start, stdout); - if (!*gargv) { -#ifdef SHELL - INTON; -#endif - return (rval); - } - /* Restart at the beginning of the format string. */ - fmt = format; - end = 1; - } - /* NOTREACHED */ -} - - -static char * -printf_doformat(char *fmt, int *rval) -{ - static const char skip1[] = "#'-+ 0"; - int fieldwidth, haveprec, havewidth, mod_ldbl, precision; - char convch, nextch; - char start[strlen(fmt) + 1]; - char **fargv; - char *dptr; - int l; - - dptr = start; - *dptr++ = '%'; - *dptr = 0; - - fmt++; - - /* look for "n$" field index specifier */ - l = strspn(fmt, digits); - if ((l > 0) && (fmt[l] == '$')) { - int idx = atoi(fmt); - if (idx <= myargc) { - gargv = &myargv[idx - 1]; - } else { - gargv = &myargv[myargc]; - } - if (gargv > maxargv) - maxargv = gargv; - fmt += l + 1; - - /* save format argument */ - fargv = gargv; - } else { - fargv = NULL; - } - - /* skip to field width */ - while (*fmt && strchr(skip1, *fmt) != NULL) { - *dptr++ = *fmt++; - *dptr = 0; - } - - if (*fmt == '*') { - - fmt++; - l = strspn(fmt, digits); - if ((l > 0) && (fmt[l] == '$')) { - int idx = atoi(fmt); - if (fargv == NULL) { - warnx("incomplete use of n$"); - return (NULL); - } - if (idx <= myargc) { - gargv = &myargv[idx - 1]; - } else { - gargv = &myargv[myargc]; - } - fmt += l + 1; - } else if (fargv != NULL) { - warnx("incomplete use of n$"); - return (NULL); - } - - if (getint(&fieldwidth)) - return (NULL); - if (gargv > maxargv) - maxargv = gargv; - havewidth = 1; - - *dptr++ = '*'; - *dptr = 0; - } else { - havewidth = 0; - - /* skip to possible '.', get following precision */ - while (isdigit(*fmt)) { - *dptr++ = *fmt++; - *dptr = 0; - } - } - - if (*fmt == '.') { - /* precision present? */ - fmt++; - *dptr++ = '.'; - - if (*fmt == '*') { - - fmt++; - l = strspn(fmt, digits); - if ((l > 0) && (fmt[l] == '$')) { - int idx = atoi(fmt); - if (fargv == NULL) { - warnx("incomplete use of n$"); - return (NULL); - } - if (idx <= myargc) { - gargv = &myargv[idx - 1]; - } else { - gargv = &myargv[myargc]; - } - fmt += l + 1; - } else if (fargv != NULL) { - warnx("incomplete use of n$"); - return (NULL); - } - - if (getint(&precision)) - return (NULL); - if (gargv > maxargv) - maxargv = gargv; - haveprec = 1; - *dptr++ = '*'; - *dptr = 0; - } else { - haveprec = 0; - - /* skip to conversion char */ - while (isdigit(*fmt)) { - *dptr++ = *fmt++; - *dptr = 0; - } - } - } else - haveprec = 0; - if (!*fmt) { - warnx("missing format character"); - return (NULL); - } - *dptr++ = *fmt; - *dptr = 0; - - /* - * Look for a length modifier. POSIX doesn't have these, so - * we only support them for floating-point conversions, which - * are extensions. This is useful because the L modifier can - * be used to gain extra range and precision, while omitting - * it is more likely to produce consistent results on different - * architectures. This is not so important for integers - * because overflow is the only bad thing that can happen to - * them, but consider the command printf %a 1.1 - */ - if (*fmt == 'L') { - mod_ldbl = 1; - fmt++; - if (!strchr("aAeEfFgG", *fmt)) { - warnx("bad modifier L for %%%c", *fmt); - return (NULL); - } - } else { - mod_ldbl = 0; - } - - /* save the current arg offset, and set to the format arg */ - if (fargv != NULL) { - gargv = fargv; - } - - convch = *fmt; - nextch = *++fmt; - - *fmt = '\0'; - switch (convch) { - case 'b': { - size_t len; - char *p; - int getout; - - /* Convert "b" to "s" for output. */ - start[strlen(start) - 1] = 's'; - if ((p = strdup(getstr())) == NULL) { - warnx("%s", strerror(ENOMEM)); - return (NULL); - } - getout = escape(p, 0, &len); - PF(start, p); - /* Restore format for next loop. */ - - free(p); - if (getout) - return (end_fmt); - break; - } - case 'c': { - char p; - - p = getchr(); - if (p != '\0') - PF(start, p); - break; - } - case 's': { - const char *p; - - p = getstr(); - PF(start, p); - break; - } - case 'd': case 'i': case 'o': case 'u': case 'x': case 'X': { - char *f; - intmax_t val; - uintmax_t uval; - int signedconv; - - signedconv = (convch == 'd' || convch == 'i'); - if ((f = mknum(start, convch)) == NULL) - return (NULL); - if (getnum(&val, &uval, signedconv)) - *rval = 1; - if (signedconv) - PF(f, val); - else - PF(f, uval); - break; - } - case 'e': case 'E': - case 'f': case 'F': - case 'g': case 'G': - case 'a': case 'A': { - long double p; - - if (getfloating(&p, mod_ldbl)) - *rval = 1; - if (mod_ldbl) - PF(start, p); - else - PF(start, (double)p); - break; - } - default: - warnx("illegal format character %c", convch); - return (NULL); - } - *fmt = nextch; - /* return the gargv to the next element */ - return (fmt); -} - -static char * -mknum(char *str, char ch) -{ - static char *copy; - static size_t copy_size; - char *newcopy; - size_t len, newlen; - - len = strlen(str) + 2; - if (len > copy_size) { - newlen = ((len + 1023) >> 10) << 10; - if ((newcopy = realloc(copy, newlen)) == NULL) { - warnx("%s", strerror(ENOMEM)); - return (NULL); - } - copy = newcopy; - copy_size = newlen; - } - - memmove(copy, str, len - 3); - copy[len - 3] = 'j'; - copy[len - 2] = ch; - copy[len - 1] = '\0'; - return (copy); -} - -static int -escape(char *fmt, int percent, size_t *len) -{ - char *save, *store, c; - int value; - - for (save = store = fmt; ((c = *fmt) != 0); ++fmt, ++store) { - if (c != '\\') { - *store = c; - continue; - } - switch (*++fmt) { - case '\0': /* EOS, user error */ - *store = '\\'; - *++store = '\0'; - *len = store - save; - return (0); - case '\\': /* backslash */ - case '\'': /* single quote */ - *store = *fmt; - break; - case 'a': /* bell/alert */ - *store = '\a'; - break; - case 'b': /* backspace */ - *store = '\b'; - break; - case 'c': - if (!percent) { - *store = '\0'; - *len = store - save; - return (1); - } - *store = 'c'; - break; - case 'f': /* form-feed */ - *store = '\f'; - break; - case 'n': /* newline */ - *store = '\n'; - break; - case 'r': /* carriage-return */ - *store = '\r'; - break; - case 't': /* horizontal tab */ - *store = '\t'; - break; - case 'v': /* vertical tab */ - *store = '\v'; - break; - /* octal constant */ - case '0': case '1': case '2': case '3': - case '4': case '5': case '6': case '7': - c = (!percent && *fmt == '0') ? 4 : 3; - for (value = 0; - c-- && *fmt >= '0' && *fmt <= '7'; ++fmt) { - value <<= 3; - value += *fmt - '0'; - } - --fmt; - if (percent && value == '%') { - *store++ = '%'; - *store = '%'; - } else - *store = (char)value; - break; - default: - *store = *fmt; - break; - } - } - *store = '\0'; - *len = store - save; - return (0); -} - -static int -getchr(void) -{ - if (!*gargv) - return ('\0'); - return ((int)**gargv++); -} - -static const char * -getstr(void) -{ - if (!*gargv) - return (""); - return (*gargv++); -} - -static int -getint(int *ip) -{ - intmax_t val; - uintmax_t uval; - int rval; - - if (getnum(&val, &uval, 1)) - return (1); - rval = 0; - if (val < INT_MIN || val > INT_MAX) { - warnx("%s: %s", *gargv, strerror(ERANGE)); - rval = 1; - } - *ip = (int)val; - return (rval); -} - -static int -getnum(intmax_t *ip, uintmax_t *uip, int signedconv) -{ - char *ep; - int rval; - - if (!*gargv) { - *ip = *uip = 0; - return (0); - } - if (**gargv == '"' || **gargv == '\'') { - if (signedconv) - *ip = asciicode(); - else - *uip = asciicode(); - return (0); - } - rval = 0; - errno = 0; - if (signedconv) - *ip = strtoimax(*gargv, &ep, 0); - else - *uip = strtoumax(*gargv, &ep, 0); - if (ep == *gargv) { - warnx("%s: expected numeric value", *gargv); - rval = 1; - } - else if (*ep != '\0') { - warnx("%s: not completely converted", *gargv); - rval = 1; - } - if (errno == ERANGE) { - warnx("%s: %s", *gargv, strerror(ERANGE)); - rval = 1; - } - ++gargv; - return (rval); -} - -static int -getfloating(long double *dp, int mod_ldbl) -{ - char *ep; - int rval; - - if (!*gargv) { - *dp = 0.0; - return (0); - } - if (**gargv == '"' || **gargv == '\'') { - *dp = asciicode(); - return (0); - } - rval = 0; - errno = 0; - if (mod_ldbl) - *dp = strtold(*gargv, &ep); - else - *dp = strtod(*gargv, &ep); - if (ep == *gargv) { - warnx("%s: expected numeric value", *gargv); - rval = 1; - } else if (*ep != '\0') { - warnx("%s: not completely converted", *gargv); - rval = 1; - } - if (errno == ERANGE) { - warnx("%s: %s", *gargv, strerror(ERANGE)); - rval = 1; - } - ++gargv; - return (rval); -} - -static int -asciicode(void) -{ - int ch; - wchar_t wch; - mbstate_t mbs; - - ch = (unsigned char)**gargv; - if (ch == '\'' || ch == '"') { - memset(&mbs, 0, sizeof(mbs)); - switch (mbrtowc(&wch, *gargv + 1, MB_LEN_MAX, &mbs)) { - case (size_t)-2: - case (size_t)-1: - wch = (unsigned char)gargv[0][1]; - break; - case 0: - wch = 0; - break; - } - ch = wch; - } - ++gargv; - return (ch); -} - -static void -usage(void) -{ - (void)fprintf(stderr, "usage: printf format [arguments ...]\n"); -} diff --git a/bin/1sh/redir.c b/bin/1sh/redir.c deleted file mode 100644 index f8fd9324..00000000 --- a/bin/1sh/redir.c +++ /dev/null @@ -1,365 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-3-Clause - * - * Copyright (c) 1991, 1993 - * The Regents of the University of California. All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * Kenneth Almquist. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#ifndef lint -#if 0 -static char sccsid[] = "@(#)redir.c 8.2 (Berkeley) 5/4/95"; -#endif -#endif /* not lint */ -#include <sys/cdefs.h> -/* $FreeBSD: releng/12.1/bin/sh/redir.c 326025 2017-11-20 19:49:47Z pfg $ */ - -#include <sys/types.h> -#include <sys/stat.h> -#include <signal.h> -#include <string.h> -#include <fcntl.h> -#include <errno.h> -#include <unistd.h> -#include <stdlib.h> - -/* - * Code for dealing with input/output redirection. - */ - -#include "shell.h" -#include "nodes.h" -#include "jobs.h" -#include "expand.h" -#include "redir.h" -#include "output.h" -#include "memalloc.h" -#include "error.h" -#include "options.h" - - -#define EMPTY -2 /* marks an unused slot in redirtab */ -#define CLOSED -1 /* fd was not open before redir */ - - -struct redirtab { - struct redirtab *next; - int renamed[10]; - int fd0_redirected; - unsigned int empty_redirs; -}; - - -static struct redirtab *redirlist; - -/* - * We keep track of whether or not fd0 has been redirected. This is for - * background commands, where we want to redirect fd0 to /dev/null only - * if it hasn't already been redirected. -*/ -static int fd0_redirected = 0; - -/* Number of redirtabs that have not been allocated. */ -static unsigned int empty_redirs = 0; - -static void openredirect(union node *, char[10 ]); -static int openhere(union node *); - - -/* - * Process a list of redirection commands. If the REDIR_PUSH flag is set, - * old file descriptors are stashed away so that the redirection can be - * undone by calling popredir. If the REDIR_BACKQ flag is set, then the - * standard output, and the standard error if it becomes a duplicate of - * stdout, is saved in memory. -* - * We suppress interrupts so that we won't leave open file - * descriptors around. Because the signal handler remains - * installed and we do not use system call restart, interrupts - * will still abort blocking opens such as fifos (they will fail - * with EINTR). There is, however, a race condition if an interrupt - * arrives after INTOFF and before open blocks. - */ - -void -redirect(union node *redir, int flags) -{ - union node *n; - struct redirtab *sv = NULL; - int i; - int fd; - char memory[10]; /* file descriptors to write to memory */ - - INTOFF; - for (i = 10 ; --i >= 0 ; ) - memory[i] = 0; - memory[1] = flags & REDIR_BACKQ; - if (flags & REDIR_PUSH) { - empty_redirs++; - if (redir != NULL) { - sv = ckmalloc(sizeof (struct redirtab)); - for (i = 0 ; i < 10 ; i++) - sv->renamed[i] = EMPTY; - sv->fd0_redirected = fd0_redirected; - sv->empty_redirs = empty_redirs - 1; - sv->next = redirlist; - redirlist = sv; - empty_redirs = 0; - } - } - for (n = redir ; n ; n = n->nfile.next) { - fd = n->nfile.fd; - if (fd == 0) - fd0_redirected = 1; - if ((n->nfile.type == NTOFD || n->nfile.type == NFROMFD) && - n->ndup.dupfd == fd) - continue; /* redirect from/to same file descriptor */ - - if ((flags & REDIR_PUSH) && sv->renamed[fd] == EMPTY) { - INTOFF; - if ((i = fcntl(fd, F_DUPFD_CLOEXEC, 10)) == -1) { - switch (errno) { - case EBADF: - i = CLOSED; - break; - default: - INTON; - error("%d: %s", fd, strerror(errno)); - break; - } - } - sv->renamed[fd] = i; - INTON; - } - openredirect(n, memory); - INTON; - INTOFF; - } - if (memory[1]) - out1 = &memout; - if (memory[2]) - out2 = &memout; - INTON; -} - - -static void -openredirect(union node *redir, char memory[10]) -{ - struct stat sb; - int fd = redir->nfile.fd; - const char *fname; - int f; - int e; - - memory[fd] = 0; - switch (redir->nfile.type) { - case NFROM: - fname = redir->nfile.expfname; - if ((f = open(fname, O_RDONLY)) < 0) - error("cannot open %s: %s", fname, strerror(errno)); - break; - case NFROMTO: - fname = redir->nfile.expfname; - if ((f = open(fname, O_RDWR|O_CREAT, 0666)) < 0) - error("cannot create %s: %s", fname, strerror(errno)); - break; - case NTO: - if (Cflag) { - fname = redir->nfile.expfname; - if (stat(fname, &sb) == -1) { - if ((f = open(fname, O_WRONLY|O_CREAT|O_EXCL, 0666)) < 0) - error("cannot create %s: %s", fname, strerror(errno)); - } else if (!S_ISREG(sb.st_mode)) { - if ((f = open(fname, O_WRONLY, 0666)) < 0) - error("cannot create %s: %s", fname, strerror(errno)); - if (fstat(f, &sb) != -1 && S_ISREG(sb.st_mode)) { - close(f); - error("cannot create %s: %s", fname, - strerror(EEXIST)); - } - } else - error("cannot create %s: %s", fname, - strerror(EEXIST)); - break; - } - /* FALLTHROUGH */ - case NCLOBBER: - fname = redir->nfile.expfname; - if ((f = open(fname, O_WRONLY|O_CREAT|O_TRUNC, 0666)) < 0) - error("cannot create %s: %s", fname, strerror(errno)); - break; - case NAPPEND: - fname = redir->nfile.expfname; - if ((f = open(fname, O_WRONLY|O_CREAT|O_APPEND, 0666)) < 0) - error("cannot create %s: %s", fname, strerror(errno)); - break; - case NTOFD: - case NFROMFD: - if (redir->ndup.dupfd >= 0) { /* if not ">&-" */ - if (memory[redir->ndup.dupfd]) - memory[fd] = 1; - else { - if (dup2(redir->ndup.dupfd, fd) < 0) - error("%d: %s", redir->ndup.dupfd, - strerror(errno)); - } - } else { - close(fd); - } - return; - case NHERE: - case NXHERE: - f = openhere(redir); - break; - default: - abort(); - } - if (f != fd) { - if (dup2(f, fd) == -1) { - e = errno; - close(f); - error("%d: %s", fd, strerror(e)); - } - close(f); - } -} - - -/* - * Handle here documents. Normally we fork off a process to write the - * data to a pipe. If the document is short, we can stuff the data in - * the pipe without forking. - */ - -static int -openhere(union node *redir) -{ - const char *p; - int pip[2]; - size_t len = 0; - int flags; - ssize_t written = 0; - - if (pipe(pip) < 0) - error("Pipe call failed: %s", strerror(errno)); - - if (redir->type == NXHERE) - p = redir->nhere.expdoc; - else - p = redir->nhere.doc->narg.text; - len = strlen(p); - if (len == 0) - goto out; - flags = fcntl(pip[1], F_GETFL, 0); - if (flags != -1 && fcntl(pip[1], F_SETFL, flags | O_NONBLOCK) != -1) { - written = write(pip[1], p, len); - if (written < 0) - written = 0; - if ((size_t)written == len) - goto out; - fcntl(pip[1], F_SETFL, flags); - } - - if (forkshell((struct job *)NULL, (union node *)NULL, FORK_NOJOB) == 0) { - close(pip[0]); - signal(SIGINT, SIG_IGN); - signal(SIGQUIT, SIG_IGN); - signal(SIGHUP, SIG_IGN); - signal(SIGTSTP, SIG_IGN); - signal(SIGPIPE, SIG_DFL); - xwrite(pip[1], p + written, len - written); - _exit(0); - } -out: - close(pip[1]); - return pip[0]; -} - - - -/* - * Undo the effects of the last redirection. - */ - -void -popredir(void) -{ - struct redirtab *rp = redirlist; - int i; - - INTOFF; - if (empty_redirs > 0) { - empty_redirs--; - INTON; - return; - } - for (i = 0 ; i < 10 ; i++) { - if (rp->renamed[i] != EMPTY) { - if (rp->renamed[i] >= 0) { - dup2(rp->renamed[i], i); - close(rp->renamed[i]); - } else { - close(i); - } - } - } - fd0_redirected = rp->fd0_redirected; - empty_redirs = rp->empty_redirs; - redirlist = rp->next; - ckfree(rp); - INTON; -} - -/* Return true if fd 0 has already been redirected at least once. */ -int -fd0_redirected_p(void) -{ - return fd0_redirected != 0; -} - -/* - * Discard all saved file descriptors. - */ - -void -clearredir(void) -{ - struct redirtab *rp; - int i; - - for (rp = redirlist ; rp ; rp = rp->next) { - for (i = 0 ; i < 10 ; i++) { - if (rp->renamed[i] >= 0) { - close(rp->renamed[i]); - } - rp->renamed[i] = EMPTY; - } - } -} diff --git a/bin/1sh/redir.h b/bin/1sh/redir.h deleted file mode 100644 index 6946f6a7..00000000 --- a/bin/1sh/redir.h +++ /dev/null @@ -1,47 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-3-Clause - * - * Copyright (c) 1991, 1993 - * The Regents of the University of California. All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * Kenneth Almquist. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)redir.h 8.2 (Berkeley) 5/4/95 - * $FreeBSD: releng/12.1/bin/sh/redir.h 326025 2017-11-20 19:49:47Z pfg $ - */ - -/* flags passed to redirect */ -#define REDIR_PUSH 01 /* save previous values of file descriptors */ -#define REDIR_BACKQ 02 /* save the command output in memory */ - -union node; -void redirect(union node *, int); -void popredir(void); -int fd0_redirected_p(void); -void clearredir(void); - diff --git a/bin/1sh/shell.h b/bin/1sh/shell.h deleted file mode 100644 index 98ac98df..00000000 --- a/bin/1sh/shell.h +++ /dev/null @@ -1,77 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-3-Clause - * - * Copyright (c) 1991, 1993 - * The Regents of the University of California. All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * Kenneth Almquist. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)shell.h 8.2 (Berkeley) 5/4/95 - * $FreeBSD: releng/12.1/bin/sh/shell.h 345117 2019-03-13 21:53:10Z jilles $ - */ - -#ifndef SHELL_H_ -#define SHELL_H_ - -#include <inttypes.h> - -/* - * The follow should be set to reflect the type of system you have: - * JOBS -> 1 if you have Berkeley job control, 0 otherwise. - * define DEBUG=1 to compile in debugging (set global "debug" to turn on) - * define DEBUG=2 to compile in and turn on debugging. - * - * When debugging is on, debugging info will be written to ./trace and - * a quit signal will generate a core dump. - */ - - -#define JOBS 1 -/* #define DEBUG 1 */ - -/* - * Type of used arithmetics. SUSv3 requires us to have at least signed long. - */ -typedef intmax_t arith_t; -#define ARITH_FORMAT_STR "%" PRIdMAX -#define ARITH_MIN INTMAX_MIN -#define ARITH_MAX INTMAX_MAX - -typedef void *pointer; - -#include <sys/cdefs.h> - -extern char nullstr[1]; /* null string */ - -#ifdef DEBUG -#define TRACE(param) sh_trace param -#else -#define TRACE(param) -#endif - -#endif /* !SHELL_H_ */ diff --git a/bin/1sh/show.c b/bin/1sh/show.c deleted file mode 100644 index a87a506d..00000000 --- a/bin/1sh/show.c +++ /dev/null @@ -1,410 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-3-Clause - * - * Copyright (c) 1991, 1993 - * The Regents of the University of California. All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * Kenneth Almquist. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#ifndef lint -#if 0 -static char sccsid[] = "@(#)show.c 8.3 (Berkeley) 5/4/95"; -#endif -#endif /* not lint */ -#include <sys/cdefs.h> -/* $FreeBSD: releng/12.1/bin/sh/show.c 326025 2017-11-20 19:49:47Z pfg $ */ - -#include <fcntl.h> -#include <stdio.h> -#include <stdlib.h> -#include <stdarg.h> -#include <errno.h> - -#include "shell.h" -#include "parser.h" -#include "nodes.h" -#include "mystring.h" -#include "show.h" - - -#ifdef DEBUG -static void shtree(union node *, int, char *, FILE*); -static void shcmd(union node *, FILE *); -static void sharg(union node *, FILE *); -static void indent(int, char *, FILE *); -static void trstring(char *); - - -void -showtree(union node *n) -{ - trputs("showtree called\n"); - shtree(n, 1, NULL, stdout); -} - - -static void -shtree(union node *n, int ind, char *pfx, FILE *fp) -{ - struct nodelist *lp; - char *s; - - if (n == NULL) - return; - - indent(ind, pfx, fp); - switch(n->type) { - case NSEMI: - s = "; "; - goto binop; - case NAND: - s = " && "; - goto binop; - case NOR: - s = " || "; -binop: - shtree(n->nbinary.ch1, ind, NULL, fp); - /* if (ind < 0) */ - fputs(s, fp); - shtree(n->nbinary.ch2, ind, NULL, fp); - break; - case NCMD: - shcmd(n, fp); - if (ind >= 0) - putc('\n', fp); - break; - case NPIPE: - for (lp = n->npipe.cmdlist ; lp ; lp = lp->next) { - shcmd(lp->n, fp); - if (lp->next) - fputs(" | ", fp); - } - if (n->npipe.backgnd) - fputs(" &", fp); - if (ind >= 0) - putc('\n', fp); - break; - default: - fprintf(fp, "<node type %d>", n->type); - if (ind >= 0) - putc('\n', fp); - break; - } -} - - - -static void -shcmd(union node *cmd, FILE *fp) -{ - union node *np; - int first; - char *s; - int dftfd; - - first = 1; - for (np = cmd->ncmd.args ; np ; np = np->narg.next) { - if (! first) - putchar(' '); - sharg(np, fp); - first = 0; - } - for (np = cmd->ncmd.redirect ; np ; np = np->nfile.next) { - if (! first) - putchar(' '); - switch (np->nfile.type) { - case NTO: s = ">"; dftfd = 1; break; - case NAPPEND: s = ">>"; dftfd = 1; break; - case NTOFD: s = ">&"; dftfd = 1; break; - case NCLOBBER: s = ">|"; dftfd = 1; break; - case NFROM: s = "<"; dftfd = 0; break; - case NFROMTO: s = "<>"; dftfd = 0; break; - case NFROMFD: s = "<&"; dftfd = 0; break; - case NHERE: s = "<<"; dftfd = 0; break; - case NXHERE: s = "<<"; dftfd = 0; break; - default: s = "*error*"; dftfd = 0; break; - } - if (np->nfile.fd != dftfd) - fprintf(fp, "%d", np->nfile.fd); - fputs(s, fp); - if (np->nfile.type == NTOFD || np->nfile.type == NFROMFD) { - if (np->ndup.dupfd >= 0) - fprintf(fp, "%d", np->ndup.dupfd); - else - fprintf(fp, "-"); - } else if (np->nfile.type == NHERE) { - fprintf(fp, "HERE"); - } else if (np->nfile.type == NXHERE) { - fprintf(fp, "XHERE"); - } else { - sharg(np->nfile.fname, fp); - } - first = 0; - } -} - - - -static void -sharg(union node *arg, FILE *fp) -{ - char *p; - struct nodelist *bqlist; - int subtype; - - if (arg->type != NARG) { - printf("<node type %d>\n", arg->type); - fflush(stdout); - abort(); - } - bqlist = arg->narg.backquote; - for (p = arg->narg.text ; *p ; p++) { - switch (*p) { - case CTLESC: - putc(*++p, fp); - break; - case CTLVAR: - putc('$', fp); - putc('{', fp); - subtype = *++p; - if (subtype == VSLENGTH) - putc('#', fp); - - while (*p != '=') - putc(*p++, fp); - - if (subtype & VSNUL) - putc(':', fp); - - switch (subtype & VSTYPE) { - case VSNORMAL: - putc('}', fp); - break; - case VSMINUS: - putc('-', fp); - break; - case VSPLUS: - putc('+', fp); - break; - case VSQUESTION: - putc('?', fp); - break; - case VSASSIGN: - putc('=', fp); - break; - case VSTRIMLEFT: - putc('#', fp); - break; - case VSTRIMLEFTMAX: - putc('#', fp); - putc('#', fp); - break; - case VSTRIMRIGHT: - putc('%', fp); - break; - case VSTRIMRIGHTMAX: - putc('%', fp); - putc('%', fp); - break; - case VSLENGTH: - break; - default: - printf("<subtype %d>", subtype); - } - break; - case CTLENDVAR: - putc('}', fp); - break; - case CTLBACKQ: - case CTLBACKQ|CTLQUOTE: - putc('$', fp); - putc('(', fp); - shtree(bqlist->n, -1, NULL, fp); - putc(')', fp); - break; - default: - putc(*p, fp); - break; - } - } -} - - -static void -indent(int amount, char *pfx, FILE *fp) -{ - int i; - - for (i = 0 ; i < amount ; i++) { - if (pfx && i == amount - 1) - fputs(pfx, fp); - putc('\t', fp); - } -} - - -/* - * Debugging stuff. - */ - - -FILE *tracefile; - -#if DEBUG >= 2 -int debug = 1; -#else -int debug = 0; -#endif - - -void -trputc(int c) -{ - if (tracefile == NULL) - return; - putc(c, tracefile); - if (c == '\n') - fflush(tracefile); -} - - -void -sh_trace(const char *fmt, ...) -{ - va_list va; - va_start(va, fmt); - if (tracefile != NULL) { - (void) vfprintf(tracefile, fmt, va); - if (strchr(fmt, '\n')) - (void) fflush(tracefile); - } - va_end(va); -} - - -void -trputs(const char *s) -{ - if (tracefile == NULL) - return; - fputs(s, tracefile); - if (strchr(s, '\n')) - fflush(tracefile); -} - - -static void -trstring(char *s) -{ - char *p; - char c; - - if (tracefile == NULL) - return; - putc('"', tracefile); - for (p = s ; *p ; p++) { - switch (*p) { - case '\n': c = 'n'; goto backslash; - case '\t': c = 't'; goto backslash; - case '\r': c = 'r'; goto backslash; - case '"': c = '"'; goto backslash; - case '\\': c = '\\'; goto backslash; - case CTLESC: c = 'e'; goto backslash; - case CTLVAR: c = 'v'; goto backslash; - case CTLVAR+CTLQUOTE: c = 'V'; goto backslash; - case CTLBACKQ: c = 'q'; goto backslash; - case CTLBACKQ+CTLQUOTE: c = 'Q'; goto backslash; -backslash: putc('\\', tracefile); - putc(c, tracefile); - break; - default: - if (*p >= ' ' && *p <= '~') - putc(*p, tracefile); - else { - putc('\\', tracefile); - putc(*p >> 6 & 03, tracefile); - putc(*p >> 3 & 07, tracefile); - putc(*p & 07, tracefile); - } - break; - } - } - putc('"', tracefile); -} - - -void -trargs(char **ap) -{ - if (tracefile == NULL) - return; - while (*ap) { - trstring(*ap++); - if (*ap) - putc(' ', tracefile); - else - putc('\n', tracefile); - } - fflush(tracefile); -} - - -void -opentrace(void) -{ - char s[100]; - int flags; - - if (!debug) - return; -#ifdef not_this_way - { - char *p; - if ((p = getenv("HOME")) == NULL) { - if (geteuid() == 0) - p = "/"; - else - p = "/tmp"; - } - strcpy(s, p); - strcat(s, "/trace"); - } -#else - strcpy(s, "./trace"); -#endif /* not_this_way */ - if ((tracefile = fopen(s, "a")) == NULL) { - fprintf(stderr, "Can't open %s: %s\n", s, strerror(errno)); - return; - } - if ((flags = fcntl(fileno(tracefile), F_GETFL, 0)) >= 0) - fcntl(fileno(tracefile), F_SETFL, flags | O_APPEND); - fputs("\nTracing started.\n", tracefile); - fflush(tracefile); -} -#endif /* DEBUG */ diff --git a/bin/1sh/show.h b/bin/1sh/show.h deleted file mode 100644 index 68840549..00000000 --- a/bin/1sh/show.h +++ /dev/null @@ -1,42 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-3-Clause - * - * Copyright (c) 1995 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)show.h 1.1 (Berkeley) 5/4/95 - * $FreeBSD: releng/12.1/bin/sh/show.h 326025 2017-11-20 19:49:47Z pfg $ - */ - -void showtree(union node *); -#ifdef DEBUG -void sh_trace(const char *, ...) __attribute__((format(printf, 1, 2))); -void trargs(char **); -void trputc(int); -void trputs(const char *); -void opentrace(void); -#endif diff --git a/bin/1sh/test.c b/bin/1sh/test.c deleted file mode 100644 index 54c16eef..00000000 --- a/bin/1sh/test.c +++ /dev/null @@ -1,630 +0,0 @@ -/* $NetBSD: test.c,v 1.21 1999/04/05 09:48:38 kleink Exp $ */ - -/*- - * test(1); version 7-like -- author Erik Baalbergen - * modified by Eric Gisin to be used as built-in. - * modified by Arnold Robbins to add SVR3 compatibility - * (-x -c -b -p -u -g -k) plus Korn's -L -nt -ot -ef and new -S (socket). - * modified by J.T. Conklin for NetBSD. - * - * This program is in the Public Domain. - */ -/* - * Important: This file is used both as a standalone program /bin/test and - * as a builtin for /bin/sh (#define SHELL). - */ - -#include <sys/cdefs.h> -/* $FreeBSD: releng/12.1/bin/test/test.c 298232 2016-04-19 00:38:07Z araujo $ */ - -#include <sys/types.h> -#include <sys/stat.h> - -#include <ctype.h> -#include <err.h> -#include <errno.h> -#include <fcntl.h> -#include <inttypes.h> -#include <limits.h> -#include <stdarg.h> -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <unistd.h> - -#ifdef SHELL -#define main testcmd -#include "bltin.h" -#else -#include <locale.h> - -static void error(const char *, ...) __attribute__((noreturn)) __attribute__((format(printf, 1, 2))); - -static void -error(const char *msg, ...) -{ - va_list ap; - va_start(ap, msg); - verrx(2, msg, ap); - /*NOTREACHED*/ - va_end(ap); -} -#endif - -/* test(1) accepts the following grammar: - oexpr ::= aexpr | aexpr "-o" oexpr ; - aexpr ::= nexpr | nexpr "-a" aexpr ; - nexpr ::= primary | "!" primary - primary ::= unary-operator operand - | operand binary-operator operand - | operand - | "(" oexpr ")" - ; - unary-operator ::= "-r"|"-w"|"-x"|"-f"|"-d"|"-c"|"-b"|"-p"| - "-u"|"-g"|"-k"|"-s"|"-t"|"-z"|"-n"|"-o"|"-O"|"-G"|"-L"|"-S"; - - binary-operator ::= "="|"!="|"-eq"|"-ne"|"-ge"|"-gt"|"-le"|"-lt"| - "-nt"|"-ot"|"-ef"; - operand ::= <any legal UNIX file name> -*/ - -enum token_types { - UNOP = 0x100, - BINOP = 0x200, - BUNOP = 0x300, - BBINOP = 0x400, - PAREN = 0x500 -}; - -enum token { - EOI, - OPERAND, - FILRD = UNOP + 1, - FILWR, - FILEX, - FILEXIST, - FILREG, - FILDIR, - FILCDEV, - FILBDEV, - FILFIFO, - FILSOCK, - FILSYM, - FILGZ, - FILTT, - FILSUID, - FILSGID, - FILSTCK, - STREZ, - STRNZ, - FILUID, - FILGID, - FILNT = BINOP + 1, - FILOT, - FILEQ, - STREQ, - STRNE, - STRLT, - STRGT, - INTEQ, - INTNE, - INTGE, - INTGT, - INTLE, - INTLT, - UNOT = BUNOP + 1, - BAND = BBINOP + 1, - BOR, - LPAREN = PAREN + 1, - RPAREN -}; - -#define TOKEN_TYPE(token) ((token) & 0xff00) - -static const struct t_op { - char op_text[2]; - short op_num; -} ops1[] = { - {"=", STREQ}, - {"<", STRLT}, - {">", STRGT}, - {"!", UNOT}, - {"(", LPAREN}, - {")", RPAREN}, -}, opsm1[] = { - {"r", FILRD}, - {"w", FILWR}, - {"x", FILEX}, - {"e", FILEXIST}, - {"f", FILREG}, - {"d", FILDIR}, - {"c", FILCDEV}, - {"b", FILBDEV}, - {"p", FILFIFO}, - {"u", FILSUID}, - {"g", FILSGID}, - {"k", FILSTCK}, - {"s", FILGZ}, - {"t", FILTT}, - {"z", STREZ}, - {"n", STRNZ}, - {"h", FILSYM}, /* for backwards compat */ - {"O", FILUID}, - {"G", FILGID}, - {"L", FILSYM}, - {"S", FILSOCK}, - {"a", BAND}, - {"o", BOR}, -}, ops2[] = { - {"==", STREQ}, - {"!=", STRNE}, -}, opsm2[] = { - {"eq", INTEQ}, - {"ne", INTNE}, - {"ge", INTGE}, - {"gt", INTGT}, - {"le", INTLE}, - {"lt", INTLT}, - {"nt", FILNT}, - {"ot", FILOT}, - {"ef", FILEQ}, -}; - -static int nargc; -static char **t_wp; -static int parenlevel; - -static int aexpr(enum token); -static int binop(enum token); -static int equalf(const char *, const char *); -static int filstat(char *, enum token); -static int getn(const char *); -static intmax_t getq(const char *); -static int intcmp(const char *, const char *); -static int isunopoperand(void); -static int islparenoperand(void); -static int isrparenoperand(void); -static int newerf(const char *, const char *); -static int nexpr(enum token); -static int oexpr(enum token); -static int olderf(const char *, const char *); -static int primary(enum token); -static void syntax(const char *, const char *); -static enum token t_lex(char *); - -int -main(int argc, char **argv) -{ - int res; - char *p; - - if ((p = strrchr(argv[0], '/')) == NULL) - p = argv[0]; - else - p++; - if (strcmp(p, "[") == 0) { - if (strcmp(argv[--argc], "]") != 0) - error("missing ]"); - argv[argc] = NULL; - } - - /* no expression => false */ - if (--argc <= 0) - return 1; - -#ifndef SHELL - (void)setlocale(LC_CTYPE, ""); -#endif - nargc = argc; - t_wp = &argv[1]; - parenlevel = 0; - if (nargc == 4 && strcmp(*t_wp, "!") == 0) { - /* Things like ! "" -o x do not fit in the normal grammar. */ - --nargc; - ++t_wp; - res = oexpr(t_lex(*t_wp)); - } else - res = !oexpr(t_lex(*t_wp)); - - if (--nargc > 0) - syntax(*t_wp, "unexpected operator"); - - return res; -} - -static void -syntax(const char *op, const char *msg) -{ - - if (op && *op) - error("%s: %s", op, msg); - else - error("%s", msg); -} - -static int -oexpr(enum token n) -{ - int res; - - res = aexpr(n); - if (t_lex(nargc > 0 ? (--nargc, *++t_wp) : NULL) == BOR) - return oexpr(t_lex(nargc > 0 ? (--nargc, *++t_wp) : NULL)) || - res; - t_wp--; - nargc++; - return res; -} - -static int -aexpr(enum token n) -{ - int res; - - res = nexpr(n); - if (t_lex(nargc > 0 ? (--nargc, *++t_wp) : NULL) == BAND) - return aexpr(t_lex(nargc > 0 ? (--nargc, *++t_wp) : NULL)) && - res; - t_wp--; - nargc++; - return res; -} - -static int -nexpr(enum token n) -{ - if (n == UNOT) - return !nexpr(t_lex(nargc > 0 ? (--nargc, *++t_wp) : NULL)); - return primary(n); -} - -static int -primary(enum token n) -{ - enum token nn; - int res; - - if (n == EOI) - return 0; /* missing expression */ - if (n == LPAREN) { - parenlevel++; - if ((nn = t_lex(nargc > 0 ? (--nargc, *++t_wp) : NULL)) == - RPAREN) { - parenlevel--; - return 0; /* missing expression */ - } - res = oexpr(nn); - if (t_lex(nargc > 0 ? (--nargc, *++t_wp) : NULL) != RPAREN) - syntax(NULL, "closing paren expected"); - parenlevel--; - return res; - } - if (TOKEN_TYPE(n) == UNOP) { - /* unary expression */ - if (--nargc == 0) - syntax(NULL, "argument expected"); /* impossible */ - switch (n) { - case STREZ: - return strlen(*++t_wp) == 0; - case STRNZ: - return strlen(*++t_wp) != 0; - case FILTT: - return isatty(getn(*++t_wp)); - default: - return filstat(*++t_wp, n); - } - } - - nn = t_lex(nargc > 0 ? t_wp[1] : NULL); - if (TOKEN_TYPE(nn) == BINOP) - return binop(nn); - - return strlen(*t_wp) > 0; -} - -static int -binop(enum token n) -{ - const char *opnd1, *op, *opnd2; - - opnd1 = *t_wp; - op = nargc > 0 ? (--nargc, *++t_wp) : NULL; - - if ((opnd2 = nargc > 0 ? (--nargc, *++t_wp) : NULL) == NULL) - syntax(op, "argument expected"); - - switch (n) { - case STREQ: - return strcmp(opnd1, opnd2) == 0; - case STRNE: - return strcmp(opnd1, opnd2) != 0; - case STRLT: - return strcmp(opnd1, opnd2) < 0; - case STRGT: - return strcmp(opnd1, opnd2) > 0; - case INTEQ: - return intcmp(opnd1, opnd2) == 0; - case INTNE: - return intcmp(opnd1, opnd2) != 0; - case INTGE: - return intcmp(opnd1, opnd2) >= 0; - case INTGT: - return intcmp(opnd1, opnd2) > 0; - case INTLE: - return intcmp(opnd1, opnd2) <= 0; - case INTLT: - return intcmp(opnd1, opnd2) < 0; - case FILNT: - return newerf (opnd1, opnd2); - case FILOT: - return olderf (opnd1, opnd2); - case FILEQ: - return equalf (opnd1, opnd2); - default: - abort(); - /* NOTREACHED */ - } -} - -static int -filstat(char *nm, enum token mode) -{ - struct stat s; - - if (mode == FILSYM ? lstat(nm, &s) : stat(nm, &s)) - return 0; - - switch (mode) { - case FILRD: - return (faccessat(AT_FDCWD, nm, R_OK, AT_EACCESS) == 0); - case FILWR: - return (faccessat(AT_FDCWD, nm, W_OK, AT_EACCESS) == 0); - case FILEX: - /* XXX work around eaccess(2) false positives for superuser */ - if (faccessat(AT_FDCWD, nm, X_OK, AT_EACCESS) != 0) - return 0; - if (S_ISDIR(s.st_mode) || geteuid() != 0) - return 1; - return (s.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH)) != 0; - case FILEXIST: - return (faccessat(AT_FDCWD, nm, F_OK, AT_EACCESS) == 0); - case FILREG: - return S_ISREG(s.st_mode); - case FILDIR: - return S_ISDIR(s.st_mode); - case FILCDEV: - return S_ISCHR(s.st_mode); - case FILBDEV: - return S_ISBLK(s.st_mode); - case FILFIFO: - return S_ISFIFO(s.st_mode); - case FILSOCK: - return S_ISSOCK(s.st_mode); - case FILSYM: - return S_ISLNK(s.st_mode); - case FILSUID: - return (s.st_mode & S_ISUID) != 0; - case FILSGID: - return (s.st_mode & S_ISGID) != 0; - case FILSTCK: - return (s.st_mode & S_ISVTX) != 0; - case FILGZ: - return s.st_size > (off_t)0; - case FILUID: - return s.st_uid == geteuid(); - case FILGID: - return s.st_gid == getegid(); - default: - return 1; - } -} - -static int -find_op_1char(const struct t_op *op, const struct t_op *end, const char *s) -{ - char c; - - c = s[0]; - while (op != end) { - if (c == *op->op_text) - return op->op_num; - op++; - } - return OPERAND; -} - -static int -find_op_2char(const struct t_op *op, const struct t_op *end, const char *s) -{ - while (op != end) { - if (s[0] == op->op_text[0] && s[1] == op->op_text[1]) - return op->op_num; - op++; - } - return OPERAND; -} - -static int -find_op(const char *s) -{ - if (s[0] == '\0') - return OPERAND; - else if (s[1] == '\0') - return find_op_1char(ops1, (&ops1)[1], s); - else if (s[2] == '\0') - return s[0] == '-' ? find_op_1char(opsm1, (&opsm1)[1], s + 1) : - find_op_2char(ops2, (&ops2)[1], s); - else if (s[3] == '\0') - return s[0] == '-' ? find_op_2char(opsm2, (&opsm2)[1], s + 1) : - OPERAND; - else - return OPERAND; -} - -static enum token -t_lex(char *s) -{ - int num; - - if (s == NULL) { - return EOI; - } - num = find_op(s); - if (((TOKEN_TYPE(num) == UNOP || TOKEN_TYPE(num) == BUNOP) - && isunopoperand()) || - (num == LPAREN && islparenoperand()) || - (num == RPAREN && isrparenoperand())) - return OPERAND; - return num; -} - -static int -isunopoperand(void) -{ - char *s; - char *t; - int num; - - if (nargc == 1) - return 1; - s = *(t_wp + 1); - if (nargc == 2) - return parenlevel == 1 && strcmp(s, ")") == 0; - t = *(t_wp + 2); - num = find_op(s); - return TOKEN_TYPE(num) == BINOP && - (parenlevel == 0 || t[0] != ')' || t[1] != '\0'); -} - -static int -islparenoperand(void) -{ - char *s; - int num; - - if (nargc == 1) - return 1; - s = *(t_wp + 1); - if (nargc == 2) - return parenlevel == 1 && strcmp(s, ")") == 0; - if (nargc != 3) - return 0; - num = find_op(s); - return TOKEN_TYPE(num) == BINOP; -} - -static int -isrparenoperand(void) -{ - char *s; - - if (nargc == 1) - return 0; - s = *(t_wp + 1); - if (nargc == 2) - return parenlevel == 1 && strcmp(s, ")") == 0; - return 0; -} - -/* atoi with error detection */ -static int -getn(const char *s) -{ - char *p; - long r; - - errno = 0; - r = strtol(s, &p, 10); - - if (s == p) - error("%s: bad number", s); - - if (errno != 0) - error((errno == EINVAL) ? "%s: bad number" : - "%s: out of range", s); - - while (isspace((unsigned char)*p)) - p++; - - if (*p) - error("%s: bad number", s); - - return (int) r; -} - -/* atoi with error detection and 64 bit range */ -static intmax_t -getq(const char *s) -{ - char *p; - intmax_t r; - - errno = 0; - r = strtoimax(s, &p, 10); - - if (s == p) - error("%s: bad number", s); - - if (errno != 0) - error((errno == EINVAL) ? "%s: bad number" : - "%s: out of range", s); - - while (isspace((unsigned char)*p)) - p++; - - if (*p) - error("%s: bad number", s); - - return r; -} - -static int -intcmp (const char *s1, const char *s2) -{ - intmax_t q1, q2; - - - q1 = getq(s1); - q2 = getq(s2); - - if (q1 > q2) - return 1; - - if (q1 < q2) - return -1; - - return 0; -} - -static int -newerf (const char *f1, const char *f2) -{ - struct stat b1, b2; - - if (stat(f1, &b1) != 0 || stat(f2, &b2) != 0) - return 0; - - if (b1.st_mtimespec.tv_sec > b2.st_mtimespec.tv_sec) - return 1; - if (b1.st_mtimespec.tv_sec < b2.st_mtimespec.tv_sec) - return 0; - - return (b1.st_mtimespec.tv_nsec > b2.st_mtimespec.tv_nsec); -} - -static int -olderf (const char *f1, const char *f2) -{ - return (newerf(f2, f1)); -} - -static int -equalf (const char *f1, const char *f2) -{ - struct stat b1, b2; - - return (stat (f1, &b1) == 0 && - stat (f2, &b2) == 0 && - b1.st_dev == b2.st_dev && - b1.st_ino == b2.st_ino); -} diff --git a/bin/1sh/trap.c b/bin/1sh/trap.c deleted file mode 100644 index fed13fcf..00000000 --- a/bin/1sh/trap.c +++ /dev/null @@ -1,553 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-3-Clause - * - * Copyright (c) 1991, 1993 - * The Regents of the University of California. All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * Kenneth Almquist. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#ifndef lint -#if 0 -static char sccsid[] = "@(#)trap.c 8.5 (Berkeley) 6/5/95"; -#endif -#endif /* not lint */ -#include <sys/cdefs.h> -/* $FreeBSD: releng/12.1/bin/sh/trap.c 326025 2017-11-20 19:49:47Z pfg $ */ - -#include <signal.h> -#include <unistd.h> -#include <stdlib.h> - -#include "shell.h" -#include "main.h" -#include "nodes.h" /* for other headers */ -#include "eval.h" -#include "jobs.h" -#include "show.h" -#include "options.h" -#include "syntax.h" -#include "output.h" -#include "memalloc.h" -#include "error.h" -#include "trap.h" -#include "mystring.h" -#include "builtins.h" -#include "myhistedit.h" - - -/* - * Sigmode records the current value of the signal handlers for the various - * modes. A value of zero means that the current handler is not known. - * S_HARD_IGN indicates that the signal was ignored on entry to the shell, - */ - -#define S_DFL 1 /* default signal handling (SIG_DFL) */ -#define S_CATCH 2 /* signal is caught */ -#define S_IGN 3 /* signal is ignored (SIG_IGN) */ -#define S_HARD_IGN 4 /* signal is ignored permanently */ -#define S_RESET 5 /* temporary - to reset a hard ignored sig */ - - -static char sigmode[NSIG]; /* current value of signal */ -volatile sig_atomic_t pendingsig; /* indicates some signal received */ -volatile sig_atomic_t pendingsig_waitcmd; /* indicates wait builtin should be interrupted */ -static int in_dotrap; /* do we execute in a trap handler? */ -static char *volatile trap[NSIG]; /* trap handler commands */ -static volatile sig_atomic_t gotsig[NSIG]; - /* indicates specified signal received */ -static int ignore_sigchld; /* Used while handling SIGCHLD traps. */ -static int last_trapsig; - -static int exiting; /* exitshell() has been called */ -static int exiting_exitstatus; /* value passed to exitshell() */ - -static int getsigaction(int, sig_t *); - - -/* - * Map a string to a signal number. - * - * Note: the signal number may exceed NSIG. - */ -static int -sigstring_to_signum(char *sig) -{ - - if (is_number(sig)) { - int signo; - - signo = atoi(sig); - return ((signo >= 0 && signo < NSIG) ? signo : (-1)); - } else if (strcasecmp(sig, "EXIT") == 0) { - return (0); - } else { - int n; - - if (strncasecmp(sig, "SIG", 3) == 0) - sig += 3; - for (n = 1; n < NSIG; n++) - if (sys_signame[n] && - strcasecmp(sys_signame[n], sig) == 0) - return (n); - } - return (-1); -} - - -/* - * Print a list of valid signal names. - */ -static void -printsignals(void) -{ - int n, outlen; - - outlen = 0; - for (n = 1; n < NSIG; n++) { - if (sys_signame[n]) { - out1fmt("%s", sys_signame[n]); - outlen += strlen(sys_signame[n]); - } else { - out1fmt("%d", n); - outlen += 3; /* good enough */ - } - ++outlen; - if (outlen > 71 || n == NSIG - 1) { - out1str("\n"); - outlen = 0; - } else { - out1c(' '); - } - } -} - - -/* - * The trap builtin. - */ -int -trapcmd(int argc __unused, char **argv) -{ - char *action; - int signo; - int errors = 0; - int i; - - while ((i = nextopt("l")) != '\0') { - switch (i) { - case 'l': - printsignals(); - return (0); - } - } - argv = argptr; - - if (*argv == NULL) { - for (signo = 0 ; signo < NSIG ; signo++) { - if (signo < NSIG && trap[signo] != NULL) { - out1str("trap -- "); - out1qstr(trap[signo]); - if (signo == 0) { - out1str(" EXIT\n"); - } else if (sys_signame[signo]) { - out1fmt(" %s\n", sys_signame[signo]); - } else { - out1fmt(" %d\n", signo); - } - } - } - return 0; - } - action = NULL; - if (*argv && !is_number(*argv)) { - if (strcmp(*argv, "-") == 0) - argv++; - else { - action = *argv; - argv++; - } - } - for (; *argv; argv++) { - if ((signo = sigstring_to_signum(*argv)) == -1) { - warning("bad signal %s", *argv); - errors = 1; - continue; - } - INTOFF; - if (action) - action = savestr(action); - if (trap[signo]) - ckfree(trap[signo]); - trap[signo] = action; - if (signo != 0) - setsignal(signo); - INTON; - } - return errors; -} - - -/* - * Clear traps on a fork. - */ -void -clear_traps(void) -{ - char *volatile *tp; - - for (tp = trap ; tp <= &trap[NSIG - 1] ; tp++) { - if (*tp && **tp) { /* trap not NULL or SIG_IGN */ - INTOFF; - ckfree(*tp); - *tp = NULL; - if (tp != &trap[0]) - setsignal(tp - trap); - INTON; - } - } -} - - -/* - * Check if we have any traps enabled. - */ -int -have_traps(void) -{ - char *volatile *tp; - - for (tp = trap ; tp <= &trap[NSIG - 1] ; tp++) { - if (*tp && **tp) /* trap not NULL or SIG_IGN */ - return 1; - } - return 0; -} - -/* - * Set the signal handler for the specified signal. The routine figures - * out what it should be set to. - */ -void -setsignal(int signo) -{ - int action; - sig_t sigact = SIG_DFL; - struct sigaction sa; - char *t; - - if ((t = trap[signo]) == NULL) - action = S_DFL; - else if (*t != '\0') - action = S_CATCH; - else - action = S_IGN; - if (action == S_DFL) { - switch (signo) { - case SIGINT: - action = S_CATCH; - break; - case SIGQUIT: -#ifdef DEBUG - { - extern int debug; - - if (debug) - break; - } -#endif - action = S_CATCH; - break; - case SIGTERM: - if (rootshell && iflag) - action = S_IGN; - break; -#if JOBS - case SIGTSTP: - case SIGTTOU: - if (rootshell && mflag) - action = S_IGN; - break; -#endif - } - } - - t = &sigmode[signo]; - if (*t == 0) { - /* - * current setting unknown - */ - if (!getsigaction(signo, &sigact)) { - /* - * Pretend it worked; maybe we should give a warning - * here, but other shells don't. We don't alter - * sigmode, so that we retry every time. - */ - return; - } - if (sigact == SIG_IGN) { - if (mflag && (signo == SIGTSTP || - signo == SIGTTIN || signo == SIGTTOU)) { - *t = S_IGN; /* don't hard ignore these */ - } else - *t = S_HARD_IGN; - } else { - *t = S_RESET; /* force to be set */ - } - } - if (*t == S_HARD_IGN || *t == action) - return; - switch (action) { - case S_DFL: sigact = SIG_DFL; break; - case S_CATCH: sigact = onsig; break; - case S_IGN: sigact = SIG_IGN; break; - } - *t = action; - sa.sa_handler = sigact; - sa.sa_flags = 0; - sigemptyset(&sa.sa_mask); - sigaction(signo, &sa, NULL); -} - - -/* - * Return the current setting for sig w/o changing it. - */ -static int -getsigaction(int signo, sig_t *sigact) -{ - struct sigaction sa; - - if (sigaction(signo, (struct sigaction *)0, &sa) == -1) - return 0; - *sigact = (sig_t) sa.sa_handler; - return 1; -} - - -/* - * Ignore a signal. - */ -void -ignoresig(int signo) -{ - - if (sigmode[signo] == 0) - setsignal(signo); - if (sigmode[signo] != S_IGN && sigmode[signo] != S_HARD_IGN) { - signal(signo, SIG_IGN); - sigmode[signo] = S_IGN; - } -} - - -int -issigchldtrapped(void) -{ - - return (trap[SIGCHLD] != NULL && *trap[SIGCHLD] != '\0'); -} - - -/* - * Signal handler. - */ -void -onsig(int signo) -{ - - if (signo == SIGINT && trap[SIGINT] == NULL) { - /* - * The !in_dotrap here is safe. The only way we can arrive - * here with in_dotrap set is that a trap handler set SIGINT to - * SIG_DFL and killed itself. - */ - if (suppressint && !in_dotrap) - SET_PENDING_INT; - else - onint(); - return; - } - - /* If we are currently in a wait builtin, prepare to break it */ - if (signo == SIGINT || signo == SIGQUIT) - pendingsig_waitcmd = signo; - - if (trap[signo] != NULL && trap[signo][0] != '\0' && - (signo != SIGCHLD || !ignore_sigchld)) { - gotsig[signo] = 1; - pendingsig = signo; - pendingsig_waitcmd = signo; - } -} - - -/* - * Called to execute a trap. Perhaps we should avoid entering new trap - * handlers while we are executing a trap handler. - */ -void -dotrap(void) -{ - struct stackmark smark; - int i; - int savestatus, prev_evalskip, prev_skipcount; - - in_dotrap++; - for (;;) { - pendingsig = 0; - pendingsig_waitcmd = 0; - for (i = 1; i < NSIG; i++) { - if (gotsig[i]) { - gotsig[i] = 0; - if (trap[i]) { - /* - * Ignore SIGCHLD to avoid infinite - * recursion if the trap action does - * a fork. - */ - if (i == SIGCHLD) - ignore_sigchld++; - - /* - * Backup current evalskip - * state and reset it before - * executing a trap, so that the - * trap is not disturbed by an - * ongoing break/continue/return - * statement. - */ - prev_evalskip = evalskip; - prev_skipcount = skipcount; - evalskip = 0; - - last_trapsig = i; - savestatus = exitstatus; - setstackmark(&smark); - evalstring(stsavestr(trap[i]), 0); - popstackmark(&smark); - - /* - * If such a command was not - * already in progress, allow a - * break/continue/return in the - * trap action to have an effect - * outside of it. - */ - if (evalskip == 0 || - prev_evalskip != 0) { - evalskip = prev_evalskip; - skipcount = prev_skipcount; - exitstatus = savestatus; - } - - if (i == SIGCHLD) - ignore_sigchld--; - } - break; - } - } - if (i >= NSIG) - break; - } - in_dotrap--; -} - - -/* - * Controls whether the shell is interactive or not based on iflag. - */ -void -setinteractive(void) -{ - setsignal(SIGINT); - setsignal(SIGQUIT); - setsignal(SIGTERM); -} - - -/* - * Called to exit the shell. - */ -void -exitshell(int status) -{ - TRACE(("exitshell(%d) pid=%d\n", status, getpid())); - exiting = 1; - exiting_exitstatus = status; - exitshell_savedstatus(); -} - -void -exitshell_savedstatus(void) -{ - struct jmploc loc1, loc2; - char *p; - int sig = 0; - sigset_t sigs; - - if (!exiting) { - if (in_dotrap && last_trapsig) { - sig = last_trapsig; - exiting_exitstatus = sig + 128; - } else - exiting_exitstatus = oexitstatus; - } - exitstatus = oexitstatus = exiting_exitstatus; - if (!setjmp(loc1.loc)) { - handler = &loc1; - if ((p = trap[0]) != NULL && *p != '\0') { - /* - * Reset evalskip, or the trap on EXIT could be - * interrupted if the last command was a "return". - */ - evalskip = 0; - trap[0] = NULL; - FORCEINTON; - evalstring(p, 0); - } - } - if (!setjmp(loc2.loc)) { - handler = &loc2; /* probably unnecessary */ - FORCEINTON; - flushall(); -#if JOBS - setjobctl(0); -#endif - } - if (sig != 0 && sig != SIGSTOP && sig != SIGTSTP && sig != SIGTTIN && - sig != SIGTTOU) { - signal(sig, SIG_DFL); - sigemptyset(&sigs); - sigaddset(&sigs, sig); - sigprocmask(SIG_UNBLOCK, &sigs, NULL); - kill(getpid(), sig); - /* If the default action is to ignore, fall back to _exit(). */ - } - _exit(exiting_exitstatus); -} diff --git a/bin/1sh/trap.h b/bin/1sh/trap.h deleted file mode 100644 index 75427d56..00000000 --- a/bin/1sh/trap.h +++ /dev/null @@ -1,50 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-3-Clause - * - * Copyright (c) 1991, 1993 - * The Regents of the University of California. All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * Kenneth Almquist. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)trap.h 8.3 (Berkeley) 6/5/95 - * $FreeBSD: releng/12.1/bin/sh/trap.h 326025 2017-11-20 19:49:47Z pfg $ - */ - -extern volatile sig_atomic_t pendingsig; -extern volatile sig_atomic_t pendingsig_waitcmd; - -void clear_traps(void); -int have_traps(void); -void setsignal(int); -void ignoresig(int); -int issigchldtrapped(void); -void onsig(int); -void dotrap(void); -void setinteractive(void); -void exitshell(int) __attribute__((noreturn)); -void exitshell_savedstatus(void) __attribute__((noreturn)); diff --git a/bin/1sh/var.c b/bin/1sh/var.c deleted file mode 100644 index 44742169..00000000 --- a/bin/1sh/var.c +++ /dev/null @@ -1,983 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-3-Clause - * - * Copyright (c) 1991, 1993 - * The Regents of the University of California. All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * Kenneth Almquist. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#ifndef lint -#if 0 -static char sccsid[] = "@(#)var.c 8.3 (Berkeley) 5/4/95"; -#endif -#endif /* not lint */ -#include <sys/cdefs.h> -/* $FreeBSD: releng/12.1/bin/sh/var.c 329221 2018-02-13 16:48:57Z bdrewery $ */ - -#include <unistd.h> -#include <stdlib.h> -#include <paths.h> - -/* - * Shell variables. - */ - -#include <locale.h> -#include <langinfo.h> - -#include "shell.h" -#include "output.h" -#include "expand.h" -#include "nodes.h" /* for other headers */ -#include "eval.h" /* defines cmdenviron */ -#include "exec.h" -#include "syntax.h" -#include "options.h" -#include "mail.h" -#include "var.h" -#include "memalloc.h" -#include "error.h" -#include "mystring.h" -#include "parser.h" -#include "builtins.h" -#ifndef NO_HISTORY -#include "myhistedit.h" -#endif - - -#ifndef VTABSIZE -#define VTABSIZE 39 -#endif - - -struct varinit { - struct var *var; - int flags; - const char *text; - void (*func)(const char *); -}; - - -#ifndef NO_HISTORY -struct var vhistfile; -struct var vhistsize; -struct var vterm; -#endif -struct var vifs; -struct var vmail; -struct var vmpath; -struct var vpath; -struct var vps0; -struct var vps1; -struct var vps2; -struct var vps4; -struct var vrps1; -struct var vrps2; -static struct var voptind; -struct var vdisvfork; - -struct localvar *localvars; -int forcelocal; - -static const struct varinit varinit[] = { -#ifndef NO_HISTORY - { &vhistfile, VUNSET, "HISTFILE=", - sethistfile }, - { &vhistsize, VUNSET, "HISTSIZE=", - sethistsize }, -#endif - { &vifs, 0, "IFS= \t\n", - NULL }, - { &vmail, VUNSET, "MAIL=", - NULL }, - { &vmpath, VUNSET, "MAILPATH=", - NULL }, - { &vpath, 0, "PATH=" _PATH_DEFPATH, - changepath }, - { &vps0, VUNSET, "PS0=", - NULL }, - /* - * vps1 depends on uid - */ - { &vps2, 0, "PS2=> ", - NULL }, - { &vps4, 0, "PS4=+ ", - NULL }, - { &vrps1, VUNSET, "RPS1=", - NULL }, - { &vrps2, VUNSET, "RPS2=", - NULL }, -#ifndef NO_HISTORY - { &vterm, VUNSET, "TERM=", - setterm }, -#endif - { &voptind, 0, "OPTIND=1", - getoptsreset }, - { &vdisvfork, VUNSET, "SH_DISABLE_VFORK=", - NULL }, - { NULL, 0, NULL, - NULL } -}; - -static struct var *vartab[VTABSIZE]; - -static const char *const locale_names[7] = { - "LC_COLLATE", "LC_CTYPE", "LC_MONETARY", - "LC_NUMERIC", "LC_TIME", "LC_MESSAGES", NULL -}; -static const int locale_categories[7] = { - LC_COLLATE, LC_CTYPE, LC_MONETARY, LC_NUMERIC, LC_TIME, LC_MESSAGES, 0 -}; - -static int varequal(const char *, const char *); -static struct var *find_var(const char *, struct var ***, int *); -static int localevar(const char *); -static void setvareq_const(const char *s, int flags); - -extern char **environ; - -/* - * This routine initializes the builtin variables and imports the environment. - * It is called when the shell is initialized. - */ - -void -initvar(void) -{ - char ppid[20]; - const struct varinit *ip; - struct var *vp; - struct var **vpp; - char **envp; - - for (ip = varinit ; (vp = ip->var) != NULL ; ip++) { - if (find_var(ip->text, &vpp, &vp->name_len) != NULL) - continue; - vp->next = *vpp; - *vpp = vp; - vp->text = (char *)(ip->text); - vp->flags = ip->flags | VSTRFIXED | VTEXTFIXED; - vp->func = ip->func; - } - /* - * PS1 depends on uid - */ - if (find_var("PS1", &vpp, &vps1.name_len) == NULL) { - vps1.next = *vpp; - *vpp = &vps1; - vps1.text = (char *)(geteuid() ? "PS1=$ " : "PS1=# "); - vps1.flags = VSTRFIXED|VTEXTFIXED; - } - fmtstr(ppid, sizeof(ppid), "%d", (int)getppid()); - setvarsafe("PPID", ppid, 0); - for (envp = environ ; *envp ; envp++) { - if (strchr(*envp, '=')) { - setvareq(*envp, VEXPORT|VTEXTFIXED); - } - } - setvareq_const("OPTIND=1", 0); - setvareq_const("IFS= \t\n", 0); -} - -/* - * Safe version of setvar, returns 1 on success 0 on failure. - */ - -int -setvarsafe(const char *name, const char *val, int flags) -{ - struct jmploc jmploc; - struct jmploc *const savehandler = handler; - int err = 0; - int inton; - - inton = is_int_on(); - if (setjmp(jmploc.loc)) - err = 1; - else { - handler = &jmploc; - setvar(name, val, flags); - } - handler = savehandler; - SETINTON(inton); - return err; -} - -/* - * Set the value of a variable. The flags argument is stored with the - * flags of the variable. If val is NULL, the variable is unset. - */ - -void -setvar(const char *name, const char *val, int flags) -{ - const char *p; - size_t len; - size_t namelen; - size_t vallen; - char *nameeq; - int isbad; - - isbad = 0; - p = name; - if (! is_name(*p)) - isbad = 1; - p++; - for (;;) { - if (! is_in_name(*p)) { - if (*p == '\0' || *p == '=') - break; - isbad = 1; - } - p++; - } - namelen = p - name; - if (isbad) - error("%.*s: bad variable name", (int)namelen, name); - len = namelen + 2; /* 2 is space for '=' and '\0' */ - if (val == NULL) { - flags |= VUNSET; - vallen = 0; - } else { - vallen = strlen(val); - len += vallen; - } - INTOFF; - nameeq = ckmalloc(len); - memcpy(nameeq, name, namelen); - nameeq[namelen] = '='; - if (val) - memcpy(nameeq + namelen + 1, val, vallen + 1); - else - nameeq[namelen + 1] = '\0'; - setvareq(nameeq, flags); - INTON; -} - -static int -localevar(const char *s) -{ - const char *const *ss; - - if (*s != 'L') - return 0; - if (varequal(s + 1, "ANG")) - return 1; - if (strncmp(s + 1, "C_", 2) != 0) - return 0; - if (varequal(s + 3, "ALL")) - return 1; - for (ss = locale_names; *ss ; ss++) - if (varequal(s + 3, *ss + 3)) - return 1; - return 0; -} - - -/* - * Sets/unsets an environment variable from a pointer that may actually be a - * pointer into environ where the string should not be manipulated. - */ -static void -change_env(const char *s, int set) -{ - char *eqp; - char *ss; - - INTOFF; - ss = savestr(s); - if ((eqp = strchr(ss, '=')) != NULL) - *eqp = '\0'; - if (set && eqp != NULL) - (void) setenv(ss, eqp + 1, 1); - else - (void) unsetenv(ss); - ckfree(ss); - INTON; - - return; -} - - -/* - * Same as setvar except that the variable and value are passed in - * the first argument as name=value. Since the first argument will - * be actually stored in the table, it should not be a string that - * will go away. - */ - -void -setvareq(char *s, int flags) -{ - struct var *vp, **vpp; - int nlen; - - if (aflag) - flags |= VEXPORT; - if (forcelocal && !(flags & (VNOSET | VNOLOCAL))) - mklocal(s); - vp = find_var(s, &vpp, &nlen); - if (vp != NULL) { - if (vp->flags & VREADONLY) { - if ((flags & (VTEXTFIXED|VSTACK)) == 0) - ckfree(s); - error("%.*s: is read only", vp->name_len, vp->text); - } - if (flags & VNOSET) { - if ((flags & (VTEXTFIXED|VSTACK)) == 0) - ckfree(s); - return; - } - INTOFF; - - if (vp->func && (flags & VNOFUNC) == 0) - (*vp->func)(s + vp->name_len + 1); - - if ((vp->flags & (VTEXTFIXED|VSTACK)) == 0) - ckfree(vp->text); - - vp->flags &= ~(VTEXTFIXED|VSTACK|VUNSET); - vp->flags |= flags; - vp->text = s; - - /* - * We could roll this to a function, to handle it as - * a regular variable function callback, but why bother? - * - * Note: this assumes iflag is not set to 1 initially. - * As part of initvar(), this is called before arguments - * are looked at. - */ - if ((vp == &vmpath || (vp == &vmail && ! mpathset())) && - iflag == 1) - chkmail(1); - if ((vp->flags & VEXPORT) && localevar(s)) { - change_env(s, 1); - (void) setlocale(LC_ALL, ""); - updatecharset(); - } - INTON; - return; - } - /* not found */ - if (flags & VNOSET) { - if ((flags & (VTEXTFIXED|VSTACK)) == 0) - ckfree(s); - return; - } - INTOFF; - vp = ckmalloc(sizeof (*vp)); - vp->flags = flags; - vp->text = s; - vp->name_len = nlen; - vp->next = *vpp; - vp->func = NULL; - *vpp = vp; - if ((vp->flags & VEXPORT) && localevar(s)) { - change_env(s, 1); - (void) setlocale(LC_ALL, ""); - updatecharset(); - } - INTON; -} - - -static void -setvareq_const(const char *s, int flags) -{ - setvareq((char *)(s), flags | VTEXTFIXED); -} - - -/* - * Process a linked list of variable assignments. - */ - -void -listsetvar(struct arglist *list, int flags) -{ - int i; - - INTOFF; - for (i = 0; i < list->count; i++) - setvareq(savestr(list->args[i]), flags); - INTON; -} - - - -/* - * Find the value of a variable. Returns NULL if not set. - */ - -char * -lookupvar(const char *name) -{ - struct var *v; - - v = find_var(name, NULL, NULL); - if (v == NULL || v->flags & VUNSET) - return NULL; - return v->text + v->name_len + 1; -} - - - -/* - * Search the environment of a builtin command. If the second argument - * is nonzero, return the value of a variable even if it hasn't been - * exported. - */ - -char * -bltinlookup(const char *name, int doall) -{ - struct var *v; - char *result; - int i; - - result = NULL; - if (cmdenviron) for (i = 0; i < cmdenviron->count; i++) { - if (varequal(cmdenviron->args[i], name)) - result = strchr(cmdenviron->args[i], '=') + 1; - } - if (result != NULL) - return result; - - v = find_var(name, NULL, NULL); - if (v == NULL || v->flags & VUNSET || - (!doall && (v->flags & VEXPORT) == 0)) - return NULL; - return v->text + v->name_len + 1; -} - - -/* - * Set up locale for a builtin (LANG/LC_* assignments). - */ -void -bltinsetlocale(void) -{ - int act = 0; - char *loc, *locdef; - int i; - - if (cmdenviron) for (i = 0; i < cmdenviron->count; i++) { - if (localevar(cmdenviron->args[i])) { - act = 1; - break; - } - } - if (!act) - return; - loc = bltinlookup("LC_ALL", 0); - INTOFF; - if (loc != NULL) { - setlocale(LC_ALL, loc); - INTON; - updatecharset(); - return; - } - locdef = bltinlookup("LANG", 0); - for (i = 0; locale_names[i] != NULL; i++) { - loc = bltinlookup(locale_names[i], 0); - if (loc == NULL) - loc = locdef; - if (loc != NULL) - setlocale(locale_categories[i], loc); - } - INTON; - updatecharset(); -} - -/* - * Undo the effect of bltinlocaleset(). - */ -void -bltinunsetlocale(void) -{ - int i; - - INTOFF; - if (cmdenviron) for (i = 0; i < cmdenviron->count; i++) { - if (localevar(cmdenviron->args[i])) { - setlocale(LC_ALL, ""); - updatecharset(); - break; - } - } - INTON; -} - -/* - * Update the localeisutf8 flag. - */ -void -updatecharset(void) -{ - char *charset; - - charset = nl_langinfo(CODESET); - localeisutf8 = !strcmp(charset, "UTF-8"); -} - -void -initcharset(void) -{ - updatecharset(); - initial_localeisutf8 = localeisutf8; -} - -/* - * Generate a list of exported variables. This routine is used to construct - * the third argument to execve when executing a program. - */ - -char ** -environment(void) -{ - int nenv; - struct var **vpp; - struct var *vp; - char **env, **ep; - - nenv = 0; - for (vpp = vartab ; vpp < vartab + VTABSIZE ; vpp++) { - for (vp = *vpp ; vp ; vp = vp->next) - if (vp->flags & VEXPORT) - nenv++; - } - ep = env = stalloc((nenv + 1) * sizeof *env); - for (vpp = vartab ; vpp < vartab + VTABSIZE ; vpp++) { - for (vp = *vpp ; vp ; vp = vp->next) - if (vp->flags & VEXPORT) - *ep++ = vp->text; - } - *ep = NULL; - return env; -} - - -static int -var_compare(const void *a, const void *b) -{ - const char *const *sa, *const *sb; - - sa = a; - sb = b; - /* - * This compares two var=value strings which creates a different - * order from what you would probably expect. POSIX is somewhat - * ambiguous on what should be sorted exactly. - */ - return strcoll(*sa, *sb); -} - - -/* - * Command to list all variables which are set. This is invoked from the - * set command when it is called without any options or operands. - */ - -int -showvarscmd(int argc __unused, char **argv __unused) -{ - struct var **vpp; - struct var *vp; - const char *s; - const char **vars; - int i, n; - - /* - * POSIX requires us to sort the variables. - */ - n = 0; - for (vpp = vartab; vpp < vartab + VTABSIZE; vpp++) { - for (vp = *vpp; vp; vp = vp->next) { - if (!(vp->flags & VUNSET)) - n++; - } - } - - INTOFF; - vars = ckmalloc(n * sizeof(*vars)); - i = 0; - for (vpp = vartab; vpp < vartab + VTABSIZE; vpp++) { - for (vp = *vpp; vp; vp = vp->next) { - if (!(vp->flags & VUNSET)) - vars[i++] = vp->text; - } - } - - qsort(vars, n, sizeof(*vars), var_compare); - for (i = 0; i < n; i++) { - /* - * Skip improper variable names so the output remains usable as - * shell input. - */ - if (!isassignment(vars[i])) - continue; - s = strchr(vars[i], '='); - s++; - outbin(vars[i], s - vars[i], out1); - out1qstr(s); - out1c('\n'); - } - ckfree(vars); - INTON; - - return 0; -} - - - -/* - * The export and readonly commands. - */ - -int -exportcmd(int argc __unused, char **argv) -{ - struct var **vpp; - struct var *vp; - char **ap; - char *name; - char *p; - char *cmdname; - int ch, values; - int flag = argv[0][0] == 'r'? VREADONLY : VEXPORT; - - cmdname = argv[0]; - values = 0; - while ((ch = nextopt("p")) != '\0') { - switch (ch) { - case 'p': - values = 1; - break; - } - } - - if (values && *argptr != NULL) - error("-p requires no arguments"); - if (*argptr != NULL) { - for (ap = argptr; (name = *ap) != NULL; ap++) { - if ((p = strchr(name, '=')) != NULL) { - p++; - } else { - vp = find_var(name, NULL, NULL); - if (vp != NULL) { - vp->flags |= flag; - if ((vp->flags & VEXPORT) && localevar(vp->text)) { - change_env(vp->text, 1); - (void) setlocale(LC_ALL, ""); - updatecharset(); - } - continue; - } - } - setvar(name, p, flag); - } - } else { - for (vpp = vartab ; vpp < vartab + VTABSIZE ; vpp++) { - for (vp = *vpp ; vp ; vp = vp->next) { - if (vp->flags & flag) { - if (values) { - /* - * Skip improper variable names - * so the output remains usable - * as shell input. - */ - if (!isassignment(vp->text)) - continue; - out1str(cmdname); - out1c(' '); - } - if (values && !(vp->flags & VUNSET)) { - outbin(vp->text, - vp->name_len + 1, out1); - out1qstr(vp->text + - vp->name_len + 1); - } else - outbin(vp->text, vp->name_len, - out1); - out1c('\n'); - } - } - } - } - return 0; -} - - -/* - * The "local" command. - */ - -int -localcmd(int argc __unused, char **argv __unused) -{ - char *name; - - nextopt(""); - if (! in_function()) - error("Not in a function"); - while ((name = *argptr++) != NULL) { - mklocal(name); - } - return 0; -} - - -/* - * Make a variable a local variable. When a variable is made local, it's - * value and flags are saved in a localvar structure. The saved values - * will be restored when the shell function returns. We handle the name - * "-" as a special case. - */ - -void -mklocal(char *name) -{ - struct localvar *lvp; - struct var **vpp; - struct var *vp; - - INTOFF; - lvp = ckmalloc(sizeof (struct localvar)); - if (name[0] == '-' && name[1] == '\0') { - lvp->text = ckmalloc(sizeof optval); - memcpy(lvp->text, optval, sizeof optval); - vp = NULL; - } else { - vp = find_var(name, &vpp, NULL); - if (vp == NULL) { - if (strchr(name, '=')) - setvareq(savestr(name), VSTRFIXED | VNOLOCAL); - else - setvar(name, NULL, VSTRFIXED | VNOLOCAL); - vp = *vpp; /* the new variable */ - lvp->text = NULL; - lvp->flags = VUNSET; - } else { - lvp->text = vp->text; - lvp->flags = vp->flags; - vp->flags |= VSTRFIXED|VTEXTFIXED; - if (name[vp->name_len] == '=') - setvareq(savestr(name), VNOLOCAL); - } - } - lvp->vp = vp; - lvp->next = localvars; - localvars = lvp; - INTON; -} - - -/* - * Called after a function returns. - */ - -void -poplocalvars(void) -{ - struct localvar *lvp; - struct var *vp; - int islocalevar; - - INTOFF; - while ((lvp = localvars) != NULL) { - localvars = lvp->next; - vp = lvp->vp; - if (vp == NULL) { /* $- saved */ - memcpy(optval, lvp->text, sizeof optval); - ckfree(lvp->text); - optschanged(); - } else if ((lvp->flags & (VUNSET|VSTRFIXED)) == VUNSET) { - vp->flags &= ~VREADONLY; - (void)unsetvar(vp->text); - } else { - islocalevar = (vp->flags | lvp->flags) & VEXPORT && - localevar(lvp->text); - if ((vp->flags & VTEXTFIXED) == 0) - ckfree(vp->text); - vp->flags = lvp->flags; - vp->text = lvp->text; - if (vp->func) - (*vp->func)(vp->text + vp->name_len + 1); - if (islocalevar) { - change_env(vp->text, vp->flags & VEXPORT && - (vp->flags & VUNSET) == 0); - setlocale(LC_ALL, ""); - updatecharset(); - } - } - ckfree(lvp); - } - INTON; -} - - -int -setvarcmd(int argc, char **argv) -{ - if (argc <= 2) - return unsetcmd(argc, argv); - else if (argc == 3) - setvar(argv[1], argv[2], 0); - else - error("too many arguments"); - return 0; -} - - -/* - * The unset builtin command. - */ - -int -unsetcmd(int argc __unused, char **argv __unused) -{ - char **ap; - int i; - int flg_func = 0; - int flg_var = 0; - int ret = 0; - - while ((i = nextopt("vf")) != '\0') { - if (i == 'f') - flg_func = 1; - else - flg_var = 1; - } - if (flg_func == 0 && flg_var == 0) - flg_var = 1; - - INTOFF; - for (ap = argptr; *ap ; ap++) { - if (flg_func) - ret |= unsetfunc(*ap); - if (flg_var) - ret |= unsetvar(*ap); - } - INTON; - return ret; -} - - -/* - * Unset the specified variable. - * Called with interrupts off. - */ - -int -unsetvar(const char *s) -{ - struct var **vpp; - struct var *vp; - - vp = find_var(s, &vpp, NULL); - if (vp == NULL) - return (0); - if (vp->flags & VREADONLY) - return (1); - if (vp->text[vp->name_len + 1] != '\0') - setvar(s, "", 0); - if ((vp->flags & VEXPORT) && localevar(vp->text)) { - change_env(s, 0); - setlocale(LC_ALL, ""); - updatecharset(); - } - vp->flags &= ~VEXPORT; - vp->flags |= VUNSET; - if ((vp->flags & VSTRFIXED) == 0) { - if ((vp->flags & VTEXTFIXED) == 0) - ckfree(vp->text); - *vpp = vp->next; - ckfree(vp); - } - return (0); -} - - - -/* - * Returns true if the two strings specify the same variable. The first - * variable name is terminated by '='; the second may be terminated by - * either '=' or '\0'. - */ - -static int -varequal(const char *p, const char *q) -{ - while (*p == *q++) { - if (*p++ == '=') - return 1; - } - if (*p == '=' && *(q - 1) == '\0') - return 1; - return 0; -} - -/* - * Search for a variable. - * 'name' may be terminated by '=' or a NUL. - * vppp is set to the pointer to vp, or the list head if vp isn't found - * lenp is set to the number of characters in 'name' - */ - -static struct var * -find_var(const char *name, struct var ***vppp, int *lenp) -{ - unsigned int hashval; - int len; - struct var *vp, **vpp; - const char *p = name; - - hashval = 0; - while (*p && *p != '=') - hashval = 2 * hashval + (unsigned char)*p++; - len = p - name; - - if (lenp) - *lenp = len; - vpp = &vartab[hashval % VTABSIZE]; - if (vppp) - *vppp = vpp; - - for (vp = *vpp ; vp ; vpp = &vp->next, vp = *vpp) { - if (vp->name_len != len) - continue; - if (memcmp(vp->text, name, len) != 0) - continue; - if (vppp) - *vppp = vpp; - return vp; - } - return NULL; -} diff --git a/bin/1sh/var.h b/bin/1sh/var.h deleted file mode 100644 index d06d8688..00000000 --- a/bin/1sh/var.h +++ /dev/null @@ -1,140 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-3-Clause - * - * Copyright (c) 1991, 1993 - * The Regents of the University of California. All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * Kenneth Almquist. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)var.h 8.2 (Berkeley) 5/4/95 - * $FreeBSD: releng/12.1/bin/sh/var.h 326025 2017-11-20 19:49:47Z pfg $ - */ - -/* - * Shell variables. - */ - -/* flags */ -#define VEXPORT 0x01 /* variable is exported */ -#define VREADONLY 0x02 /* variable cannot be modified */ -#define VSTRFIXED 0x04 /* variable struct is statically allocated */ -#define VTEXTFIXED 0x08 /* text is statically allocated */ -#define VSTACK 0x10 /* text is allocated on the stack */ -#define VUNSET 0x20 /* the variable is not set */ -#define VNOFUNC 0x40 /* don't call the callback function */ -#define VNOSET 0x80 /* do not set variable - just readonly test */ -#define VNOLOCAL 0x100 /* ignore forcelocal */ - - -struct var { - struct var *next; /* next entry in hash list */ - int flags; /* flags are defined above */ - int name_len; /* length of name */ - char *text; /* name=value */ - void (*func)(const char *); - /* function to be called when */ - /* the variable gets set/unset */ -}; - - -struct localvar { - struct localvar *next; /* next local variable in list */ - struct var *vp; /* the variable that was made local */ - int flags; /* saved flags */ - char *text; /* saved text */ -}; - - -extern struct localvar *localvars; -extern int forcelocal; - -extern struct var vifs; -extern struct var vmail; -extern struct var vmpath; -extern struct var vpath; -extern struct var vps0; -extern struct var vps1; -extern struct var vps2; -extern struct var vps4; -extern struct var vrps1; -extern struct var vrps2; -extern struct var vdisvfork; -#ifndef NO_HISTORY -extern struct var vhistfile; -extern struct var vhistsize; -extern struct var vterm; -#endif - -extern int localeisutf8; -/* The parser uses the locale that was in effect at startup. */ -extern int initial_localeisutf8; - -/* - * The following macros access the values of the above variables. - * They have to skip over the name. They return the null string - * for unset variables. - */ - -#define ifsval() (vifs.text + 4) -#define ifsset() ((vifs.flags & VUNSET) == 0) -#define mailval() (vmail.text + 5) -#define mpathval() (vmpath.text + 9) -#define pathval() (vpath.text + 5) -#define ps0val() (vps0.text + 4) -#define ps1val() (vps1.text + 4) -#define ps2val() (vps2.text + 4) -#define ps4val() (vps4.text + 4) -#define rps1val() (vrps1.text + 5) -#define rps2val() (vrps2.text + 5) -#define optindval() (voptind.text + 7) -#ifndef NO_HISTORY -#define histfileval() (vhistfile.text + 9) -#define histsizeval() (vhistsize.text + 9) -#define termval() (vterm.text + 5) -#endif - -#define mpathset() ((vmpath.flags & VUNSET) == 0) -#define disvforkset() ((vdisvfork.flags & VUNSET) == 0) - -void initvar(void); -void setvar(const char *, const char *, int); -void setvareq(char *, int); -struct arglist; -void listsetvar(struct arglist *, int); -char *lookupvar(const char *); -char *bltinlookup(const char *, int); -void bltinsetlocale(void); -void bltinunsetlocale(void); -void updatecharset(void); -void initcharset(void); -char **environment(void); -int showvarscmd(int, char **); -void mklocal(char *); -void poplocalvars(void); -int unsetvar(const char *); -int setvarsafe(const char *, const char *, int); diff --git a/bin/Makefile b/bin/Makefile index 09ec952e..bb1535d6 100644 --- a/bin/Makefile +++ b/bin/Makefile @@ -1,142 +1,142 @@ -PREFIX = ~/.local -MANDIR = ${PREFIX}/share/man +PREFIX ?= ~/.local +MANDIR ?= ${PREFIX}/share/man -LIBS_PREFIX = /usr/local +LIBS_PREFIX ?= /usr/local CFLAGS += -I${LIBS_PREFIX}/include LDFLAGS += -L${LIBS_PREFIX}/lib CFLAGS += -Wall -Wextra -Wpedantic -Wno-gnu-case-range -LDLIBS.dtch = -lutil -LDLIBS.glitch = -lz -LDLIBS.hnel = -lutil -LDLIBS.modem = -lutil -LDLIBS.pngo = -lz -LDLIBS.ptee = -lutil -LDLIBS.relay = -ltls -LDLIBS.scheme = -lm -LDLIBS.title = -lcurl - --include config.mk BINS += beef +BINS += bibsort BINS += bit BINS += c +BINS += dehtml BINS += dtch -BINS += edit +BINS += enc +BINS += git-comment BINS += glitch -BINS += hi -BINS += hnel +BINS += hilex +BINS += htagml BINS += modem +BINS += mtags +BINS += nudge BINS += order BINS += pbd BINS += pngo BINS += psf2png BINS += ptee +BINS += qf +BINS += quick BINS += scheme BINS += shotty +BINS += sup BINS += title -BINS += ttpre BINS += up BINS += when BINS += xx -LINKS += open -LINKS += pbcopy -LINKS += pbpaste +BSD += ever -BINS_BSD += ever -BINS_LINUX += bri -BINS_LINUX += fbatt -BINS_LINUX += fbclock -BINS_LINUX += psfed -BINS_TLS += relay +GAMES += freecell -BINS_ALL = ${BINS} ${BINS_BSD} ${BINS_LINUX} ${BINS_TLS} -MANS_ALL = ${BINS_ALL:%=man1/%.1} +TLS += downgrade +TLS += relay -any: meta ${BINS} ${LINKS} +MANS = ${BINS:%=man1/%.1} +MANS.BSD = ${BSD:%=man1/%.1} +MANS.GAMES = ${GAMES:%=man6/%.6} +MANS.TLS = ${TLS:%=man1/%.1} -bsd: meta ${BINS_BSD} - -linux: meta ${BINS_LINUX} - -tls: meta ${BINS_TLS} - -meta: .gitignore tags +LDLIBS.downgrade = -ltls +LDLIBS.dtch = -lutil +LDLIBS.fbclock = -lz +LDLIBS.freecell = -lcurses +LDLIBS.glitch = -lz +LDLIBS.modem = -lutil +LDLIBS.pngo = -lz +LDLIBS.ptee = -lutil +LDLIBS.qf = -lcurses +LDLIBS.relay = -ltls +LDLIBS.scheme = -lm +LDLIBS.title = -lcurl +LDLIBS.typer = -ltls -.c: - ${CC} ${CFLAGS} ${LDFLAGS} $< ${LDLIBS.$@} -o $@ +ALL ?= meta any -.o: - ${CC} ${LDFLAGS} $< ${LDLIBS.$@} -o $@ +-include config.mk -hi: hi.c - ${CC} ${CFLAGS} ${LDFLAGS} hi.c ${LDLIBS.$@} -o $@ - ./hi -c +all: ${ALL} -open pbcopy pbpaste: pbd - ln -f pbd $@ +meta: .gitignore tags -fbatt.o fbclock.o: scheme.h +any: ${BINS} -psf2png.o scheme.o: png.h +bsd: ${BSD} -scheme.h: scheme - ./scheme -c > scheme.h +games: ${GAMES} -tags: *.h *.c - ctags -w *.h *.c +tls: ${TLS} -IGNORE = *.o *.html ${BINS_ALL} ${LINKS} scheme.h tags +IGNORE = *.o *.html +IGNORE += ${BINS} ${BSD} ${GAMES} ${TLS} +IGNORE += tags htmltags .gitignore: Makefile - echo config.mk '${IGNORE}' | tr ' ' '\n' | sort > .gitignore + echo config.mk '${IGNORE}' | tr ' ' '\n' | sort > $@ + +tags: *.[chly] + ctags -w *.[chly] clean: rm -f ${IGNORE} -setuid: bri - chown root bri - chmod u+s bri +install: ${ALL:%=install-%} -link: +install-meta: install -d ${PREFIX}/bin ${MANDIR}/man1 - ln -fs ${BINS_ALL:%=${PWD}/%} ${PREFIX}/bin - ln -fs ${MANS_ALL:%=${PWD}/%} ${MANDIR}/man1 - ln -fs ${LINKS:%=${PWD}/%} ${PREFIX}/bin -unlink: - rm -f ${BINS_ALL:%=${PREFIX}/bin/%} - rm -f ${MANS_ALL:%=${MANDIR}/%} - rm -f ${LINKS:%=${PREFIX}/bin/%} +install-any: install-meta ${BINS} ${MANS} + install ${BINS} ${PREFIX}/bin + install -m 644 ${MANS} ${MANDIR}/man1 -HTMLS = index.html ${BINS_ALL:=.html} png.html -WEBROOT = /usr/local/www/causal.agency +install-bsd: install-meta ${BSD} ${MANS.BSD} + install ${BSD} ${PREFIX}/bin + install -m 644 ${MANS.BSD} ${MANDIR}/man1 -html: ${HTMLS} - @true +install-games: install-meta ${GAMES} ${MANS.GAMES} + install ${GAMES} ${PREFIX}/bin + install -m 644 ${MANS.GAMES} ${MANDIR}/man6 -${HTMLS}: html.sh hi ttpre +install-tls: install-meta ${TLS} ${MANS.TLS} + install ${TLS} ${PREFIX}/bin + install -m 644 ${MANS.TLS} ${MANDIR}/man1 -.SUFFIXES: .html +uninstall: + rm -f ${BINS:%=${PREFIX}/bin/%} ${MANS:%=${MANDIR}/%} + rm -f ${BSD:%=${PREFIX}/bin/%} ${MANS.BSD:%=${MANDIR}/%} + rm -f ${GAMES:%=${PREFIX}/bin/%} ${MANS.GAMES:%=${MANDIR}/%} + rm -f ${TLS:%=${PREFIX}/bin/%} ${MANS.TLS:%=${MANDIR}/%} -.c.html: - sh html.sh $< man1/${<:.c=.1} > $@ +.SUFFIXES: .pl -.h.html: - sh html.sh $< man3/${<:.h=.3} > $@ +.c: + ${CC} ${CFLAGS} ${LDFLAGS} $< ${LDLIBS.$@} -o $@ -.sh.html: - sh html.sh $< man1/${<:.sh=.1} > $@ +.o: + ${CC} ${LDFLAGS} $< ${LDLIBS.$@} -o $@ -.y.html: - sh html.sh $< man1/${<:.y=.1} > $@ +.pl: + cp -f $< $@ + chmod a+x $@ -index.html: Makefile README.7 - sh html.sh Makefile README.7 \ - | sed -E 's,([a-z0-9-]+)[(][1-9][)],<a href="\1.html">&</a>,' \ - > index.html +OBJS.hilex = c11.o hilex.o make.o mdoc.o sh.o + +hilex: ${OBJS.hilex} + ${CC} ${LDFLAGS} ${OBJS.$@} ${LDLIBS.$@} -o $@ + +${OBJS.hilex}: hilex.h + +psf2png.o scheme.o: png.h -install-html: ${HTMLS} - install -d ${WEBROOT}/bin - install -C -m 644 ${HTMLS} ${WEBROOT}/bin +include html.mk diff --git a/bin/README.7 b/bin/README.7 index 16d86c67..100e183e 100644 --- a/bin/README.7 +++ b/bin/README.7 @@ -1,4 +1,4 @@ -.Dd June 17, 2020 +.Dd June 2, 2022 .Dt BIN 7 .Os "Causal Agency" . @@ -8,40 +8,46 @@ . .Sh DESCRIPTION Various tools primarily targeting -Darwin, -.Fx -and -.Nx . -Some tools target Linux. +.Fx , +.Ox +and macOS. . .Pp -.Bl -tag -width "fbclock(1)" -compact +.Bl -tag -width "git-comment(1)" -compact .It Xr beef 1 Befunge-93 interpreter +.It Xr bibsort 1 +reformat bibliography .It Xr bit 1 calculator -.It Xr bri 1 -backlight brightness control .It Xr c 1 run C statements +.It Xr dehtml 1 +extract text from HTML +.It Xr downgrade 1 +IRC features for all .It Xr dtch 1 detached sessions -.It Xr edit 1 -interactive script +.It Xr enc 1 +encrypt and decrypt files .It Xr ever 1 watch files -.It Xr fbatt 1 -framebuffer battery indicator -.It Xr fbclock 1 -framebuffer clock +.It Xr freecell 6 +patience game +.It Xr git-comment 1 +add commit comments .It Xr glitch 1 PNG glitcher -.It Xr hi 1 +.It Xr hilex 1 syntax highlighter -.It Xr hnel 1 -PTY input remapper +.It Xr htagml 1 +tags HTMLizer .It Xr modem 1 fixed baud rate wrapper +.It Xr mtags 1 +miscellaneous tags +.It Xr nudge 1 +terminal vibrator .It Xr order 1 operator precedence .It Xr pbd 1 @@ -50,20 +56,22 @@ macOS pasteboard daemon PNG optimizer .It Xr psf2png 1 PSF2 to PNG renderer -.It Xr psfed 1 -PSF2 font editor .It Xr ptee 1 tee for PTYs +.It Xr qf 1 +grep pager +.It Xr quick 1 +terrible HTTP/CGI server .It Xr relay 1 IRC relay bot .It Xr scheme 1 color scheme .It Xr shotty 1 terminal capture +.It Xr sup 1 +single-use passwords .It Xr title 1 page titles -.It Xr ttpre 1 -man output to HTML .It Xr up 1 upload file .It Xr when 1 diff --git a/bin/beef.c b/bin/beef.c index b2579b73..556f3088 100644 --- a/bin/beef.c +++ b/bin/beef.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2019 C. McEnroe <june@causal.agency> +/* Copyright (C) 2019 June McEnroe <june@causal.agency> * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by diff --git a/bin/bibsort.pl b/bin/bibsort.pl new file mode 100644 index 00000000..a4a8956a --- /dev/null +++ b/bin/bibsort.pl @@ -0,0 +1,69 @@ +#!/usr/bin/env perl +use strict; +use warnings; + +while (<>) { + print; + last if /^[.]Sh STANDARDS$/; +} + +my ($ref, @refs); +while (<>) { + next if /^[.](Bl|It|$)/; + last if /^[.]El$/; + if (/^[.]Rs$/) { + $ref = {}; + } elsif (/^[.]%(.) (.*)/) { + $ref->{$1} = [] unless $ref->{$1}; + push @{$ref->{$1}}, $2; + } elsif (/^[.]Re$/) { + push @refs, $ref; + } else { + print; + } +} + +sub byLast { + my ($af, $al) = split /\s(\S+)(,.*)?$/, $a; + my ($bf, $bl) = split /\s(\S+)(,.*)?$/, $b; + ($al // $af) cmp ($bl // $bf) || $af cmp $bf; +} + +foreach $ref (@refs) { + @{$ref->{A}} = sort byLast @{$ref->{A}}; + @{$ref->{Q}} = sort @{$ref->{Q}} if $ref->{Q}; + if ($ref->{N} && $ref->{N}[0] =~ /RFC/) { + $ref->{R} = $ref->{N}; + delete $ref->{N}; + } + if ($ref->{R} && $ref->{R}[0] =~ /RFC (\d+)/ && !$ref->{U}) { + $ref->{U} = ["https://tools.ietf.org/html/rfc${1}"]; + } +} + +sub byAuthor { + my ($ta, $tb) = ($a->{T}[0], $b->{T}[0]); + local ($a, $b) = ($a->{A}[0], $b->{A}[0]); + byLast() || $ta cmp $tb; +} + +{ + local ($,, $\) = (' ', "\n"); + print '.Bl', '-item'; + foreach $ref (sort byAuthor @refs) { + print '.It'; + print '.Rs'; + foreach my $key (qw(A T B I J R N V U P Q C D O)) { + next unless $ref->{$key}; + foreach (@{$ref->{$key}}) { + print ".%${key}", $_; + } + } + print '.Re'; + } + print '.El'; +} + +while (<>) { + print; +} diff --git a/bin/bit.y b/bin/bit.y index 0a9bc7ce..1119bce6 100644 --- a/bin/bit.y +++ b/bin/bit.y @@ -1,4 +1,4 @@ -/* Copyright (C) 2019 C. McEnroe <june@causal.agency> +/* Copyright (C) 2019 June McEnroe <june@causal.agency> * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by @@ -26,15 +26,19 @@ #define MASK(b) ((1ULL << (b)) - 1) -static void yyerror(const char *str); -static int yylex(void); - #define YYSTYPE uint64_t +static int yylex(void); +static void yyerror(const char *str); +static void print(uint64_t val); + static uint64_t vars[128]; %} +%token Int Var + +%left '$' %right '=' %left '|' %left '^' @@ -45,12 +49,12 @@ static uint64_t vars[128]; %right '~' %left 'K' 'M' 'G' 'T' -%token Int Var - %% stmt: - expr { vars['_'] = $1; } + | stmt expr '\n' { print(vars['_'] = $2); printf("\n"); } + | stmt expr ',' { print(vars['_'] = $2); } + | stmt '\n' ; expr: @@ -62,7 +66,9 @@ expr: | expr 'G' { $$ = $1 << 30; } | expr 'T' { $$ = $1 << 40; } | '~' expr { $$ = ~$2; } - | '-' expr { $$ = -$2; } + | '&' expr %prec '~' { $$ = MASK($2); } + | '+' expr %prec '~' { $$ = +$2; } + | '-' expr %prec '~' { $$ = -$2; } | expr '*' expr { $$ = $1 * $3; } | expr '/' expr { $$ = $1 / $3; } | expr '%' expr { $$ = $1 % $3; } @@ -75,33 +81,26 @@ expr: | expr '^' expr { $$ = $1 ^ $3; } | expr '|' expr { $$ = $1 | $3; } | Var '=' expr { $$ = vars[$1] = $3; } + | expr '$' { $$ = $1; } ; %% -static void yyerror(const char *str) { - warnx("%s", str); -} - -#define T(a, b) ((int)(a) << 8 | (int)(b)) - -static const char *input; - static int lexInt(uint64_t base) { - for (yylval = 0; input[0]; ++input) { - uint64_t digit; - if (input[0] == '_') { + yylval = 0; + for (int ch; EOF != (ch = getchar());) { + uint64_t digit = base; + if (ch == '_') { continue; - } else if (input[0] >= '0' && input[0] <= '9') { - digit = input[0] - '0'; - } else if (input[0] >= 'A' && input[0] <= 'F') { - digit = 0xA + input[0] - 'A'; - } else if (input[0] >= 'a' && input[0] <= 'f') { - digit = 0xA + input[0] - 'a'; - } else { + } else if (isdigit(ch)) { + digit = ch - '0'; + } else if (isxdigit(ch)) { + digit = 0xA + toupper(ch) - 'A'; + } + if (digit >= base) { + ungetc(ch, stdin); return Int; } - if (digit >= base) return Int; yylval *= base; yylval += digit; } @@ -109,86 +108,95 @@ static int lexInt(uint64_t base) { } static int yylex(void) { - while (isspace(input[0])) input++; - if (!input[0]) return EOF; - - if (input[0] == '\'' && input[1] && input[2] == '\'') { - yylval = input[1]; - input += 3; + int ch; + while (isblank(ch = getchar())); + if (ch == '\'') { + yylval = 0; + while (EOF != (ch = getchar()) && ch != '\'') { + yylval <<= 8; + yylval |= ch; + } return Int; - } - - if (input[0] == '0') { - if (input[1] == 'b') { - input += 2; + } else if (ch == '0') { + ch = getchar(); + if (ch == 'b') { return lexInt(2); - } else if (input[1] == 'x') { - input += 2; + } else if (ch == 'x') { return lexInt(16); } else { - input += 1; + ungetc(ch, stdin); return lexInt(8); } - } else if (isdigit(input[0])) { + } else if (isdigit(ch)) { + ungetc(ch, stdin); return lexInt(10); - } - - if (input[0] == '_' || islower(input[0])) { - yylval = *input++; + } else if (ch == '_' || islower(ch)) { + yylval = ch; return Var; - } - - switch (T(input[0], input[1])) { - case T('<', '<'): input += 2; return Shl; - case T('>', '>'): input += 2; return Shr; - case T('-', '>'): input += 2; return Sar; - default: return *input++; + } else if (ch == '<') { + char ne = getchar(); + if (ne == '<') { + return Shl; + } else { + ungetc(ne, stdin); + return ch; + } + } else if (ch == '-' || ch == '>') { + char ne = getchar(); + if (ne == '>') { + return (ch == '-' ? Sar : Shr); + } else { + ungetc(ne, stdin); + return ch; + } + } else { + return ch; } } -int main(void) { - char *line = NULL; - size_t cap = 0; - while (0 < getline(&line, &cap, stdin)) { - if (line[0] == '\n') continue; - - input = line; - int error = yyparse(); - if (error) continue; - - uint64_t result = vars['_']; - - int bits = result > UINT32_MAX ? 64 - : result > UINT16_MAX ? 32 - : result > UINT8_MAX ? 16 - : 8; - - printf("0x%0*"PRIX64" %"PRId64"", bits >> 2, result, (int64_t)result); - - if (bits == 8) { - char bin[9] = {0}; - for (int i = 0; i < 8; ++i) { - bin[i] = '0' + (result >> (7 - i) & 1); - } - printf(" 0b%s", bin); - } +static void yyerror(const char *str) { + warnx("%s", str); +} - if (result < 128 && isprint(result)) { - printf(" '%c'", (char)result); +static const char *Codes[128] = { + "NUL", "SOH", "STX", "ETX", "EOT", "ENQ", "ACK", "BEL", + "BS", "HT", "NL", "VT", "NP", "CR", "SO", "SI", + "DLE", "DC1", "DC2", "DC3", "DC4", "NAK", "SYN", "ETB", + "CAN", "EM", "SUB", "ESC", "FS", "GS", "RS", "US", + [127] = "DEL", +}; + +static void print(uint64_t val) { + int bits = val > UINT32_MAX ? 64 + : val > UINT16_MAX ? 32 + : val > UINT8_MAX ? 16 + : 8; + printf("0x%0*"PRIX64" %"PRId64"", bits >> 2, val, (int64_t)val); + if (bits == 8) { + char bin[9] = {0}; + for (int i = 0; i < 8; ++i) { + bin[i] = '0' + (val >> (7 - i) & 1); } - - if (result) { - if (!(result & MASK(40))) { - printf(" %"PRIu64"T", result >> 40); - } else if (!(result & MASK(30))) { - printf(" %"PRIu64"G", result >> 30); - } else if (!(result & MASK(20))) { - printf(" %"PRIu64"M", result >> 20); - } else if (!(result & MASK(10))) { - printf(" %"PRIu64"K", result >> 10); - } + printf(" %#"PRIo64" 0b%s", val, bin); + } + if (val < 128) { + if (isprint(val)) printf(" '%c'", (char)val); + if (Codes[val]) printf(" %s", Codes[val]); + } + if (val) { + if (!(val & MASK(40))) { + printf(" %"PRIu64"T", val >> 40); + } else if (!(val & MASK(30))) { + printf(" %"PRIu64"G", val >> 30); + } else if (!(val & MASK(20))) { + printf(" %"PRIu64"M", val >> 20); + } else if (!(val & MASK(10))) { + printf(" %"PRIu64"K", val >> 10); } - - printf("\n\n"); } + printf("\n"); +} + +int main(void) { + while (yyparse()); } diff --git a/bin/bri.c b/bin/bri.c deleted file mode 100644 index 81df2995..00000000 --- a/bin/bri.c +++ /dev/null @@ -1,85 +0,0 @@ -/* Copyright (C) 2017 C. McEnroe <june@causal.agency> - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -#include <dirent.h> -#include <err.h> -#include <errno.h> -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <sysexits.h> -#include <unistd.h> - -typedef unsigned uint; - -static const char *Class = "/sys/class/backlight"; - -int main(int argc, char *argv[]) { - int error; - - const char *input = (argc > 1) ? argv[1] : NULL; - - error = chdir(Class); - if (error) err(EX_OSFILE, "%s", Class); - - DIR *dir = opendir("."); - if (!dir) err(EX_OSFILE, "%s", Class); - - struct dirent *entry; - while (NULL != (errno = 0, entry = readdir(dir))) { - if (entry->d_name[0] == '.') continue; - - error = chdir(entry->d_name); - if (error) err(EX_OSFILE, "%s/%s", Class, entry->d_name); - break; - } - if (!entry) { - if (errno) err(EX_IOERR, "%s", Class); - errx(EX_CONFIG, "%s: empty", Class); - } - - FILE *actual = fopen("actual_brightness", "r"); - if (!actual) err(EX_OSFILE, "actual_brightness"); - - uint value; - int match = fscanf(actual, "%u", &value); - if (match == EOF) err(EX_IOERR, "actual_brightness"); - if (match < 1) errx(EX_DATAERR, "actual_brightness"); - - if (!input) { - printf("%u\n", value); - return EX_OK; - } - - if (input[0] == '+' || input[0] == '-') { - size_t count = strnlen(input, 16); - if (input[0] == '+') { - value += 16 * count; - } else { - value -= 16 * count; - } - } else { - value = strtoul(input, NULL, 0); - } - - FILE *brightness = fopen("brightness", "w"); - if (!brightness) err(EX_OSFILE, "brightness"); - - int size = fprintf(brightness, "%u", value); - if (size < 0) err(EX_IOERR, "brightness"); - - return EX_OK; -} diff --git a/bin/c.sh b/bin/c.sh index 153a2f94..ff059437 100644 --- a/bin/c.sh +++ b/bin/c.sh @@ -2,7 +2,7 @@ set -eu temp=$(mktemp -d) -trap 'rm -r "$temp"' EXIT +trap 'rm -r "${temp}"' EXIT exec 3>>"${temp}/run.c" @@ -23,15 +23,19 @@ cat >&3 <<EOF #include <wchar.h> #include <wctype.h> +#include <dirent.h> #include <fcntl.h> #include <strings.h> #include <unistd.h> EOF -while getopts 'e:i:' opt; do - case "$opt" in +expr= +type= +while getopts 'e:i:t' opt; do + case "${opt}" in (e) expr=$OPTARG;; (i) echo "#include <${OPTARG}>" >&3;; + (t) type=1;; (?) exit 1;; esac done @@ -44,14 +48,45 @@ int main(int argc, char *argv[]) { $*; EOF -if [ -n "${expr:-}" ]; then +if [ -n "${type}" ]; then + cat >&3 <<EOF + printf( + _Generic( + ${expr}, + char: "(char) ", + char *: "(char *) ", + const char *: "(const char *) ", + wchar_t *: "(wchar_t *) ", + const wchar_t *: "(const wchar_t *) ", + signed char: "(signed char) ", + short: "(short) ", + int: "(int) ", + long: "(long) ", + long long: "(long long) ", + unsigned char: "(unsigned char) ", + unsigned short: "(unsigned short) ", + unsigned int: "(unsigned int) ", + unsigned long: "(unsigned long) ", + unsigned long long: "(unsigned long long) ", + float: "(float) ", + double: "(double) ", + long double: "(long double) ", + default: "(void *) " + ) + ); +EOF +fi + +if [ -n "${expr}" ]; then cat >&3 <<EOF printf( _Generic( ${expr}, char: "%c\n", char *: "%s\n", + const char *: "%s\n", wchar_t *: "%ls\n", + const wchar_t *: "%ls\n", signed char: "%hhd\n", short: "%hd\n", int: "%d\n", @@ -62,7 +97,9 @@ if [ -n "${expr:-}" ]; then unsigned int: "%u\n", unsigned long: "%lu\n", unsigned long long: "%llu\n", + float: "%g\n", double: "%g\n", + long double: "%Lg\n", default: "%p\n" ), ${expr} @@ -70,7 +107,7 @@ if [ -n "${expr:-}" ]; then EOF fi -if [ $# -eq 0 -a -z "${expr:-}" ]; then +if [ $# -eq 0 -a -z "${expr}" ]; then cat >&3 fi diff --git a/bin/c11.l b/bin/c11.l new file mode 100644 index 00000000..b1f0b960 --- /dev/null +++ b/bin/c11.l @@ -0,0 +1,144 @@ +/* Copyright (C) 2020 June McEnroe <june@causal.agency> + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +%option prefix="c11" +%option noinput nounput noyywrap + +%{ +#include "hilex.h" +%} + +%s MacroLine MacroInclude +%x CharLiteral StringLiteral + +ident [_[:alpha:]][_[:alnum:]]* +width "*"|[0-9]+ + +%% + static int pop = INITIAL; + +[[:blank:]]+ { return Normal; } + +^"%"[%{}]? { + BEGIN(pop = MacroLine); + return Macro; +} + +([-+*/%&|^=!<>]|"<<"|">>")"="? | +[=~.?:]|"["|"]"|"++"|"--"|"&&"|"||"|"->" | +sizeof|(_A|alignof) { + return Operator; +} + +([1-9][0-9]*|"0"[0-7]*|"0x"[[:xdigit:]]+)([ulUL]{0,3}) | +([0-9]+("."[0-9]*)?|[0-9]*"."[0-9]+)([eE][+-]?[0-9]+)?[flFL]? | +"0x"[[:xdigit:]]*("."[[:xdigit:]]*)?([pP][+-]?[0-9]+)[flFL]? { + return Number; +} + +auto|break|case|const|continue|default|do|else|enum|extern|for|goto|if|inline | +register|restrict|return|static|struct|switch|typedef|union|volatile|while | +(_A|a)lignas|_Atomic|_Generic|(_N|n)oreturn|(_S|s)tatic_assert | +(_T|t)hread_local { + return Keyword; +} + +^"#"[[:blank:]]*(include|import) { + BEGIN(pop = MacroInclude); + return Macro; +} +^"#"[[:blank:]]*{ident} { + BEGIN(pop = MacroLine); + return Macro; +} +<MacroInclude>"<"[^>]+">" { + return String; +} +<MacroLine,MacroInclude>{ + "\n" { + BEGIN(pop = INITIAL); + return Normal; + } + "\\\n" { return Macro; } + {ident} { return Macro; } +} + +{ident} { return Ident; } + +"//"([^\n]|"\\\n")* | +"/*"([^*]|"*"+[^*/])*"*"+"/" { + return Comment; +} + +[LUu]?"'"/[^\\] { + BEGIN(CharLiteral); + yymore(); +} +[LUu]?"'" { + BEGIN(CharLiteral); + return String; +} +([LU]|u8?)?"\""/[^\\%] { + BEGIN(StringLiteral); + yymore(); +} +([LU]|u8?)?"\"" { + BEGIN(StringLiteral); + return String; +} + +<CharLiteral,StringLiteral>{ + "\\\n" | + "\\"[''""?\\abfnrtv] | + "\\"([0-7]{1,3}) | + "\\x"([[:xdigit:]]{2}) | + "\\u"([[:xdigit:]]{4}) | + "\\U"([[:xdigit:]]{8}) { + return Escape; + } +} +<StringLiteral>{ + "%%" | + "%"[EO]?[ABCDFGHIMRSTUVWXYZabcdeghjmnprtuwxyz] | + "%"[ #+-0]*{width}?("."{width})?([Lhjltz]|hh|ll)?[AEFGXacdefginopsux] { + return Format; + } +} + +<CharLiteral>{ + [^\\'']*"'" { + BEGIN(pop); + return String; + } + [^\\'']+|. { return String; } +} +<StringLiteral>{ + [^%\\""]*"\"" { + BEGIN(pop); + return String; + } + [^%\\""]+|. { return String; } +} + +<MacroLine,MacroInclude>. { + return Macro; +} + +.|\n { return Normal; } + +%% + +const struct Lexer LexC = { yylex, &yyin, &yytext }; diff --git a/bin/dehtml.l b/bin/dehtml.l new file mode 100644 index 00000000..799f0926 --- /dev/null +++ b/bin/dehtml.l @@ -0,0 +1,150 @@ +/* Copyright (C) 2021 June McEnroe <june@causal.agency> + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +%option noinput nounput noyywrap + +%{ +enum Token { + Doctype = 1, + Comment, + TagOpen, + TagClose, + Entity, + Text, + Space, +}; +%} + +%% + +"<!DOCTYPE "[^>]*">" { return Doctype; } +"<!--"([^-]|-[^-]|--[^>])*"-->" { return Comment; } +"</"[^>]*">" { return TagClose; } +"<"[^>]*">" { return TagOpen; } +"&"[^;]*";" { return Entity; } +[^<&[:space:]]+ { return Text; } +[[:space:]]+ { return Space; } + +%% + +#include <err.h> +#include <locale.h> +#include <stdbool.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <strings.h> +#include <sysexits.h> +#include <unistd.h> +#include <wchar.h> + +static const struct { + wchar_t ch; + const char *name; +} Entities[] = { + { L'&', "&" }, + { L'<', "<" }, + { L'>', ">" }, + { L'"', """ }, + { L' ', " " }, + { L'\u00A9', "©" }, + { L'\u00B7', "·" }, + { L'\u00BB', "»" }, + { L'\u200F', "‏" }, + { L'\u2014', "—" }, + { L'\u2191', "↑" }, +}; + +static void entity(void) { + wchar_t ch = 0; + if (yytext[1] == '#') { + if (yytext[2] == 'x') { + ch = strtoul(&yytext[3], NULL, 16); + } else { + ch = strtoul(&yytext[2], NULL, 10); + } + } else { + for (size_t i = 0; i < sizeof(Entities) / sizeof(Entities[0]); ++i) { + if (strcmp(Entities[i].name, yytext)) continue; + ch = Entities[i].ch; + break; + } + } + if (ch) { + printf("%lc", (wint_t)ch); + } else { + warnx("unknown entity %s", yytext); + printf("%s", yytext); + } +} + +static bool isTag(const char *tag) { + const char *ptr = &yytext[1]; + if (*ptr == '/') ptr++; + size_t len = strlen(tag); + if (strncasecmp(ptr, tag, len)) return false; + ptr += len; + return *ptr == ' ' || *ptr == '>'; +} + +int main(int argc, char *argv[]) { + setlocale(LC_CTYPE, ""); + + bool collapse = 0; + for (int opt; 0 < (opt = getopt(argc, argv, "s"));) { + switch (opt) { + break; case 's': collapse = true; + break; default: return EX_USAGE; + } + } + argc -= optind; + argv += optind; + + if (!argc) argc++; + for (int i = 0; i < argc; ++i) { + yyin = (argv[i] ? fopen(argv[i], "r") : stdin); + if (!yyin) err(EX_NOINPUT, "%s", argv[i]); + + bool space = true; + bool discard = false; + bool pre = false; + for (enum Token tok; (tok = yylex());) { + if (tok == TagOpen || tok == TagClose) { + if (isTag("title") || isTag("style") || isTag("script")) { + discard = (tok == TagOpen); + } else if (isTag("pre")) { + pre = (tok == TagOpen); + } + } else if (discard) { + continue; + } else if (tok == Entity) { + entity(); + space = false; + } else if (tok == Text) { + printf("%s", yytext); + space = false; + } else if (tok == Space) { + if (collapse && !pre) { + if (space) continue; + printf("%c", yytext[0]); + } else { + printf("%s", yytext); + } + space = true; + } + } + } +} diff --git a/bin/downgrade.c b/bin/downgrade.c new file mode 100644 index 00000000..31019714 --- /dev/null +++ b/bin/downgrade.c @@ -0,0 +1,362 @@ +/* Copyright (C) 2021 June McEnroe <june@causal.agency> + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +#include <assert.h> +#include <err.h> +#include <signal.h> +#include <stdarg.h> +#include <stdbool.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <sysexits.h> +#include <tls.h> +#include <unistd.h> + +#ifdef __FreeBSD__ +#include <capsicum_helpers.h> +#endif + +enum { BufferCap = 8192 + 512 }; + +static bool verbose; +static struct tls *client; + +static void clientWrite(const char *ptr, size_t len) { + if (verbose) printf("%.*s", (int)len, ptr); + while (len) { + ssize_t ret = tls_write(client, ptr, len); + if (ret == TLS_WANT_POLLIN || ret == TLS_WANT_POLLOUT) continue; + if (ret < 0) errx(EX_IOERR, "tls_write: %s", tls_error(client)); + ptr += ret; + len -= ret; + } +} + +static void format(const char *format, ...) { + char buf[BufferCap]; + va_list ap; + va_start(ap, format); + int len = vsnprintf(buf, sizeof(buf), format, ap); + va_end(ap); + assert((size_t)len < sizeof(buf)); + clientWrite(buf, len); +} + +static bool invite; +static const char *join; + +enum { Cap = 1024 }; +static struct Message { + char *id; + char *nick; + char *chan; + char *mesg; +} msgs[Cap]; +static size_t m; + +static void push(struct Message msg) { + struct Message *dst = &msgs[m++ % Cap]; + free(dst->id); + free(dst->nick); + free(dst->chan); + free(dst->mesg); + dst->id = strdup(msg.id); + dst->nick = strdup(msg.nick); + dst->chan = strdup(msg.chan); + if (!dst->id || !dst->nick || !dst->chan) err(EX_OSERR, "strdup"); + dst->mesg = NULL; + if (msg.mesg) { + dst->mesg = strdup(msg.mesg); + if (!dst->mesg) err(EX_OSERR, "strdup"); + } +} + +static struct Message *find(const char *id) { + for (size_t i = 0; i < Cap; ++i) { + if (!msgs[i].id) return NULL; + if (!strcmp(msgs[i].id, id)) return &msgs[i]; + } + return NULL; +} + +static void handle(char *ptr) { + char *tags = NULL; + char *origin = NULL; + if (ptr && *ptr == '@') tags = 1 + strsep(&ptr, " "); + if (ptr && *ptr == ':') origin = 1 + strsep(&ptr, " "); + char *cmd = strsep(&ptr, " "); + if (!cmd) return; + if (!strcmp(cmd, "CAP")) { + strsep(&ptr, " "); + char *sub = strsep(&ptr, " "); + if (!sub) errx(EX_PROTOCOL, "CAP without subcommand"); + if (!strcmp(sub, "NAK")) { + errx(EX_CONFIG, "server does not support %s", ptr); + } else if (!strcmp(sub, "ACK")) { + if (!ptr) errx(EX_PROTOCOL, "CAP ACK without caps"); + if (*ptr == ':') ptr++; + if (!strcmp(ptr, "sasl")) format("AUTHENTICATE EXTERNAL\r\n"); + } + } else if (!strcmp(cmd, "AUTHENTICATE")) { + format("AUTHENTICATE +\r\nCAP END\r\n"); + } else if (!strcmp(cmd, "433")) { + strsep(&ptr, " "); + char *nick = strsep(&ptr, " "); + if (!nick) errx(EX_PROTOCOL, "ERR_NICKNAMEINUSE missing nick"); + format("NICK %s_\r\n", nick); + } else if (!strcmp(cmd, "001")) { + if (join) format("JOIN %s\r\n", join); + } else if (!strcmp(cmd, "005")) { + char *self = strsep(&ptr, " "); + if (!self) errx(EX_PROTOCOL, "RPL_ISUPPORT missing nick"); + while (ptr && *ptr != ':') { + char *tok = strsep(&ptr, " "); + char *key = strsep(&tok, "="); + if (!strcmp(key, "BOT") && tok) { + format("MODE %s +%s\r\n", self, tok); + } + } + } else if (!strcmp(cmd, "INVITE") && invite) { + strsep(&ptr, " "); + if (!ptr) errx(EX_PROTOCOL, "INVITE missing channel"); + if (*ptr == ':') ptr++; + format("JOIN %s\r\n", ptr); + } else if (!strcmp(cmd, "PING")) { + if (!ptr) errx(EX_PROTOCOL, "PING missing parameter"); + format("PONG %s\r\n", ptr); + } else if (!strcmp(cmd, "ERROR")) { + if (!ptr) errx(EX_PROTOCOL, "ERROR missing parameter"); + if (*ptr == ':') ptr++; + errx(EX_UNAVAILABLE, "%s", ptr); + } + + if ( + strcmp(cmd, "PRIVMSG") && + strcmp(cmd, "NOTICE") && + strcmp(cmd, "TAGMSG") + ) return; + if (!origin) errx(EX_PROTOCOL, "%s missing origin", cmd); + + struct Message msg = { + .nick = strsep(&origin, "!"), + .chan = strsep(&ptr, " "), + }; + if (!msg.chan) errx(EX_PROTOCOL, "%s missing target", cmd); + if (msg.chan[0] == ':') msg.chan++; + if (msg.chan[0] != '#') return; + if (strcmp(cmd, "TAGMSG")) msg.mesg = (*ptr == ':' ? &ptr[1] : ptr); + + if (msg.mesg) { + if (!strncmp(msg.mesg, "\1ACTION ", 8)) msg.mesg += 8; + size_t len = strlen(msg.mesg); + if (msg.mesg[len-1] == '\1') msg.mesg[len-1] = '\0'; + } + + char *reply = NULL; + char *react = NULL; + char *typing = NULL; + if (!tags) return; + while (tags) { + char *tag = strsep(&tags, ";"); + char *key = strsep(&tag, "="); + if (!strcmp(key, "msgid")) { + if (tag) msg.id = tag; + } else if (!strcmp(key, "+draft/reply")) { + if (tag) reply = tag; + } else if (!strcmp(key, "+draft/react")) { + if (!tag) continue; + for (char *ptr = tag; (ptr = strchr(ptr, '\\')); ptr += !!*ptr) { + switch (ptr[1]) { + break; case ':': ptr[1] = ';'; + break; case 's': ptr[1] = ' '; + //break; case 'r': ptr[1] = '\r'; + //break; case 'n': ptr[1] = '\n'; + } + memmove(ptr, &ptr[1], strlen(&ptr[1]) + 1); + } + react = tag; + } else if (!strcmp(key, "+typing") || !strcmp(key, "+draft/typing")) { + if (tag) typing = tag; + } + } + if (msg.id) push(msg); + + if (typing) { + if (!strcmp(typing, "active")) { + format("NOTICE %s :* %s is typing...\r\n", msg.chan, msg.nick); + } else if (!strcmp(typing, "paused")) { + format( + "NOTICE %s :* %s is thinking hard...\r\n", msg.chan, msg.nick + ); + } else if (!strcmp(typing, "done")) { + format("NOTICE %s :* %s has given up :(\r\n", msg.chan, msg.nick); + } else { + format( + "NOTICE %s :* %s is doing some wacky %s typing!\r\n", + msg.chan, msg.nick, typing + ); + } + } else if (react && reply) { + struct Message *to = find(reply); + format("NOTICE %s :* %s reacted to ", msg.chan, msg.nick); + if (to && strcmp(to->chan, msg.chan)) { + format("a message in another channel"); + } else if (to && to->mesg) { + size_t len = 0; + for (size_t n; to->mesg[len]; len += n) { + n = 1 + strcspn(&to->mesg[len+1], " "); + if (len + n > 50) break; + } + format( + "%s's message (\"%.*s\"%s)", + to->nick, (int)len, to->mesg, (to->mesg[len] ? "..." : "") + ); + } else if (to) { + format("%s's reaction", to->nick); + } else { + format("an unknown message"); + } + format(" with \"%s\"\r\n", react); + } else if (react) { + format( + "NOTICE %s :* %s reacted to nothing with \"%s\"\r\n", + msg.chan, msg.nick, react + ); + } else if (reply) { + struct Message *to = find(reply); + format("NOTICE %s :* %s was replying to ", msg.chan, msg.nick); + if (to && strcmp(to->chan, msg.chan)) { + format("a message in another channel!\r\n"); + } else if (to && to->mesg) { + size_t len = 0; + for (size_t n; to->mesg[len]; len += n) { + n = 1 + strcspn(&to->mesg[len+1], " "); + if (len + n > 50) break; + } + format( + "%s's message (\"%.*s\"%s)\r\n", + to->nick, (int)len, to->mesg, (to->mesg[len] ? "..." : "") + ); + } else if (to) { + format("%s's reaction\r\n", to->nick); + } else { + format("an unknown message!\r\n"); + } + } +} + +static void quit(int sig) { + (void)sig; + format("QUIT\r\n"); + tls_close(client); + exit(EX_OK); +} + +int main(int argc, char *argv[]) { + const char *host = NULL; + const char *port = "6697"; + const char *nick = "downgrade"; + const char *cert = NULL; + const char *priv = NULL; + + for (int opt; 0 < (opt = getopt(argc, argv, "c:ij:k:n:p:v"));) { + switch (opt) { + break; case 'c': cert = optarg; + break; case 'i': invite = true; + break; case 'j': join = optarg; + break; case 'k': priv = optarg; + break; case 'n': nick = optarg; + break; case 'p': port = optarg; + break; case 'v': verbose = true; + break; default: return EX_USAGE; + } + } + if (optind == argc) errx(EX_USAGE, "host required"); + host = argv[optind]; + + client = tls_client(); + if (!client) errx(EX_SOFTWARE, "tls_client"); + + struct tls_config *config = tls_config_new(); + if (!config) errx(EX_SOFTWARE, "tls_config_new"); + + if (cert) { + if (!priv) priv = cert; + int error = tls_config_set_keypair_file(config, cert, priv); + if (error) errx(EX_NOINPUT, "%s: %s", cert, tls_config_error(config)); + } + + int error = tls_configure(client, config); + if (error) errx(EX_SOFTWARE, "tls_configure: %s", tls_error(client)); + + error = tls_connect(client, host, port); + if (error) errx(EX_UNAVAILABLE, "tls_connect: %s", tls_error(client)); + + do { + error = tls_handshake(client); + } while (error == TLS_WANT_POLLIN || error == TLS_WANT_POLLOUT); + if (error) errx(EX_PROTOCOL, "tls_handshake: %s", tls_error(client)); + tls_config_clear_keys(config); + +#ifdef __OpenBSD__ + error = pledge("stdio", NULL); + if (error) err(EX_OSERR, "pledge"); +#endif + +#ifdef __FreeBSD__ + error = caph_enter() || caph_limit_stdio(); + if (error) err(EX_OSERR, "caph_enter"); +#endif + + signal(SIGHUP, quit); + signal(SIGINT, quit); + signal(SIGTERM, quit); + format( + "CAP REQ :echo-message message-tags\r\n" + "NICK %s\r\n" + "USER %s 0 * :https://causal.agency/bin/downgrade.html\r\n", + nick, nick + ); + if (cert) { + format("CAP REQ sasl\r\n"); + } else { + format("CAP END\r\n"); + } + + size_t len = 0; + char buf[BufferCap]; + for (;;) { + ssize_t n = tls_read(client, &buf[len], sizeof(buf) - len); + if (n == TLS_WANT_POLLIN || n == TLS_WANT_POLLOUT) continue; + if (n < 0) errx(EX_IOERR, "tls_read: %s", tls_error(client)); + if (!n) errx(EX_UNAVAILABLE, "disconnected"); + len += n; + + char *ptr = buf; + for ( + char *crlf; + (crlf = memmem(ptr, &buf[len] - ptr, "\r\n", 2)); + ptr = crlf + 2 + ) { + *crlf = '\0'; + if (verbose) printf("%s\n", ptr); + handle(ptr); + } + len -= ptr - buf; + memmove(buf, ptr, len); + } +} diff --git a/bin/dtch.c b/bin/dtch.c index 2aea53ae..026493dd 100644 --- a/bin/dtch.c +++ b/bin/dtch.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2017-2019 C. McEnroe <june@causal.agency> +/* Copyright (C) 2017-2019 June McEnroe <june@causal.agency> * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by diff --git a/bin/edit.sh b/bin/edit.sh deleted file mode 100644 index c276707f..00000000 --- a/bin/edit.sh +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/sh -set -eu - -script=$(mktemp) -trap "rm -f '$script'" EXIT - -sed "s/.*/${1:-: &}/" >> "$script" -$EDITOR "$script" -sh -eux "$script" diff --git a/bin/enc.sh b/bin/enc.sh new file mode 100644 index 00000000..4233f0a3 --- /dev/null +++ b/bin/enc.sh @@ -0,0 +1,70 @@ +#!/bin/sh +set -eu + +readonly Command='openssl enc -ChaCha20 -pbkdf2' + +base64= +stdout=false +mode=encrypt +force=false + +while getopts 'acdef' opt; do + case $opt in + (a) base64=-a;; + (c) stdout=true;; + (d) mode=decrypt;; + (e) mode=encrypt;; + (f) force=true;; + (?) exit 1;; + esac +done +shift $((OPTIND - 1)) + +confirm() { + $force && return 0 + while :; do + printf '%s: overwrite %s? [y/N] ' "$0" "$1" >&2 + read -r confirm + case "$confirm" in + (Y*|y*) return 0;; + (N*|n*|'') return 1;; + esac + done +} + +encrypt() { + if test -z "${1:-}"; then + $Command -e $base64 + elif $stdout; then + $Command -e $base64 -in "$1" + else + input=$1 + output="${1}.enc" + if test -e "$output" && ! confirm "$output"; then + return + fi + $Command -e $base64 -in "$input" -out "$output" + fi +} + +decrypt() { + if test -z "${1:-}"; then + $Command -d $base64 + elif $stdout || [ "${1%.enc}" = "$1" ]; then + $Command -d $base64 -in "$1" + else + input=$1 + output=${1%.enc} + if test -e "$output" && ! confirm "$output"; then + return + fi + $Command -d $base64 -in "$input" -out "$output" + fi +} + +for input; do + $mode "$input" +done +if [ $# -eq 0 ]; then + $mode +fi diff --git a/bin/ever.c b/bin/ever.c index 258b058b..f8ff943b 100644 --- a/bin/ever.c +++ b/bin/ever.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2017 C. McEnroe <june@causal.agency> +/* Copyright (C) 2017 June McEnroe <june@causal.agency> * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by @@ -45,6 +45,7 @@ static int watch(int kq, char *path) { return fd; } +static bool quiet; static void exec(int fd, char *const argv[]) { pid_t pid = fork(); if (pid < 0) err(EX_OSERR, "fork"); @@ -59,6 +60,7 @@ static void exec(int fd, char *const argv[]) { pid = wait(&status); if (pid < 0) err(EX_OSERR, "wait"); + if (quiet) return; if (WIFEXITED(status)) { warnx("exit %d\n", WEXITSTATUS(status)); } else if (WIFSIGNALED(status)) { @@ -71,9 +73,10 @@ static void exec(int fd, char *const argv[]) { int main(int argc, char *argv[]) { bool input = false; - for (int opt; 0 < (opt = getopt(argc, argv, "i"));) { + for (int opt; 0 < (opt = getopt(argc, argv, "iq"));) { switch (opt) { break; case 'i': input = true; + break; case 'q': quiet = true; break; default: return EX_USAGE; } } diff --git a/bin/fbatt.c b/bin/fbatt.c deleted file mode 100644 index 9feffe47..00000000 --- a/bin/fbatt.c +++ /dev/null @@ -1,123 +0,0 @@ -/* Copyright (C) 2018 C. McEnroe <june@causal.agency> - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -#include <dirent.h> -#include <err.h> -#include <errno.h> -#include <fcntl.h> -#include <linux/fb.h> -#include <stdint.h> -#include <stdio.h> -#include <stdlib.h> -#include <sys/ioctl.h> -#include <sys/mman.h> -#include <sysexits.h> -#include <unistd.h> - -#include "scheme.h" - -static const char *Class = "/sys/class/power_supply"; - -static const uint32_t Right = 5 * 8 + 1; // fbclock width. -static const uint32_t Width = 8; -static const uint32_t Height = 16; - -int main() { - int error; - - DIR *dir = opendir(Class); - if (!dir) err(EX_OSFILE, "%s", Class); - - FILE *chargeFull = NULL; - FILE *chargeNow = NULL; - - const struct dirent *entry; - while (NULL != (errno = 0, entry = readdir(dir))) { - if (entry->d_name[0] == '.') continue; - - error = chdir(Class); - if (error) err(EX_OSFILE, "%s", Class); - - error = chdir(entry->d_name); - if (error) err(EX_OSFILE, "%s/%s", Class, entry->d_name); - - chargeFull = fopen("charge_full", "r"); - chargeNow = fopen("charge_now", "r"); - if (chargeFull && chargeNow) break; - } - if (!chargeFull || !chargeNow) { - if (errno) err(EX_OSFILE, "%s", Class); - errx(EX_CONFIG, "%s: empty", Class); - } - closedir(dir); - - const char *path = getenv("FRAMEBUFFER"); - if (!path) path = "/dev/fb0"; - - int fb = open(path, O_RDWR); - if (fb < 0) err(EX_OSFILE, "%s", path); - - struct fb_var_screeninfo info; - error = ioctl(fb, FBIOGET_VSCREENINFO, &info); - if (error) err(EX_IOERR, "%s", path); - - size_t size = 4 * info.xres * info.yres; - uint32_t *buf = mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_SHARED, fb, 0); - if (buf == MAP_FAILED) err(EX_IOERR, "%s", path); - - for (;;) { - int match; - - rewind(chargeFull); - fflush(chargeFull); - uint32_t full; - match = fscanf(chargeFull, "%u", &full); - if (match == EOF) err(EX_IOERR, "charge_full"); - if (match < 1) errx(EX_DATAERR, "charge_full"); - - rewind(chargeNow); - fflush(chargeNow); - uint32_t now; - match = fscanf(chargeNow, "%u", &now); - if (match == EOF) err(EX_IOERR, "charge_now"); - if (match < 1) errx(EX_DATAERR, "charge_now"); - - uint32_t percent = 100 * now / full; - uint32_t height = 16 * now / full; - - for (int i = 0; i < 60; ++i, sleep(1)) { - uint32_t left = info.xres - Right - Width; - - for (uint32_t y = 0; y <= Height; ++y) { - buf[y * info.xres + left - 1] = DarkWhite; - buf[y * info.xres + left + Width] = DarkWhite; - } - for (uint32_t x = left; x < left + Width; ++x) { - buf[Height * info.xres + x] = DarkWhite; - } - - for (uint32_t y = 0; y < Height; ++y) { - for (uint32_t x = left; x < left + Width; ++x) { - buf[y * info.xres + x] = - (Height - 1 - y > height) ? DarkBlack - : (percent <= 10) ? DarkRed - : (percent <= 30) ? DarkYellow - : LightBlack; - } - } - } - } -} diff --git a/bin/fbclock.c b/bin/fbclock.c deleted file mode 100644 index ddc32db6..00000000 --- a/bin/fbclock.c +++ /dev/null @@ -1,132 +0,0 @@ -/* Copyright (C) 2018 C. McEnroe <june@causal.agency> - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -#include <assert.h> -#include <err.h> -#include <fcntl.h> -#include <linux/fb.h> -#include <stdint.h> -#include <stdio.h> -#include <stdlib.h> -#include <sys/ioctl.h> -#include <sys/mman.h> -#include <sysexits.h> -#include <time.h> -#include <unistd.h> -#include <zlib.h> - -#include "scheme.h" - -static const uint32_t PSF2Magic = 0x864AB572; -struct PSF2Header { - uint32_t magic; - uint32_t version; - uint32_t headerSize; - uint32_t flags; - uint32_t glyphCount; - uint32_t glyphSize; - uint32_t glyphHeight; - uint32_t glyphWidth; -}; - -int main() { - size_t len; - - const char *fontPath = getenv("FONT"); - if (!fontPath) { - fontPath = "/usr/share/kbd/consolefonts/Lat2-Terminus16.psfu.gz"; - } - - gzFile font = gzopen(fontPath, "r"); - if (!font) err(EX_NOINPUT, "%s", fontPath); - - struct PSF2Header header; - len = gzfread(&header, sizeof(header), 1, font); - if (!len && gzeof(font)) errx(EX_DATAERR, "%s: missing header", fontPath); - if (!len) errx(EX_IOERR, "%s", gzerror(font, NULL)); - - if (header.magic != PSF2Magic) { - errx( - EX_DATAERR, "%s: invalid header magic %08X", - fontPath, header.magic - ); - } - if (header.headerSize != sizeof(struct PSF2Header)) { - errx( - EX_DATAERR, "%s: weird header size %d", - fontPath, header.headerSize - ); - } - - uint8_t glyphs[128][header.glyphSize]; - len = gzfread(glyphs, header.glyphSize, 128, font); - if (!len && gzeof(font)) errx(EX_DATAERR, "%s: missing glyphs", fontPath); - if (!len) errx(EX_IOERR, "%s", gzerror(font, NULL)); - - gzclose(font); - - const char *fbPath = getenv("FRAMEBUFFER"); - if (!fbPath) fbPath = "/dev/fb0"; - - int fb = open(fbPath, O_RDWR); - if (fb < 0) err(EX_OSFILE, "%s", fbPath); - - struct fb_var_screeninfo info; - int error = ioctl(fb, FBIOGET_VSCREENINFO, &info); - if (error) err(EX_IOERR, "%s", fbPath); - - size_t size = 4 * info.xres * info.yres; - uint32_t *buf = mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_SHARED, fb, 0); - if (buf == MAP_FAILED) err(EX_IOERR, "%s", fbPath); - - for (;;) { - time_t t = time(NULL); - if (t < 0) err(EX_OSERR, "time"); - const struct tm *local = localtime(&t); - if (!local) err(EX_OSERR, "localtime"); - - char str[64]; - len = strftime(str, sizeof(str), "%H:%M", local); - assert(len); - - for (int i = 0; i < (60 - local->tm_sec); ++i, sleep(1)) { - uint32_t left = info.xres - header.glyphWidth * len; - uint32_t bottom = header.glyphHeight; - - for (uint32_t y = 0; y < bottom; ++y) { - buf[y * info.xres + left - 1] = DarkWhite; - } - for (uint32_t x = left - 1; x < info.xres; ++x) { - buf[bottom * info.xres + x] = DarkWhite; - } - - for (const char *s = str; *s; ++s) { - const uint8_t *glyph = glyphs[(unsigned)*s]; - uint32_t stride = header.glyphSize / header.glyphHeight; - for (uint32_t y = 0; y < header.glyphHeight; ++y) { - for (uint32_t x = 0; x < header.glyphWidth; ++x) { - uint8_t bits = glyph[y * stride + x / 8]; - uint8_t bit = bits >> (7 - x % 8) & 1; - buf[y * info.xres + left + x] = bit - ? DarkWhite - : DarkBlack; - } - } - left += header.glyphWidth; - } - } - } -} diff --git a/bin/freecell.c b/bin/freecell.c new file mode 100644 index 00000000..fbc0fe22 --- /dev/null +++ b/bin/freecell.c @@ -0,0 +1,388 @@ +/* Copyright (C) 2019, 2021 June McEnroe <june@causal.agency> + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +#include <assert.h> +#include <ctype.h> +#include <curses.h> +#include <err.h> +#include <locale.h> +#include <stdbool.h> +#include <stdio.h> +#include <stdlib.h> +#include <sysexits.h> +#include <time.h> +#include <unistd.h> + +typedef unsigned uint; +typedef unsigned char byte; + +typedef byte Card; +enum { + A = 1, + J = 11, + Q = 12, + K = 13, + Rank = 0x0F, + Suit = 0x30, + Color = 0x10, + Club = 0x00, + Diamond = 0x10, + Spade = 0x20, + Heart = 0x30, +}; + +enum { StackCap = 52 }; +struct Stack { + byte len; + Card cards[StackCap]; +}; +static void push(struct Stack *stack, Card card) { + assert(stack->len < StackCap); + stack->cards[stack->len++] = card; +} +static Card pop(struct Stack *stack) { + if (!stack->len) return 0; + return stack->cards[--stack->len]; +} +static Card peek(struct Stack *stack) { + if (!stack->len) return 0; + return stack->cards[stack->len-1]; +} + +enum { + Foundation, + Cell = Foundation + 4, + Tableau = Cell + 4, + Stacks = Tableau + 8, +}; +static struct Stack stacks[Stacks]; + +struct Move { + byte dst; + byte src; +}; + +enum { QCap = 16 }; +static struct { + struct Move moves[QCap]; + uint r, w, u; +} q; +static void enq(byte dst, byte src) { + q.moves[q.w % QCap].dst = dst; + q.moves[q.w % QCap].src = src; + q.w++; +} +static void deq(void) { + struct Move move = q.moves[q.r++ % QCap]; + push(&stacks[move.dst], pop(&stacks[move.src])); +} +static void undo(void) { + uint len = q.w - q.u; + if (!len || len > QCap) return; + for (uint i = len-1; i < len; --i) { + struct Move move = q.moves[(q.u+i) % QCap]; + push(&stacks[move.src], pop(&stacks[move.dst])); + } + q.r = q.w = q.u; +} + +// https://rosettacode.org/wiki/Deal_cards_for_FreeCell +static uint lcgState; +static uint lcg(void) { + lcgState = (214013 * lcgState + 2531011) % (1 << 31); + return lcgState >> 16; +} +static void deal(uint game) { + lcgState = game; + struct Stack deck = {0}; + for (Card i = A; i <= K; ++i) { + push(&deck, Club | i); + push(&deck, Diamond | i); + push(&deck, Heart | i); + push(&deck, Spade | i); + } + for (uint stack = 0; deck.len; ++stack) { + uint i = lcg() % deck.len; + Card card = deck.cards[i]; + deck.cards[i] = deck.cards[--deck.len]; + push(&stacks[Tableau + stack%8], card); + } +} + +static bool win(void) { + for (uint i = Foundation; i < Cell; ++i) { + if (stacks[i].len != 13) return false; + } + return true; +} + +static bool valid(uint dst, Card card) { + Card top = peek(&stacks[dst]); + if (dst < Cell) { + if (!top) return (card & Rank) == A; + return (card & Suit) == (top & Suit) + && (card & Rank) == (top & Rank) + 1; + } + if (!top) return true; + if (dst >= Tableau) { + return (card & Color) != (top & Color) + && (card & Rank) == (top & Rank) - 1; + } + return false; +} + +static void autoEnq(void) { + Card min[] = { K, K }; + for (uint i = Cell; i < Stacks; ++i) { + for (uint j = 0; j < stacks[i].len; ++j) { + Card card = stacks[i].cards[j]; + if ((card & Rank) < min[!!(card & Color)]) { + min[!!(card & Color)] = card & Rank; + } + } + } + for (uint src = Cell; src < Stacks; ++src) { + Card card = peek(&stacks[src]); + if (!card) continue; + if (min[!(card & Color)] < (card & Rank)-1) continue; + for (uint dst = Foundation; dst < Cell; ++dst) { + if (valid(dst, card)) { + enq(dst, src); + return; + } + } + } +} + +static void moveSingle(uint dst, uint src) { + if (!valid(dst, peek(&stacks[src]))) return; + q.u = q.w; + enq(dst, src); +} + +static uint freeCells(uint cells[static 4]) { + uint len = 0; + for (uint i = Cell; i < Tableau; ++i) { + if (!stacks[i].len) cells[len++] = i; + } + return len; +} + +static uint moveDepth(uint src) { + struct Stack stack = stacks[src]; + if (stack.len < 2) return stack.len; + uint n = 1; + for (uint i = stack.len-2; i < stack.len; --i, ++n) { + if ((stack.cards[i] & Color) == (stack.cards[i+1] & Color)) break; + if ((stack.cards[i] & Rank) != (stack.cards[i+1] & Rank) + 1) break; + } + return n; +} + +static void moveColumn(uint dst, uint src) { + uint depth; + uint cells[4]; + uint free = freeCells(cells); + for (depth = moveDepth(src); depth; --depth) { + if (free < depth-1) continue; + if (valid(dst, stacks[src].cards[stacks[src].len-depth])) break; + } + if (depth < 2 || dst < Tableau) { + moveSingle(dst, src); + return; + } + q.u = q.w; + for (uint i = 0; i < depth-1; ++i) { + enq(cells[i], src); + } + enq(dst, src); + for (uint i = depth-2; i < depth-1; --i) { + enq(dst, cells[i]); + } +} + +static void curse(void) { + setlocale(LC_CTYPE, ""); + initscr(); + cbreak(); + noecho(); + curs_set(0); + start_color(); + use_default_colors(); + init_pair(1, COLOR_BLACK, COLOR_WHITE); + init_pair(2, COLOR_RED, COLOR_WHITE); + init_pair(3, COLOR_GREEN, -1); +} + +static void drawCard(bool hi, int y, int x, Card card) { + if (!card) return; + move(y, x); + attr_set(hi ? A_REVERSE : A_NORMAL, (card & Color) ? 2 : 1, NULL); + switch (card & Suit) { + break; case Club: addstr("\u2663"); + break; case Diamond: addstr("\u2666"); + break; case Spade: addstr("\u2660"); + break; case Heart: addstr("\u2665"); + break; default:; + } + switch (card & Rank) { + break; case A: addstr(" A"); + break; case 10: addstr("10"); + break; case J: addstr(" J"); + break; case Q: addstr(" Q"); + break; case K: addstr(" K"); + break; default: { + addch(' '); + addch('0' + (card & Rank)); + } + } + attr_set(A_NORMAL, 0, NULL); +} + +static void drawStack(bool hi, int y, int x, const struct Stack *stack) { + for (uint i = 0; i < stack->len; ++i) { + drawCard(hi && i == stack->len-1, y++, x, stack->cards[i]); + } +} + +enum { + Padding = 1, + CardWidth = 3, + CardHeight = 1, + CellX = Padding, + CellY = 2*CardHeight, + FoundationX = CellX + 4*(CardWidth+Padding), + FoundationY = CellY, + TableauX = CellX, + TableauY = CellY + 2*CardHeight, +}; + +static uint game; +static uint srcStack = Stacks; + +static void draw(void) { + erase(); + static char buf[256]; + if (!buf[0]) snprintf(buf, sizeof(buf), "Game #%u", game); + attr_set(A_NORMAL, 3, NULL); + mvaddstr(0, Padding, buf); + for (uint i = 0; i < Stacks; ++i) { + int y, x; + char key; + if (i < Cell) { + y = FoundationY; + x = FoundationX + (3-(i-Foundation)) * (CardWidth+Padding); + key = '_'; + } else if (i < Tableau) { + y = CellY; + x = CellX + (i-Cell) * (CardWidth+Padding); + key = '1' + i-Cell; + } else { + y = TableauY; + x = TableauX + (i-Tableau) * (CardWidth+Padding); + key = "QWERASDF"[i-Tableau]; + } + if (i < Tableau) { + mvaddch(y, x+1, COLOR_PAIR(3) | key); + } else { + mvaddch(y + 8*CardHeight, x+1, COLOR_PAIR(3) | key); + } + if (i < Cell) { + drawCard(false, y, x, peek(&stacks[i])); + } else { + drawStack(i == srcStack, y, x, &stacks[i]); + } + } +} + +static void input(void) { + char ch = getch(); + uint stack = Stacks; + switch (tolower(ch)) { + break; case '\33': srcStack = Stacks; + break; case 'u': case '\b': case '\177': undo(); + break; case '1': case '!': stack = Cell+0; + break; case '2': case '@': stack = Cell+1; + break; case '3': case '#': stack = Cell+2; + break; case '4': case '$': stack = Cell+3; + break; case '_': case ' ': stack = Foundation; + break; case 'q': stack = Tableau+0; + break; case 'w': stack = Tableau+1; + break; case 'e': stack = Tableau+2; + break; case 'r': stack = Tableau+3; + break; case 'a': stack = Tableau+4; + break; case 's': stack = Tableau+5; + break; case 'd': stack = Tableau+6; + break; case 'f': stack = Tableau+7; + } + if (stack == Stacks) return; + + if (srcStack < Stacks) { + Card card = peek(&stacks[srcStack]); + if (stack == Foundation) { + for (; stack < Cell; ++stack) { + if (valid(stack, card)) break; + } + if (stack == Cell) return; + } + if (stack == srcStack) { + for (stack = Cell; stack < Stacks; ++stack) { + if (!stacks[stack].len) break; + } + if (stack == Stacks) return; + } + if (isupper(ch)) { + moveSingle(stack, srcStack); + } else { + moveColumn(stack, srcStack); + } + srcStack = Stacks; + + } else if (stack >= Cell && stacks[stack].len) { + srcStack = stack; + } +} + +static void status(void) { + printf("Game #%u %s!\n", game, win() ? "win" : "lose"); +} + +int main(int argc, char *argv[]) { + game = 1 + time(NULL) % 32000; + uint delay = 50; + for (int opt; 0 < (opt = getopt(argc, argv, "d:n:"));) { + switch (opt) { + break; case 'd': delay = strtoul(optarg, NULL, 10); + break; case 'n': game = strtoul(optarg, NULL, 10); + break; default: return EX_USAGE; + } + } + curse(); + deal(game); + atexit(status); + while (!win()) { + while (q.r < q.w) { + deq(); + draw(); + refresh(); + usleep(delay * 1000); + if (q.r == q.w) autoEnq(); + } + draw(); + input(); + } + endwin(); +} diff --git a/bin/git-comment.pl b/bin/git-comment.pl new file mode 100644 index 00000000..5352702d --- /dev/null +++ b/bin/git-comment.pl @@ -0,0 +1,92 @@ +#!/usr/bin/env perl +# Copyright (C) 2021 June McEnroe <june@causal.agency> +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. + +use lib (split(/:/, $ENV{GITPERLLIB} || '/usr/local/share/perl5')); + +use strict; +use warnings; +use Getopt::Long qw(:config pass_through); +use Git; + +my $repo = Git->repository(); + +my ($all, $minGroup, $minRepeat, $noRepeat) = (0, 2, 30, 0); +my $commentStart = $repo->config('comment.start') // "/*"; +my $commentLead = $repo->config('comment.lead') // " *"; +my $commentEnd = $repo->config('comment.end') // " */"; +my $pretty = $repo->config('comment.pretty') // 'format:%h %s%n%n%-b'; +GetOptions( + 'all' => \$all, + 'comment-start=s' => \$commentStart, + 'comment-lead=s' => \$commentLead, + 'comment-end:s' => \$commentEnd, + 'min-group=i' => \$minGroup, + 'min-repeat=i' => \$minRepeat, + 'no-repeat' => \$noRepeat, + 'pretty=s' => \$pretty, +) or die; + +sub printComment { + my ($indent, $summary, @body) = @_; + print "$indent$commentStart $summary"; + if (@body) { + print "\n"; + foreach (@body) { + print "$indent$commentLead"; + print " $_" if $_; + print "\n"; + } + print "$indent$commentEnd\n" if $commentEnd; + } else { + print "$commentEnd\n"; + } +} + +my ($pipe, $ctx) = $repo->command_output_pipe('blame', '--porcelain', @ARGV); + +my ($commit, $nr, $group, $printed, %message, %nrs); +while (<$pipe>) { + chomp; + if (/^([[:xdigit:]]+) \d+ (\d+) (\d+)/) { + ($commit, $nr, $group, $printed) = ($1, $2, $3, 0); + next if $message{$commit}; + if ($commit =~ /^0+$/) { + $message{$commit} = ['Not committed yet']; + next; + } + my @message = $repo->command( + 'show', '--no-patch', "--pretty=$pretty", $commit + ); + $message{$commit} = \@message; + } elsif (/^\t(\s*)(.*)/) { + my ($indent, $line) = ($1, $2); + unless ($printed || $line =~ /^[})]?;?$/) { + $printed = 1; + if ( + $group >= $minGroup && + !($noRepeat && $nrs{$commit}) && + !($nrs{$commit} && $nr < $nrs{$commit} + $minRepeat) && + ($all || @{$message{$commit}} > 1) + ) { + $nrs{$commit} = $nr; + printComment($indent, @{$message{$commit}}); + } + } + print "$indent$line\n"; + } +} + +$repo->command_close_pipe($pipe, $ctx); diff --git a/bin/glitch.c b/bin/glitch.c index 9747f35a..d0c926f9 100644 --- a/bin/glitch.c +++ b/bin/glitch.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2018 C. McEnroe <june@causal.agency> +/* Copyright (C) 2018, 2021 June McEnroe <june@causal.agency> * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by @@ -14,8 +14,9 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -#include <arpa/inet.h> #include <err.h> +#include <inttypes.h> +#include <limits.h> #include <stdbool.h> #include <stdint.h> #include <stdio.h> @@ -25,286 +26,328 @@ #include <unistd.h> #include <zlib.h> -#define PACKED __attribute__((packed)) - -#define CRC_INIT (crc32(0, Z_NULL, 0)) +#define ARRAY_LEN(a) (sizeof(a) / sizeof(a[0])) static const char *path; static FILE *file; static uint32_t crc; -static void readExpect(void *ptr, size_t size, const char *expect) { - fread(ptr, size, 1, file); - if (ferror(file)) err(EX_IOERR, "%s", path); - if (feof(file)) errx(EX_DATAERR, "%s: missing %s", path, expect); - crc = crc32(crc, ptr, size); +static void pngRead(void *ptr, size_t len, const char *desc) { + size_t n = fread(ptr, len, 1, file); + if (!n && ferror(file)) err(EX_IOERR, "%s", path); + if (!n) errx(EX_DATAERR, "%s: missing %s", path, desc); + crc = crc32(crc, ptr, len); } -static void writeExpect(const void *ptr, size_t size) { - fwrite(ptr, size, 1, file); - if (ferror(file)) err(EX_IOERR, "%s", path); - crc = crc32(crc, ptr, size); +static void pngWrite(const void *ptr, size_t len) { + size_t n = fwrite(ptr, len, 1, file); + if (!n) err(EX_IOERR, "%s", path); + crc = crc32(crc, ptr, len); } -static const uint8_t Signature[8] = "\x89PNG\r\n\x1A\n"; +static const uint8_t Sig[8] = "\x89PNG\r\n\x1A\n"; -static void readSignature(void) { - uint8_t signature[8]; - readExpect(signature, 8, "signature"); - if (0 != memcmp(signature, Signature, 8)) { +static void sigRead(void) { + uint8_t sig[sizeof(Sig)]; + pngRead(sig, sizeof(sig), "signature"); + if (memcmp(sig, Sig, sizeof(sig))) { errx(EX_DATAERR, "%s: invalid signature", path); } } -static void writeSignature(void) { - writeExpect(Signature, sizeof(Signature)); +static void sigWrite(void) { + pngWrite(Sig, sizeof(Sig)); } -struct PACKED Chunk { - uint32_t size; - char type[4]; -}; +static uint32_t u32Read(const char *desc) { + uint8_t b[4]; + pngRead(b, sizeof(b), desc); + return (uint32_t)b[0] << 24 | (uint32_t)b[1] << 16 + | (uint32_t)b[2] << 8 | (uint32_t)b[3]; +} -static const char *typeStr(struct Chunk chunk) { - static char buf[5]; - memcpy(buf, chunk.type, 4); - return buf; +static void u32Write(uint32_t x) { + uint8_t b[4] = { x >> 24 & 0xFF, x >> 16 & 0xFF, x >> 8 & 0xFF, x & 0xFF }; + pngWrite(b, sizeof(b)); } -static struct Chunk readChunk(void) { +struct Chunk { + uint32_t len; + char type[5]; +}; + +static struct Chunk chunkRead(void) { struct Chunk chunk; - readExpect(&chunk, sizeof(chunk), "chunk"); - chunk.size = ntohl(chunk.size); - crc = crc32(CRC_INIT, (Byte *)chunk.type, sizeof(chunk.type)); + chunk.len = u32Read("chunk length"); + crc = crc32(0, Z_NULL, 0); + pngRead(chunk.type, 4, "chunk type"); + chunk.type[4] = 0; return chunk; } -static void writeChunk(struct Chunk chunk) { - chunk.size = htonl(chunk.size); - writeExpect(&chunk, sizeof(chunk)); - crc = crc32(CRC_INIT, (Byte *)chunk.type, sizeof(chunk.type)); +static void chunkWrite(struct Chunk chunk) { + u32Write(chunk.len); + crc = crc32(0, Z_NULL, 0); + pngWrite(chunk.type, 4); } -static void readCrc(void) { - uint32_t expected = crc; - uint32_t found; - readExpect(&found, sizeof(found), "CRC32"); - found = ntohl(found); - if (found != expected) { - errx( - EX_DATAERR, "%s: expected CRC32 %08X, found %08X", - path, expected, found - ); - } +static void crcRead(void) { + uint32_t expect = crc; + uint32_t actual = u32Read("CRC32"); + if (actual == expect) return; + errx( + EX_DATAERR, "%s: expected CRC32 %08X, found %08X", + path, expect, actual + ); } -static void writeCrc(void) { - uint32_t net = htonl(crc); - writeExpect(&net, sizeof(net)); +static void crcWrite(void) { + u32Write(crc); } -static void skipChunk(struct Chunk chunk) { - uint8_t discard[chunk.size]; - readExpect(discard, sizeof(discard), "chunk data"); - readCrc(); +static void chunkSkip(struct Chunk chunk) { + if (!(chunk.type[0] & 0x20)) { + errx(EX_CONFIG, "%s: unsupported critical chunk %s", path, chunk.type); + } + uint8_t buf[4096]; + while (chunk.len > sizeof(buf)) { + pngRead(buf, sizeof(buf), "chunk data"); + chunk.len -= sizeof(buf); + } + if (chunk.len) pngRead(buf, chunk.len, "chunk data"); + crcRead(); } -static struct PACKED { +enum Color { + Grayscale = 0, + Truecolor = 2, + Indexed = 3, + GrayscaleAlpha = 4, + TruecolorAlpha = 6, +}; +enum Compression { + Deflate, +}; +enum FilterMethod { + Adaptive, +}; +enum Interlace { + Progressive, + Adam7, +}; + +enum { HeaderLen = 13 }; +static struct { uint32_t width; uint32_t height; uint8_t depth; - enum PACKED { - Grayscale = 0, - Truecolor = 2, - Indexed = 3, - GrayscaleAlpha = 4, - TruecolorAlpha = 6, - } color; + uint8_t color; uint8_t compression; uint8_t filter; uint8_t interlace; } header; -_Static_assert(13 == sizeof(header), "header size"); -static size_t pixelBits(void) { +static size_t pixelLen; +static size_t lineLen; +static size_t dataLen; + +static void recalc(void) { + size_t pixelBits = header.depth; switch (header.color) { - case Grayscale: return 1 * header.depth; - case Truecolor: return 3 * header.depth; - case Indexed: return 1 * header.depth; - case GrayscaleAlpha: return 2 * header.depth; - case TruecolorAlpha: return 4 * header.depth; - default: abort(); + break; case GrayscaleAlpha: pixelBits *= 2; + break; case Truecolor: pixelBits *= 3; + break; case TruecolorAlpha: pixelBits *= 4; } + pixelLen = (pixelBits + 7) / 8; + lineLen = (header.width * pixelBits + 7) / 8; + dataLen = (1 + lineLen) * header.height; } -static size_t pixelSize(void) { - return (pixelBits() + 7) / 8; +static void headerRead(struct Chunk chunk) { + if (chunk.len != HeaderLen) { + errx( + EX_DATAERR, "%s: expected %s length %" PRIu32 ", found %" PRIu32, + path, chunk.type, (uint32_t)HeaderLen, chunk.len + ); + } + header.width = u32Read("header width"); + header.height = u32Read("header height"); + pngRead(&header.depth, 1, "header depth"); + pngRead(&header.color, 1, "header color"); + pngRead(&header.compression, 1, "header compression"); + pngRead(&header.filter, 1, "header filter"); + pngRead(&header.interlace, 1, "header interlace"); + crcRead(); + recalc(); +} + +static void headerWrite(void) { + struct Chunk ihdr = { HeaderLen, "IHDR" }; + chunkWrite(ihdr); + u32Write(header.width); + u32Write(header.height); + pngWrite(&header.depth, 1); + pngWrite(&header.color, 1); + pngWrite(&header.compression, 1); + pngWrite(&header.filter, 1); + pngWrite(&header.interlace, 1); + crcWrite(); } -static size_t lineSize(void) { - return (header.width * pixelBits() + 7) / 8; -} +static struct { + uint32_t len; + uint8_t rgb[256][3]; +} pal; -static size_t dataSize(void) { - return (1 + lineSize()) * header.height; +static struct { + uint32_t len; + uint8_t a[256]; +} trans; + +static void palClear(void) { + pal.len = 0; + trans.len = 0; } -static void readHeader(void) { - struct Chunk ihdr = readChunk(); - if (0 != memcmp(ihdr.type, "IHDR", 4)) { - errx(EX_DATAERR, "%s: expected IHDR, found %s", path, typeStr(ihdr)); +static void palRead(struct Chunk chunk) { + if (chunk.len % 3) { + errx( + EX_DATAERR, "%s: %s length %" PRIu32 " not divisible by 3", + path, chunk.type, chunk.len + ); } - if (ihdr.size != sizeof(header)) { + pal.len = chunk.len / 3; + if (pal.len > 256) { errx( - EX_DATAERR, "%s: expected IHDR size %zu, found %u", - path, sizeof(header), ihdr.size + EX_DATAERR, "%s: %s length %" PRIu32 " > 256", + path, chunk.type, pal.len ); } - readExpect(&header, sizeof(header), "header"); - readCrc(); - header.width = ntohl(header.width); - header.height = ntohl(header.height); - if (!header.width) errx(EX_DATAERR, "%s: invalid width 0", path); - if (!header.height) errx(EX_DATAERR, "%s: invalid height 0", path); + pngRead(pal.rgb, chunk.len, "palette data"); + crcRead(); } -static void writeHeader(void) { - struct Chunk ihdr = { .size = sizeof(header), .type = "IHDR" }; - writeChunk(ihdr); - header.width = htonl(header.width); - header.height = htonl(header.height); - writeExpect(&header, sizeof(header)); - writeCrc(); - header.width = ntohl(header.width); - header.height = ntohl(header.height); +static void palWrite(void) { + struct Chunk plte = { 3 * pal.len, "PLTE" }; + chunkWrite(plte); + pngWrite(pal.rgb, plte.len); + crcWrite(); } -static struct { - uint32_t len; - uint8_t entries[256][3]; -} palette; - -static void readPalette(void) { - struct Chunk chunk; - for (;;) { - chunk = readChunk(); - if (0 == memcmp(chunk.type, "PLTE", 4)) break; - skipChunk(chunk); +static void transRead(struct Chunk chunk) { + trans.len = chunk.len; + if (trans.len > 256) { + errx( + EX_DATAERR, "%s: %s length %" PRIu32 " > 256", + path, chunk.type, trans.len + ); } - palette.len = chunk.size / 3; - readExpect(palette.entries, chunk.size, "palette data"); - readCrc(); + pngRead(trans.a, chunk.len, "transparency data"); + crcRead(); } -static void writePalette(void) { - struct Chunk plte = { .size = 3 * palette.len, .type = "PLTE" }; - writeChunk(plte); - writeExpect(palette.entries, plte.size); - writeCrc(); +static void transWrite(void) { + struct Chunk trns = { trans.len, "tRNS" }; + chunkWrite(trns); + pngWrite(trans.a, trns.len); + crcWrite(); } static uint8_t *data; -static void readData(void) { - data = malloc(dataSize()); - if (!data) err(EX_OSERR, "malloc(%zu)", dataSize()); +static void dataAlloc(void) { + data = malloc(dataLen); + if (!data) err(EX_OSERR, "malloc"); +} - struct z_stream_s stream = { .next_out = data, .avail_out = dataSize() }; +static void dataRead(struct Chunk chunk) { + z_stream stream = { .next_out = data, .avail_out = dataLen }; int error = inflateInit(&stream); - if (error != Z_OK) errx(EX_SOFTWARE, "%s: inflateInit: %s", path, stream.msg); + if (error != Z_OK) errx(EX_SOFTWARE, "inflateInit: %s", stream.msg); for (;;) { - struct Chunk chunk = readChunk(); - if (0 == memcmp(chunk.type, "IDAT", 4)) { - uint8_t *idat = malloc(chunk.size); - if (!idat) err(EX_OSERR, "malloc"); - - readExpect(idat, chunk.size, "image data"); - readCrc(); + if (strcmp(chunk.type, "IDAT")) { + errx(EX_DATAERR, "%s: missing IDAT chunk", path); + } - stream.next_in = idat; - stream.avail_in = chunk.size; - int error = inflate(&stream, Z_SYNC_FLUSH); - free(idat); + uint8_t *idat = malloc(chunk.len); + if (!idat) err(EX_OSERR, "malloc"); - if (error == Z_STREAM_END) break; - if (error != Z_OK) errx(EX_DATAERR, "%s: inflate: %s", path, stream.msg); + pngRead(idat, chunk.len, "image data"); + crcRead(); + + stream.next_in = idat; + stream.avail_in = chunk.len; + error = inflate(&stream, Z_SYNC_FLUSH); + free(idat); - } else if (0 == memcmp(chunk.type, "IEND", 4)) { - errx(EX_DATAERR, "%s: missing IDAT chunk", path); - } else { - skipChunk(chunk); + if (error == Z_STREAM_END) break; + if (error != Z_OK) { + errx(EX_DATAERR, "%s: inflate: %s", path, stream.msg); } - } + chunk = chunkRead(); + } inflateEnd(&stream); - if ((size_t)stream.total_out != dataSize()) { + if ((size_t)stream.total_out != dataLen) { errx( - EX_DATAERR, "%s: expected data size %zu, found %zu", - path, dataSize(), (size_t)stream.total_out + EX_DATAERR, "%s: expected data length %zu, found %zu", + path, dataLen, (size_t)stream.total_out ); } } -static void writeData(void) { - uLong size = compressBound(dataSize()); - uint8_t *deflate = malloc(size); - if (!deflate) err(EX_OSERR, "malloc"); +static void dataWrite(void) { + z_stream stream = { + .next_in = data, + .avail_in = dataLen, + }; + int error = deflateInit2( + &stream, Z_BEST_COMPRESSION, Z_DEFLATED, 15, 8, Z_FILTERED + ); + if (error != Z_OK) errx(EX_SOFTWARE, "deflateInit2: %s", stream.msg); - int error = compress2(deflate, &size, data, dataSize(), Z_BEST_SPEED); - if (error != Z_OK) errx(EX_SOFTWARE, "%s: compress2: %d", path, error); + uLong bound = deflateBound(&stream, dataLen); + uint8_t *buf = malloc(bound); + if (!buf) err(EX_OSERR, "malloc"); - struct Chunk idat = { .size = size, .type = "IDAT" }; - writeChunk(idat); - writeExpect(deflate, size); - writeCrc(); + stream.next_out = buf; + stream.avail_out = bound; + deflate(&stream, Z_FINISH); + deflateEnd(&stream); - free(deflate); -} + struct Chunk idat = { stream.total_out, "IDAT" }; + chunkWrite(idat); + pngWrite(buf, stream.total_out); + crcWrite(); + free(buf); -static void writeEnd(void) { - struct Chunk iend = { .size = 0, .type = "IEND" }; - writeChunk(iend); - writeCrc(); + struct Chunk iend = { 0, "IEND" }; + chunkWrite(iend); + crcWrite(); } -enum PACKED Filter { +enum Filter { None, Sub, Up, Average, Paeth, - FilterCount, + FilterCap, }; -static struct { - bool brokenPaeth; - bool filt; - bool recon; - uint8_t declareFilter; - uint8_t applyFilter; - enum Filter declareFilters[255]; - enum Filter applyFilters[255]; - bool invert; - bool mirror; - bool zeroX; - bool zeroY; -} options; - struct Bytes { - uint8_t x; - uint8_t a; - uint8_t b; - uint8_t c; + uint8_t x, a, b, c; }; +static bool brokenPaeth; static uint8_t paethPredictor(struct Bytes f) { int32_t p = (int32_t)f.a + (int32_t)f.b - (int32_t)f.c; - int32_t pa = abs(p - (int32_t)f.a); - int32_t pb = abs(p - (int32_t)f.b); - int32_t pc = abs(p - (int32_t)f.c); + int32_t pa = labs(p - (int32_t)f.a); + int32_t pb = labs(p - (int32_t)f.b); + int32_t pc = labs(p - (int32_t)f.c); if (pa <= pb && pa <= pc) return f.a; - if (options.brokenPaeth) { + if (brokenPaeth) { if (pb < pc) return f.b; } else { if (pb <= pc) return f.b; @@ -319,7 +362,7 @@ static uint8_t recon(enum Filter type, struct Bytes f) { case Up: return f.x + f.b; case Average: return f.x + ((uint32_t)f.a + (uint32_t)f.b) / 2; case Paeth: return f.x + paethPredictor(f); - default: abort(); + default: abort(); } } @@ -330,59 +373,59 @@ static uint8_t filt(enum Filter type, struct Bytes f) { case Up: return f.x - f.b; case Average: return f.x - ((uint32_t)f.a + (uint32_t)f.b) / 2; case Paeth: return f.x - paethPredictor(f); - default: abort(); + default: abort(); } } -static struct Line { - enum Filter type; - uint8_t data[]; -} **lines; - -static void scanlines(void) { - lines = calloc(header.height, sizeof(*lines)); - if (!lines) err(EX_OSERR, "calloc(%u, %zu)", header.height, sizeof(*lines)); - - size_t stride = 1 + lineSize(); - for (uint32_t y = 0; y < header.height; ++y) { - lines[y] = (struct Line *)&data[y * stride]; - if (lines[y]->type >= FilterCount) { - errx(EX_DATAERR, "%s: invalid filter type %hhu", path, lines[y]->type); - } - } +static uint8_t *lineType(uint32_t y) { + return &data[y * (1 + lineLen)]; +} +static uint8_t *lineData(uint32_t y) { + return 1 + lineType(y); } static struct Bytes origBytes(uint32_t y, size_t i) { - bool a = (i >= pixelSize()), b = (y > 0), c = (a && b); + bool a = (i >= pixelLen), b = (y > 0), c = (a && b); return (struct Bytes) { - .x = lines[y]->data[i], - .a = a ? lines[y]->data[i - pixelSize()] : 0, - .b = b ? lines[y - 1]->data[i] : 0, - .c = c ? lines[y - 1]->data[i - pixelSize()] : 0, + .x = lineData(y)[i], + .a = (a ? lineData(y)[i-pixelLen] : 0), + .b = (b ? lineData(y-1)[i] : 0), + .c = (c ? lineData(y-1)[i-pixelLen] : 0), }; } -static void reconData(void) { +static bool reconFilter; +static void dataRecon(void) { for (uint32_t y = 0; y < header.height; ++y) { - for (size_t i = 0; i < lineSize(); ++i) { - if (options.filt) { - lines[y]->data[i] = filt(lines[y]->type, origBytes(y, i)); + for (size_t i = 0; i < lineLen; ++i) { + if (reconFilter) { + lineData(y)[i] = filt(*lineType(y), origBytes(y, i)); } else { - lines[y]->data[i] = recon(lines[y]->type, origBytes(y, i)); + lineData(y)[i] = recon(*lineType(y), origBytes(y, i)); } } - lines[y]->type = None; + *lineType(y) = None; } } -static void filterData(void) { - for (uint32_t y = header.height - 1; y < header.height; --y) { - uint8_t filter[FilterCount][lineSize()]; - uint32_t heuristic[FilterCount] = {0}; +static bool filterRecon; +static size_t applyFilter; +static enum Filter applyFilters[256]; +static size_t declFilter; +static enum Filter declFilters[256]; + +static void dataFilter(void) { + uint8_t *filter[FilterCap]; + for (enum Filter i = None; i < FilterCap; ++i) { + filter[i] = malloc(lineLen); + if (!filter[i]) err(EX_OSERR, "malloc"); + } + for (uint32_t y = header.height-1; y < header.height; --y) { + uint32_t heuristic[FilterCap] = {0}; enum Filter minType = None; - for (enum Filter type = None; type < FilterCount; ++type) { - for (size_t i = 0; i < lineSize(); ++i) { - if (options.recon) { + for (enum Filter type = None; type < FilterCap; ++type) { + for (size_t i = 0; i < lineLen; ++i) { + if (filterRecon) { filter[type][i] = recon(type, origBytes(y, i)); } else { filter[type][i] = filt(type, origBytes(y, i)); @@ -391,49 +434,26 @@ static void filterData(void) { } if (heuristic[type] < heuristic[minType]) minType = type; } - - if (options.declareFilter) { - lines[y]->type = options.declareFilters[y % options.declareFilter]; + if (declFilter) { + *lineType(y) = declFilters[y % declFilter]; } else { - lines[y]->type = minType; + *lineType(y) = minType; } - - if (options.applyFilter) { - enum Filter type = options.applyFilters[y % options.applyFilter]; - memcpy(lines[y]->data, filter[type], lineSize()); + if (applyFilter) { + memcpy(lineData(y), filter[applyFilters[y % applyFilter]], lineLen); } else { - memcpy(lines[y]->data, filter[minType], lineSize()); + memcpy(lineData(y), filter[minType], lineLen); } } -} - -static void invert(void) { - for (uint32_t y = 0; y < header.height; ++y) { - for (size_t i = 0; i < lineSize(); ++i) { - lines[y]->data[i] ^= 0xFF; - } - } -} - -static void mirror(void) { - for (uint32_t y = 0; y < header.height; ++y) { - for (size_t i = 0, j = lineSize() - 1; i < j; ++i, --j) { - uint8_t t = lines[y]->data[i]; - lines[y]->data[i] = lines[y]->data[j]; - lines[y]->data[j] = t; - } - } -} - -static void zeroX(void) { - for (uint32_t y = 0; y < header.height; ++y) { - memset(lines[y]->data, 0, pixelSize()); + for (enum Filter i = None; i < FilterCap; ++i) { + free(filter[i]); } } -static void zeroY(void) { - memset(lines[0]->data, 0, lineSize()); -} +static bool invertData; +static bool mirrorData; +static bool zeroX; +static bool zeroY; static void glitch(const char *inPath, const char *outPath) { if (inPath) { @@ -441,98 +461,145 @@ static void glitch(const char *inPath, const char *outPath) { file = fopen(path, "r"); if (!file) err(EX_NOINPUT, "%s", path); } else { - path = "(stdin)"; + path = "stdin"; file = stdin; } - readSignature(); - readHeader(); - if (header.color == Indexed) readPalette(); - readData(); + sigRead(); + struct Chunk ihdr = chunkRead(); + if (strcmp(ihdr.type, "IHDR")) { + errx(EX_DATAERR, "%s: expected IHDR, found %s", path, ihdr.type); + } + headerRead(ihdr); + if (header.interlace != Progressive) { + errx(EX_CONFIG, "%s: unsupported interlacing", path); + } + + palClear(); + dataAlloc(); + for (;;) { + struct Chunk chunk = chunkRead(); + if (!strcmp(chunk.type, "PLTE")) { + palRead(chunk); + } else if (!strcmp(chunk.type, "tRNS")) { + transRead(chunk); + } else if (!strcmp(chunk.type, "IDAT")) { + dataRead(chunk); + } else if (!strcmp(chunk.type, "IEND")) { + break; + } else { + chunkSkip(chunk); + } + } fclose(file); - scanlines(); - reconData(); - filterData(); - if (options.invert) invert(); - if (options.mirror) mirror(); - if (options.zeroX) zeroX(); - if (options.zeroY) zeroY(); - free(lines); + dataRecon(); + dataFilter(); + if (invertData) { + for (uint32_t y = 0; y < header.height; ++y) { + for (size_t i = 0; i < lineLen; ++i) { + lineData(y)[i] ^= 0xFF; + } + } + } + if (mirrorData) { + for (uint32_t y = 0; y < header.height; ++y) { + for (size_t i = 0, j = lineLen-1; i < j; ++i, --j) { + uint8_t x = lineData(y)[i]; + lineData(y)[i] = lineData(y)[j]; + lineData(y)[j] = x; + } + } + } + if (zeroX) { + for (uint32_t y = 0; y < header.height; ++y) { + memset(lineData(y), 0, pixelLen); + } + } + if (zeroY) { + memset(lineData(0), 0, lineLen); + } + + char buf[PATH_MAX]; if (outPath) { path = outPath; - file = fopen(path, "w"); - if (!file) err(EX_CANTCREAT, "%s", path); + if (outPath == inPath) { + snprintf(buf, sizeof(buf), "%sg", outPath); + file = fopen(buf, "wx"); + if (!file) err(EX_CANTCREAT, "%s", buf); + } else { + file = fopen(path, "w"); + if (!file) err(EX_CANTCREAT, "%s", outPath); + } } else { - path = "(stdout)"; + path = "stdout"; file = stdout; } - writeSignature(); - writeHeader(); - if (header.color == Indexed) writePalette(); - writeData(); - writeEnd(); + sigWrite(); + headerWrite(); + if (header.color == Indexed) { + palWrite(); + if (trans.len) transWrite(); + } + dataWrite(); free(data); - int error = fclose(file); if (error) err(EX_IOERR, "%s", path); + + if (outPath && outPath == inPath) { + error = rename(buf, outPath); + if (error) err(EX_CANTCREAT, "%s", outPath); + } } -static enum Filter parseFilter(const char *s) { - switch (s[0]) { +static enum Filter parseFilter(const char *str) { + switch (str[0]) { case 'N': case 'n': return None; case 'S': case 's': return Sub; case 'U': case 'u': return Up; case 'A': case 'a': return Average; case 'P': case 'p': return Paeth; - default: errx(EX_USAGE, "invalid filter type %s", s); + default: errx(EX_USAGE, "invalid filter type %s", str); } } -static uint8_t parseFilters(enum Filter *filters, const char *s) { - uint8_t len = 0; - do { - filters[len++] = parseFilter(s); - s = strchr(s, ','); - } while (s++); +static size_t parseFilters(enum Filter *filters, char *str) { + size_t len = 0; + while (str) { + char *filt = strsep(&str, ","); + filters[len++] = parseFilter(filt); + } return len; } int main(int argc, char *argv[]) { bool stdio = false; - char *output = NULL; + char *outPath = NULL; - int opt; - while (0 < (opt = getopt(argc, argv, "a:cd:fimo:prxy"))) { + for (int opt; 0 < (opt = getopt(argc, argv, "a:cd:fimo:prxy"));) { switch (opt) { - break; case 'a': - options.applyFilter = parseFilters(options.applyFilters, optarg); + break; case 'a': applyFilter = parseFilters(applyFilters, optarg); break; case 'c': stdio = true; - break; case 'd': - options.declareFilter = parseFilters(options.declareFilters, optarg); - break; case 'f': options.filt = true; - break; case 'i': options.invert = true; - break; case 'm': options.mirror = true; - break; case 'o': output = optarg; - break; case 'p': options.brokenPaeth = true; - break; case 'r': options.recon = true; - break; case 'x': options.zeroX = true; - break; case 'y': options.zeroY = true; - break; default: return EX_USAGE; + break; case 'd': declFilter = parseFilters(declFilters, optarg); + break; case 'f': reconFilter = true; + break; case 'i': invertData = true; + break; case 'm': mirrorData = true; + break; case 'o': outPath = optarg; + break; case 'p': brokenPaeth = true; + break; case 'r': filterRecon = true; + break; case 'x': zeroX = true; + break; case 'y': zeroY = true; + break; default: return EX_USAGE; } } - if (argc - optind == 1 && (output || stdio)) { - glitch(argv[optind], output); - } else if (optind < argc) { + if (optind < argc) { for (int i = optind; i < argc; ++i) { - glitch(argv[i], argv[i]); + glitch(argv[i], (stdio ? NULL : outPath ? outPath : argv[i])); } } else { - glitch(NULL, output); + glitch(NULL, outPath); } - - return EX_OK; } diff --git a/bin/hi.c b/bin/hi.c deleted file mode 100644 index 7e19f3fc..00000000 --- a/bin/hi.c +++ /dev/null @@ -1,766 +0,0 @@ -/* vim: set foldmethod=marker foldlevel=0: */ -/* Copyright (C) 2019 C. McEnroe <june@causal.agency> - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -#include <assert.h> -#include <err.h> -#include <locale.h> -#include <regex.h> -#include <stdbool.h> -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <sys/stat.h> -#include <sysexits.h> -#include <unistd.h> - -#define ARRAY_LEN(a) (sizeof(a) / sizeof(a[0])) - -typedef unsigned Set; -#define SET(x) ((Set)1 << (x)) - -#define ENUM_CLASS \ - X(Normal) \ - X(Keyword) \ - X(Macro) \ - X(Tag) \ - X(String) \ - X(Escape) \ - X(Format) \ - X(Interp) \ - X(Comment) \ - X(Todo) \ - X(DiffOld) \ - X(DiffNew) - -enum Class { -#define X(class) class, - ENUM_CLASS -#undef X - ClassLen, -}; - -static const char *ClassName[ClassLen] = { -#define X(class) [class] = #class, - ENUM_CLASS -#undef X -}; - -struct Syntax { - enum Class class; - Set parent; - bool newline; - size_t subexp; - const char *pattern; -}; - -#define WB "(^|[^_[:alnum:]]|\n)" -#define BL0 "[[:blank:]]*" -#define BL1 "[[:blank:]]+" -#define SP0 "[[:space:]]*" -#define SP1 "[[:space:]]+" -#define PATTERN_ID "[_[:alpha:]][_[:alnum:]]*" -#define PATTERN_SQ "'([^']|[\\]')*'" -#define PATTERN_DQ "\"([^\"]|[\\]\")*\"" -#define PATTERN_BC "/[*]" "([^*]|[*][^/])*" "[*]+/" -#define PATTERN_TODO "FIXME|TODO|XXX" - -// C syntax {{{ -static const struct Syntax CSyntax[] = { - { Keyword, .subexp = 2, .pattern = WB - "(" "auto|extern|register|static|(_T|t)hread_local|typedef" - "|" "_Atomic|const|restrict|volatile" - "|" "inline|(_N|n)oreturn" - "|" "(_A|a)lignas" - "|" "enum|struct|union" - "|" "do|else|for|if|switch|while" - "|" "break|case|continue|default|goto|return" - ")" WB }, - { Macro, - .pattern = "^" BL0 "#(.|[\\]\n)*" }, - { Tag, .parent = SET(Macro), .subexp = 1, - .pattern = "define" BL1 "(" PATTERN_ID ")" "[(]" }, - { Tag, .subexp = 2, - .pattern = "(enum|struct|union)" SP1 "(" PATTERN_ID ")" SP0 "[{]" }, - { Tag, .parent = ~SET(Keyword), .newline = true, .subexp = 1, - .pattern = "(" PATTERN_ID ")" SP0 "[(][^()]*[)]" SP0 "[{]" }, - { Tag, .newline = true, .subexp = 3, .pattern = - "(static|typedef)" SP1 - "(" "(" PATTERN_ID ")" SP0 - "(" "[*]" "|" "[[][^]]*[]]" "|" "[{][^}]*[}]" "|" SP0 ")*" ")+" }, - { String, .parent = SET(Macro), .subexp = 2, - .pattern = "(include|import)" BL0 "(<[^>]*>)" }, - { String, - .pattern = "[LUu]?" PATTERN_SQ }, - { String, .parent = ~SET(String), - .pattern = "([LU]|u8?)?" PATTERN_DQ }, - { Escape, .parent = SET(String), - .pattern = "[\\]([\"'?\\abfnrtv]|[0-7]{1,3}|x[0-9A-Fa-f]+)" }, - { Escape, .parent = SET(String), - .pattern = "[\\](U[0-9A-Fa-f]{8}|u[0-9A-Fa-f]{4})" }, - { Format, .parent = SET(String), .pattern = - "%%|%[ #+-0]*" // flags - "([*]|[0-9]+)?" // field width - "([.]([*]|[0-9]+))?" // precision - "([Lhjltz]|hh|ll)?" // length modifier - "[AEFGXacdefginopsux]" // format specifier - }, - { Comment, .parent = ~SET(String), - .pattern = "//(.|[\\]\n)*" }, - { Comment, .parent = ~SET(String), .newline = true, - .pattern = PATTERN_BC }, - { Todo, .parent = SET(Comment), - .pattern = PATTERN_TODO }, -}; -// }}} - -// diff syntax {{{ -static const struct Syntax DiffSyntax[] = { - { Keyword, .pattern = "^[^ ].*" }, - { Comment, .pattern = "^@@.*" }, - { DiffOld, .pattern = "^[-].*" }, - { DiffNew, .pattern = "^[+].*" }, -}; -// }}} - -// make syntax {{{ -#define MAKE_TARGET "[-./_[:alnum:]]+" -static const struct Syntax MakeSyntax[] = { - { Keyword, .subexp = 2, - .pattern = WB "([.](PHONY|PRECIOUS|SUFFIXES))" WB }, - { Macro, - .pattern = "^ *-?include" }, - { Tag, .parent = ~SET(Keyword), .subexp = 1, .pattern = - "(" MAKE_TARGET ")" "(" BL1 MAKE_TARGET ")*" BL0 ":([^=]|$)" }, - { String, .subexp = 1, - .pattern = "[._[:alnum:]]+" BL0 "[!+:?]?=" BL0 "(.*)" }, - { Normal, - .pattern = "^\t.*" }, - { String, - .pattern = PATTERN_SQ }, - { String, - .pattern = PATTERN_DQ }, - { Interp, - .pattern = "[$]." }, - // Support one level of nesting with the same delimiter. - { Interp, - .pattern = "[$][(](" "[^$)]" "|" "[$]." "|" "[$][(][^)]*[)]" ")*[)]" }, - { Interp, - .pattern = "[$][{](" "[^$}]" "|" "[$]." "|" "[$][{][^}]*[}]" ")*[}]" }, - { Escape, - .pattern = "[$][$]" }, - { Comment, .parent = ~SET(String), - .pattern = "#.*" }, - { Todo, .parent = SET(Comment), - .pattern = PATTERN_TODO }, -}; -// }}} - -// mdoc syntax {{{ -static const struct Syntax MdocSyntax[] = { - { Keyword, .subexp = 2, .pattern = WB - "(" "D[dt]|N[dm]|Os" - "|" "S[hsx]|[LP]p|Xr" - "|" "%[ABCDIJNOPQRTUV]|[BE][dl]|D[1l]|It|Ql|R[es]|Ta" - "|" "Ap|[BE]k|Ns|Pf|Sm" - "|" "Ar|Cm|Ev|Fl|O[cop]|Pa" - "|" "Dv|Er|F[acdnot]|In|Lb|V[at]" - "|" "A[dn]|Cd|Lk|M[st]" - "|" "[BE]f|Em|Li|No|Sy" - "|" "(Br|[ABDPQS])[coq]|E[co]" - "|" "At|(Bs|[BDEFNO])x|Rv|St" - ")" WB }, - { Tag, .subexp = 1, - .pattern = "^[.]S[hs]" BL1 "(.+)" }, - { String, - .pattern = PATTERN_DQ }, - { Normal, - .pattern = "^[^.].*" }, - { String, - .pattern = "[\\](" "." "|" "[(].{2}" "|" "[[][^]]*[]]" ")" }, - { Comment, - .pattern = "^[.][\\]\".*" }, - { Todo, .parent = SET(Comment), - .pattern = PATTERN_TODO }, -}; -// }}} - -// Rust syntax {{{ -static const struct Syntax RustSyntax[] = { - { Keyword, .subexp = 2, .pattern = WB - "(" "'?static|[Ss]elf|abstract|as|async|await|become|box|break|const" - "|" "continue|crate|do|dyn|else|enum|extern|false|final|fn|for|if" - "|" "impl|in|let|loop|macro|match|mod|move|mut|override|priv|pub|ref" - "|" "return|struct|super|trait|true|try|type(of)?|union|uns(afe|ized)" - "|" "use|virtual|where|while|yield" - ")" WB }, - { Tag, .subexp = 2, .pattern = - "(enum|fn|macro_rules!|mod|struct|type|union)" SP1 "(" PATTERN_ID ")" }, - { Macro, .newline = true, - .pattern = "#!?[[][^]]*[]]" }, - { Macro, - .pattern = PATTERN_ID "!" }, - { Interp, - .pattern = "[$]" PATTERN_ID }, - { String, - .pattern = "b?'([^']|[\\]')'" }, - { String, - .pattern = "b?" "\"([^\"]|[\\][\n\"])*\"" }, - { Escape, .parent = SET(String), - .pattern = "[\\]([\"'0\\nrt]|u[{][0-9A-Fa-f]{1,6}[}]|x[0-9A-Fa-f]{2})" }, - { Format, .parent = SET(String), - .pattern = "[{][{]|[{][^{}]*[}]|[}][}]" }, - { String, .parent = ~SET(String), .newline = true, - .pattern = "b?r\"[^\"]*\"" }, - { String, .parent = ~SET(String), .newline = true, - .pattern = "b?r#+\"" "([^\"]|\"[^#])*" "\"+#+" }, - { Comment, .parent = ~SET(String), - .pattern = "//.*" }, - { Comment, .parent = ~SET(String), .newline = true, - .pattern = PATTERN_BC }, - { Todo, .parent = SET(Comment), - .pattern = PATTERN_TODO }, -}; -// }}} - -// sh syntax {{{ -static const struct Syntax ShSyntax[] = { - { Keyword, .subexp = 2, .pattern = WB - "(" "!|case|do|done|elif|else|esac|fi|for|if|in|then|until|while" - "|" "alias|bg|cd|command|false|fc|fg|getopts|jobs|kill|newgrp|pwd|read" - "|" "true|type|ulimit|umask|unalias|wait" - "|" "[.:]|break|continue|eval|exec|exit|export|local|readonly|return" - "|" "set|shift|times|trap|unset" - ")" WB }, - { Tag, .subexp = 2, - .pattern = WB "(" PATTERN_ID ")" BL0 "[(]" BL0 "[)]" }, - { String, .newline = true, .subexp = 1, .pattern = - "<<-?" BL0 "EOF[^\n]*\n" - "(([^\n]|\n\t*[^E]|\n\t*E[^O]|\n\t*EO[^F]|\n\t*EOF[^\n])*)" - "\n\t*EOF\n" }, - { String, .parent = ~SET(String), .newline = true, - .pattern = PATTERN_DQ }, - { Escape, .parent = SET(String), - .pattern = "[\\][\"$\\`]" }, - { Interp, .parent = ~SET(Escape), - .pattern = "[$][(][^)]*[)]" "|" "`[^`]*`" }, - { Interp, .parent = ~SET(Escape), - .pattern = "[$][(][(]([^)]|[)][^)])*[)][)]" }, - { String, .parent = SET(Interp), - .pattern = PATTERN_DQ }, - { Interp, .parent = ~SET(Escape), - .pattern = "[$]([!#$*?@-]|[_[:alnum:]]+|[{][^}]*[}])" }, - { String, .parent = ~SET(Escape), - .pattern = "[\\]." }, - { String, .subexp = 1, .newline = true, .pattern = - "<<-?" BL0 "'EOF'[^\n]*\n" - "(([^\n]|\n\t*[^E]|\n\t*E[^O]|\n\t*EO[^F]|\n\t*EOF[^\n])*)" - "\n\t*EOF\n" }, - { String, .parent = ~SET(String), .newline = true, - .pattern = "'[^']*'" }, - { Comment, .parent = ~SET(String), .subexp = 2, - .pattern = "(^|[[:blank:]]+)(#.*)" }, - { Todo, .parent = SET(Comment), - .pattern = PATTERN_TODO }, -}; -// }}} - -static const struct Language { - const char *name; - const char *pattern; - const struct Syntax *syntax; - size_t len; -} Languages[] = { - { "c", "[.][chlmy]$", CSyntax, ARRAY_LEN(CSyntax) }, - { "diff", "[.](diff|patch)$", DiffSyntax, ARRAY_LEN(DiffSyntax) }, - { "make", "[.]mk$|^Makefile$", MakeSyntax, ARRAY_LEN(MakeSyntax) }, - { "mdoc", "[.][1-9]$", MdocSyntax, ARRAY_LEN(MdocSyntax) }, - { "rust", "[.]rs$", RustSyntax, ARRAY_LEN(RustSyntax) }, - { "sh", "[.]sh$|^[.](profile|shrc)$", ShSyntax, ARRAY_LEN(ShSyntax) }, - { "text", "[.]txt$", NULL, 0 }, -}; - -static regex_t compile(const char *pattern, int flags) { - regex_t regex; - int error = regcomp(®ex, pattern, REG_EXTENDED | flags); - if (!error) return regex; - char buf[256]; - regerror(error, ®ex, buf, sizeof(buf)); - errx(EX_SOFTWARE, "regcomp: %s: %s", buf, pattern); -} - -enum { SubsLen = 8 }; -static void highlight(struct Language lang, enum Class *hi, const char *str) { - for (size_t i = 0; i < lang.len; ++i) { - struct Syntax syn = lang.syntax[i]; - regex_t regex = compile(syn.pattern, syn.newline ? 0 : REG_NEWLINE); - assert(syn.subexp < SubsLen); - assert(syn.subexp <= regex.re_nsub); - regmatch_t subs[SubsLen] = {{0}}; - for (size_t offset = 0; str[offset]; offset += subs[syn.subexp].rm_eo) { - int error = regexec( - ®ex, &str[offset], SubsLen, subs, offset ? REG_NOTBOL : 0 - ); - if (error == REG_NOMATCH) break; - if (error) errx(EX_SOFTWARE, "regexec: %d", error); - regmatch_t *sub = &subs[syn.subexp]; - if (syn.parent && !(syn.parent & SET(hi[offset + sub->rm_so]))) { - sub->rm_eo = sub->rm_so + 1; - continue; - } - for (regoff_t j = sub->rm_so; j < sub->rm_eo; ++j) { - hi[offset + j] = lang.syntax[i].class; - } - } - regfree(®ex); - } -} - -static void check(void) { - for (size_t i = 0; i < ARRAY_LEN(Languages); ++i) { - regex_t regex = compile(Languages[i].pattern, REG_NOSUB); - regfree(®ex); - for (size_t j = 0; j < Languages[i].len; ++j) { - struct Syntax syn = Languages[i].syntax[j]; - regex = compile(syn.pattern, 0); - if (syn.subexp >= SubsLen || syn.subexp > regex.re_nsub) { - errx( - EX_SOFTWARE, "subexpression %zu out of bounds: %s", - syn.subexp, syn.pattern - ); - } - regfree(®ex); - } - } -} - -#define ENUM_OPTION \ - X(Anchor, "anchor") \ - X(CSS, "css") \ - X(Document, "document") \ - X(Inline, "inline") \ - X(Monospace, "monospace") \ - X(Tab, "tab") \ - X(Title, "title") - -enum Option { -#define X(option, _) option, - ENUM_OPTION -#undef X - OptionLen, -}; - -static const char *OptionKey[OptionLen + 1] = { -#define X(option, key) [option] = key, - ENUM_OPTION -#undef X - NULL, -}; - -typedef void HeaderFn(const char *opts[]); -typedef void -OutputFn(const char *opts[], enum Class class, const char *str, size_t len); - -// ANSI format {{{ - -enum SGR { - SGRBoldOn = 1, - SGRUnderlineOn = 4, - SGRBoldOff = 22, - SGRUnderlineOff = 24, - SGRBlack = 30, - SGRRed, - SGRGreen, - SGRYellow, - SGRBlue, - SGRMagenta, - SGRCyan, - SGRWhite, - SGRDefault = 39, -}; - -static const enum SGR ANSIStyle[ClassLen][3] = { - [Normal] = { SGRDefault }, - [Keyword] = { SGRWhite }, - [Macro] = { SGRGreen }, - [Tag] = { SGRDefault, SGRUnderlineOn, SGRUnderlineOff }, - [String] = { SGRCyan }, - [Escape] = { SGRDefault }, - [Format] = { SGRCyan, SGRBoldOn, SGRBoldOff }, - [Interp] = { SGRYellow }, - [Comment] = { SGRBlue }, - [Todo] = { SGRBlue, SGRBoldOn, SGRBoldOff }, - [DiffOld] = { SGRRed }, - [DiffNew] = { SGRGreen }, -}; - -static void -ansiOutput(const char *opts[], enum Class class, const char *str, size_t len) { - (void)opts; - if (ANSIStyle[class][1]) { - printf( - "\x1B[%d;%dm%.*s\x1B[%dm", - ANSIStyle[class][0], ANSIStyle[class][1], - (int)len, str, - ANSIStyle[class][2] - ); - } else { - printf("\x1B[%dm%.*s", ANSIStyle[class][0], (int)len, str); - } -} - -// }}} - -// IRC format {{{ - -enum IRC { - IRCWhite, - IRCBlack, - IRCBlue, - IRCGreen, - IRCRed, - IRCBrown, - IRCMagenta, - IRCOrange, - IRCYellow, - IRCLightGreen, - IRCCyan, - IRCLightCyan, - IRCLightBlue, - IRCPink, - IRCGray, - IRCLightGray, - IRCBold = 0x02, - IRCColor = 0x03, - IRCMonospace = 0x11, - IRCUnderline = 0x1F, -}; - -static const enum IRC SGRIRC[] = { - [SGRBoldOn] = IRCBold, - [SGRBoldOff] = IRCBold, - [SGRUnderlineOn] = IRCUnderline, - [SGRUnderlineOff] = IRCUnderline, - [SGRBlack] = IRCBlack, - [SGRRed] = IRCRed, - [SGRGreen] = IRCGreen, - [SGRYellow] = IRCYellow, - [SGRBlue] = IRCBlue, - [SGRMagenta] = IRCMagenta, - [SGRCyan] = IRCCyan, - [SGRWhite] = IRCGray, - [SGRDefault] = 0, -}; - -static void ircHeader(const char *opts[]) { - if (opts[Monospace]) printf("%c", IRCMonospace); -} - -static void -ircOutput(const char *opts[], enum Class class, const char *str, size_t len) { - char cc[3] = ""; - if (ANSIStyle[class][0] != SGRDefault) { - snprintf(cc, sizeof(cc), "%d", SGRIRC[ANSIStyle[class][0]]); - } - // Prevent trailing formatting after newline ... - bool newline = (str[len - 1] == '\n'); - if (ANSIStyle[class][1]) { - printf( - "%c%s%c%.*s%c%s", - IRCColor, cc, SGRIRC[ANSIStyle[class][1]], - (int)(newline ? len - 1 : len), str, - SGRIRC[ANSIStyle[class][2]], - (newline ? "\n" : "") - ); - } else { - // Double-toggle bold to prevent str being interpreted as color. - printf("%c%s%c%c%.*s", IRCColor, cc, IRCBold, IRCBold, (int)len, str); - } - // ... except for monospace, at the beginning of each line. - if (newline && opts[Monospace]) printf("%c", IRCMonospace); -} - -// }}} - -// HTML format {{{ - -static void htmlEscape(const char *str, size_t len) { - while (len) { - size_t run = strcspn(str, "\"&<>"); - if (run > len) run = len; - switch (str[0]) { - break; case '"': run = 1; printf("""); - break; case '&': run = 1; printf("&"); - break; case '<': run = 1; printf("<"); - break; case '>': run = 1; printf(">"); - break; default: printf("%.*s", (int)run, str); - } - str += run; - len -= run; - } -} - -static const char *HTMLStyle[ClassLen] = { - [Keyword] = "color: dimgray;", - [Macro] = "color: green;", - [Tag] = "color: inherit; text-decoration: underline;", - [String] = "color: teal;", - [Format] = "color: teal; font-weight: bold;", - [Interp] = "color: olive;", - [Comment] = "color: navy;", - [Todo] = "color: navy; font-weight: bold;", - [DiffOld] = "color: red;", - [DiffNew] = "color: green;", -}; - -static void htmlTabSize(const char *tab) { - printf("-moz-tab-size: "); - htmlEscape(tab, strlen(tab)); - printf("; tab-size: "); - htmlEscape(tab, strlen(tab)); - printf(";"); -} - -static void htmlHeader(const char *opts[]) { - if (!opts[Document]) goto body; - printf("<!DOCTYPE html>\n<title>"); - if (opts[Title]) htmlEscape(opts[Title], strlen(opts[Title])); - printf("</title>\n"); - if (opts[CSS]) { - printf("<link rel=\"stylesheet\" href=\""); - htmlEscape(opts[CSS], strlen(opts[CSS])); - printf("\">\n"); - } else if (!opts[Inline]) { - printf("<style>\n"); - if (opts[Tab]) { - printf("pre.hi { "); - htmlTabSize(opts[Tab]); - printf(" }\n"); - } - for (enum Class class = 0; class < ClassLen; ++class) { - if (!HTMLStyle[class]) continue; - printf(".hi.%s { %s }\n", ClassName[class], HTMLStyle[class]); - } - printf( - ".hi.%s:target { color: goldenrod; outline: none; }\n", - ClassName[Tag] - ); - printf("</style>\n"); - } -body: - if (opts[Inline] && opts[Tab]) { - printf("<pre class=\"hi\" style=\""); - htmlTabSize(opts[Tab]); - printf("\">"); - } else { - printf("<pre class=\"hi\">"); - } -} - -static void htmlFooter(const char *opts[]) { - (void)opts; - printf("</pre>\n"); -} - -static void htmlAnchor(const char *opts[], const char *str, size_t len) { - if (opts[Inline]) { - printf("<a style=\"%s\" id=\"", HTMLStyle[Tag] ? HTMLStyle[Tag] : ""); - } else { - printf("<a class=\"hi %s\" id=\"", ClassName[Tag]); - } - htmlEscape(str, len); - printf("\" href=\"#"); - htmlEscape(str, len); - printf("\">"); - htmlEscape(str, len); - printf("</a>"); -} - -static void -htmlOutput(const char *opts[], enum Class class, const char *str, size_t len) { - if (opts[Anchor] && class == Tag) { - htmlAnchor(opts, str, len); - return; - } - if (opts[Inline]) { - printf("<span style=\"%s\">", HTMLStyle[class] ? HTMLStyle[class] : ""); - } else { - printf("<span class=\"hi %s\">", ClassName[class]); - } - htmlEscape(str, len); - printf("</span>"); -} - -// }}} - -// Debug format {{{ -static void -debugOutput(const char *opts[], enum Class class, const char *str, size_t len) { - (void)opts; - printf("%s\t\"", ClassName[class]); - while (len) { - size_t run = strcspn(str, "\t\n\"\\"); - if (run > len) run = len; - switch (str[0]) { - break; case '\t': run = 1; printf("\\t"); - break; case '\n': run = 1; printf("\\n"); - break; case '"': run = 1; printf("\\\""); - break; case '\\': run = 1; printf("\\\\"); - break; default: printf("%.*s", (int)run, str); - } - str += run; - len -= run; - } - printf("\"\n"); -} -// }}} - -static const struct Format { - const char *name; - OutputFn *output; - HeaderFn *header; - HeaderFn *footer; -} Formats[] = { - { "ansi", ansiOutput, NULL, NULL }, - { "irc", ircOutput, ircHeader, NULL }, - { "html", htmlOutput, htmlHeader, htmlFooter }, - { "debug", debugOutput, NULL, NULL }, -}; - -static bool findLanguage(struct Language *lang, const char *name) { - for (size_t i = 0; i < ARRAY_LEN(Languages); ++i) { - if (strcmp(name, Languages[i].name)) continue; - *lang = Languages[i]; - return true; - } - return false; -} - -static bool matchLanguage(struct Language *lang, const char *name) { - for (size_t i = 0; i < ARRAY_LEN(Languages); ++i) { - regex_t regex = compile(Languages[i].pattern, REG_NOSUB); - int error = regexec(®ex, name, 0, NULL, 0); - regfree(®ex); - if (error == REG_NOMATCH) continue; - if (error) errx(EX_SOFTWARE, "regexec: %d", error); - *lang = Languages[i]; - return true; - } - return false; -} - -static bool findFormat(struct Format *format, const char *name) { - for (size_t i = 0; i < ARRAY_LEN(Formats); ++i) { - if (strcmp(name, Formats[i].name)) continue; - *format = Formats[i]; - return true; - } - return false; -} - -int main(int argc, char *argv[]) { - setlocale(LC_CTYPE, ""); - - bool text = false; - const char *name = NULL; - struct Language lang = {0}; - struct Format format = Formats[0]; - const char *opts[OptionLen] = {0}; - - int opt; - while (0 < (opt = getopt(argc, argv, "cf:l:n:o:t"))) { - switch (opt) { - break; case 'c': check(); return EX_OK; - break; case 'f': { - if (!findFormat(&format, optarg)) { - errx(EX_USAGE, "no such format %s", optarg); - } - } - break; case 'l': { - if (!findLanguage(&lang, optarg)) { - errx(EX_USAGE, "no such language %s", optarg); - } - } - break; case 'n': name = optarg; - break; case 'o': { - char *val; - enum Option key; - while (optarg[0]) { - key = getsubopt(&optarg, (char *const *)OptionKey, &val); - if (key >= OptionLen) { - errx(EX_USAGE, "no such option %s", val); - } - opts[key] = (val ? val : ""); - } - } - break; case 't': text = true; - break; default: return EX_USAGE; - } - } - - const char *path = "(stdin)"; - FILE *file = stdin; - if (optind < argc) { - path = argv[optind]; - file = fopen(path, "r"); - if (!file) err(EX_NOINPUT, "%s", path); - } - - if (!name) { - name = strrchr(path, '/'); - name = (name ? &name[1] : path); - } - if (!lang.name && !matchLanguage(&lang, name) && !text) { - errx(EX_USAGE, "cannot infer language for %s", name); - } - if (!opts[Title]) opts[Title] = name; - - struct stat stat; - int error = fstat(fileno(file), &stat); - if (error) err(EX_IOERR, "fstat"); - - size_t cap = (stat.st_mode & S_IFREG ? stat.st_size + 1 : 4096); - char *str = malloc(cap); - if (!str) err(EX_OSERR, "malloc"); - - size_t len = 0, read; - while (0 < (read = fread(&str[len], 1, cap - len - 1, file))) { - len += read; - if (len + 1 < cap) continue; - cap *= 2; - str = realloc(str, cap); - if (!str) err(EX_OSERR, "realloc"); - } - if (ferror(file)) err(EX_IOERR, "fread"); - if (memchr(str, 0, len)) errx(EX_DATAERR, "input is binary"); - str[len] = '\0'; - - enum Class *hi = calloc(len, sizeof(*hi)); - if (!hi) err(EX_OSERR, "calloc"); - - highlight(lang, hi, str); - - size_t run = 0; - if (format.header) format.header(opts); - for (size_t i = 0; i < len; i += run) { - for (run = 1; i + run < len; ++run) { - if (hi[i + run] != hi[i]) break; - if (str[i + run - 1] == '\n') break; - } - format.output(opts, hi[i], &str[i], run); - } - if (format.footer) format.footer(opts); -} diff --git a/bin/hilex.c b/bin/hilex.c new file mode 100644 index 00000000..7d7b3f2d --- /dev/null +++ b/bin/hilex.c @@ -0,0 +1,406 @@ +/* Copyright (C) 2020 June McEnroe <june@causal.agency> + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +#include <assert.h> +#include <ctype.h> +#include <err.h> +#include <regex.h> +#include <stdbool.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <sys/wait.h> +#include <sysexits.h> +#include <unistd.h> + +#include "hilex.h" + +#define ARRAY_LEN(a) (sizeof(a) / sizeof(a[0])) + +static const char *Class[] = { +#define X(class) [class] = #class, + ENUM_CLASS +#undef X +}; + +static FILE *yyin; +static char *yytext; +static int yylex(void) { + static size_t cap = 0; + return (getline(&yytext, &cap, yyin) < 0 ? None : Normal); +} +static const struct Lexer LexText = { yylex, &yyin, &yytext }; + +static const struct { + const struct Lexer *lexer; + const char *name; + const char *namePatt; + const char *linePatt; +} Lexers[] = { + { &LexC, "c", "[.][chlmy]$", NULL }, + { &LexMake, "make", "[.](mk|am)$|^Makefile$", NULL }, + { &LexMdoc, "mdoc", "[.][1-9]$", "^[.]Dd" }, + { &LexSh, "sh", "[.]sh$|^[.](profile|shrc)$", "^#![ ]?/bin/k?sh" }, + { &LexText, "text", "[.]txt$", NULL }, +}; + +static const struct Lexer *parseLexer(const char *name) { + for (size_t i = 0; i < ARRAY_LEN(Lexers); ++i) { + if (!strcmp(name, Lexers[i].name)) return Lexers[i].lexer; + } + errx(EX_USAGE, "unknown lexer %s", name); +} + +static void ungets(const char *str, FILE *file) { + size_t len = strlen(str); + for (size_t i = len-1; i < len; --i) { + int ch = ungetc(str[i], file); + if (ch == EOF) errx(EX_IOERR, "cannot push back string"); + } +} + +static const struct Lexer *matchLexer(const char *name, FILE *file) { + char buf[256]; + regex_t regex; + for (size_t i = 0; i < ARRAY_LEN(Lexers); ++i) { + int error = regcomp( + ®ex, Lexers[i].namePatt, REG_EXTENDED | REG_NOSUB + ); + assert(!error); + error = regexec(®ex, name, 0, NULL, 0); + regfree(®ex); + if (!error) return Lexers[i].lexer; + } + char *line = fgets(buf, sizeof(buf), file); + if (!line) return NULL; + for (size_t i = 0; i < ARRAY_LEN(Lexers); ++i) { + if (!Lexers[i].linePatt) continue; + int error = regcomp( + ®ex, Lexers[i].linePatt, REG_EXTENDED | REG_NOSUB + ); + assert(!error); + error = regexec(®ex, line, 0, NULL, 0); + regfree(®ex); + if (!error) { + ungets(line, file); + return Lexers[i].lexer; + } + } + ungets(line, file); + return NULL; +} + +#define ENUM_OPTION \ + X(Document, "document") \ + X(Inline, "inline") \ + X(Monospace, "monospace") \ + X(Pre, "pre") \ + X(Style, "style") \ + X(Tab, "tab") \ + X(Title, "title") + +enum Option { +#define X(option, key) option, + ENUM_OPTION +#undef X + OptionCap, +}; + +typedef void Header(const char *opts[]); +typedef void Output(const char *opts[], enum Class class, const char *text); + +static bool pager; +static void ansiHeader(const char *opts[]) { + (void)opts; + if (!pager) return; + const char *shell = getenv("SHELL"); + const char *pager = getenv("PAGER"); + if (!shell) shell = "/bin/sh"; + if (!pager) pager = "less"; + setenv("LESS", "FRX", 0); + + int rw[2]; + int error = pipe(rw); + if (error) err(EX_OSERR, "pipe"); + + pid_t pid = fork(); + if (pid < 0) err(EX_OSERR, "fork"); + if (!pid) { + dup2(rw[0], STDIN_FILENO); + close(rw[0]); + close(rw[1]); + execl(shell, shell, "-c", pager, NULL); + err(EX_CONFIG, "%s", shell); + } + dup2(rw[1], STDOUT_FILENO); + close(rw[0]); + close(rw[1]); + setlinebuf(stdout); + +#ifdef __OpenBSD__ + error = pledge("stdio", NULL); + if (error) err(EX_OSERR, "pledge"); +#endif +} + +static void ansiFooter(const char *opts[]) { + (void)opts; + if (!pager) return; + int status; + fclose(stdout); + wait(&status); +} + +static const char *SGR[ClassCap] = { + [Keyword] = "37", + [Macro] = "32", + [Comment] = "34", + [String] = "36", + [Format] = "36;1;96", + [Subst] = "33", +}; + +static void ansiFormat(const char *opts[], enum Class class, const char *text) { + (void)opts; + if (!SGR[class]) { + printf("%s", text); + return; + } + // Set color on each line for piping to less -R: + for (const char *nl; (nl = strchr(text, '\n')); text = &nl[1]) { + printf("\33[%sm%.*s\33[m\n", SGR[class], (int)(nl - text), text); + } + if (*text) printf("\33[%sm%s\33[m", SGR[class], text); +} + +static void +debugFormat(const char *opts[], enum Class class, const char *text) { + if (class != Normal) { + printf("%s(", Class[class]); + ansiFormat(opts, class, text); + printf(")"); + } else { + printf("%s", text); + } +} + +static const char *IRC[ClassCap] = { + [Keyword] = "\00315", + [Macro] = "\0033", + [Comment] = "\0032", + [String] = "\00310", + [Format] = "\00311", + [Subst] = "\0037", +}; + +static void ircHeader(const char *opts[]) { + if (opts[Monospace]) printf("\21"); +} + +static const char *stop(const char *text) { + return (*text == ',' || isdigit(*text) ? "\2\2" : ""); +} + +static void ircFormat(const char *opts[], enum Class class, const char *text) { + for (const char *nl; (nl = strchr(text, '\n')); text = &nl[1]) { + if (IRC[class]) printf("%s%s", IRC[class], stop(text)); + printf("%.*s\n", (int)(nl - text), text); + if (opts[Monospace]) printf("\21"); + } + if (*text) { + if (IRC[class]) { + printf("%s%s%s\17", IRC[class], stop(text), text); + if (opts[Monospace]) printf("\21"); + } else { + printf("%s", text); + } + } +} + +static void htmlEscape(const char *text) { + while (*text) { + switch (*text) { + break; case '"': text++; printf("""); + break; case '&': text++; printf("&"); + break; case '<': text++; printf("<"); + } + size_t len = strcspn(text, "\"&<"); + if (len) fwrite(text, len, 1, stdout); + text += len; + } +} + +static const char *Styles[ClassCap] = { + [Keyword] = "color: dimgray;", + [Macro] = "color: green;", + [Comment] = "color: navy;", + [String] = "color: teal;", + [Format] = "color: teal; font-weight: bold;", + [Subst] = "color: olive;", +}; + +static void styleTabSize(const char *tab) { + printf("-moz-tab-size: "); + htmlEscape(tab); + printf("; tab-size: "); + htmlEscape(tab); + printf(";"); +} + +static void htmlHeader(const char *opts[]) { + if (!opts[Document]) goto body; + + printf("<!DOCTYPE html>\n<title>"); + if (opts[Title]) htmlEscape(opts[Title]); + printf("</title>\n"); + + if (opts[Style]) { + printf("<link rel=\"stylesheet\" href=\""); + htmlEscape(opts[Style]); + printf("\">\n"); + } else if (!opts[Inline]) { + printf("<style>\n"); + if (opts[Tab]) { + printf("pre.hilex { "); + styleTabSize(opts[Tab]); + printf(" }\n"); + } + for (enum Class class = 0; class < ClassCap; ++class) { + if (!Styles[class]) continue; + printf("pre.hilex .%.2s { %s }\n", Class[class], Styles[class]); + } + printf("</style>\n"); + } + +body: + if ((opts[Document] || opts[Pre]) && opts[Inline] && opts[Tab]) { + printf("<pre class=\"hilex\" style=\""); + styleTabSize(opts[Tab]); + printf("\">"); + } else if (opts[Document] || opts[Pre]) { + printf("<pre class=\"hilex\">"); + } +} + +static void htmlFooter(const char *opts[]) { + if (opts[Document] || opts[Pre]) printf("</pre>"); + if (opts[Document]) printf("\n"); +} + +static void htmlFormat(const char *opts[], enum Class class, const char *text) { + if (class != Normal) { + if (opts[Inline]) { + printf("<span style=\"%s\">", Styles[class] ? Styles[class] : ""); + } else { + printf("<span class=\"%.2s\">", Class[class]); + } + htmlEscape(text); + printf("</span>"); + } else { + htmlEscape(text); + } +} + +static const struct Formatter { + const char *name; + Header *header; + Output *format; + Header *footer; +} Formatters[] = { + { "ansi", ansiHeader, ansiFormat, ansiFooter }, + { "debug", NULL, debugFormat, NULL }, + { "html", htmlHeader, htmlFormat, htmlFooter }, + { "irc", ircHeader, ircFormat, NULL }, +}; + +static const struct Formatter *parseFormatter(const char *name) { + for (size_t i = 0; i < ARRAY_LEN(Formatters); ++i) { + if (!strcmp(name, Formatters[i].name)) return &Formatters[i]; + } + errx(EX_USAGE, "unknown formatter %s", name); +} + +static char *const OptionKeys[OptionCap + 1] = { +#define X(option, key) [option] = key, + ENUM_OPTION +#undef X + NULL, +}; + +int main(int argc, char *argv[]) { + bool text = false; + const char *name = NULL; + const struct Lexer *lexer = NULL; + const struct Formatter *formatter = &Formatters[0]; + const char *opts[OptionCap] = {0}; + + for (int opt; 0 < (opt = getopt(argc, argv, "f:l:n:o:t"));) { + switch (opt) { + break; case 'f': formatter = parseFormatter(optarg); + break; case 'l': lexer = parseLexer(optarg); + break; case 'n': name = optarg; + break; case 'o': { + while (*optarg) { + char *val; + int key = getsubopt(&optarg, OptionKeys, &val); + if (key < 0) errx(EX_USAGE, "no such option %s", val); + opts[key] = (val ? val : ""); + } + } + break; case 't': text = true; + break; default: return EX_USAGE; + } + } + + const char *path = "(stdin)"; + FILE *file = stdin; + if (optind < argc) { + path = argv[optind]; + file = fopen(path, "r"); + if (!file) err(EX_NOINPUT, "%s", path); + pager = isatty(STDOUT_FILENO); + } + +#ifdef __OpenBSD__ + int error; + if (formatter->header == ansiHeader && pager) { + error = pledge("stdio proc exec", NULL); + } else { + error = pledge("stdio", NULL); + } + if (error) err(EX_OSERR, "pledge"); +#endif + + if (!name) { + if (NULL != (name = strrchr(path, '/'))) { + name++; + } else { + name = path; + } + } + if (!opts[Title]) opts[Title] = name; + if (!lexer) lexer = matchLexer(name, file); + if (!lexer && text) lexer = &LexText; + if (!lexer) errx(EX_USAGE, "cannot infer lexer for %s", name); + + *lexer->in = file; + if (formatter->header) formatter->header(opts); + for (enum Class class; None != (class = lexer->lex());) { + assert(class < ClassCap); + formatter->format(opts, class, *lexer->text); + } + if (formatter->footer) formatter->footer(opts); +} diff --git a/bin/hilex.h b/bin/hilex.h new file mode 100644 index 00000000..b57fc8cc --- /dev/null +++ b/bin/hilex.h @@ -0,0 +1,50 @@ +/* Copyright (C) 2020 June McEnroe <june@causal.agency> + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +#include <stdio.h> + +#define ENUM_CLASS \ + X(None) \ + X(Normal) \ + X(Operator) \ + X(Number) \ + X(Keyword) \ + X(Ident) \ + X(Macro) \ + X(Comment) \ + X(String) \ + X(Escape) \ + X(Format) \ + X(Subst) + +enum Class { +#define X(class) class, + ENUM_CLASS +#undef X + ClassCap, +}; + +typedef int Lex(void); +struct Lexer { + Lex *lex; + FILE **in; + char **text; +}; + +extern const struct Lexer LexC; +extern const struct Lexer LexMake; +extern const struct Lexer LexMdoc; +extern const struct Lexer LexSh; diff --git a/bin/hnel.c b/bin/hnel.c deleted file mode 100644 index 4a869c2d..00000000 --- a/bin/hnel.c +++ /dev/null @@ -1,120 +0,0 @@ -/* Copyright (C) 2017 C. McEnroe <june@causal.agency> - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -#include <err.h> -#include <poll.h> -#include <stdbool.h> -#include <stdlib.h> -#include <string.h> -#include <sys/ioctl.h> -#include <sys/wait.h> -#include <sysexits.h> -#include <termios.h> -#include <unistd.h> - -#if defined __FreeBSD__ -#include <libutil.h> -#elif defined __linux__ -#include <pty.h> -#else -#include <util.h> -#endif - -typedef unsigned char byte; - -static struct termios saveTerm; -static void restoreTerm(void) { - tcsetattr(STDIN_FILENO, TCSADRAIN, &saveTerm); -} - -int main(int argc, char *argv[]) { - int error; - - if (argc < 4) return EX_USAGE; - - byte table[256] = {0}; - if (strlen(argv[1]) != strlen(argv[2])) return EX_USAGE; - for (const char *from = argv[1], *to = argv[2]; *from; ++from, ++to) { - table[(byte)*from] = *to; - } - - error = tcgetattr(STDERR_FILENO, &saveTerm); - if (error) err(EX_IOERR, "tcgetattr"); - atexit(restoreTerm); - - struct termios raw = saveTerm; - cfmakeraw(&raw); - error = tcsetattr(STDERR_FILENO, TCSADRAIN, &raw); - if (error) err(EX_IOERR, "tcsetattr"); - - struct winsize window; - error = ioctl(STDERR_FILENO, TIOCGWINSZ, &window); - if (error) err(EX_IOERR, "TIOCGWINSZ"); - - int pty; - pid_t pid = forkpty(&pty, NULL, NULL, &window); - if (pid < 0) err(EX_OSERR, "forkpty"); - - if (!pid) { - execvp(argv[3], &argv[3]); - err(EX_NOINPUT, "%s", argv[3]); - } - - bool enable = true; - - byte buf[4096]; - struct pollfd fds[2] = { - { .fd = STDIN_FILENO, .events = POLLIN }, - { .fd = pty, .events = POLLIN }, - }; - while (0 < poll(fds, 2, -1)) { - if (fds[0].revents & POLLIN) { - ssize_t readSize = read(STDIN_FILENO, buf, sizeof(buf)); - if (readSize < 0) err(EX_IOERR, "read(%d)", STDIN_FILENO); - - if (readSize == 1) { - if (buf[0] == CTRL('S')) { - enable ^= true; - continue; - } - - byte c = buf[0]; - if (enable && table[c]) buf[0] = table[c]; - } - - ssize_t writeSize = write(pty, buf, readSize); - if (writeSize < 0) err(EX_IOERR, "write(%d)", pty); - if (writeSize < readSize) errx(EX_IOERR, "short write(%d)", pty); - } - - if (fds[1].revents & POLLIN) { - ssize_t readSize = read(pty, buf, sizeof(buf)); - if (readSize < 0) err(EX_IOERR, "read(%d)", pty); - - ssize_t writeSize = write(STDOUT_FILENO, buf, readSize); - if (writeSize < 0) err(EX_IOERR, "write(%d)", STDOUT_FILENO); - if (writeSize < readSize) { - errx(EX_IOERR, "short write(%d)", STDOUT_FILENO); - } - } - - int status; - pid_t dead = waitpid(pid, &status, WNOHANG); - if (dead < 0) err(EX_OSERR, "waitpid(%d)", pid); - if (dead) return WIFEXITED(status) ? WEXITSTATUS(status) : EX_SOFTWARE; - } - err(EX_IOERR, "poll"); -} diff --git a/bin/htagml.c b/bin/htagml.c new file mode 100644 index 00000000..1f547be6 --- /dev/null +++ b/bin/htagml.c @@ -0,0 +1,223 @@ +/* Copyright (C) 2021 June McEnroe <june@causal.agency> + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +#include <ctype.h> +#include <err.h> +#include <stdbool.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <sysexits.h> +#include <unistd.h> + +static char *deregex(const char *patt) { + char *buf = malloc(strlen(patt) + 1); + if (!buf) err(EX_OSERR, "malloc"); + char *ptr = buf; + if (*patt == '^') patt++; + for (; *patt; ++patt) { + if (patt[0] == '$' && !patt[1]) { + *ptr++ = '\n'; + break; + } + if (patt[0] == '\\' && patt[1]) patt++; + *ptr++ = *patt; + } + *ptr = '\0'; + return buf; +} + +static size_t escape(bool esc, const char *ptr, size_t len) { + if (!esc) { + fwrite(ptr, len, 1, stdout); + return len; + } + for (size_t i = 0; i < len; ++i) { + switch (ptr[i]) { + break; case '&': printf("&"); + break; case '<': printf("<"); + break; case '"': printf("""); + break; default: putchar(ptr[i]); + } + } + return len; +} + +static void id(const char *tag) { + for (const char *ch = tag; *ch; ++ch) { + if (isalnum(*ch) || strchr("-._", *ch)) { + putchar(*ch); + } else { + putchar('_'); + } + } +} + +static char *hstrstr(const char *haystack, const char *needle) { + while (haystack) { + char *elem = strchr(haystack, '<'); + char *match = strstr(haystack, needle); + if (!match) return NULL; + if (!elem || match < elem) return match; + haystack = strchr(elem, '>'); + } + return NULL; +} + +static int isident(int c) { + return isalnum(c) || c == '_'; +} + +int main(int argc, char *argv[]) { + bool pre = false; + bool pipe = false; + bool main = false; + bool index = false; + const char *tagsPath = "tags"; + for (int opt; 0 < (opt = getopt(argc, argv, "f:impx"));) { + switch (opt) { + break; case 'f': tagsPath = optarg; + break; case 'i': pipe = true; + break; case 'm': main = true; + break; case 'p': pre = true; + break; case 'x': index = true; + break; default: return EX_USAGE; + } + } + if (optind == argc) errx(EX_USAGE, "name required"); + const char *name = argv[optind]; + + FILE *file = fopen(name, "r"); + if (!file) err(EX_NOINPUT, "%s", name); + + FILE *tagsFile = fopen(tagsPath, "r"); + if (!tagsFile) err(EX_NOINPUT, "%s", tagsPath); + +#ifdef __OpenBSD__ + int error = pledge("stdio", NULL); + if (error) err(EX_OSERR, "pledge"); +#endif + + size_t len = 0; + size_t cap = 256; + struct Tag { + char *tag; + int num; + char *str; + size_t len; + } *tags = malloc(cap * sizeof(*tags)); + if (!tags) err(EX_OSERR, "malloc"); + + char *buf = NULL; + size_t bufCap = 0; + while (0 < getline(&buf, &bufCap, tagsFile)) { + char *line = buf; + char *tag = strsep(&line, "\t"); + char *file = strsep(&line, "\t"); + char *def = strsep(&line, "\n"); + if (!tag || !file || !def) errx(EX_DATAERR, "malformed tags file"); + + if (strcmp(file, name)) continue; + if (len == cap) { + tags = realloc(tags, (cap *= 2) * sizeof(*tags)); + if (!tags) err(EX_OSERR, "realloc"); + } + tags[len].tag = strdup(tag); + if (!tags[len].tag) err(EX_OSERR, "strdup"); + + tags[len].num = 0; + if (def[0] == '/' || def[0] == '?') { + def++; + def[strlen(def)-1] = '\0'; + if (def[0] != '^') { + warnx("unanchored regex for tag %s: %s", tag, def); + } + tags[len].str = deregex(def); + tags[len].len = strlen(tags[len].str); + } else { + tags[len].num = strtol(def, &def, 10); + if (*def) { + warnx("invalid line number for tag %s: %s", tag, def); + continue; + } + } + len++; + } + fclose(tagsFile); + + int num = 0; + printf(pre ? "<pre>" : index ? "<ul class=\"index\">\n" : ""); + while (0 < getline(&buf, &bufCap, file) && ++num) { + char *tag = NULL; + for (size_t i = 0; i < len; ++i) { + if (tags[i].num) { + if (num != tags[i].num) continue; + } else { + if (strncmp(tags[i].str, buf, tags[i].len)) continue; + } + tag = tags[i].tag; + tags[i] = tags[--len]; + break; + } + if (index) { + if (!tag) continue; + printf("<li><a class=\"tag\" href=\"#"); + id(tag); + printf("\">"); + escape(true, tag, strlen(tag)); + printf("</a></li>\n"); + continue; + } + if (pipe) { + ssize_t len = getline(&buf, &bufCap, stdin); + if (len < 0) { + errx(EX_DATAERR, "missing line %d on standard input", num); + } + } + if (!tag) { + escape(!pipe, buf, strlen(buf)); + continue; + } + + size_t mlen = strlen(tag); + char *match = (pipe ? hstrstr : strstr)(buf, tag); + while ( + match && + ((match > buf && isident(match[-1])) || isident(match[mlen])) + ) { + match = (pipe ? hstrstr : strstr)(&match[mlen], tag); + } + if (!match && tag[0] == 'M') { + mlen = 4; + match = (pipe ? hstrstr : strstr)(buf, "main"); + if (main) tag = "main"; + } + if (!match) { + mlen = strlen(buf) - 1; + match = buf; + } + escape(!pipe, buf, match - buf); + printf("<a class=\"tag\" id=\""); + id(tag); + printf("\" href=\"#"); + id(tag); + printf("\">"); + match += escape(!pipe, match, mlen); + printf("</a>"); + escape(!pipe, match, strlen(match)); + } + printf(pre ? "</pre>" : index ? "</ul>\n" : ""); +} diff --git a/bin/html.mk b/bin/html.mk new file mode 100644 index 00000000..818c6cf5 --- /dev/null +++ b/bin/html.mk @@ -0,0 +1,47 @@ +WEBROOT ?= /var/www/causal.agency + +HTMLS = index.html png.html +HTMLS += ${BINS:=.html} +HTMLS += ${BSD:=.html} +HTMLS += ${GAMES:=.html} +HTMLS += ${TLS:=.html} + +html: ${HTMLS} + @true + +install-html: ${HTMLS} + install -d ${WEBROOT}/bin + install -C -m 644 ${HTMLS} ${WEBROOT}/bin + +${HTMLS}: html.sh scheme hilex htagml htmltags + +htmltags: *.[chly] mtags Makefile html.mk *.sh + rm -f $@ + for f in *.[chly]; do ctags -aw -f $@ $$f; done + ./mtags -a -f $@ Makefile html.mk *.sh + +index.html: README.7 Makefile html.mk html.sh + sh html.sh README.7 Makefile html.mk html.sh > $@ + +.SUFFIXES: .html + +.c.html: + sh html.sh man1/${<:.c=.1} $< > $@ + +.h.html: + sh html.sh man3/${<:.h=.3} $< > $@ + +.l.html: + sh html.sh man1/${<:.l=.1} $< > $@ + +.y.html: + sh html.sh man1/${<:.y=.1} $< > $@ + +.sh.html: + sh html.sh man1/${<:.sh=.1} $< > $@ + +.pl.html: + sh html.sh man1/${<:.pl=.1} $< > $@ + +freecell.html: freecell.c man6/freecell.6 + sh html.sh man6/freecell.6 freecell.c > $@ diff --git a/bin/html.sh b/bin/html.sh index e5a15fdc..3223120b 100644 --- a/bin/html.sh +++ b/bin/html.sh @@ -3,12 +3,64 @@ set -eu readonly GitURL='https://git.causal.agency/src/tree/bin' -src=$1 -man=${2:-} +man=$1 +shift +title=${man##*/} +title=${title%.[1-9]} -./hi -f html -o document,tab=4 -n "$src" /dev/null | sed '/<pre/d' -cat <<- EOF - <code><a href="${GitURL}/${src}">${src} in git</a></code> +cat <<EOF +<!DOCTYPE html> +<meta charset="UTF-8"> +<meta name="viewport" content="width=device-width, initial-scale=1.0"/> +<title>${title}</title> +<style> +html { line-height: 1.25em; font-family: monospace; } +body { max-width: 80ch; margin: 1em auto; padding: 0 1ch; } + +table.head, table.foot { width: 100%; } +td.head-rtitle, td.foot-os { text-align: right; } +td.head-vol { text-align: center; } +div.Pp { margin: 1ex 0ex; } +div.Nd, div.Bf, div.Op { display: inline; } +span.Pa, span.Ad { font-style: italic; } +span.Ms { font-weight: bold; } +dl.Bl-diag > dt { font-weight: bold; } +code.Nm, code.Fl, code.Cm, code.Ic, code.In, code.Fd, code.Fn, +code.Cd { font-weight: bold; font-family: inherit; } + +table { border-collapse: collapse; } +table.Nm code.Nm { padding-right: 1ch; } +table.foot { margin-top: 1em; } + +ul.index { padding: 0; } +ul.index li { display: inline; list-style-type: none; } +pre { -moz-tab-size: 4; tab-size: 4; } + +$(./scheme -st) +html { background-color: var(--ansi16); color: var(--ansi17); } +a { color: var(--ansi4); } +a:visited { color: var(--ansi5); } +a.permalink, a.tag { color: var(--ansi3); text-decoration: none; } +a.permalink > code:target, *:target > a.permalink, +a.tag:target { color: var(--ansi11); } +pre .Ke { color: var(--ansi7); } +pre .Ma { color: var(--ansi2); } +pre .Co { color: var(--ansi4); } +pre .St { color: var(--ansi6); } +pre .Fo { color: var(--ansi14); } +pre .Su { color: var(--ansi1); } +</style> EOF -[ -f "$man" ] && man -P cat "${PWD}/${man}" | ./ttpre -./hi -f html -o anchor "$src" + +opts=fragment +[ "${man}" = "README.7" ] && opts=${opts},man=%N.html +mandoc -T html -O ${opts} "${man}" + +for src; do + cat <<-EOF + <p> + <a href="${GitURL}/${src}">${src} in git</a> + EOF + ./htagml -x -f htmltags "${src}" + ./hilex -t -f html "${src}" | ./htagml -ip -f htmltags "${src}" +done diff --git a/bin/make.l b/bin/make.l new file mode 100644 index 00000000..6296716d --- /dev/null +++ b/bin/make.l @@ -0,0 +1,127 @@ +/* Copyright (C) 2020 June McEnroe <june@causal.agency> + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +%option prefix="make" +%option noinput nounput noyywrap + +%{ +#include "hilex.h" +%} + +%s Assign Preproc +%x Variable Shell + +ident [._[:alnum:]]+ +assign [+?:!]?= +target [-._/?*\[\][:alnum:]]+ +operator [:!]|:: + +%% + static int pop = INITIAL; + static int depth = 0; + +^"\t"+ { + BEGIN(pop = Shell); + return Normal; +} +<Shell>{ + "\n" { + BEGIN(pop = INITIAL); + return Normal; + } + "\\\n" { return Normal; } + [^\\\n$]+|. { return Normal; } +} + +[[:blank:]]+ { return Normal; } + +{operator} { return Operator; } + +"."(PHONY|PRECIOUS|SUFFIXES)/{operator}? { + return Keyword; +} + +{target}/{operator} { return Ident; } + +^"."{ident} | +^"-"?include { + BEGIN(pop = Preproc); + return Macro; +} +<Preproc>{ + "\n" { + BEGIN(pop = INITIAL); + return Normal; + } + "\\\n""\t"? { return Normal; } + + "\""[^""]*"\"" | + "<"[^>]*">" { + return String; + } + + [!<>=]"="?|"||"|"&&" { return Operator; } + [0-9]+|"0x"[[:xdigit:]]+ { return Number; } + defined|make|empty|exists|target|commands|in { return Keyword; } +} + +^{ident}/[[:blank:]]*{assign} { + return Ident; +} + +{assign} { + BEGIN(pop = Assign); + return Operator; +} +<Assign>{ + "\n" { + BEGIN(pop = INITIAL); + return Normal; + } + "\\\n""\t"? { return Escape; } + [^\\$[:space:]]+|. { return String; } +} + +{target} { return Ident; } + +"#"([^\\\n]|"\\"[^\n]|"\\\n")* { return Comment; } + +<*>{ + "$"("{"|"(")/[^$] { + depth++; + BEGIN(Variable); + yymore(); + } + "$"("{"|"(") { + depth++; + BEGIN(Variable); + return Subst; + } + "$". { return Subst; } +} +<Variable>{ + [^${}()]*"}"|")" { + if (!--depth) BEGIN(pop); + return Subst; + } + [^${}()]+ { return Subst; } +} + +.|\n { return Normal; } + +%% + +const struct Lexer LexMake = { yylex, &yyin, &yytext }; diff --git a/bin/man1/bibsort.1 b/bin/man1/bibsort.1 new file mode 100644 index 00000000..07ed91ef --- /dev/null +++ b/bin/man1/bibsort.1 @@ -0,0 +1,40 @@ +.Dd February 16, 2021 +.Dt BIBSORT 1 +.Os +. +.Sh NAME +.Nm bibsort +.Nd reformat bibliography +. +.Sh SYNOPSIS +.Nm +.Op Ar file +. +.Sh DESCRIPTION +.Nm +reformats on standard output +the +.Em STANDARDS +section of the +.Xr mdoc 7 +manual page +.Ar file +or standard input. +Bibliographic references +are sorted by author last names, +and formatted in an item list +with macro lines appearing +in the order they are formatted by +.Xr mandoc 1 . +Additionally, +.Ic \&%N +macros referencing RFC numbers +are rewritten to +.Ic \&%R +macros +and missing +.Ic \&%U +macros are added for RFCs. +. +.Sh EXAMPLES +.Dl :%!bibsort diff --git a/bin/man1/bit.1 b/bin/man1/bit.1 index b61bc704..b91a10e1 100644 --- a/bin/man1/bit.1 +++ b/bin/man1/bit.1 @@ -1,4 +1,4 @@ -.Dd June 7, 2019 +.Dd December 30, 2020 .Dt BIT 1 .Os . @@ -27,6 +27,11 @@ The .Sy -> operator is used for arithmetic shift. .It +The unary +.Sy & +operator is equivalent to +.Sy (1 << x) - 1 . +.It The postfix operators .Sy K , .Sy M , @@ -34,6 +39,11 @@ The postfix operators .Sy T are used as constant multipliers. .It +The postfix operator +.Sy $ +is of lowest precedence and is equivalent to +wrapping the preceding expression in parentheses. +.It Single-letter (lower case) variables can be assigned. The variable diff --git a/bin/man1/bri.1 b/bin/man1/bri.1 deleted file mode 100644 index 54a02322..00000000 --- a/bin/man1/bri.1 +++ /dev/null @@ -1,44 +0,0 @@ -.Dd September 7, 2018 -.Dt BRI 1 -.Os -. -.Sh NAME -.Nm bri -.Nd backlight brightness control -. -.Sh SYNOPSIS -.Nm -.Op Ar brightness -.Nm -.Cm + -.Nm -.Cm - -. -.Sh DESCRIPTION -.Nm -controls the backlight brightness on Linux. -. -.Pp -With no argument, -the current brightness is printed. -With a numerical -.Ar brightness -argument, -the brightness is set. -. -.Pp -The -.Cm + -and -.Cm - -arguments -may be repeated any number of times -and adjust the brightness -in increments of 16. -. -.Sh FILES -.Bl -tag -.It Pa /sys/class/backlight -Files under the first subdirectory found -are used to control the backlight brightness. -.El diff --git a/bin/man1/c.1 b/bin/man1/c.1 index 3ae10945..97384ebe 100644 --- a/bin/man1/c.1 +++ b/bin/man1/c.1 @@ -1,4 +1,4 @@ -.Dd May 31, 2020 +.Dd January 9, 2021 .Dt C 1 .Os . @@ -8,6 +8,7 @@ . .Sh SYNOPSIS .Nm +.Op Fl t .Op Fl e Ar expr .Op Fl i Ar include .Op Ar stmts ... @@ -37,4 +38,8 @@ after executing .It Fl i Ar include Add the include file .Ar include . +.It Fl t +With +.Fl e , +print the type of the expression. .El diff --git a/bin/man1/dehtml.1 b/bin/man1/dehtml.1 new file mode 100644 index 00000000..c55c35d4 --- /dev/null +++ b/bin/man1/dehtml.1 @@ -0,0 +1,38 @@ +.Dd September 7, 2021 +.Dt DEHTML 1 +.Os +. +.Sh NAME +.Nm dehtml +.Nd extract text from HTML +. +.Sh SYNOPSIS +.Nm +.Op Fl s +.Op Ar +. +.Sh DESCRIPTION +The +.Nm +utility extracts text +from HTML documents. +Text inside +.Sy <title> , +.Sy <style> +and +.Sy <script> +tags is discarded. +Numeric and common named HTML entities +are converted. +. +.Pp +The arguments are as follows: +.Bl -tag -width Ds +.It Fl s +Collapse whitespace outside of +.Sy <pre> +tags. +.El +. +.Sh BUGS +There is no way to extract image alt text. diff --git a/bin/man1/downgrade.1 b/bin/man1/downgrade.1 new file mode 100644 index 00000000..e1a594b7 --- /dev/null +++ b/bin/man1/downgrade.1 @@ -0,0 +1,122 @@ +.Dd September 14, 2021 +.Dt DOWNGRADE 1 +.Os +. +.Sh NAME +.Nm downgrade +.Nd IRC features for all +. +.Sh SYNOPSIS +.Nm +.Op Fl iv +.Op Fl c Ar cert +.Op Fl j Ar join +.Op Fl k Ar priv +.Op Fl n Ar nick +.Op Fl p Ar port +.Ar host +. +.Sh DESCRIPTION +The +.Nm +IRC bot downgrades new IRC +.Dq features +so +.Em everyone +can see them. +It supports typing notifications, +message reactions +and message replies. +. +.Pp +The arguments are as follows: +.Bl -tag -width Ds +.It Fl c Ar cert +Load the TLS client certificate from +.Ar cert +and authenticate using SASL EXTERNAL. +.It Fl i +Accept invites to channels. +.It Fl j Ar join +Join the channel list +.Ar join . +.It Fl k Ar priv +Load the TLS client private key from +.Ar priv . +The default is the same path as +.Ar cert . +.It Fl n Ar nick +Set the nickname and username to +.Ar nick . +The default is +.Nm . +.It Fl p Ar port +Connect to +.Ar port . +The default is 6697. +.It Fl v +Log IRC protocol. +.It Ar host +Connect to +.Ar host . +.El +. +.Sh EXAMPLES +.Bd -literal +-downgrade- * guest-n4 is typing... +<guest-n4> wtf +-downgrade- * june reacted to guest-n4's message ("wtf") with "\[u1F44D]" +-downgrade- * guest-n4 is typing... +-downgrade- * guest-n4 has given up :( +.Ed +.Bd -literal +<june> ,bef +-downgrade- * tildebot is typing... +<tildebot> [Ducks] june: There was no duck! +-downgrade- * tildebot was replying to june's message (",bef") +.Ed +. +.Sh STANDARDS +.Bl -item +.It +.Rs +.%A Kiyoshi Aman +.%A Kyle Fuller +.%A St\('ephan Kochen +.%A Alexey Sokolov +.%A James Wheare +.%T Message Tags +.%U https://ircv3.net/specs/extensions/message-tags +.Re +.It +.Rs +.%A MuffinMedic +.%A James Wheare +.%T typing client tag +.%U https://ircv3.net/specs/client-tags/typing +.Re +.It +.Rs +.%A Daniel Oaks +.%T Bot Mode +.%U https://ircv3.net/specs/extensions/bot-mode +.Re +.It +.Rs +.%A James Wheare +.%T Message IDs +.%U https://ircv3.net/specs/extensions/message-ids +.Re +.It +.Rs +.%A James Wheare +.%T react client tag +.%U https://ircv3.net/specs/client-tags/react +.Re +.It +.Rs +.%A James Wheare +.%T reply client tag +.%U https://ircv3.net/specs/client-tags/reply +.Re +.El diff --git a/bin/man1/edit.1 b/bin/man1/edit.1 deleted file mode 100644 index 8c94939a..00000000 --- a/bin/man1/edit.1 +++ /dev/null @@ -1,34 +0,0 @@ -.Dd August 29, 2019 -.Dt EDIT 1 -.Os -. -.Sh NAME -.Nm edit -.Nd interactive script -. -.Sh SYNOPSIS -.Nm -.Op Ar replacement -. -.Sh DESCRIPTION -.Nm -creates a temporary -.Xr sh 1 -script -from standard input -and invokes -.Ev EDITOR -before it executes. -The -.Ar replacement -argument is used in a -.Xr sed 1 -substitute expression -to generate the script. -The default -.Ar replacement -is -.Ql : & . -. -.Sh EXAMPLES -.Dl ls | edit 'mv & &' diff --git a/bin/man1/enc.1 b/bin/man1/enc.1 new file mode 100644 index 00000000..32845847 --- /dev/null +++ b/bin/man1/enc.1 @@ -0,0 +1,55 @@ +.Dd January 30, 2022 +.Dt ENC 1 +.Os +. +.Sh NAME +.Nm enc +.Nd encrypt and decrypt files +. +.Sh SYNOPSIS +.Nm +.Op Fl acdef +.Op Ar +. +.Sh DESCRIPTION +.Nm +encrypts and decrypts files +using ChaCha20 via +.Xr openssl 1 . +When encrypting files, +the +.Pa .enc +extension is added. +When decrypting files, +the +.Pa .enc +extension is removed, +if possible. +Otherwise output is written +to standard output. +Input files are not removed. +If no files are provided, +standard input is encrypted or decrypted. +. +.Pp +The arguments are as follows: +.Bl -tag -width Ds +.It Fl a +Encrypted data is Base64-encoded. +.It Fl c +Always write to standard output. +.It Fl d +Decrypt. +.It Fl e +Encrypt. +This is the default. +.It Fl f +Do not ask to confirm overwriting files. +.El +. +.Sh EXAMPLES +.Bd -literal -offset indent +$ enc secret.txt +$ rm secret.txt +$ enc -d secret.txt.enc +.Ed diff --git a/bin/man1/ever.1 b/bin/man1/ever.1 index 7689c5fb..8cdab99b 100644 --- a/bin/man1/ever.1 +++ b/bin/man1/ever.1 @@ -1,4 +1,4 @@ -.Dd June 1, 2020 +.Dd February 24, 2021 .Dt EVER 1 .Os . @@ -8,7 +8,7 @@ . .Sh SYNOPSIS .Nm -.Op Fl i +.Op Fl iq .Ar .Ar command .Nm @@ -35,6 +35,8 @@ Attach the which was modified to the standard input of .Ar command . +.It Fl q +Suppress exit status output. .El . .Sh EXAMPLES diff --git a/bin/man1/fbatt.1 b/bin/man1/fbatt.1 deleted file mode 100644 index 2d30cba7..00000000 --- a/bin/man1/fbatt.1 +++ /dev/null @@ -1,34 +0,0 @@ -.Dd September 7, 2018 -.Dt FBATT 1 -.Os -. -.Sh NAME -.Nm fbatt -.Nd framebuffer battery indicator -. -.Sh SYNOPSIS -.Nm -. -.Sh DESCRIPTION -.Nm -displays a battery charge indicator -in the top-right corner -of the Linux framebuffer. -. -.Sh ENVIRONMENT -.Bl -tag -.It Ev FRAMEBUFFER -The framebuffer device path. -.El -. -.Sh FILES -.Bl -tag -.It Pa /dev/fb0 -The default framebuffer device path. -.It Pa /sys/class/power_supply -The first subdirectory containing -.Pa charge_full -and -.Pa charge_now -is used to read the battery charge. -.El diff --git a/bin/man1/fbclock.1 b/bin/man1/fbclock.1 deleted file mode 100644 index 3195eb42..00000000 --- a/bin/man1/fbclock.1 +++ /dev/null @@ -1,36 +0,0 @@ -.Dd September 7, 2018 -.Dt FBCLOCK 1 -.Os -. -.Sh NAME -.Nm fbclock -.Nd framebuffer clock -. -.Sh SYNOPSIS -.Nm -. -.Sh DESCRIPTION -.Nm -displays a clock -in the top-right corner -of the Linux framebuffer. -. -.Sh ENVIRONMENT -.Bl -tag -.It Ev FONT -Path to gzipped PSF file. -. -.It Ev FRAMEBUFFER -The framebuffer device path. -.El -. -.Sh FILES -.Bl -tag -.It Pa /dev/fb0 -The default framebuffer device path. -.It Pa /usr/share/kbd/consolefonts/Lat2-Terminus16.psfu.gz -The default font path. -.El -. -.Sh SEE ALSO -.Xr setfont 8 diff --git a/bin/man1/git-comment.1 b/bin/man1/git-comment.1 new file mode 100644 index 00000000..8e958f30 --- /dev/null +++ b/bin/man1/git-comment.1 @@ -0,0 +1,117 @@ +.Dd September 10, 2021 +.Dt GIT-COMMENT 1 +.Os +. +.Sh NAME +.Nm git-comment +.Nd add comments from commit messages +. +.Sh SYNOPSIS +.Nm git comment +.Op Fl \-all +.Op Fl \-comment-start Ar string +.Op Fl \-comment-lead Ar string +.Op Fl \-comment-end Ar string +.Op Fl \-min-group Ar lines +.Op Fl \-min-repeat Ar lines +.Op Fl \-no-repeat +.Op Fl \-pretty Ar format +.Op Ar options ... +.Op Fl \- +.Ar file +. +.Sh DESCRIPTION +The +.Nm +command +adds comments to a file +showing the commit messages +which last modified +each group of lines. +By default only commit messages with bodies +and which modified groups of at least 2 lines +are added. +Each comment contains +the abbreviated commit hash +and the commit summary, +followed by the commit body. +. +.Pp +.Nm +accepts all the options of +.Xr git-blame 1 +in addition to the following: +.Bl -tag -width Ds +.It Fl \-all +Include all commit messages. +The default is to include +only commit messages with bodies +(lines after the summary). +. +.It Fl \-comment-start Ar string +Start comments with +.Ar string . +The default is the value of +.Cm comment.start +or +.Ql /* . +. +.It Fl \-comment-lead Ar string +Continue comments with the leading +.Ar string . +The default is the value of +.Cm comment.lead +or +.Ql " *" . +. +.It Fl \-comment-end Ar string +End comments with +.Ar string . +The default is the value of +.Cm comment.end +or +.Ql " */" . +. +.It Fl \-min-group Ar lines +Add comments only for groups of at least +.Ar lines . +The default is 2 lines. +. +.It Fl \-min-repeat Ar lines +Avoid repeating a comment +if it occurred in the last +.Ar lines . +The default is 30 lines. +. +.It Fl \-no-repeat +Avoid repeating comments entirely. +. +.It Fl \-pretty Ar format +Set the pretty-print format +to use for commit messages. +The default is the value of +.Cm comment.pretty +or +.Ql format:%h\ %s%n%n%-b . +See +.Xr git-show 1 . +.El +. +.Sh EXAMPLES +For files with +.Ql # +comments: +.Bd -literal -offset indent +git config comment.start '#' +git config comment.lead '#' +git config comment.end '' +.Ed +. +.Pp +Add as many comments as possible: +.Bd -literal -offset indent +git comment --all --min-group 1 --min-repeat 1 +.Ed +. +.Sh SEE ALSO +.Xr git-blame 1 diff --git a/bin/man1/hi.1 b/bin/man1/hi.1 deleted file mode 100644 index 517fbab9..00000000 --- a/bin/man1/hi.1 +++ /dev/null @@ -1,173 +0,0 @@ -.Dd December 15, 2019 -.Dt HI 1 -.Os -. -.Sh NAME -.Nm hi -.Nd syntax highlighter -. -.Sh SYNOPSIS -.Nm -.Op Fl t -.Op Fl f Ar format -.Op Fl l Ar lang -.Op Fl n Ar name -.Op Fl o Ar opts -.Op Ar file -.Nm -.Fl c -. -.Sh DESCRIPTION -.Nm -highlights the contents of a -.Ar file -or standard input -and formats it -on standard output. -. -.Pp -The arguments are as follows: -.Bl -tag -width "-f format" -.It Fl c -Compile all regular expressions and exit. -.It Fl f Ar format -Set the output format. -.It Fl l Ar lang -Set the input language. -.It Fl n Ar name -Override the name used -to infer the input language. -.It Fl o Ar opts -Set output format options. -.Ar opts -is a comma-separated list of options. -.It Fl t -Default to -.Cm text -if the input language cannot be inferred. -.El -. -.Ss Output Formats -The default output format is -.Cm ansi . -. -.Bl -tag -width Ds -.It Cm ansi -Output ANSI terminal escape codes. -. -.It Cm irc -Output IRC formatting codes. -.Pp -The options are as follows: -.Bl -tag -width "monospace" -.It Cm monospace -Use the monospace formatting code -introduced by IRCCloud. -.El -. -.It Cm html -Output HTML -.Sy <pre> -with -.Sy <span> -classes. -. -.Pp -The options are as follows: -.Bl -tag -width "title=..." -.It Cm anchor -Output tags -(top-level definition names) -as anchor links. -. -.It Cm css Ns = Ns Ar url -With -.Cm document , -output a -.Sy <link> -element for the external stylesheet -.Ar url . -If unset, -output default styles in a -.Sy <style> -element. -. -.It Cm document -Output an HTML document. -. -.It Cm inline -Output inline -.Sy style -attributes rather than classes. -. -.It Cm tab Ns = Ns Ar n -With -.Cm document -or -.Cm inline , -set the -.Sy tab-size -property to -.Ar n . -. -.It Cm title Ns = Ns Ar ... -With -.Cm document , -set the -.Sy <title> -element text. -The default title is the -.Ar file -name. -.El -.El -. -.Ss Input Languages -If no input language is set with -.Fl l , -it may be inferred from the name set by -.Fl m -or from the provided -.Ar file -name. -. -.Bl -tag -width Ds -.It Cm c -The C11 language. -. -.It Cm diff -The output of -.Xr diff 1 -with the -.Fl u -flag. -. -.It Cm make -The portable subset of -.Xr make 1 . -Variable substitution supports -one level of nesting with the same delimiter. -. -.It Cm mdoc -The -.Xr mdoc 7 -language. -. -.It Cm rust -The Rust 2018 language. -Nested raw strings and block comments -are not highlighted correctly. -. -.It Cm sh -The POSIX -.Xr sh 1 -language. -Here-documents are correctly highlighted -only with a delimiter of -.Ql EOF . -Arbitrarily nested strings and command substitutions -are not highlighted correctly. -. -.It Cm text -Plain text. -.El diff --git a/bin/man1/hilex.1 b/bin/man1/hilex.1 new file mode 100644 index 00000000..80b3155b --- /dev/null +++ b/bin/man1/hilex.1 @@ -0,0 +1,218 @@ +.Dd January 20, 2021 +.Dt HILEX 1 +.Os +. +.Sh NAME +.Nm hilex +.Nd syntax highlighter +. +.Sh SYNOPSIS +.Nm +.Op Fl t +.Op Fl f Ar format +.Op Fl l Ar lexer +.Op Fl n Ar name +.Op Fl o Ar opts +.Op Ar file +. +.Sh DESCRIPTION +The +.Nm +utility +syntax highlights +the contents of +.Ar file +or standard input +and formats it on standard output. +. +.Pp +The arguments are as follows: +.Bl -tag -width "-f format" +.It Fl f Ar format +Set the output format. +See +.Sx Output Formats . +The default format is +.Cm ansi . +. +.It Fl l Ar lexer +Set the input lexer. +See +.Sx Input Lexers . +The default input lexer is inferred from +.Ar name +or the first line of input. +. +.It Fl n Ar name +Set the name used to infer the input lexer. +The default is the final component of +.Ar file . +. +.It Fl o Ar opts +Set output format options. +.Ar opts +is a comma-separated list of options. +Options for each output format are documented in +.Sx Output Formats . +. +.It Fl t +Default to the +.Cm text +input lexer if one cannot be inferred. +.El +. +.Ss Output Formats +.Bl -tag -width Ds +.It Cm ansi +Output ANSI terminal control sequences. +If standard output is a terminal +and standard input is not being read, +output is piped to +.Ev PAGER +with +.Ev LESS=FRX +if it is not already set. +. +.It Cm html +Output HTML +.Sy span +elements +with the following classes: +.Pp +.Bl -hang -width "\&Op" -compact +.It Sy \&Op +operators +.It Sy \&Nu +numbers +.It Sy \&Ke +keywords +.It Sy \&Id +identifiers +.It Sy \&Ma +macros +.It Sy \&Co +comments +.It Sy \&St +strings +.It Sy \&Es +character escapes +.It Sy \&Fo +format strings +.It Sy \&Su +variable substitutions +.El +.Pp +The options are as follows: +.Bl -tag -width "title=..." +.It Cm document +Output an HTML document containing a +.Sy pre +element. +.It Cm inline +Output inline style attributes +rather than classes. +.It Cm pre +Wrap the output in a +.Sy pre +element with the class +.Sy hilex . +.It Cm style Ns = Ns Ar url +With +.Cm document , +use the external stylesheet +.Ar url . +If unset, +default styles are included in a +.Sy style +element. +.It Cm tab Ns = Ns Ar n +With +.Cm document , +.Cm inline +or +.Cm pre , +set the +.Sy tab-size +property to +.Ar n . +.It Cm title Ns = Ns Ar ... +With +.Cm document , +set the +.Sy title +element text. +The default title is the same as +.Ar name . +.El +. +.It Cm irc +Output IRC formatting codes. +The options are as follows: +.Bl -tag -width "monospace" +.It Cm monospace +Use the IRCCloud monospace formatting code. +.El +.El +. +.Ss Input Lexers +.Bl -tag -width Ds +.It Cm c +The C11 language, +with minimal support for +.Xr lex 1 , +.Xr yacc 1 +and Objective-C input. +Inferred for +.Pa *.[chlmy] +files. +. +.It Cm make +BSD +.Xr make 1 . +Inferred for +.Pa Makefile , +.Pa *.mk +and +.Pa *.am +files. +. +.It Cm mdoc +The +.Xr mdoc 7 +language. +Inferred for +.Pa *.[1-9] +files +and files starting with +.Dq .Dd . +. +.It Cm sh +POSIX +.Xr sh 1 . +Since lexical analysis of +the shell command language +is effectively impossible, +this is best-effort only. +Inferred for +.Pa *.sh , +.Pa .profile , +.Pa .shrc +files +and files starting with +.Dq #!/bin/sh . +. +.It Cm text +Plain text. +Inferred for +.Pa *.txt +files. +.El +. +.Sh ENVIRONMENT +.Bl -tag -width "PAGER" +.It Ev PAGER +The command to pipe ANSI output to +if standard output is a terminal. +The default is +.Ev PAGER=less . +.El diff --git a/bin/man1/hnel.1 b/bin/man1/hnel.1 deleted file mode 100644 index 82305be8..00000000 --- a/bin/man1/hnel.1 +++ /dev/null @@ -1,36 +0,0 @@ -.Dd July 8, 2019 -.Dt HNEL 1 -.Os -. -.Sh NAME -.Nm hnel -.Nd PTY input remapper -. -.Sh SYNOPSIS -.Nm -.Ar string1 -.Ar string2 -.Ar command ... -. -.Sh DESCRIPTION -.Nm -runs the -.Ar command -in a new PTY, -remapping input characters in -.Ar string1 -to the corresponding characters in -.Ar string2 . -Type -.Ic ^S -to toggle remapping. -. -.Sh EXAMPLES -.Dl hnel '[]{}' '{}[]' vim -. -.Sh SEE ALSO -.Xr tr 1 -. -.Sh BUGS -Window size changes are not propagated -to the child PTY. diff --git a/bin/man1/htagml.1 b/bin/man1/htagml.1 new file mode 100644 index 00000000..d8cf6441 --- /dev/null +++ b/bin/man1/htagml.1 @@ -0,0 +1,75 @@ +.Dd October 1, 2021 +.Dt HTAGML 1 +.Os +. +.Sh NAME +.Nm htagml +.Nd format tagged file as HTML +. +.Sh SYNOPSIS +.Nm +.Op Fl imp | x +.Op Fl f Ar tagsfile +.Ar file +. +.Sh DESCRIPTION +The +.Nm +utility formats a file tagged with +.Xr ctags 1 +as HTML. +Tags are output as fragment hyperlinks +with the class +.Qq tag . +. +.Pp +The arguments are as follows: +.Bl -tag -width Ds +.It Fl f Ar tagsfile +Read the tag descriptions from a file called +.Ar tagsfile . +The default behavior is +to read them from a file called +.Pa tags . +.It Fl i +Assume +.Ar file +has been pre-formatted +on standard input, +such as by a syntax highlighter. +Only tag hyperlinks are added. +.It Fl m +Rename the +.Xr ctags 1 +.Sq M +tag to +.Sy main . +.It Fl p +Wrap the output in a +.Sy pre +element. +.It Fl x +Instead produce an index of tags +ordered by their occurrence in +.Ar file . +The index is formatted as a +.Sy ul +element with the class +.Qq index . +.El +. +.Sh FILES +.Bl -tag -width Ds +.It Pa tags +default input tags file +.El +. +.Sh EXAMPLES +.Bd -literal -offset indent +ctags htagml.c && htagml htagml.c +hilex -f html htagml.c | htagml -i htagml.c +.Ed +. +.Sh SEE ALSO +.Xr ctags 1 , +.Xr hilex 1 diff --git a/bin/man1/modem.1 b/bin/man1/modem.1 index 522242b3..a4bbc3f1 100644 --- a/bin/man1/modem.1 +++ b/bin/man1/modem.1 @@ -1,4 +1,4 @@ -.Dd July 8, 2019 +.Dd December 8, 2020 .Dt MODEM 1 .Os . @@ -8,6 +8,7 @@ . .Sh SYNOPSIS .Nm +.Op Fl r Ar rate .Ar command ... . .Sh DESCRIPTION @@ -15,8 +16,15 @@ runs the .Ar command in a new PTY -with a fixed baud rate -of 19.2 kbps. +with a fixed baud rate. +. +.Pp +The arguments are as follows: +.Bl -tag -width Ds +.It Fl r Ar rate +Set the baud rate. +The default is 19200. +.El . .Sh BUGS Window size changes are not propagated diff --git a/bin/man1/mtags.1 b/bin/man1/mtags.1 new file mode 100644 index 00000000..57856ba0 --- /dev/null +++ b/bin/man1/mtags.1 @@ -0,0 +1,76 @@ +.Dd January 20, 2021 +.Dt MTAGS 1 +.Os +. +.Sh NAME +.Nm mtags +.Nd miscellaneous tags +. +.Sh SYNOPSIS +.Nm +.Op Fl a +.Op Fl f Ar tagsfile +.Ar +. +.Sh DESCRIPTION +The +.Nm +utility +makes a +.Pa tags +file for +.Xr ex 1 +from the specified +.Xr make 1 , +.Xr mdoc 7 +.Xr sh 1 +sources. +. +.Pp +The arguments are as follows: +.Bl -tag -width Ds +.It Fl a +Append to +.Pa tags +file. +.It Fl f Ar tagsfile +Place the tag descriptions +in a file called +.Ar tagsfile . +The default behaviour is +to place them in a file called +.Pa tags . +.El +. +.Pp +Files whose names are +.Pa Makefile +or end in +.Pa .mk +are assumed to be +.Xr make 1 +files. +Files whose names end in +.Pa .[1-9] +are assumed to be +.Xr mdoc 7 +files. +Files whose names are +.Pa .profile , +.Pa .shrc +or end in +.Pa .sh +are assumed to be +.Xr sh 1 +files. +. +.Sh FILES +.Bl -tag -width Ds +.It Pa tags +default output tags file +.El +. +.Sh SEE ALSO +.Xr ctags 1 , +.Xr ex 1 , +.Xr vi 1 diff --git a/bin/man1/nudge.1 b/bin/man1/nudge.1 new file mode 100644 index 00000000..3ca4294a --- /dev/null +++ b/bin/man1/nudge.1 @@ -0,0 +1,44 @@ +.Dd September 4, 2020 +.Dt NUDGE 1 +.Os +. +.Sh NAME +.Nm nudge +.Nd terminal vibrator +. +.Sh SYNOPSIS +.Nm +.Op Fl f Ar file +.Op Fl n Ar count +.Op Fl s Ar shake +.Op Fl t Ar delay +. +.Sh DESCRIPTION +The +.Nm +utility +nudges the terminal. +An +.Xr xterm 1 +compatible terminal is required. +. +.Pp +The arguments are as follows: +.Bl -tag -width Ds +.It Fl f Ar file +Open the terminal named by +.Ar file . +The default is +.Pa /dev/tty . +.It Fl n Ar count +Set the number of times +to nudge the terminal. +The default is 2. +.It Fl s Ar shake +Set the shake intensity in pixels. +The default is 10. +.It Fl t Ar delay +Set the interval between shakes +in milliseconds. +The default is 20. +.El diff --git a/bin/man1/order.1 b/bin/man1/order.1 index f042102f..89fcbda5 100644 --- a/bin/man1/order.1 +++ b/bin/man1/order.1 @@ -1,4 +1,4 @@ -.Dd May 18, 2019 +.Dd July 18, 2020 .Dt ORDER 1 .Os . @@ -8,7 +8,7 @@ . .Sh SYNOPSIS .Nm -.Ar expr ... +.Op Ar expr ... . .Sh DESCRIPTION .Nm @@ -16,6 +16,11 @@ parses C expressions and prints them with parentheses according to the precedence rules in .Xr operator 7 . +If no +.Ar expr +are given, +an expression is read +from standard input. . .Sh EXAMPLES .Bd -literal diff --git a/bin/man1/pbd.1 b/bin/man1/pbd.1 index bbc7b785..f0665891 100644 --- a/bin/man1/pbd.1 +++ b/bin/man1/pbd.1 @@ -1,20 +1,13 @@ -.Dd September 7, 2018 +.Dd February 9, 2021 .Dt PBD 1 .Os . .Sh NAME -.Nm pbd , -.Nm pbcopy , -.Nm pbpaste , -.Nm open +.Nm pbd .Nd macOS pasteboard daemon . .Sh SYNOPSIS -.Nm -.Nm pbcopy -.Nm pbpaste -.Nm open -.Ar +.Nm Op Fl s | c | p | o Ar url . .Sh DESCRIPTION .Nm @@ -30,12 +23,7 @@ sent over TCP port 7062. .Pp The socket can be forwarded through .Xr ssh 1 -and the stub implementations of -.Nm pbcopy , -.Nm pbpaste -and -.Nm open -can be used remotely +and the flags can be used remotely to access the local pasteboard and open URLs. . @@ -44,11 +32,30 @@ Forwarding can be configured with: .Pp .Dl RemoteForward 7062 127.0.0.1:7062 . +.Pp +The arguments are as follows: +.Bl -tag -width Ds +.It Fl c +Behave as +.Xr pbcopy 1 . +.It Fl o Ar url +Behave as +.Xr open 1 . +.It Fl p +Behave as +.Xr pbpaste 1 . +.It Fl s +Run the server. +This is the default. +.El +.Pp +ACAB. +. .Sh EXAMPLES .Bd -literal -offset indent pbd & ssh -R 7062:127.0.0.1:7062 tux.local -pbpaste +pbd -p .Ed . .Sh SEE ALSO diff --git a/bin/man1/pngo.1 b/bin/man1/pngo.1 index cec13160..a235355b 100644 --- a/bin/man1/pngo.1 +++ b/bin/man1/pngo.1 @@ -1,4 +1,4 @@ -.Dd September 17, 2018 +.Dd September 21, 2021 .Dt PNGO 1 .Os . @@ -8,30 +8,17 @@ . .Sh SYNOPSIS .Nm -.Op Fl cv +.Op Fl acgv +.Op Fl b Ar depth .Op Fl o Ar file .Op Ar . .Sh DESCRIPTION .Nm -optimizes PNG files for size. -. -.Pp -The arguments are as follows: -.Bl -tag -width Ds -.It Fl c -Write to standard output. -.It Fl o Ar file -Write to -.Ar file . -.It Fl v -Output PNG header information. -.El -. +optimizes PNG files for size +by performing the following: .Pp -.Nm -performs the following optimizations: -.Bl -bullet +.Bl -enum -compact .It Discard ancillary chunks. .It @@ -39,18 +26,39 @@ Discard unnecessary alpha channel. .It Convert unnecessary truecolor to grayscale. .It -Palletize color and alpha if possible. +Palletize color if possible. .It -Reduce bit depth if possible. +Reduce unnecessary bit depth. .It -Apply a simple filter heuristic. +Apply a simple filter type heuristic. .It -Apply zlib's best compresion. +Apply zlib's best compression. +.El +. +.Pp +The arguments are as follows: +.Bl -tag -width Ds +.It Fl a +Always discard the alpha channel. +.It Fl b Ar depth +Reduce bit depth to +.Ar depth +or lower. +.It Fl c +Write to standard output. +.It Fl g +Convert to grayscale. +.It Fl o Ar file +Write to +.Ar file . +.It Fl v +Print header information and sizes +to standard error. .El . .Sh SEE ALSO .Xr glitch 1 . -.Sh CAVEATS +.Sh BUGS .Nm does not support interlaced PNGs. diff --git a/bin/man1/psfed.1 b/bin/man1/psfed.1 deleted file mode 100644 index 3fbc4710..00000000 --- a/bin/man1/psfed.1 +++ /dev/null @@ -1,166 +0,0 @@ -.Dd January 14, 2019 -.Dt PSFED 1 -.Os -. -.Sh NAME -.Nm psfed -.Nd PSF2 font editor -. -.Sh SYNOPSIS -.Nm -.Op Fl H Ar height -.Op Fl g Ar glyphs -.Op Fl h Ar height -.Op Fl w Ar width -.Ar file -. -.Sh DESCRIPTION -.Nm -is a PSF2 font editor -for the Linux framebuffer. -. -.Pp -The arguments are as follows: -. -.Bl -tag -width Ds -.It Fl H Ar height -Modify the height of an existing font. -Only increasing the height is allowed. -. -.It Fl g Ar glyphs -Set the number of glyphs in a new font. -The default number of glyphs is 256. -. -.It Fl h Ar height -Set the height of a new font. -The default height is 16. -. -.It Fl w Ar width -Set the width of a new font. -The default width is 8. -.El -. -.Ss Normal Mode -In normal mode, -each glyph is displayed in a grid. -. -.Pp -.Bl -tag -width Ds -compact -.It Ic q -Quit. -.Nm -will ask for confirmation -if the font has been modified -since the last write. -. -.It Ic w -Write font to -.Ar file . -. -.It Ic - Ic + -Adjust display scale. -. -.It Ic h Ic l -Select previous/next glyph. -. -.It Ic k Ic j -Select glyph in previous/next row. -. -.It Ic f -Select glyph of next input character. -. -.It Ic ' -Return to previously selected glyph. -. -.It Ic y -Copy selected glyph. -. -.It Ic e -Edit selected glyph in -.Sx Edit Mode . -. -.It Ic i -Enter -.Sx Preview Mode . -.El -. -.Ss Edit Mode -In edit mode, -the selected glyph is displayed for editing -surrounded by a checked border. -The glyph is also displayed unscaled -in the bottom-right corner. -. -.Pp -.Bl -tag -width Ds -compact -.It Ic ESC -Return to -.Sx Normal Mode . -. -.It Ic - Ic + -Adjust display scale. -. -.It Ic g Ic G -Toggle guide on selected column/row. -. -.It Ic h Ic l -Select previous/next bit in row. -. -.It Ic k Ic j -Select previous/next bit in column. -. -.It Ic SPACE -Flip selected bit. -. -.It Ic r -Invert glyph. -. -.It Ic H Ic L -Move glyph left/right. -. -.It Ic K Ic J -Move glyph up/down. -. -.It Ic p -Paste the copied glyph. -. -.It Ic u -Revert glyph to initial state. -.El -. -.Ss Preview Mode -In preview mode, -arbitrary text may be entered -for preview. -Press -.Ic ESC -to return to -.Sx Normal Mode . -. -.Sh ENVIRONMENT -.Bl -tag -width FRAMEBUFFER -.It Ev FRAMEBUFFER -The framebuffer device path. -The default path is -.Pa /dev/fb0 . -.El -. -.Sh SEE ALSO -.Xr psfaddtable 1 , -.Xr psfgettable 1 , -.Xr psfstriptable 1 , -.Xr setfont 8 -. -.Sh CAVEATS -.Nm -does not support Unicode tables. -Use -.Xr psfaddtable 1 -to add Unicode tables -to fonts created by -.Nm . -. -.Sh BUGS -.Nm -makes no attempt to convert header fields -to and from little-endian format. diff --git a/bin/man1/ptee.1 b/bin/man1/ptee.1 index 04f9cdac..bb381ecb 100644 --- a/bin/man1/ptee.1 +++ b/bin/man1/ptee.1 @@ -1,4 +1,4 @@ -.Dd July 17, 2019 +.Dd October 18, 2021 .Dt PTEE 1 .Os . @@ -8,6 +8,7 @@ . .Sh SYNOPSIS .Nm +.Op Fl t Ar ms .Ar command ... .Cm > .Ar file @@ -26,14 +27,24 @@ to a file or pipe. .Pp Type .Ic ^S -to toggle writing to standard output. +to write a media copy sequence +to standard output. Type .Ic ^Q -to write the media copy sequence for -.Xr shotty 1 . +to toggle writing to standard output. +. +.Pp +The arguments are as follows: +.Bl -tag -width Ds +.It Fl t Ar ms +Write a media copy sequence +to standard output every +.Ar ms +milliseconds. +.El . .Sh SEE ALSO -.Xr tee 1 +.Xr script 1 . .Sh BUGS Window size changes are not propagated diff --git a/bin/man1/qf.1 b/bin/man1/qf.1 new file mode 100644 index 00000000..8828d723 --- /dev/null +++ b/bin/man1/qf.1 @@ -0,0 +1,71 @@ +.Dd June 2, 2022 +.Dt QF 1 +.Os +. +.Sh NAME +.Nm qf +.Nd grep pager +. +.Sh SYNOPSIS +.Nm Op Ar pattern +. +.Sh DESCRIPTION +.Nm +is a pager for +.Xr grep 1 , +.Xr ag 1 , +.Xr rg 1 , +etc.\& +which allows +jumping to matches in +.Ev $EDITOR . +It parses any input +prefixed by path +and line number +separated by a colon +.Ql ":" +followed by either a colon +or a hyphen +.Ql "-" . +It otherwise operates similar to +.Xr less 1 . +. +.Pp +If +.Ar pattern +is given, +the first match on each line +will be highlighted. +The +.Ar pattern +is interpreted as +an extended regular expression +and is matched case-insensitively +unless it contains an uppercase letter. +. +.Pp +The keys are as follows: +.Bl -tag -width Ds +.It Ic Enter +Open the currently selected line in +.Ev $EDITOR . +When the editor exits, +.Nm +resumes. +.It Ic {} +Jump between files. +.It Ic gG +Jump to first or last line. +.It Ic jk +Move to next or previous line. +.It Ic nN +Jump to next or previous match line. +.It Ic q +Exit. +.It Ic r +Refresh the display. +.El +. +.Sh EXAMPLES +.Dl $ ag -C open | qf +.Dl $ git grep -n open | qf diff --git a/bin/man1/quick.1 b/bin/man1/quick.1 new file mode 100644 index 00000000..96f1766a --- /dev/null +++ b/bin/man1/quick.1 @@ -0,0 +1,66 @@ +.Dd September 23, 2021 +.Dt QUICK 1 +.Os +. +.Sh NAME +.Nm quick +.Nd (and dirty) HTTP/CGI server +. +.Sh SYNOPSIS +.Nm +.Op Fl p Ar port +.Ar script +.Op Ar args ... +. +.Sh DESCRIPTION +.Nm +is a barely functional HTTP server +for running CGI scripts. +It listens only on localhost, +on a randomly assigned port, +unless +.Fl p +is used. +The URL of the server +is printed to standard output. +. +.Sh EXAMPLES +.Dl quick cgit | xargs -n1 open +. +.Sh STANDARDS +.Nm +does +.Em not +implement the following: +.Bl -item +.It +.Rs +.%A T. Berners-Lee +.%A R. Fielding +.%A H. Frystyk +.%A J. Gettys +.%A J. Mogul +.%T Hypertext Transfer Protocol -- HTTP/1.1 +.%R RFC 2068 +.%U https://tools.ietf.org/html/rfc2068 +.%D January 1997 +.Re +.It +.Rs +.%A K. Coar +.%A D. Robinson +.%T The Common Gateway Interface (CGI) Version 1.1 +.%R RFC 3875 +.%U https://tools.ietf.org/html/rfc3875 +.%D October 2004 +.Re +.El +. +.Sh CAVEATS +Oh, so many. +No error handling, +no validation, +no security. +This is a local testing tool only. +.Pp +Every response is served as a 200 OK. diff --git a/bin/man1/scheme.1 b/bin/man1/scheme.1 index 9aa4f054..9f72d945 100644 --- a/bin/man1/scheme.1 +++ b/bin/man1/scheme.1 @@ -1,4 +1,4 @@ -.Dd July 6, 2019 +.Dd February 6, 2021 .Dt SCHEME 1 .Os . @@ -8,7 +8,7 @@ . .Sh SYNOPSIS .Nm -.Op Fl acghilmstx +.Op Fl Xacghilmstx .Op Fl p Ar n . .Sh DESCRIPTION @@ -19,6 +19,9 @@ and outputs it in a number of formats. .Pp The arguments are as follows: .Bl -tag -width Ds +.It Fl X +Output Xresources for +.Xr xterm 1 . .It Fl a Generate the 16 ANSI colors. This is the default. diff --git a/bin/man1/shotty.1 b/bin/man1/shotty.1 index d5eaa780..0a3bd127 100644 --- a/bin/man1/shotty.1 +++ b/bin/man1/shotty.1 @@ -1,14 +1,14 @@ -.Dd November 25, 2019 +.Dd October 18, 2021 .Dt SHOTTY 1 .Os . .Sh NAME .Nm shotty -.Nd terminal capture +.Nd HTML terminal renderer . .Sh SYNOPSIS .Nm -.Op Fl Bdns +.Op Fl Bdins .Op Fl b Ar bg .Op Fl f Ar fg .Op Fl h Ar rows @@ -17,37 +17,37 @@ . .Sh DESCRIPTION .Nm -interprets terminal output from +renders a terminal session +captured with +.Xr ptee 1 +or +.Xr script 1 +from .Ar file or standard input -and produces HTML -.Sy <pre> -on standard output. -. -.Pp -Terminal output -can be captured with -.Xr ptee 1 . +and renders one or more HTML snapshots. +One snapshot is rendered +for each media copy sequence, +or a single snapshot is rendered +at the end of the session. .Nm targets compatibility with -.Ev TERM Ns = Ns Cm xterm +.Ev TERM=xterm and -.Ev TERM Ns = Ns Cm xterm-256color +.Ev TERM=xterm-256color as used by .Xr ncurses 3 . -A snapshot of the terminal -is output each time -a media copy sequence occurs, -or once at the end of the capture. . .Pp -HTML output uses the classes +HTML output uses .Sy bg Ns Va n and -.Sy fg Ns Va n , +.Sy fg Ns Va n +classes for colors, and inline styles for bold, italic and underline. -CSS for colors can be generated with +CSS for colors +can be generated by .Xr scheme 1 . . .Pp @@ -58,35 +58,58 @@ Replace bold with bright colors. . .It Fl b Ar bg Set the default background color. -The default value is 0 (black). +The default is 0 (black). . .It Fl d -Output the terminal state -following each control sequence. +Render a snapshot +after each control sequence. . .It Fl f Ar fg Set the default foreground color. -The default value is 7 (white). +The default is 7 (white). . .It Fl h Ar rows Set the terminal height. -The default value is 24. +The default is 24. +. +.It Fl i +Output inline color attributes. . .It Fl n -Do not show the cursor. +Hide the cursor. . .It Fl s -Set the terminal size -from the current terminal size. +Copy the terminal size +from the current terminal. . .It Fl w Ar cols Set the terminal width. -The default value is 80. +The default is 80. .El . .Sh EXAMPLES -.Dl ptee htop | shotty -s > htop.html +.Dl $ ptee htop | shotty -Bis >htop.html . .Sh SEE ALSO .Xr ptee 1 , -.Xr scheme 1 +.Xr script 1 +. +.Sh STANDARDS +.Bl -item +.It +.Rs +.%A Thomas Dickey +.%A Stephen Gildea +.%A Edward Moy +.%T XTerm Control Sequences +.%U https://invisible-island.net/xterm/ctlseqs/ctlseqs.html +.Re +.It +.Rs +.%A F. Yergeau +.%T UTF-8 +.%R RFC 2044 +.%U https://tools.ietf.org/html/rfc2044 +.%D October 1996 +.Re +.El diff --git a/bin/man1/sup.1 b/bin/man1/sup.1 new file mode 100644 index 00000000..bd88ad47 --- /dev/null +++ b/bin/man1/sup.1 @@ -0,0 +1,51 @@ +.Dd January 12, 2022 +.Dt SUP 1 +.Os +. +.Sh NAME +.Nm sup +.Nd single-use password +. +.Sh SYNOPSIS +.Nm +.Ar service +.Op Ar email +. +.Sh DESCRIPTION +The +.Nm +utility +sets a random single-use password +for a service using the +.Dq forgot password +or +.Dq password reset +flow. +The password is copied to the clipboard +and the service login page is opened. +For passwordless services +with email-based authentication, +the emailed login link is opened. +. +.Pp +The following services are supported: +.Cm asciinema , +.Cm discogs , +.Cm freebsdbugzilla , +.Cm liberapay , +.Cm lobsters , +.Cm lwn , +.Cm patreon , +.Cm tildegit , +.Cm tildenews . +. +.Pp +The +.Nm +utility requires +.Xr curl 1 , +.Xr git-fetch-email 1 , +.Xr openssl 1 , +.Xr pbcopy 1 +and +.Xr open 1 . diff --git a/bin/man1/ttpre.1 b/bin/man1/ttpre.1 deleted file mode 100644 index bd178525..00000000 --- a/bin/man1/ttpre.1 +++ /dev/null @@ -1,32 +0,0 @@ -.Dd October 8, 2018 -.Dt TTPRE 1 -.Os -. -.Sh NAME -.Nm ttpre -.Nd man output to HTML -. -.Sh SYNOPSIS -.Nm -. -.Sh DESCRIPTION -.Nm -formats -.Xr man 1 -output on standard input -as an HTML -.Sy <pre> -fragment on standard output. -Ampersands and angle brackets -are replaced with corresponding HTML entities, -and backspace formatting sequences -are replaced with -.Sy <i> -and -.Sy <b> -tags. -. -.Sh SEE ALSO -.Xr less 1 , -.Xr man 1 , -.Xr mandoc 1 diff --git a/bin/man1/up.1 b/bin/man1/up.1 index 58b5359f..aece79bd 100644 --- a/bin/man1/up.1 +++ b/bin/man1/up.1 @@ -1,4 +1,4 @@ -.Dd July 15, 2019 +.Dd July 26, 2022 .Dt UP 1 .Os . @@ -8,15 +8,9 @@ . .Sh SYNOPSIS .Nm -.Op Fl h -.Op Ar file -. -.Nm -.Fl c | t -.Ar command ... -. -.Nm -.Fl s +.Op Fl c | h | s | t +.Op Fl w Ar warn +.Op Ar file | command . .Sh DESCRIPTION .Nm @@ -49,28 +43,35 @@ Run a command to produce a text file for upload. .It Fl h Use -.Xr hi 1 +.Xr hilex 1 to produce an HTML file for upload. .It Fl s Use .Xr screencapture 1 +or +.Xr scrot 1 to produce a PNG file for upload. The file is optimized by -.Xr pngo 1 -if available. +.Xr pngo 1 . .It Fl t Run a command with .Xr ptee 1 and .Xr shotty 1 to produce an HTML file for upload. +.It Fl w Ar warn +Create an HTML redirect with +.Ar warn +in its title. .El . .Pp Any arguments after .Ql \-\- are passed to -.Xr hi 1 +.Xr hilex 1 and -.Xr screencapture 1 , +.Xr screencapture 1 +or +.Xr scrot 1 , respectively. diff --git a/bin/man1/when.1 b/bin/man1/when.1 index 0b473573..3f2735f7 100644 --- a/bin/man1/when.1 +++ b/bin/man1/when.1 @@ -1,4 +1,4 @@ -.Dd July 24, 2019 +.Dd September 19, 2022 .Dt WHEN 1 .Os . @@ -9,6 +9,8 @@ .Sh SYNOPSIS .Nm .Op Ar expr +.Nm +.Cm - . .Sh DESCRIPTION .Nm @@ -18,24 +20,32 @@ If no is given, expressions are read from standard input. +If +.Cm - +is given, +the intervals between each named date +and today are printed. . .Pp The grammar is as follows: .Bl -tag -width Ds .It Sy \&. Today's date. +The empty expression is equivalent. +. +.It Ar name Op Sy = Ar date +A named date. +Names are alphanumeric including underscores. . .It Ar month Ar date Op Ar year A full date, or a date in the current year. -.Ar month -must be at least three letters. +Months can be abbreviated to three letters. . .It Ar day A day of the week in the current week. -.Ar day -must be at least three letters. +Days can be abbreviated to three letters. . .It Sy < Ar date The date one week before. @@ -65,6 +75,14 @@ A number of months. A number of years. .El . +.Sh FILES +The file +.Pa $XDG_CONFIG_HOME/when/dates +or +.Pa ~/.config/when/dates +is read before any other expressions, +if it exists. +. .Sh EXAMPLES .Bl -tag -width "Dec 25 - ." .It Ic Dec 25 - \&. @@ -74,3 +92,9 @@ The date next Friday. .It Ic \&. + 2w Your last day at work. .El +.Pp +Checking a milestone: +.Bd -literal -offset indent +$ echo 'hrt = oct 15 2021' >> ~/.config/when/dates +$ when -hrt +.Ed diff --git a/bin/man6/freecell.6 b/bin/man6/freecell.6 new file mode 100644 index 00000000..0e485a16 --- /dev/null +++ b/bin/man6/freecell.6 @@ -0,0 +1,50 @@ +.Dd April 17, 2021 +.Dt FREECELL 6 +.Os +. +.Sh NAME +.Nm freecell +.Nd patience game +. +.Sh SYNOPSIS +.Nm +.Op Fl d Ar delay +.Op Fl n Ar game +. +.Sh DESCRIPTION +.Nm +is a terminal FreeCell patience game. +The arguments are as follows: +.Bl -tag -width Ds +.It Fl d Ar delay +Set the delay in milliseconds +between queued moves. +The default is 50. +.It Fl n Ar game +Select the game number to play. +.El +. +.Pp +Moves are performed +by typing a sequence of two keys. +To automatically move a card +to a free cell, +type the same key twice. +The keys are as follows: +.Bl -tag -width Ds +.It Ic Escape +Cancel a pending move. +.It Ic u , Backspace +Undo the previous move. +.It Ic 1 , 2 , 3 , 4 +Select the cells. +.It Ic q , w , e , r , a , s , d , f +Select the tableau cascades. +.It Ic _ , Space +Manually move +the selected card +to the foundations. +.It Ic Shift +Move a single card +to an empty tableau cascade. +.El diff --git a/bin/mdoc.l b/bin/mdoc.l new file mode 100644 index 00000000..b6deacbe --- /dev/null +++ b/bin/mdoc.l @@ -0,0 +1,60 @@ +/* Copyright (C) 2020 June McEnroe <june@causal.agency> + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +%option prefix="mdoc" +%option noinput nounput noyywrap + +%{ +#include "hilex.h" +%} + +%s MacroLine + +%% + +[[:blank:]]+ { return Normal; } + +^"." { + BEGIN(MacroLine); + return Keyword; +} + +^".\\\"".* { return Comment; } + +<MacroLine>{ + "\n" { + BEGIN(0); + return Normal; + } + + %[ABCDIJNOPQRTUV]|A[cdnopqrt]|B[cdfkloqtx]|Br[coq]|Bsx|C[dm]|D[1bcdloqtvx] | + E[cdfklmnorsvx]|F[acdlnortx]|Hf|I[cnt]|L[bikp]|M[st]|N[dmosx]|O[copstx] | + P[acfopq]|Q[cloq]|R[esv]|S[chmoqstxy]|T[an]|U[dx]|V[at]|X[cor] { + return Keyword; + } + + "\""([^""]|"\\\"")*"\"" { return String; } +} + +"\\"(.|"("..|"["[^]]*"]") { return String; } + +[^.\\""[:space:]]+ { return Normal; } + +.|\n { return Normal; } + +%% + +const struct Lexer LexMdoc = { yylex, &yyin, &yytext }; diff --git a/bin/modem.c b/bin/modem.c index a003506f..4392e071 100644 --- a/bin/modem.c +++ b/bin/modem.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2018 C. McEnroe <june@causal.agency> +/* Copyright (C) 2018 June McEnroe <june@causal.agency> * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by @@ -34,8 +34,6 @@ typedef unsigned uint; typedef unsigned char byte; -static const uint BaudRate = 19200; - static struct termios saveTerm; static void restoreTerm(void) { tcsetattr(STDIN_FILENO, TCSADRAIN, &saveTerm); @@ -44,7 +42,14 @@ static void restoreTerm(void) { int main(int argc, char *argv[]) { int error; - if (argc < 2) return EX_USAGE; + uint baudRate = 19200; + for (int opt; 0 < (opt = getopt(argc, argv, "r:"));) { + switch (opt) { + break; case 'r': baudRate = strtoul(optarg, NULL, 10); + break; default: return EX_USAGE; + } + } + if (argc - optind < 1) return EX_USAGE; error = tcgetattr(STDIN_FILENO, &saveTerm); if (error) err(EX_IOERR, "tcgetattr"); @@ -64,8 +69,8 @@ int main(int argc, char *argv[]) { if (pid < 0) err(EX_OSERR, "forkpty"); if (!pid) { - execvp(argv[1], &argv[1]); - err(EX_NOINPUT, "%s", argv[1]); + execvp(argv[optind], &argv[optind]); + err(EX_NOINPUT, "%s", argv[optind]); } byte c; @@ -73,7 +78,7 @@ int main(int argc, char *argv[]) { { .events = POLLIN, .fd = STDIN_FILENO }, { .events = POLLIN, .fd = pty }, }; - while (usleep(8 * 1000000 / BaudRate), 0 < poll(fds, 2, -1)) { + while (usleep(8 * 1000000 / baudRate), 0 < poll(fds, 2, -1)) { if (fds[0].revents) { ssize_t size = read(STDIN_FILENO, &c, 1); if (size < 0) err(EX_IOERR, "read(%d)", STDIN_FILENO); @@ -84,14 +89,14 @@ int main(int argc, char *argv[]) { if (fds[1].revents) { ssize_t size = read(pty, &c, 1); if (size < 0) err(EX_IOERR, "read(%d)", pty); + if (!size) break; size = write(STDOUT_FILENO, &c, 1); if (size < 0) err(EX_IOERR, "write(%d)", STDOUT_FILENO); } - - int status; - pid_t dead = waitpid(pid, &status, WNOHANG); - if (dead < 0) err(EX_OSERR, "waitpid"); - if (dead) return WIFEXITED(status) ? WEXITSTATUS(status) : EX_SOFTWARE; } - err(EX_IOERR, "poll"); + + int status; + pid_t dead = waitpid(pid, &status, 0); + if (dead < 0) err(EX_OSERR, "waitpid"); + return WIFEXITED(status) ? WEXITSTATUS(status) : EX_SOFTWARE; } diff --git a/bin/mtags.c b/bin/mtags.c new file mode 100644 index 00000000..5c1a057e --- /dev/null +++ b/bin/mtags.c @@ -0,0 +1,105 @@ +/* Copyright (C) 2021 June McEnroe <june@causal.agency> + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +#include <assert.h> +#include <err.h> +#include <regex.h> +#include <stdbool.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <sysexits.h> +#include <unistd.h> + +static void escape(FILE *file, const char *str, size_t len) { + for (size_t i = 0; i < len; ++i) { + if (str[i] == '\\' || str[i] == '/') { + putc('\\', file); + } + putc(str[i], file); + } +} + +int main(int argc, char *argv[]) { + int error; + bool append = false; + const char *path = "tags"; + for (int opt; 0 < (opt = getopt(argc, argv, "af:"));) { + switch (opt) { + break; case 'a': append = true; + break; case 'f': path = optarg; + break; default: return EX_USAGE; + } + } + + FILE *tags = fopen(path, (append ? "a" : "w")); + if (!tags) err(EX_CANTCREAT, "%s", path); + +#ifdef __OpenBSD__ + error = pledge("stdio rpath", NULL); + if (error) err(EX_OSERR, "pledge"); +#endif + + regex_t makeFile, makeLine; + regex_t mdocFile, mdocLine; + regex_t shFile, shLine; + error = 0 + || regcomp(&makeFile, "(^|/)Makefile|[.]mk$", REG_EXTENDED | REG_NOSUB) + || regcomp( + &makeLine, + "^([.][^:$A-Z][^:$[:space:]]*|[^.:$][^:$[:space:]]*):", + REG_EXTENDED + ) + || regcomp(&mdocFile, "[.][1-9]$", REG_EXTENDED | REG_NOSUB) + || regcomp(&mdocLine, "^[.]S[hs] ([^\t\n]+)", REG_EXTENDED) + || regcomp( + &shFile, "(^|/)[.](profile|shrc)|[.]sh$", REG_EXTENDED | REG_NOSUB + ) + || regcomp(&shLine, "^([_[:alnum:]]+)[[:blank:]]*[(][)]", REG_EXTENDED); + assert(!error); + + size_t cap = 0; + char *buf = NULL; + for (int i = optind; i < argc; ++i) { + const regex_t *regex; + if (!regexec(&makeFile, argv[i], 0, NULL, 0)) { + regex = &makeLine; + } else if (!regexec(&mdocFile, argv[i], 0, NULL, 0)) { + regex = &mdocLine; + } else if (!regexec(&shFile, argv[i], 0, NULL, 0)) { + regex = &shLine; + } else { + warnx("skipping unknown file type %s", argv[i]); + continue; + } + + FILE *file = fopen(argv[i], "r"); + if (!file) err(EX_NOINPUT, "%s", argv[i]); + + while (0 < getline(&buf, &cap, file)) { + regmatch_t match[2]; + if (regexec(regex, buf, 2, match, 0)) continue; + fprintf( + tags, "%.*s\t%s\t/^", + (int)(match[1].rm_eo - match[1].rm_so), &buf[match[1].rm_so], + argv[i] + ); + escape(tags, buf, match[0].rm_eo); + fprintf(tags, "/\n"); + } + fclose(file); + } +} diff --git a/bin/nudge.c b/bin/nudge.c new file mode 100644 index 00000000..8ae916eb --- /dev/null +++ b/bin/nudge.c @@ -0,0 +1,78 @@ +/* Copyright (C) 2020 June McEnroe <june@causal.agency> + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +#include <err.h> +#include <fcntl.h> +#include <stdio.h> +#include <stdlib.h> +#include <sysexits.h> +#include <termios.h> +#include <unistd.h> + +static int shake = 10; +static int delay = 20000; +static int count = 2; + +static void move(int tty, int x, int y) { + dprintf(tty, "\33[3;%d;%dt", x, y); + usleep(delay); +} + +int main(int argc, char *argv[]) { + const char *path = "/dev/tty"; + for (int opt; 0 < (opt = getopt(argc, argv, "f:n:s:t:"));) { + switch (opt) { + break; case 'f': path = optarg; + break; case 'n': count = atoi(optarg); + break; case 's': shake = atoi(optarg); + break; case 't': delay = atoi(optarg) * 1000; + break; default: return EX_USAGE; + } + } + + int tty = open(path, O_RDWR); + if (tty < 0) err(EX_OSFILE, "%s", path); + + struct termios save; + int error = tcgetattr(tty, &save); + if (error) err(EX_IOERR, "tcgetattr"); + + struct termios raw = save; + cfmakeraw(&raw); + error = tcsetattr(tty, TCSAFLUSH, &raw); + if (error) err(EX_IOERR, "tcsetattr"); + + char buf[256]; + dprintf(tty, "\33[13t"); + ssize_t len = read(tty, buf, sizeof(buf) - 1); + buf[(len < 0 ? 0 : len)] = '\0'; + + int x, y; + int n = sscanf(buf, "\33[3;%d;%dt", &x, &y); + + error = tcsetattr(tty, TCSANOW, &save); + if (error) err(EX_IOERR, "tcsetattr"); + if (n < 2) return EX_CONFIG; + + dprintf(tty, "\33[5t"); + for (int i = 0; i < count; ++i) { + move(tty, x - shake, y); + move(tty, x, y + shake); + move(tty, x + shake, y); + move(tty, x, y - shake); + move(tty, x, y); + } +} diff --git a/bin/order.y b/bin/order.y index 0fb882d9..b3cbf2df 100644 --- a/bin/order.y +++ b/bin/order.y @@ -1,4 +1,4 @@ -/* Copyright (C) 2019 C. McEnroe <june@causal.agency> +/* Copyright (C) 2019 June McEnroe <june@causal.agency> * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by @@ -24,12 +24,6 @@ #include <string.h> #include <sysexits.h> -int vasprintf(char **ret, const char *format, va_list ap); - -static void yyerror(const char *str) { - errx(EX_DATAERR, "%s", str); -} - #define YYSTYPE char * static char *fmt(const char *format, ...) { @@ -43,9 +37,12 @@ static char *fmt(const char *format, ...) { } static int yylex(void); +static void yyerror(const char *str); %} +%token Ident + %left ',' %right '=' MulAss DivAss ModAss AddAss SubAss ShlAss ShrAss AndAss XorAss OrAss %right '?' ':' @@ -62,8 +59,6 @@ static int yylex(void); %right '!' '~' Inc Dec Sizeof %left '(' ')' '[' ']' Arr '.' -%token Var - %% start: @@ -71,17 +66,18 @@ start: ; expr: - Var + Ident | '(' expr ')' { $$ = $2; } | expr '[' expr ']' { $$ = fmt("(%s[%s])", $1, $3); } - | expr Arr Var { $$ = fmt("(%s->%s)", $1, $3); } - | expr '.' Var { $$ = fmt("(%s.%s)", $1, $3); } + | expr Arr Ident { $$ = fmt("(%s->%s)", $1, $3); } + | expr '.' Ident { $$ = fmt("(%s.%s)", $1, $3); } | '!' expr { $$ = fmt("(!%s)", $2); } | '~' expr { $$ = fmt("(~%s)", $2); } | Inc expr { $$ = fmt("(++%s)", $2); } | Dec expr { $$ = fmt("(--%s)", $2); } | expr Inc { $$ = fmt("(%s++)", $1); } | expr Dec { $$ = fmt("(%s--)", $1); } + | '+' expr %prec '!' { $$ = fmt("(+%s)", $2); } | '-' expr %prec '!' { $$ = fmt("(-%s)", $2); } | '*' expr %prec '!' { $$ = fmt("(*%s)", $2); } | '&' expr %prec '!' { $$ = fmt("(&%s)", $2); } @@ -127,60 +123,73 @@ ass: #define T(a, b) ((int)(a) << 8 | (int)(b)) -static const char *input; +static FILE *in; static int yylex(void) { - while (isspace(input[0])) input++; - if (!input[0]) return EOF; - - int len; - for (len = 0; isalnum(input[len]) || input[len] == '_'; ++len); - if (len) { - if (!strncmp(input, "sizeof", len)) { - input += len; - return Sizeof; + char ch; + while (isspace(ch = getc(in))); + + if (isalnum(ch)) { + char ident[64] = { ch, '\0' }; + for (size_t i = 1; i < sizeof(ident) - 1; ++i) { + ch = getc(in); + if (!isalnum(ch) && ch != '_') break; + ident[i] = ch; } - yylval = fmt("%.*s", len, input); - input += len; - return Var; + ungetc(ch, in); + if (!strcmp(ident, "sizeof")) return Sizeof; + yylval = fmt("%s", ident); + return Ident; } - int tok; - switch (T(input[0], input[1])) { - break; case T('-', '>'): tok = Arr; - break; case T('+', '+'): tok = Inc; - break; case T('-', '-'): tok = Dec; - break; case T('<', '<'): tok = Shl; - break; case T('>', '>'): tok = Shr; - break; case T('<', '='): tok = Le; - break; case T('>', '='): tok = Ge; - break; case T('=', '='): tok = Eq; - break; case T('!', '='): tok = Ne; - break; case T('&', '&'): tok = And; - break; case T('|', '|'): tok = Or; - break; case T('*', '='): tok = MulAss; - break; case T('/', '='): tok = DivAss; - break; case T('%', '='): tok = ModAss; - break; case T('+', '='): tok = AddAss; - break; case T('-', '='): tok = SubAss; - break; case T('&', '='): tok = AndAss; - break; case T('^', '='): tok = XorAss; - break; case T('|', '='): tok = OrAss; - break; default: return *input++; - } - input += 2; - - switch (T(tok, input[0])) { - case T(Shl, '='): input++; return ShlAss; - case T(Shr, '='): input++; return ShrAss; + char ne = getc(in); + switch (T(ch, ne)) { + case T('-', '>'): return Arr; + case T('+', '+'): return Inc; + case T('-', '-'): return Dec; + case T('<', '='): return Le; + case T('>', '='): return Ge; + case T('=', '='): return Eq; + case T('!', '='): return Ne; + case T('&', '&'): return And; + case T('|', '|'): return Or; + case T('*', '='): return MulAss; + case T('/', '='): return DivAss; + case T('%', '='): return ModAss; + case T('+', '='): return AddAss; + case T('-', '='): return SubAss; + case T('&', '='): return AndAss; + case T('^', '='): return XorAss; + case T('|', '='): return OrAss; + case T('<', '<'): { + if ('=' == (ne = getc(in))) return ShlAss; + ungetc(ne, in); + return Shl; + } + case T('>', '>'): { + if ('=' == (ne = getc(in))) return ShrAss; + ungetc(ne, in); + return Shr; + } + default: { + ungetc(ne, in); + return ch; + } } +} - return tok; +static void yyerror(const char *str) { + errx(EX_DATAERR, "%s", str); } int main(int argc, char *argv[]) { for (int i = 1; i < argc; ++i) { - input = argv[i]; + in = fmemopen(argv[i], strlen(argv[i]), "r"); + if (!in) err(EX_OSERR, "fmemopen"); yyparse(); + fclose(in); } + if (argc > 1) return EX_OK; + in = stdin; + yyparse(); } diff --git a/bin/pbd.c b/bin/pbd.c index 2ba333fd..9f47b63e 100644 --- a/bin/pbd.c +++ b/bin/pbd.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2017 C. McEnroe <june@causal.agency> +/* Copyright (C) 2017 June McEnroe <june@causal.agency> * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by @@ -138,15 +138,14 @@ static int open1(const char *url) { } int main(int argc, char *argv[]) { - (void)argc; - if (strchr(argv[0], '/')) { - argv[0] = strrchr(argv[0], '/') + 1; - } - switch (argv[0][0] && argv[0][1] ? argv[0][2] : 0) { - case 'd': return pbd(); - case 'c': return pbcopy(); - case 'p': return pbpaste(); - case 'e': return open1(argv[1]); - default: return EX_USAGE; + for (int opt; 0 < (opt = getopt(argc, argv, "co:ps"));) { + switch (opt) { + case 'c': return pbcopy(); + case 'o': return open1(optarg); + case 'p': return pbpaste(); + case 's': return pbd(); + default: return EX_USAGE; + } } + return pbd(); } diff --git a/bin/png.h b/bin/png.h index 15b6d13d..0df4699b 100644 --- a/bin/png.h +++ b/bin/png.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2018 C. McEnroe <june@causal.agency> +/* Copyright (C) 2018 June McEnroe <june@causal.agency> * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by diff --git a/bin/pngo.c b/bin/pngo.c index 322cb1ba..eb51ccc2 100644 --- a/bin/pngo.c +++ b/bin/pngo.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2018 C. McEnroe <june@causal.agency> +/* Copyright (C) 2018, 2021 June McEnroe <june@causal.agency> * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by @@ -14,8 +14,9 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -#include <arpa/inet.h> #include <err.h> +#include <inttypes.h> +#include <limits.h> #include <stdbool.h> #include <stdint.h> #include <stdio.h> @@ -25,256 +26,282 @@ #include <unistd.h> #include <zlib.h> -#define PACKED __attribute__((packed)) -#define PAIR(a, b) ((uint16_t)(a) << 8 | (uint16_t)(b)) - -#define CRC_INIT (crc32(0, Z_NULL, 0)) +#define ARRAY_LEN(a) (sizeof(a) / sizeof(a[0])) static bool verbose; static const char *path; static FILE *file; static uint32_t crc; -static void readExpect(void *ptr, size_t size, const char *expect) { - fread(ptr, size, 1, file); - if (ferror(file)) err(EX_IOERR, "%s", path); - if (feof(file)) errx(EX_DATAERR, "%s: missing %s", path, expect); - crc = crc32(crc, ptr, size); +static void pngRead(void *ptr, size_t len, const char *desc) { + size_t n = fread(ptr, len, 1, file); + if (!n && ferror(file)) err(EX_IOERR, "%s", path); + if (!n) errx(EX_DATAERR, "%s: missing %s", path, desc); + crc = crc32(crc, ptr, len); } -static void writeExpect(const void *ptr, size_t size) { - fwrite(ptr, size, 1, file); - if (ferror(file)) err(EX_IOERR, "%s", path); - crc = crc32(crc, ptr, size); +static void pngWrite(const void *ptr, size_t len) { + size_t n = fwrite(ptr, len, 1, file); + if (!n) err(EX_IOERR, "%s", path); + crc = crc32(crc, ptr, len); } -static const uint8_t Signature[8] = "\x89PNG\r\n\x1A\n"; +static const uint8_t Sig[8] = "\x89PNG\r\n\x1A\n"; -static void readSignature(void) { - uint8_t signature[8]; - readExpect(signature, 8, "signature"); - if (0 != memcmp(signature, Signature, 8)) { +static void sigRead(void) { + uint8_t sig[sizeof(Sig)]; + pngRead(sig, sizeof(sig), "signature"); + if (memcmp(sig, Sig, sizeof(sig))) { errx(EX_DATAERR, "%s: invalid signature", path); } } -static void writeSignature(void) { - writeExpect(Signature, sizeof(Signature)); +static void sigWrite(void) { + pngWrite(Sig, sizeof(Sig)); } -struct PACKED Chunk { - uint32_t size; - char type[4]; -}; +static uint32_t u32Read(const char *desc) { + uint8_t b[4]; + pngRead(b, sizeof(b), desc); + return (uint32_t)b[0] << 24 | (uint32_t)b[1] << 16 + | (uint32_t)b[2] << 8 | (uint32_t)b[3]; +} -static const char *typeStr(struct Chunk chunk) { - static char buf[5]; - memcpy(buf, chunk.type, 4); - return buf; +static void u32Write(uint32_t x) { + uint8_t b[4] = { x >> 24 & 0xFF, x >> 16 & 0xFF, x >> 8 & 0xFF, x & 0xFF }; + pngWrite(b, sizeof(b)); } -static struct Chunk readChunk(void) { +struct Chunk { + uint32_t len; + char type[5]; +}; + +static struct Chunk chunkRead(void) { struct Chunk chunk; - readExpect(&chunk, sizeof(chunk), "chunk"); - chunk.size = ntohl(chunk.size); - crc = crc32(CRC_INIT, (Byte *)chunk.type, sizeof(chunk.type)); + chunk.len = u32Read("chunk length"); + crc = crc32(0, Z_NULL, 0); + pngRead(chunk.type, 4, "chunk type"); + chunk.type[4] = 0; return chunk; } -static void writeChunk(struct Chunk chunk) { - chunk.size = htonl(chunk.size); - writeExpect(&chunk, sizeof(chunk)); - crc = crc32(CRC_INIT, (Byte *)chunk.type, sizeof(chunk.type)); +static void chunkWrite(struct Chunk chunk) { + u32Write(chunk.len); + crc = crc32(0, Z_NULL, 0); + pngWrite(chunk.type, 4); } -static void readCrc(void) { - uint32_t expected = crc; - uint32_t found; - readExpect(&found, sizeof(found), "CRC32"); - found = ntohl(found); - if (found != expected) { - errx( - EX_DATAERR, "%s: expected CRC32 %08X, found %08X", - path, expected, found - ); - } +static void crcRead(void) { + uint32_t expect = crc; + uint32_t actual = u32Read("CRC32"); + if (actual == expect) return; + errx( + EX_DATAERR, "%s: expected CRC32 %08X, found %08X", + path, expect, actual + ); } -static void writeCrc(void) { - uint32_t net = htonl(crc); - writeExpect(&net, sizeof(net)); +static void crcWrite(void) { + u32Write(crc); } -static void skipChunk(struct Chunk chunk) { +static void chunkSkip(struct Chunk chunk) { if (!(chunk.type[0] & 0x20)) { - errx(EX_CONFIG, "%s: unsupported critical chunk %s", path, typeStr(chunk)); + errx(EX_CONFIG, "%s: unsupported critical chunk %s", path, chunk.type); } - uint8_t discard[4096]; - while (chunk.size > sizeof(discard)) { - readExpect(discard, sizeof(discard), "chunk data"); - chunk.size -= sizeof(discard); + uint8_t buf[4096]; + while (chunk.len > sizeof(buf)) { + pngRead(buf, sizeof(buf), "chunk data"); + chunk.len -= sizeof(buf); } - if (chunk.size) readExpect(discard, chunk.size, "chunk data"); - readCrc(); + if (chunk.len) pngRead(buf, chunk.len, "chunk data"); + crcRead(); } -static struct PACKED { +enum Color { + Grayscale = 0, + Truecolor = 2, + Indexed = 3, + GrayscaleAlpha = 4, + TruecolorAlpha = 6, +}; +enum Compression { + Deflate, +}; +enum FilterMethod { + Adaptive, +}; +enum Interlace { + Progressive, + Adam7, +}; + +enum { HeaderLen = 13 }; +static struct { uint32_t width; uint32_t height; uint8_t depth; - enum PACKED { - Grayscale = 0, - Truecolor = 2, - Indexed = 3, - GrayscaleAlpha = 4, - TruecolorAlpha = 6, - } color; - enum PACKED { Deflate } compression; - enum PACKED { Adaptive } filter; - enum PACKED { Progressive, Adam7 } interlace; + uint8_t color; + uint8_t compression; + uint8_t filter; + uint8_t interlace; } header; -_Static_assert(13 == sizeof(header), "header size"); -static size_t pixelBits(void) { - switch (header.color) { - case Grayscale: return 1 * header.depth; - case Truecolor: return 3 * header.depth; - case Indexed: return 1 * header.depth; - case GrayscaleAlpha: return 2 * header.depth; - case TruecolorAlpha: return 4 * header.depth; - default: abort(); - } -} +static size_t pixelLen; +static size_t lineLen; +static size_t dataLen; -static size_t pixelSize(void) { - return (pixelBits() + 7) / 8; -} - -static size_t lineSize(void) { - return (header.width * pixelBits() + 7) / 8; -} - -static size_t dataSize(void) { - return (1 + lineSize()) * header.height; -} - -static const char *ColorStr[] = { - [Grayscale] = "grayscale", - [Truecolor] = "truecolor", - [Indexed] = "indexed", - [GrayscaleAlpha] = "grayscale alpha", - [TruecolorAlpha] = "truecolor alpha", -}; -static void printHeader(void) { +static void recalc(void) { + size_t pixelBits = header.depth; + switch (header.color) { + break; case GrayscaleAlpha: pixelBits *= 2; + break; case Truecolor: pixelBits *= 3; + break; case TruecolorAlpha: pixelBits *= 4; + } + pixelLen = (pixelBits + 7) / 8; + lineLen = (header.width * pixelBits + 7) / 8; + dataLen = (1 + lineLen) * header.height; +} + +static void headerPrint(void) { + static const char *String[] = { + [Grayscale] = "grayscale", + [Truecolor] = "truecolor", + [Indexed] = "indexed", + [GrayscaleAlpha] = "grayscale alpha", + [TruecolorAlpha] = "truecolor alpha", + }; fprintf( - stderr, - "%s: %ux%u %hhu-bit %s\n", - path, - header.width, header.height, - header.depth, ColorStr[header.color] + stderr, "%s: %" PRIu32 "x%" PRIu32 " %" PRIu8 "-bit %s\n", + path, header.width, header.height, header.depth, String[header.color] ); } -static void readHeader(struct Chunk chunk) { - if (chunk.size != sizeof(header)) { +static void headerRead(struct Chunk chunk) { + if (chunk.len != HeaderLen) { errx( - EX_DATAERR, "%s: expected IHDR size %zu, found %u", - path, sizeof(header), chunk.size + EX_DATAERR, "%s: expected %s length %" PRIu32 ", found %" PRIu32, + path, chunk.type, (uint32_t)HeaderLen, chunk.len ); } - readExpect(&header, sizeof(header), "header"); - readCrc(); - - header.width = ntohl(header.width); - header.height = ntohl(header.height); + header.width = u32Read("header width"); + header.height = u32Read("header height"); + pngRead(&header.depth, 1, "header depth"); + pngRead(&header.color, 1, "header color"); + pngRead(&header.compression, 1, "header compression"); + pngRead(&header.filter, 1, "header filter"); + pngRead(&header.interlace, 1, "header interlace"); + crcRead(); + recalc(); if (!header.width) errx(EX_DATAERR, "%s: invalid width 0", path); if (!header.height) errx(EX_DATAERR, "%s: invalid height 0", path); - switch (PAIR(header.color, header.depth)) { - case PAIR(Grayscale, 1): - case PAIR(Grayscale, 2): - case PAIR(Grayscale, 4): - case PAIR(Grayscale, 8): - case PAIR(Grayscale, 16): - case PAIR(Truecolor, 8): - case PAIR(Truecolor, 16): - case PAIR(Indexed, 1): - case PAIR(Indexed, 2): - case PAIR(Indexed, 4): - case PAIR(Indexed, 8): - case PAIR(GrayscaleAlpha, 8): - case PAIR(GrayscaleAlpha, 16): - case PAIR(TruecolorAlpha, 8): - case PAIR(TruecolorAlpha, 16): - break; - default: - errx( - EX_DATAERR, "%s: invalid color type %hhu and bit depth %hhu", - path, header.color, header.depth - ); + static const struct { + uint8_t color; + uint8_t depth; + } Valid[] = { + { Grayscale, 1 }, + { Grayscale, 2 }, + { Grayscale, 4 }, + { Grayscale, 8 }, + { Grayscale, 16 }, + { Truecolor, 8 }, + { Truecolor, 16 }, + { Indexed, 1 }, + { Indexed, 2 }, + { Indexed, 4 }, + { Indexed, 8 }, + { Indexed, 16 }, + { GrayscaleAlpha, 8 }, + { GrayscaleAlpha, 16 }, + { TruecolorAlpha, 8 }, + { TruecolorAlpha, 16 }, + }; + bool valid = false; + for (size_t i = 0; i < ARRAY_LEN(Valid); ++i) { + valid = ( + header.color == Valid[i].color && + header.depth == Valid[i].depth + ); + if (valid) break; + } + if (!valid) { + errx( + EX_DATAERR, + "%s: invalid color type %" PRIu8 " and bit depth %" PRIu8, + path, header.color, header.depth + ); } if (header.compression != Deflate) { errx( - EX_DATAERR, "%s: invalid compression method %hhu", + EX_DATAERR, "%s: invalid compression method %" PRIu8, path, header.compression ); } if (header.filter != Adaptive) { - errx(EX_DATAERR, "%s: invalid filter method %hhu", path, header.filter); + errx( + EX_DATAERR, "%s: invalid filter method %" PRIu8, + path, header.filter + ); } if (header.interlace > Adam7) { - errx(EX_DATAERR, "%s: invalid interlace method %hhu", path, header.interlace); + errx( + EX_DATAERR, "%s: invalid interlace method %" PRIu8, + path, header.interlace + ); } - if (verbose) printHeader(); + if (verbose) headerPrint(); } -static void writeHeader(void) { - if (verbose) printHeader(); - - struct Chunk ihdr = { .size = sizeof(header), .type = "IHDR" }; - writeChunk(ihdr); - header.width = htonl(header.width); - header.height = htonl(header.height); - writeExpect(&header, sizeof(header)); - writeCrc(); +static void headerWrite(void) { + if (verbose) headerPrint(); - header.width = ntohl(header.width); - header.height = ntohl(header.height); + struct Chunk ihdr = { HeaderLen, "IHDR" }; + chunkWrite(ihdr); + u32Write(header.width); + u32Write(header.height); + pngWrite(&header.depth, 1); + pngWrite(&header.color, 1); + pngWrite(&header.compression, 1); + pngWrite(&header.filter, 1); + pngWrite(&header.interlace, 1); + crcWrite(); } static struct { uint32_t len; - uint8_t entries[256][3]; -} palette; + uint8_t rgb[256][3]; +} pal; static struct { uint32_t len; - uint8_t alpha[256]; + uint8_t a[256]; } trans; -static void paletteClear(void) { - palette.len = 0; +static void palClear(void) { + pal.len = 0; trans.len = 0; } -static uint32_t paletteIndex(bool alpha, const uint8_t *rgba) { +static uint32_t palIndex(bool alpha, const uint8_t *rgba) { uint32_t i; - for (i = 0; i < palette.len; ++i) { - if (alpha && i < trans.len && trans.alpha[i] != rgba[3]) continue; - if (0 == memcmp(palette.entries[i], rgba, 3)) break; + for (i = 0; i < pal.len; ++i) { + if (alpha && i < trans.len && trans.a[i] != rgba[3]) continue; + if (!memcmp(pal.rgb[i], rgba, 3)) break; } return i; } -static bool paletteAdd(bool alpha, const uint8_t *rgba) { - uint32_t i = paletteIndex(alpha, rgba); - if (i < palette.len) return true; +static bool palAdd(bool alpha, const uint8_t *rgba) { + uint32_t i = palIndex(alpha, rgba); + if (i < pal.len) return true; if (i == 256) return false; - memcpy(palette.entries[i], rgba, 3); - palette.len++; + memcpy(pal.rgb[i], rgba, 3); + pal.len++; if (alpha) { - trans.alpha[i] = rgba[3]; + trans.a[i] = rgba[3]; trans.len++; } return true; @@ -283,97 +310,120 @@ static bool paletteAdd(bool alpha, const uint8_t *rgba) { static void transCompact(void) { uint32_t i; for (i = 0; i < trans.len; ++i) { - if (trans.alpha[i] == 0xFF) break; + if (trans.a[i] == 0xFF) break; } if (i == trans.len) return; - for (uint32_t j = i + 1; j < trans.len; ++j) { - if (trans.alpha[j] == 0xFF) continue; - - uint8_t alpha = trans.alpha[i]; - trans.alpha[i] = trans.alpha[j]; - trans.alpha[j] = alpha; - + for (uint32_t j = i+1; j < trans.len; ++j) { + if (trans.a[j] == 0xFF) continue; + uint8_t a = trans.a[i]; + trans.a[i] = trans.a[j]; + trans.a[j] = a; uint8_t rgb[3]; - memcpy(rgb, palette.entries[i], 3); - memcpy(palette.entries[i], palette.entries[j], 3); - memcpy(palette.entries[j], rgb, 3); - + memcpy(rgb, pal.rgb[i], 3); + memcpy(pal.rgb[i], pal.rgb[j], 3); + memcpy(pal.rgb[j], rgb, 3); i++; } trans.len = i; } -static void readPalette(struct Chunk chunk) { - if (chunk.size % 3) { - errx(EX_DATAERR, "%s: PLTE size %u not divisible by 3", path, chunk.size); +static void palRead(struct Chunk chunk) { + if (chunk.len % 3) { + errx( + EX_DATAERR, "%s: %s length %" PRIu32 " not divisible by 3", + path, chunk.type, chunk.len + ); } - - palette.len = chunk.size / 3; - if (palette.len > 256) { - errx(EX_DATAERR, "%s: PLTE length %u > 256", path, palette.len); + pal.len = chunk.len / 3; + if (pal.len > 256) { + errx( + EX_DATAERR, "%s: %s length %" PRIu32 " > 256", + path, chunk.type, pal.len + ); + } + pngRead(pal.rgb, chunk.len, "palette data"); + crcRead(); + if (verbose) { + fprintf(stderr, "%s: palette length %" PRIu32 "\n", path, pal.len); } - - readExpect(palette.entries, chunk.size, "palette data"); - readCrc(); - - if (verbose) fprintf(stderr, "%s: palette length %u\n", path, palette.len); } -static void writePalette(void) { - if (verbose) fprintf(stderr, "%s: palette length %u\n", path, palette.len); - struct Chunk plte = { .size = 3 * palette.len, .type = "PLTE" }; - writeChunk(plte); - writeExpect(palette.entries, plte.size); - writeCrc(); +static void palWrite(void) { + if (verbose) { + fprintf(stderr, "%s: palette length %" PRIu32 "\n", path, pal.len); + } + struct Chunk plte = { 3 * pal.len, "PLTE" }; + chunkWrite(plte); + pngWrite(pal.rgb, plte.len); + crcWrite(); } -static void readTrans(struct Chunk chunk) { - trans.len = chunk.size; +static void transRead(struct Chunk chunk) { + trans.len = chunk.len; if (trans.len > 256) { - errx(EX_DATAERR, "%s: tRNS length %u > 256", path, trans.len); + errx( + EX_DATAERR, "%s: %s length %" PRIu32 " > 256", + path, chunk.type, trans.len + ); + } + pngRead(trans.a, chunk.len, "transparency data"); + crcRead(); + if (verbose) { + fprintf(stderr, "%s: trans length %" PRIu32 "\n", path, trans.len); } - readExpect(trans.alpha, chunk.size, "transparency alpha"); - readCrc(); - if (verbose) fprintf(stderr, "%s: transparency length %u\n", path, trans.len); } -static void writeTrans(void) { - if (verbose) fprintf(stderr, "%s: transparency length %u\n", path, trans.len); - struct Chunk trns = { .size = trans.len, .type = "tRNS" }; - writeChunk(trns); - writeExpect(trans.alpha, trns.size); - writeCrc(); +static void transWrite(void) { + if (verbose) { + fprintf(stderr, "%s: trans length %" PRIu32 "\n", path, trans.len); + } + struct Chunk trns = { trans.len, "tRNS" }; + chunkWrite(trns); + pngWrite(trans.a, trns.len); + crcWrite(); } static uint8_t *data; -static void allocData(void) { - data = malloc(dataSize()); - if (!data) err(EX_OSERR, "malloc(%zu)", dataSize()); +static void dataAlloc(void) { + data = malloc(dataLen); + if (!data) err(EX_OSERR, "malloc"); +} + +static const char *humanize(size_t n) { + static char buf[64]; + if (n >> 10) { + snprintf(buf, sizeof(buf), "%zuK", n >> 10); + } else { + snprintf(buf, sizeof(buf), "%zuB", n); + } + return buf; } -static void readData(struct Chunk chunk) { - if (verbose) fprintf(stderr, "%s: data size %zu\n", path, dataSize()); +static void dataRead(struct Chunk chunk) { + if (verbose) { + fprintf(stderr, "%s: data size %s\n", path, humanize(dataLen)); + } - struct z_stream_s stream = { .next_out = data, .avail_out = dataSize() }; + z_stream stream = { .next_out = data, .avail_out = dataLen }; int error = inflateInit(&stream); - if (error != Z_OK) errx(EX_SOFTWARE, "%s: inflateInit: %s", path, stream.msg); + if (error != Z_OK) errx(EX_SOFTWARE, "inflateInit: %s", stream.msg); for (;;) { - if (0 != memcmp(chunk.type, "IDAT", 4)) { + if (strcmp(chunk.type, "IDAT")) { errx(EX_DATAERR, "%s: missing IDAT chunk", path); } - uint8_t *idat = malloc(chunk.size); + uint8_t *idat = malloc(chunk.len); if (!idat) err(EX_OSERR, "malloc"); - readExpect(idat, chunk.size, "image data"); - readCrc(); - + pngRead(idat, chunk.len, "image data"); + crcRead(); + stream.next_in = idat; - stream.avail_in = chunk.size; - int error = inflate(&stream, Z_SYNC_FLUSH); + stream.avail_in = chunk.len; + error = inflate(&stream, Z_SYNC_FLUSH); free(idat); if (error == Z_STREAM_END) break; @@ -381,71 +431,83 @@ static void readData(struct Chunk chunk) { errx(EX_DATAERR, "%s: inflate: %s", path, stream.msg); } - chunk = readChunk(); + chunk = chunkRead(); } - inflateEnd(&stream); - if ((size_t)stream.total_out != dataSize()) { + if ((size_t)stream.total_out != dataLen) { errx( - EX_DATAERR, "%s: expected data size %zu, found %zu", - path, dataSize(), (size_t)stream.total_out + EX_DATAERR, "%s: expected data length %zu, found %zu", + path, dataLen, (size_t)stream.total_out ); } if (verbose) { fprintf( - stderr, "%s: deflate size %zu\n", path, (size_t)stream.total_in + stderr, "%s: deflate size %s\n", + path, humanize(stream.total_in) ); } } -static void writeData(void) { - if (verbose) fprintf(stderr, "%s: data size %zu\n", path, dataSize()); +static void dataWrite(void) { + if (verbose) { + fprintf(stderr, "%s: data size %s\n", path, humanize(dataLen)); + } - uLong size = compressBound(dataSize()); - uint8_t *deflate = malloc(size); - if (!deflate) err(EX_OSERR, "malloc"); + z_stream stream = { + .next_in = data, + .avail_in = dataLen, + }; + int error = deflateInit2( + &stream, Z_BEST_COMPRESSION, Z_DEFLATED, 15, 8, Z_FILTERED + ); + if (error != Z_OK) errx(EX_SOFTWARE, "deflateInit2: %s", stream.msg); - int error = compress2(deflate, &size, data, dataSize(), Z_BEST_COMPRESSION); - if (error != Z_OK) errx(EX_SOFTWARE, "%s: compress2: %d", path, error); + uLong bound = deflateBound(&stream, dataLen); + uint8_t *buf = malloc(bound); + if (!buf) err(EX_OSERR, "malloc"); - struct Chunk idat = { .size = size, .type = "IDAT" }; - writeChunk(idat); - writeExpect(deflate, size); - writeCrc(); + stream.next_out = buf; + stream.avail_out = bound; + deflate(&stream, Z_FINISH); + deflateEnd(&stream); - free(deflate); + struct Chunk idat = { stream.total_out, "IDAT" }; + chunkWrite(idat); + pngWrite(buf, stream.total_out); + crcWrite(); + free(buf); - if (verbose) fprintf(stderr, "%s: deflate size %lu\n", path, size); -} + struct Chunk iend = { 0, "IEND" }; + chunkWrite(iend); + crcWrite(); -static void writeEnd(void) { - struct Chunk iend = { .size = 0, .type = "IEND" }; - writeChunk(iend); - writeCrc(); + if (verbose) { + fprintf( + stderr, "%s: deflate size %s\n", + path, humanize(stream.total_out) + ); + } } -enum PACKED Filter { +enum Filter { None, Sub, Up, Average, Paeth, - FilterCount, + FilterCap, }; struct Bytes { - uint8_t x; - uint8_t a; - uint8_t b; - uint8_t c; + uint8_t x, a, b, c; }; static uint8_t paethPredictor(struct Bytes f) { int32_t p = (int32_t)f.a + (int32_t)f.b - (int32_t)f.c; - int32_t pa = abs(p - (int32_t)f.a); - int32_t pb = abs(p - (int32_t)f.b); - int32_t pc = abs(p - (int32_t)f.c); + int32_t pa = labs(p - (int32_t)f.a); + int32_t pb = labs(p - (int32_t)f.b); + int32_t pc = labs(p - (int32_t)f.c); if (pa <= pb && pa <= pc) return f.a; if (pb <= pc) return f.b; return f.c; @@ -458,7 +520,7 @@ static uint8_t recon(enum Filter type, struct Bytes f) { case Up: return f.x + f.b; case Average: return f.x + ((uint32_t)f.a + (uint32_t)f.b) / 2; case Paeth: return f.x + paethPredictor(f); - default: abort(); + default: abort(); } } @@ -469,244 +531,308 @@ static uint8_t filt(enum Filter type, struct Bytes f) { case Up: return f.x - f.b; case Average: return f.x - ((uint32_t)f.a + (uint32_t)f.b) / 2; case Paeth: return f.x - paethPredictor(f); - default: abort(); + default: abort(); } } -static struct Line { - enum Filter type; - uint8_t data[]; -} **lines; - -static void allocLines(void) { - lines = calloc(header.height, sizeof(*lines)); - if (!lines) err(EX_OSERR, "calloc(%u, %zu)", header.height, sizeof(*lines)); +static uint8_t *lineType(uint32_t y) { + return &data[y * (1 + lineLen)]; } - -static void scanlines(void) { - size_t stride = 1 + lineSize(); - for (uint32_t y = 0; y < header.height; ++y) { - lines[y] = (struct Line *)&data[y * stride]; - if (lines[y]->type >= FilterCount) { - errx(EX_DATAERR, "%s: invalid filter type %hhu", path, lines[y]->type); - } - } +static uint8_t *lineData(uint32_t y) { + return 1 + lineType(y); } static struct Bytes origBytes(uint32_t y, size_t i) { - bool a = (i >= pixelSize()), b = (y > 0), c = (a && b); + bool a = (i >= pixelLen), b = (y > 0), c = (a && b); return (struct Bytes) { - .x = lines[y]->data[i], - .a = a ? lines[y]->data[i - pixelSize()] : 0, - .b = b ? lines[y - 1]->data[i] : 0, - .c = c ? lines[y - 1]->data[i - pixelSize()] : 0, + .x = lineData(y)[i], + .a = (a ? lineData(y)[i-pixelLen] : 0), + .b = (b ? lineData(y-1)[i] : 0), + .c = (c ? lineData(y-1)[i-pixelLen] : 0), }; } -static void reconData(void) { +static void dataRecon(void) { for (uint32_t y = 0; y < header.height; ++y) { - for (size_t i = 0; i < lineSize(); ++i) { - lines[y]->data[i] = - recon(lines[y]->type, origBytes(y, i)); + for (size_t i = 0; i < lineLen; ++i) { + lineData(y)[i] = recon(*lineType(y), origBytes(y, i)); } - lines[y]->type = None; + *lineType(y) = None; } } -static void filterData(void) { +static void dataFilter(void) { if (header.color == Indexed || header.depth < 8) return; - for (uint32_t y = header.height - 1; y < header.height; --y) { - uint8_t filter[FilterCount][lineSize()]; - uint32_t heuristic[FilterCount] = {0}; + uint8_t *filter[FilterCap]; + for (enum Filter i = None; i < FilterCap; ++i) { + filter[i] = malloc(lineLen); + if (!filter[i]) err(EX_OSERR, "malloc"); + } + for (uint32_t y = header.height-1; y < header.height; --y) { + uint32_t heuristic[FilterCap] = {0}; enum Filter minType = None; - for (enum Filter type = None; type < FilterCount; ++type) { - for (size_t i = 0; i < lineSize(); ++i) { + for (enum Filter type = None; type < FilterCap; ++type) { + for (size_t i = 0; i < lineLen; ++i) { filter[type][i] = filt(type, origBytes(y, i)); heuristic[type] += abs((int8_t)filter[type][i]); } if (heuristic[type] < heuristic[minType]) minType = type; } - lines[y]->type = minType; - memcpy(lines[y]->data, filter[minType], lineSize()); + *lineType(y) = minType; + memcpy(lineData(y), filter[minType], lineLen); + } + for (enum Filter i = None; i < FilterCap; ++i) { + free(filter[i]); } } -static void discardAlpha(void) { - if (header.color != GrayscaleAlpha && header.color != TruecolorAlpha) return; - size_t sampleSize = header.depth / 8; - size_t colorSize = pixelSize() - sampleSize; - for (uint32_t y = 0; y < header.height; ++y) { - for (uint32_t x = 0; x < header.width; ++x) { - for (size_t i = 0; i < sampleSize; ++i) { - if (lines[y]->data[x * pixelSize() + colorSize + i] != 0xFF) return; - } - } +static bool alphaUnused(void) { + if (header.color != GrayscaleAlpha && header.color != TruecolorAlpha) { + return false; + } + size_t sampleLen = header.depth / 8; + size_t colorLen = pixelLen - sampleLen; + for (uint32_t y = 0; y < header.height; ++y) + for (uint32_t x = 0; x < header.width; ++x) + for (size_t i = 0; i < sampleLen; ++i) { + if (lineData(y)[x * pixelLen + colorLen + i] != 0xFF) return false; } + return true; +} +static void alphaDiscard(void) { + if (header.color != GrayscaleAlpha && header.color != TruecolorAlpha) { + return; + } + size_t sampleLen = header.depth / 8; + size_t colorLen = pixelLen - sampleLen; uint8_t *ptr = data; for (uint32_t y = 0; y < header.height; ++y) { - *ptr++ = lines[y]->type; + *ptr++ = *lineType(y); for (uint32_t x = 0; x < header.width; ++x) { - memmove(ptr, &lines[y]->data[x * pixelSize()], colorSize); - ptr += colorSize; + memmove(ptr, &lineData(y)[x * pixelLen], colorLen); + ptr += colorLen; } } - header.color = (header.color == GrayscaleAlpha) ? Grayscale : Truecolor; - scanlines(); + header.color = (header.color == GrayscaleAlpha ? Grayscale : Truecolor); + recalc(); } -static void discardColor(void) { - if (header.color != Truecolor && header.color != TruecolorAlpha) return; - size_t sampleSize = header.depth / 8; +static bool depth16Unused(void) { + if (header.color != Grayscale && header.color != Truecolor) return false; + if (header.depth != 16) return false; + for (uint32_t y = 0; y < header.height; ++y) + for (size_t i = 0; i < lineLen; i += 2) { + if (lineData(y)[i] != lineData(y)[i+1]) return false; + } + return true; +} + +static void depth16Reduce(void) { + if (header.depth != 16) return; + uint8_t *ptr = data; for (uint32_t y = 0; y < header.height; ++y) { - for (uint32_t x = 0; x < header.width; ++x) { - uint8_t *r = &lines[y]->data[x * pixelSize()]; - uint8_t *g = r + sampleSize; - uint8_t *b = g + sampleSize; - if (0 != memcmp(r, g, sampleSize)) return; - if (0 != memcmp(g, b, sampleSize)) return; + *ptr++ = *lineType(y); + for (size_t i = 0; i < lineLen / 2; ++i) { + *ptr++ = lineData(y)[i*2]; } } + header.depth = 8; + recalc(); +} + +static bool colorUnused(void) { + if (header.color != Truecolor && header.color != TruecolorAlpha) { + return false; + } + if (header.depth != 8) return false; + for (uint32_t y = 0; y < header.height; ++y) + for (uint32_t x = 0; x < header.width; ++x) { + uint8_t r = lineData(y)[x * pixelLen + 0]; + uint8_t g = lineData(y)[x * pixelLen + 1]; + uint8_t b = lineData(y)[x * pixelLen + 2]; + if (r != g || g != b) return false; + } + return true; +} +static void colorDiscard(void) { + if (header.color != Truecolor && header.color != TruecolorAlpha) return; + if (header.depth != 8) return; uint8_t *ptr = data; for (uint32_t y = 0; y < header.height; ++y) { - *ptr++ = lines[y]->type; + *ptr++ = *lineType(y); for (uint32_t x = 0; x < header.width; ++x) { - uint8_t *pixel = &lines[y]->data[x * pixelSize()]; - memmove(ptr, pixel, sampleSize); - ptr += sampleSize; + uint8_t r = lineData(y)[x * pixelLen + 0]; + uint8_t g = lineData(y)[x * pixelLen + 1]; + uint8_t b = lineData(y)[x * pixelLen + 2]; + *ptr++ = ((uint32_t)r + (uint32_t)g + (uint32_t)b) / 3; if (header.color == TruecolorAlpha) { - memmove(ptr, pixel + 3 * sampleSize, sampleSize); - ptr += sampleSize; + *ptr++ = lineData(y)[x * pixelLen + 3]; } } } - header.color = (header.color == Truecolor) ? Grayscale : GrayscaleAlpha; - scanlines(); + header.color = (header.color == Truecolor ? Grayscale : GrayscaleAlpha); + recalc(); } -static void indexColor(void) { +static void colorIndex(void) { if (header.color != Truecolor && header.color != TruecolorAlpha) return; if (header.depth != 8) return; bool alpha = (header.color == TruecolorAlpha); - for (uint32_t y = 0; y < header.height; ++y) { - for (uint32_t x = 0; x < header.width; ++x) { - if (!paletteAdd(alpha, &lines[y]->data[x * pixelSize()])) return; - } + for (uint32_t y = 0; y < header.height; ++y) + for (uint32_t x = 0; x < header.width; ++x) { + if (!palAdd(alpha, &lineData(y)[x * pixelLen])) return; } - transCompact(); + transCompact(); uint8_t *ptr = data; for (uint32_t y = 0; y < header.height; ++y) { - *ptr++ = lines[y]->type; + *ptr++ = *lineType(y); for (uint32_t x = 0; x < header.width; ++x) { - *ptr++ = paletteIndex(alpha, &lines[y]->data[x * pixelSize()]); + *ptr++ = palIndex(alpha, &lineData(y)[x * pixelLen]); } } header.color = Indexed; - scanlines(); + recalc(); } -static void reduceDepth8(void) { - if (header.color != Grayscale && header.color != Indexed) return; - if (header.depth != 8) return; - if (header.color == Grayscale) { - for (uint32_t y = 0; y < header.height; ++y) { - for (size_t i = 0; i < lineSize(); ++i) { - uint8_t a = lines[y]->data[i]; - if ((a >> 4) != (a & 0x0F)) return; - } - } - } else if (palette.len > 16) { - return; +static bool depth8Unused(void) { + if (header.depth != 8) return false; + if (header.color == Indexed) return pal.len <= 16; + if (header.color != Grayscale) return false; + for (uint32_t y = 0; y < header.height; ++y) + for (size_t i = 0; i < lineLen; ++i) { + if ((lineData(y)[i] >> 4) != (lineData(y)[i] & 0x0F)) return false; } + return true; +} +static void depth8Reduce(void) { + if (header.color != Grayscale && header.color != Indexed) return; + if (header.depth != 8) return; uint8_t *ptr = data; for (uint32_t y = 0; y < header.height; ++y) { - *ptr++ = lines[y]->type; - for (size_t i = 0; i < lineSize(); i += 2) { - uint8_t iByte = lines[y]->data[i]; - uint8_t jByte = (i + 1 < lineSize()) ? lines[y]->data[i + 1] : 0; - uint8_t a = iByte & 0x0F; - uint8_t b = jByte & 0x0F; + *ptr++ = *lineType(y); + for (size_t i = 0; i < lineLen; i += 2) { + uint8_t a, b; + uint8_t aa = lineData(y)[i]; + uint8_t bb = (i+1 < lineLen ? lineData(y)[i+1] : 0); + if (header.color == Grayscale) { + a = aa >> 4; + b = bb >> 4; + } else { + a = aa & 0x0F; + b = bb & 0x0F; + } *ptr++ = a << 4 | b; } } header.depth = 4; - scanlines(); + recalc(); } -static void reduceDepth4(void) { - if (header.depth != 4) return; - if (header.color == Grayscale) { - for (uint32_t y = 0; y < header.height; ++y) { - for (size_t i = 0; i < lineSize(); ++i) { - uint8_t a = lines[y]->data[i] >> 4; - uint8_t b = lines[y]->data[i] & 0x0F; - if ((a >> 2) != (a & 0x03)) return; - if ((b >> 2) != (b & 0x03)) return; - } - } - } else if (palette.len > 4) { - return; +static bool depth4Unused(void) { + if (header.depth != 4) return false; + if (header.color == Indexed) return pal.len <= 4; + if (header.color != Grayscale) return false; + for (uint32_t y = 0; y < header.height; ++y) + for (size_t i = 0; i < lineLen; ++i) { + uint8_t a = lineData(y)[i] >> 4; + uint8_t b = lineData(y)[i] & 0x0F; + if ((a >> 2) != (a & 0x03)) return false; + if ((b >> 2) != (b & 0x03)) return false; } + return true; +} +static void depth4Reduce(void) { + if (header.color != Grayscale && header.color != Indexed) return; + if (header.depth != 4) return; uint8_t *ptr = data; for (uint32_t y = 0; y < header.height; ++y) { - *ptr++ = lines[y]->type; - for (size_t i = 0; i < lineSize(); i += 2) { - uint8_t iByte = lines[y]->data[i]; - uint8_t jByte = (i + 1 < lineSize()) ? lines[y]->data[i + 1] : 0; - uint8_t a = iByte >> 4 & 0x03, b = iByte & 0x03; - uint8_t c = jByte >> 4 & 0x03, d = jByte & 0x03; + *ptr++ = *lineType(y); + for (size_t i = 0; i < lineLen; i += 2) { + uint8_t a, b, c, d; + uint8_t aabb = lineData(y)[i]; + uint8_t ccdd = (i+1 < lineLen ? lineData(y)[i+1] : 0); + if (header.color == Grayscale) { + a = aabb >> 6; + c = ccdd >> 6; + b = aabb >> 2 & 0x03; + d = ccdd >> 2 & 0x03; + } else { + a = aabb >> 4 & 0x03; + c = ccdd >> 4 & 0x03; + b = aabb & 0x03; + d = ccdd & 0x03; + } *ptr++ = a << 6 | b << 4 | c << 2 | d; } } header.depth = 2; - scanlines(); + recalc(); +} + +static bool depth2Unused(void) { + if (header.depth != 2) return false; + if (header.color == Indexed) return pal.len <= 2; + if (header.color != Grayscale) return false; + for (uint32_t y = 0; y < header.height; ++y) + for (size_t i = 0; i < lineLen; ++i) { + uint8_t a = lineData(y)[i] >> 6; + uint8_t b = lineData(y)[i] >> 4 & 0x03; + uint8_t c = lineData(y)[i] >> 2 & 0x03; + uint8_t d = lineData(y)[i] & 0x03; + if ((a >> 1) != (a & 1)) return false; + if ((b >> 1) != (b & 1)) return false; + if ((c >> 1) != (c & 1)) return false; + if ((d >> 1) != (d & 1)) return false; + } + return true; } -static void reduceDepth2(void) { +static void depth2Reduce(void) { + if (header.color != Grayscale && header.color != Indexed) return; if (header.depth != 2) return; - if (header.color == Grayscale) { - for (uint32_t y = 0; y < header.height; ++y) { - for (size_t i = 0; i < lineSize(); ++i) { - uint8_t a = lines[y]->data[i] >> 6; - uint8_t b = lines[y]->data[i] >> 4 & 0x03; - uint8_t c = lines[y]->data[i] >> 2 & 0x03; - uint8_t d = lines[y]->data[i] & 0x03; - if ((a >> 1) != (a & 0x01)) return; - if ((b >> 1) != (b & 0x01)) return; - if ((c >> 1) != (c & 0x01)) return; - if ((d >> 1) != (d & 0x01)) return; - } - } - } else if (palette.len > 2) { - return; - } - uint8_t *ptr = data; for (uint32_t y = 0; y < header.height; ++y) { - *ptr++ = lines[y]->type; - for (size_t i = 0; i < lineSize(); i += 2) { - uint8_t iByte = lines[y]->data[i]; - uint8_t jByte = (i + 1 < lineSize()) ? lines[y]->data[i + 1] : 0; - uint8_t a = iByte >> 6 & 0x01, b = iByte >> 4 & 0x01; - uint8_t c = iByte >> 2 & 0x01, d = iByte & 0x01; - uint8_t e = jByte >> 6 & 0x01, f = jByte >> 4 & 0x01; - uint8_t g = jByte >> 2 & 0x01, h = jByte & 0x01; - *ptr++ = a << 7 | b << 6 | c << 5 | d << 4 | e << 3 | f << 2 | g << 1 | h; + *ptr++ = *lineType(y); + for (size_t i = 0; i < lineLen; i += 2) { + uint8_t a, b, c, d, e, f, g, h; + uint8_t aabbccdd = lineData(y)[i]; + uint8_t eeffgghh = (i+1 < lineLen ? lineData(y)[i+1] : 0); + if (header.color == Grayscale) { + a = aabbccdd >> 7; + b = aabbccdd >> 5 & 1; + c = aabbccdd >> 3 & 1; + d = aabbccdd >> 1 & 1; + e = eeffgghh >> 7; + f = eeffgghh >> 5 & 1; + g = eeffgghh >> 3 & 1; + h = eeffgghh >> 1 & 1; + } else { + a = aabbccdd >> 6 & 1; + b = aabbccdd >> 4 & 1; + c = aabbccdd >> 2 & 1; + d = aabbccdd & 1; + e = eeffgghh >> 6 & 1; + f = eeffgghh >> 4 & 1; + g = eeffgghh >> 2 & 1; + h = eeffgghh & 1; + } + *ptr++ = 0 + | a << 7 | b << 6 | c << 5 | d << 4 + | e << 3 | f << 2 | g << 1 | h; } } header.depth = 1; - scanlines(); + recalc(); } -static void reduceDepth(void) { - reduceDepth8(); - reduceDepth4(); - reduceDepth2(); -} +static bool discardAlpha; +static bool discardColor; +static uint8_t reduceDepth = 16; static void optimize(const char *inPath, const char *outPath) { if (inPath) { @@ -714,99 +840,102 @@ static void optimize(const char *inPath, const char *outPath) { file = fopen(path, "r"); if (!file) err(EX_NOINPUT, "%s", path); } else { - path = "(stdin)"; + path = "stdin"; file = stdin; } - readSignature(); - struct Chunk ihdr = readChunk(); - if (0 != memcmp(ihdr.type, "IHDR", 4)) { - errx(EX_DATAERR, "%s: expected IHDR, found %s", path, typeStr(ihdr)); + sigRead(); + struct Chunk ihdr = chunkRead(); + if (strcmp(ihdr.type, "IHDR")) { + errx(EX_DATAERR, "%s: expected IHDR, found %s", path, ihdr.type); } - readHeader(ihdr); + headerRead(ihdr); if (header.interlace != Progressive) { - errx( - EX_CONFIG, "%s: unsupported interlace method %hhu", - path, header.interlace - ); + errx(EX_CONFIG, "%s: unsupported interlacing", path); } - paletteClear(); - allocData(); + palClear(); + dataAlloc(); for (;;) { - struct Chunk chunk = readChunk(); - if (0 == memcmp(chunk.type, "PLTE", 4)) { - readPalette(chunk); - } else if (0 == memcmp(chunk.type, "tRNS", 4)) { - readTrans(chunk); - } else if (0 == memcmp(chunk.type, "IDAT", 4)) { - readData(chunk); - } else if (0 != memcmp(chunk.type, "IEND", 4)) { - skipChunk(chunk); - } else { + struct Chunk chunk = chunkRead(); + if (!strcmp(chunk.type, "PLTE")) { + palRead(chunk); + } else if (!strcmp(chunk.type, "tRNS")) { + transRead(chunk); + } else if (!strcmp(chunk.type, "IDAT")) { + dataRead(chunk); + } else if (!strcmp(chunk.type, "IEND")) { break; + } else { + chunkSkip(chunk); } } - fclose(file); - allocLines(); - scanlines(); - reconData(); - - discardAlpha(); - discardColor(); - indexColor(); - reduceDepth(); - filterData(); - free(lines); - + dataRecon(); + if (discardAlpha || alphaUnused()) alphaDiscard(); + if (reduceDepth < 16 || depth16Unused()) depth16Reduce(); + if (discardColor || colorUnused()) colorDiscard(); + colorIndex(); + if (reduceDepth < 8 || depth8Unused()) depth8Reduce(); + if (reduceDepth < 4 || depth4Unused()) depth4Reduce(); + if (reduceDepth < 2 || depth2Unused()) depth2Reduce(); + dataFilter(); + + char buf[PATH_MAX]; if (outPath) { path = outPath; - file = fopen(path, "w"); - if (!file) err(EX_CANTCREAT, "%s", path); + if (outPath == inPath) { + snprintf(buf, sizeof(buf), "%so", outPath); + file = fopen(buf, "wx"); + if (!file) err(EX_CANTCREAT, "%s", buf); + } else { + file = fopen(path, "w"); + if (!file) err(EX_CANTCREAT, "%s", outPath); + } } else { - path = "(stdout)"; + path = "stdout"; file = stdout; } - writeSignature(); - writeHeader(); + sigWrite(); + headerWrite(); if (header.color == Indexed) { - writePalette(); - if (trans.len) writeTrans(); + palWrite(); + if (trans.len) transWrite(); } - writeData(); - writeEnd(); + dataWrite(); free(data); - int error = fclose(file); if (error) err(EX_IOERR, "%s", path); + + if (outPath && outPath == inPath) { + error = rename(buf, outPath); + if (error) err(EX_CANTCREAT, "%s", outPath); + } } int main(int argc, char *argv[]) { bool stdio = false; - char *output = NULL; + char *outPath = NULL; - int opt; - while (0 < (opt = getopt(argc, argv, "co:v"))) { + for (int opt; 0 < (opt = getopt(argc, argv, "ab:cgo:v"));) { switch (opt) { + break; case 'a': discardAlpha = true; + break; case 'b': reduceDepth = strtoul(optarg, NULL, 10); break; case 'c': stdio = true; - break; case 'o': output = optarg; + break; case 'g': discardColor = true; + break; case 'o': outPath = optarg; break; case 'v': verbose = true; - break; default: return EX_USAGE; + break; default: return EX_USAGE; } } - if (argc - optind == 1 && (output || stdio)) { - optimize(argv[optind], output); - } else if (optind < argc) { + if (optind < argc) { for (int i = optind; i < argc; ++i) { - optimize(argv[i], argv[i]); + optimize(argv[i], (stdio ? NULL : outPath ? outPath : argv[i])); } } else { - optimize(NULL, output); + optimize(NULL, outPath); } - - return EX_OK; } diff --git a/bin/psf2png.c b/bin/psf2png.c index 1aaa8635..c36238a0 100644 --- a/bin/psf2png.c +++ b/bin/psf2png.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2018 C. McEnroe <june@causal.agency> +/* Copyright (C) 2018 June McEnroe <june@causal.agency> * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by diff --git a/bin/psfed.c b/bin/psfed.c deleted file mode 100644 index 4f46b500..00000000 --- a/bin/psfed.c +++ /dev/null @@ -1,577 +0,0 @@ -/* Copyright (C) 2018 C. McEnroe <june@causal.agency> - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -#include <err.h> -#include <errno.h> -#include <fcntl.h> -#include <linux/fb.h> -#include <locale.h> -#include <stdbool.h> -#include <stdint.h> -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <sys/ioctl.h> -#include <sys/mman.h> -#include <sysexits.h> -#include <termios.h> -#include <unistd.h> -#include <wchar.h> - -static const wchar_t CP437[256] = - L"\0☺☻♥♦♣♠•◘○◙♂♀♪♫☼" - L"►◄↕‼¶§▬↨↑↓→←∟↔▲▼" - L" !\"#$%&'()*+,-./" - L"0123456789:;<=>?" - L"@ABCDEFGHIJKLMNO" - L"PQRSTUVWXYZ[\\]^_" - L"`abcdefghijklmno" - L"pqrstuvwxyz{|}~⌂" - L"ÇüéâäàåçêëèïîìÄÅ" - L"ÉæÆôöòûùÿÖÜ¢£¥₧ƒ" - L"áíóúñѪº¿⌐¬½¼¡«»" - L"░▒▓│┤╡╢╖╕╣║╗╝╜╛┐" - L"└┴┬├─┼╞╟╚╔╩╦╠═╬╧" - L"╨╤╥╙╘╒╓╫╪┘┌█▄▌▐▀" - L"αßΓπΣσµτΦΘΩδ∞φε∩" - L"≡±≥≤⌠⌡÷≈°∙·√ⁿ²■\0"; - -static struct { - uint32_t width; - uint32_t height; - uint32_t *buffer; - uint32_t background; -} frame; - -static void frameClear(void) { - for (uint32_t i = 0; i < frame.width * frame.height; ++i) { - frame.buffer[i] = frame.background; - } -} - -static void frameOpen(void) { - const char *dev = getenv("FRAMEBUFFER"); - if (!dev) dev = "/dev/fb0"; - - int fd = open(dev, O_RDWR); - if (fd < 0) err(EX_OSFILE, "%s", dev); - - struct fb_var_screeninfo info; - int error = ioctl(fd, FBIOGET_VSCREENINFO, &info); - if (error) err(EX_IOERR, "%s", dev); - - frame.width = info.xres; - frame.height = 3 * info.yres / 4; - frame.buffer = mmap( - NULL, sizeof(*frame.buffer) * frame.width * frame.height, - PROT_READ | PROT_WRITE, MAP_SHARED, - fd, 0 - ); - if (frame.buffer == MAP_FAILED) err(EX_IOERR, "%s", dev); - close(fd); - - frame.background = frame.buffer[0]; - atexit(frameClear); -} - -static const uint32_t Magic = 0x864AB572; -static const uint32_t Version = 0; -static const uint32_t FlagUnicode = 1 << 0; -static uint32_t bytes(uint32_t bits) { - return (bits + 7) / 8; -} - -static char *path; -static struct { - uint32_t magic; - uint32_t version; - uint32_t size; - uint32_t flags; - struct { - uint32_t len; - uint32_t size; - uint32_t height; - uint32_t width; - } glyph; -} header; -static uint8_t *glyphs; - -static void fileRead(uint32_t newLen, uint32_t newWidth, uint32_t newHeight) { - FILE *file = fopen(path, "r"); - if (file) { - size_t len = fread(&header, sizeof(header), 1, file); - if (ferror(file)) err(EX_IOERR, "%s", path); - if (len < 1) errx(EX_DATAERR, "%s: truncated header", path); - - } else { - if (errno != ENOENT) err(EX_NOINPUT, "%s", path); - header.magic = Magic; - header.version = Version; - header.size = sizeof(header); - header.flags = 0; - header.glyph.len = newLen; - header.glyph.size = bytes(newWidth) * newHeight; - header.glyph.height = newHeight; - header.glyph.width = newWidth; - } - - if (header.magic != Magic) { - errx(EX_DATAERR, "%s: invalid magic %08X", path, header.magic); - } - if (header.version != Version) { - errx(EX_DATAERR, "%s: unsupported version %u", path, header.version); - } - if (header.flags & FlagUnicode) { - errx(EX_DATAERR, "%s: unsupported unicode table", path); - } - if (header.flags) { - errx(EX_DATAERR, "%s: unsupported flags %08X", path, header.flags); - } - - if (file && header.size > sizeof(header)) { - int error = fseek(file, header.size, SEEK_SET); - if (error) err(EX_IOERR, "%s", path); - - warnx("%s: truncating long header", path); - header.size = sizeof(header); - } - - glyphs = calloc(header.glyph.len, header.glyph.size); - if (!glyphs) err(EX_OSERR, "calloc"); - - if (file) { - size_t len = fread(glyphs, header.glyph.size, header.glyph.len, file); - if (ferror(file)) err(EX_IOERR, "%s", path); - if (len < header.glyph.len) { - errx(EX_DATAERR, "%s: truncated glyphs", path); - } - fclose(file); - } -} - -static void fileWrite(void) { - FILE *file = fopen(path, "w"); - if (!file) err(EX_CANTCREAT, "%s", path); - - fwrite(&header, sizeof(header), 1, file); - if (ferror(file)) err(EX_IOERR, "%s", path); - - fwrite(glyphs, header.glyph.size, header.glyph.len, file); - if (ferror(file)) err(EX_IOERR, "%s", path); - - int error = fclose(file); - if (error) err(EX_IOERR, "%s", path); -} - -static uint8_t *glyph(uint32_t index) { - return &glyphs[header.glyph.size * index]; -} -static uint8_t *bitByte(uint32_t index, uint32_t x, uint32_t y) { - return &glyph(index)[bytes(header.glyph.width) * y + x / 8]; -} -static uint8_t bitGet(uint32_t index, uint32_t x, uint32_t y) { - return *bitByte(index, x, y) >> (7 - x % 8) & 1; -} -static void bitFlip(uint32_t index, uint32_t x, uint32_t y) { - *bitByte(index, x, y) ^= 1 << (7 - x % 8); -} -static void bitSet(uint32_t index, uint32_t x, uint32_t y, uint8_t bit) { - *bitByte(index, x, y) &= ~(1 << (7 - x % 8)); - *bitByte(index, x, y) |= bit << (7 - x % 8); -} - -static void drawGlyph( - uint32_t destX, uint32_t destY, uint32_t scale, uint32_t index, - uint32_t selectX, uint32_t selectY, uint32_t guideX, uint32_t guideY -) { - destX <<= scale; - destY <<= scale; - - for (uint32_t y = 0; y < (header.glyph.height << scale); ++y) { - if (destY + y >= frame.height) break; - for (uint32_t x = 0; x < (header.glyph.width << scale); ++x) { - if (destX + x >= frame.width) break; - - uint32_t glyphX = x >> scale; - uint32_t glyphY = y >> scale; - uint32_t fill = -bitGet(index, glyphX, glyphY); - if (selectX & 1 << glyphX && selectY & 1 << glyphY) fill ^= 0x77; - if (guideX & 1 << glyphX || guideY & 1 << glyphY) fill ^= 0x3300; - - frame.buffer[frame.width * (destY + y) + destX + x] = fill; - } - } -} - -static void drawBorder(uint32_t destX, uint32_t destY, uint32_t scale) { - destX <<= scale; - destY <<= scale; - - for (uint32_t y = 0; y < destY; ++y) { - if (y >= frame.height) break; - uint32_t fill = -(y >> scale & 1) ^ 0x555555; - for (uint32_t x = 0; x < (uint32_t)(1 << scale); ++x) { - if (destX + x >= frame.width) break; - frame.buffer[frame.width * y + destX + x] = fill; - } - } - - for (uint32_t x = 0; x < destX; ++x) { - if (x >= frame.width) break; - uint32_t fill = -(x >> scale & 1) ^ 0x555555; - for (uint32_t y = 0; y < (uint32_t)(1 << scale); ++y) { - if (destY + y >= frame.height) break; - frame.buffer[frame.width * (destY + y) + x] = fill; - } - } -} - -enum { LF = '\n', Esc = '\33', Del = '\177' }; - -static enum { - Normal, - Edit, - Preview, - Discard, -} mode; - -static struct { - uint32_t scale; - uint32_t index; - bool modified; - bool to; - uint32_t from; -} normal; - -static struct { - uint32_t scale; - uint32_t index; - uint32_t x; - uint32_t y; - uint32_t guideX; - uint32_t guideY; - uint8_t *undo; - uint8_t *copy; -} edit = { - .scale = 4, -}; - -static const uint32_t NormalCols = 32; -static void drawNormal(void) { - for (uint32_t i = 0; i < header.glyph.len; ++i) { - drawGlyph( - header.glyph.width * (i % NormalCols), - header.glyph.height * (i / NormalCols), - normal.scale, i, - -(i == normal.index), -(i == normal.index), 0, 0 - ); - } -} - -static void normalDec(uint32_t n) { - if (normal.index >= n) normal.index -= n; -} -static void normalInc(uint32_t n) { - if (normal.index + n < header.glyph.len) normal.index += n; -} -static void normalPrint(const char *prefix) { - if (normal.index <= 256) { - printf( - "%s: %02X '%lc'\n", - prefix, normal.index, (wint_t)CP437[normal.index] - ); - } else { - printf("%s: %02X\n", prefix, normal.index); - } -} - -static void inputNormal(char ch) { - if (normal.to) { - if (ch < header.glyph.len) normal.index = ch; - normalPrint("index"); - normal.to = false; - return; - } - - switch (ch) { - break; case 'q': { - if (!normal.modified) exit(EX_OK); - mode = Discard; - } - break; case 'w': { - fileWrite(); - printf("write: %s\n", path); - normal.modified = false; - } - break; case '-': if (normal.scale) normal.scale--; frameClear(); - break; case '+': normal.scale++; - break; case 'h': normalDec(1); normalPrint("index"); - break; case 'l': normalInc(1); normalPrint("index"); - break; case 'k': normalDec(NormalCols); normalPrint("index"); - break; case 'j': normalInc(NormalCols); normalPrint("index"); - break; case 'f': normal.from = normal.index; normal.to = true; - break; case 047: normal.index = normal.from; normalPrint("index"); - break; case 'y': { - if (!edit.copy) edit.copy = malloc(header.glyph.size); - if (!edit.copy) err(EX_OSERR, "malloc"); - memcpy(edit.copy, glyph(normal.index), header.glyph.size); - normalPrint("copy"); - } - break; case 'e': { - normal.modified = true; - edit.index = normal.index; - if (!edit.undo) edit.undo = malloc(header.glyph.size); - if (!edit.undo) err(EX_OSERR, "malloc"); - memcpy(edit.undo, glyph(edit.index), header.glyph.size); - mode = Edit; - frameClear(); - } - break; case 'i': mode = Preview; frameClear(); - } -} - -static void drawEdit(void) { - drawGlyph( - 0, 0, edit.scale, edit.index, - 1 << edit.x, 1 << edit.y, edit.guideX, edit.guideY - ); - drawBorder(header.glyph.width, header.glyph.height, edit.scale); - drawGlyph( - header.glyph.width << edit.scale, - header.glyph.height << edit.scale, - 0, edit.index, - 0, 0, 0, 0 - ); -} - -static void inputEdit(char ch) { - switch (ch) { - break; case Esc: mode = Normal; frameClear(); - - break; case '-': if (edit.scale) edit.scale--; frameClear(); - break; case '+': edit.scale++; - break; case 'g': edit.guideY ^= 1 << edit.y; - break; case 'G': edit.guideX ^= 1 << edit.x; - - break; case 'h': if (edit.x) edit.x--; - break; case 'l': if (edit.x + 1 < header.glyph.width) edit.x++; - break; case 'k': if (edit.y) edit.y--; - break; case 'j': if (edit.y + 1 < header.glyph.height) edit.y++; - break; case ' ': bitFlip(edit.index, edit.x, edit.y); - - break; case 'r': { - for (uint32_t y = 0; y < header.glyph.height; ++y) { - for (uint32_t x = 0; x < header.glyph.width; ++x) { - bitFlip(edit.index, x, y); - } - } - } - - break; case 'H': { - for (uint32_t x = 0; x < header.glyph.width; ++x) { - for (uint32_t y = 0; y < header.glyph.height; ++y) { - if (x + 1 < header.glyph.width) { - bitSet(edit.index, x, y, bitGet(edit.index, x + 1, y)); - } else { - bitSet(edit.index, x, y, 0); - } - } - } - } - - break; case 'L': { - uint32_t width = header.glyph.width; - for (uint32_t x = width - 1; x < width; --x) { - for (uint32_t y = 0; y < header.glyph.height; ++y) { - if (x - 1 < width) { - bitSet(edit.index, x, y, bitGet(edit.index, x - 1, y)); - } else { - bitSet(edit.index, x, y, 0); - } - } - } - } - - break; case 'K': { - for (uint32_t y = 0; y < header.glyph.height; ++y) { - for (uint32_t x = 0; x < header.glyph.width; ++x) { - if (y + 1 < header.glyph.height) { - bitSet(edit.index, x, y, bitGet(edit.index, x, y + 1)); - } else { - bitSet(edit.index, x, y, 0); - } - } - } - } - - break; case 'J': { - uint32_t height = header.glyph.height; - for (uint32_t y = height - 1; y < height; --y) { - for (uint32_t x = 0; x < header.glyph.width; ++x) { - if (y - 1 < height) { - bitSet(edit.index, x, y, bitGet(edit.index, x, y - 1)); - } else { - bitSet(edit.index, x, y, 0); - } - } - } - } - - break; case 'p': { - if (!edit.copy) break; - memcpy(glyph(edit.index), edit.copy, header.glyph.size); - } - break; case 'u': { - if (!edit.undo) break; - memcpy(glyph(edit.index), edit.undo, header.glyph.size); - } - } -} - -enum { PreviewRows = 8, PreviewCols = 64 }; -static struct { - uint32_t glyphs[PreviewRows * PreviewCols]; - uint32_t index; -} preview; - -static void drawPreview(void) { - for (uint32_t i = 0; i < PreviewRows * PreviewCols; ++i) { - drawGlyph( - header.glyph.width * (i % PreviewCols), - header.glyph.height * (i / PreviewCols), - 0, preview.glyphs[i], - -(i == preview.index), -(i == preview.index), 0, 0 - ); - } -} - -static void inputPreview(char ch) { - switch (ch) { - break; case Esc: mode = Normal; frameClear(); - break; case Del: { - if (preview.index) preview.index--; - preview.glyphs[preview.index] = 0; - } - break; case LF: { - uint32_t tail = PreviewCols - (preview.index % PreviewCols); - memset( - &preview.glyphs[preview.index], - 0, sizeof(preview.glyphs[0]) * tail - ); - preview.index += tail; - } - break; default: preview.glyphs[preview.index++] = ch; - } - preview.index %= PreviewRows * PreviewCols; -} - -static void drawDiscard(void) { - printf("discard modifications? "); - fflush(stdout); -} - -static void inputDiscard(char ch) { - printf("%c\n", ch); - if (ch == 'Y' || ch == 'y') exit(EX_OK); - mode = Normal; -} - -static void draw(void) { - switch (mode) { - break; case Normal: drawNormal(); - break; case Edit: drawEdit(); - break; case Preview: drawPreview(); - break; case Discard: drawDiscard(); - } -} - -static void input(char ch) { - switch (mode) { - break; case Normal: inputNormal(ch); - break; case Edit: inputEdit(ch); - break; case Preview: inputPreview(ch); - break; case Discard: inputDiscard(ch); - } -} - -static struct termios saveTerm; -static void restoreTerm(void) { - tcsetattr(STDIN_FILENO, TCSADRAIN, &saveTerm); -} - -int main(int argc, char *argv[]) { - setlocale(LC_CTYPE, ""); - - uint32_t newLen = 256; - uint32_t newWidth = 8; - uint32_t newHeight = 16; - uint32_t setHeight = 0; - - int opt; - while (0 < (opt = getopt(argc, argv, "H:g:h:w:"))) { - switch (opt) { - break; case 'H': setHeight = strtoul(optarg, NULL, 0); - break; case 'g': newLen = strtoul(optarg, NULL, 0); - break; case 'h': newHeight = strtoul(optarg, NULL, 0); - break; case 'w': newWidth = strtoul(optarg, NULL, 0); - break; default: return EX_USAGE; - } - } - if (!newLen || !newWidth || !newHeight) return EX_USAGE; - if (optind == argc) return EX_USAGE; - - path = strdup(argv[optind]); - fileRead(newLen, newWidth, newHeight); - - if (setHeight) { - if (setHeight < header.glyph.height) { - errx(EX_CONFIG, "cannot decrease height"); - } - - uint32_t setSize = bytes(header.glyph.width) * setHeight; - uint8_t *setGlyphs = calloc(header.glyph.len, setSize); - for (uint32_t i = 0; i < header.glyph.len; ++i) { - memcpy(&setGlyphs[setSize * i], glyph(i), header.glyph.size); - } - free(glyphs); - glyphs = setGlyphs; - - header.glyph.height = setHeight; - header.glyph.size = setSize; - normal.modified = true; - } - - frameOpen(); - frameClear(); - - int error = tcgetattr(STDIN_FILENO, &saveTerm); - if (error) err(EX_IOERR, "tcgetattr"); - atexit(restoreTerm); - - struct termios term = saveTerm; - term.c_lflag &= ~(ICANON | ECHO); - error = tcsetattr(STDIN_FILENO, TCSADRAIN, &term); - if (error) err(EX_IOERR, "tcsetattr"); - - for (;;) { - draw(); - char ch; - ssize_t size = read(STDIN_FILENO, &ch, 1); - if (size < 0) err(EX_IOERR, "read"); - if (!size) return EX_SOFTWARE; - input(ch); - } -} diff --git a/bin/ptee.c b/bin/ptee.c index 6a9a16b4..52350a21 100644 --- a/bin/ptee.c +++ b/bin/ptee.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2019 C. McEnroe <june@causal.agency> +/* Copyright (C) 2019 June McEnroe <june@causal.agency> * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by @@ -15,11 +15,14 @@ */ #include <err.h> +#include <errno.h> #include <poll.h> +#include <signal.h> #include <stdbool.h> #include <stdio.h> #include <stdlib.h> #include <sys/ioctl.h> +#include <sys/time.h> #include <sys/wait.h> #include <sysexits.h> #include <termios.h> @@ -40,8 +43,22 @@ static void restoreTerm(void) { tcsetattr(STDIN_FILENO, TCSADRAIN, &saveTerm); } +static void handler(int sig) { + (void)sig; +} + int main(int argc, char *argv[]) { - if (argc < 2) return EX_USAGE; + int timer = 0; + for (int opt; 0 < (opt = getopt(argc, argv, "t:"));) { + switch (opt) { + break; case 't': timer = atoi(optarg); + break; default: return EX_USAGE; + } + } + argc -= optind; + argv += optind; + + if (argc < 1) return EX_USAGE; if (isatty(STDOUT_FILENO)) errx(EX_USAGE, "stdout is not redirected"); int error = tcgetattr(STDIN_FILENO, &saveTerm); @@ -62,10 +79,21 @@ int main(int argc, char *argv[]) { if (pid < 0) err(EX_OSERR, "forkpty"); if (!pid) { - execvp(argv[1], &argv[1]); - err(EX_NOINPUT, "%s", argv[1]); + execvp(argv[0], argv); + err(EX_NOINPUT, "%s", argv[0]); + } + + if (timer) { + signal(SIGALRM, handler); + struct timeval tv = { + .tv_sec = timer / 1000, + .tv_usec = timer % 1000 * 1000, + }; + struct itimerval itv = { tv, tv }; + setitimer(ITIMER_REAL, &itv, NULL); } + char mc[] = "\x1B[10i"; bool stop = false; byte buf[4096]; @@ -73,19 +101,27 @@ int main(int argc, char *argv[]) { { .events = POLLIN, .fd = STDIN_FILENO }, { .events = POLLIN, .fd = pty }, }; - while (0 < poll(fds, 2, -1)) { + for (;;) { + int nfds = poll(fds, 2, -1); + if (nfds < 0 && errno != EINTR) err(EX_IOERR, "poll"); + + if (nfds < 0) { + ssize_t wlen = write(STDOUT_FILENO, mc, sizeof(mc) - 1); + if (wlen < 0) err(EX_IOERR, "write"); + continue; + } + if (fds[0].revents & POLLIN) { ssize_t rlen = read(STDIN_FILENO, buf, sizeof(buf)); if (rlen < 0) err(EX_IOERR, "read"); - if (rlen == 1 && buf[0] == CTRL('S')) { + if (rlen == 1 && buf[0] == CTRL('Q')) { stop ^= true; continue; } - if (rlen == 1 && buf[0] == CTRL('Q')) { - char dump[] = "\x1B[10i"; - ssize_t wlen = write(STDOUT_FILENO, dump, sizeof(dump) - 1); + if (rlen == 1 && buf[0] == CTRL('S')) { + ssize_t wlen = write(STDOUT_FILENO, mc, sizeof(mc) - 1); if (wlen < 0) err(EX_IOERR, "write"); continue; } @@ -112,5 +148,4 @@ int main(int argc, char *argv[]) { if (dead < 0) err(EX_OSERR, "waitpid"); if (dead) return WIFEXITED(status) ? WEXITSTATUS(status) : EX_SOFTWARE; } - err(EX_IOERR, "poll"); } diff --git a/bin/qf.c b/bin/qf.c new file mode 100644 index 00000000..1fbf48b9 --- /dev/null +++ b/bin/qf.c @@ -0,0 +1,294 @@ +/* Copyright (C) 2022 June McEnroe <june@causal.agency> + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +#include <ctype.h> +#include <curses.h> +#include <err.h> +#include <fcntl.h> +#include <poll.h> +#include <regex.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <sys/wait.h> +#include <sysexits.h> +#include <unistd.h> + +enum Type { + File, + Match, + Context, + Text, +}; + +struct Line { + enum Type type; + char *path; + unsigned nr; + char *text; + regmatch_t match; +}; + +static struct { + struct Line *ptr; + size_t len, cap; +} lines; + +static void push(struct Line line) { + if (lines.len == lines.cap) { + lines.cap = (lines.cap ? lines.cap * 2 : 256); + lines.ptr = realloc(lines.ptr, sizeof(*lines.ptr) * lines.cap); + if (!lines.ptr) err(EX_OSERR, "realloc"); + } + lines.ptr[lines.len++] = line; +} + +static const char *pattern; +static regex_t regex; + +static void parse(struct Line line) { + line.path = strsep(&line.text, ":"); + if (!line.text) { + line.type = Text; + line.text = line.path; + if (lines.len) line.path = lines.ptr[lines.len-1].path; + push(line); + return; + } + char *rest; + line.nr = strtoul(line.text, &rest, 10); + struct Line prev = {0}; + if (lines.len) prev = lines.ptr[lines.len-1]; + if (!prev.path || strcmp(line.path, prev.path)) { + if (lines.len) push((struct Line) { .type = Text, .text = " " }); + line.type = File; + push(line); + } + if (rest > line.text && rest[0] == ':') { + line.type = Match; + line.text = &rest[1]; + } else if (rest > line.text && rest[0] == '-') { + line.type = Context; + line.text = &rest[1]; + } else { + line.type = Text; + } + if (line.type == Match && pattern) { + regexec(®ex, line.text, 1, &line.match, 0); + } + push(line); +} + +enum { + Path = 1, + Number = 2, + Highlight = 3, +}; + +static void curse(void) { + set_term(newterm(NULL, stdout, stderr)); + cbreak(); + noecho(); + nodelay(stdscr, true); + TABSIZE = 4; + curs_set(0); + start_color(); + use_default_colors(); + init_pair(Path, COLOR_GREEN, -1); + init_pair(Number, COLOR_YELLOW, -1); + init_pair(Highlight, COLOR_MAGENTA, -1); +} + +static size_t top; +static size_t cur; +static bool reading = true; + +static void draw(void) { + int y = 0, x = 0; + for (int i = 0; i < LINES; ++i) { + move(i, 0); + clrtoeol(); + if (top + i >= lines.len) { + addstr(reading ? "..." : !lines.len ? "No results" : ""); + break; + } + struct Line line = lines.ptr[top + i]; + if (top + i == cur) { + getyx(stdscr, y, x); + attron(A_REVERSE); + } else { + attroff(A_REVERSE); + } + switch (line.type) { + break; case File: { + color_set(Path, NULL); + addstr(line.path); + color_set(0, NULL); + } + break; case Match: { + color_set(Number, NULL); + printw("%u", line.nr); + color_set(0, NULL); + addch(':'); + if (line.match.rm_so == line.match.rm_eo) { + addstr(line.text); + break; + } + addnstr(line.text, line.match.rm_so); + color_set(Highlight, NULL); + addnstr( + &line.text[line.match.rm_so], + line.match.rm_eo - line.match.rm_so + ); + color_set(0, NULL); + addstr(&line.text[line.match.rm_eo]); + } + break; case Context: { + color_set(Number, NULL); + printw("%u", line.nr); + color_set(0, NULL); + addch('-'); + addstr(line.text); + } + break; case Text: addstr(line.text); + } + } + move(y, x); + refresh(); +} + +static void edit(struct Line line) { + char cmd[32]; + snprintf(cmd, sizeof(cmd), "+%u", (line.nr ? line.nr : 1)); + const char *editor = getenv("EDITOR"); + if (!editor) editor = "vi"; + pid_t pid = fork(); + if (pid < 0) err(EX_OSERR, "fork"); + if (!pid) { + dup2(STDERR_FILENO, STDIN_FILENO); + execlp(editor, editor, cmd, line.path, NULL); + err(EX_CONFIG, "%s", editor); + } + int status; + pid = waitpid(pid, &status, 0); + if (pid < 0) err(EX_OSERR, "waitpid"); +} + +static void toPrev(enum Type type) { + if (!cur) return; + size_t prev = cur - 1; + while (prev && lines.ptr[prev].type != type) { + prev--; + } + if (lines.ptr[prev].type == type) { + cur = prev; + } +} + +static void toNext(enum Type type) { + size_t next = cur + 1; + while (next < lines.len && lines.ptr[next].type != type) { + next++; + } + if (next < lines.len && lines.ptr[next].type == type) { + cur = next; + } +} + +static void input(void) { + char ch; + while (ERR != (ch = getch())) { + switch (ch) { + break; case '\n': { + if (lines.ptr[cur].type == Text) break; + endwin(); + edit(lines.ptr[cur]); + refresh(); + } + break; case '{': toPrev(File); + break; case '}': toNext(File); + break; case 'G': cur = lines.len - 1; + break; case 'N': toPrev(Match); + break; case 'g': cur = 0; + break; case 'j': if (cur + 1 < lines.len) cur++; + break; case 'k': if (cur) cur--; + break; case 'n': toNext(Match); + break; case 'q': { + endwin(); + exit(EX_OK); + } + break; case 'r': clearok(stdscr, true); + } + } + if (cur < top) top = cur; + if (cur >= top + LINES) top = cur - LINES + 1; +} + +int main(int argc, char *argv[]) { + if (isatty(STDIN_FILENO)) errx(EX_USAGE, "no input"); + if (argc > 1) { + pattern = argv[1]; + int flags = REG_EXTENDED | REG_ICASE; + for (const char *ch = pattern; *ch; ++ch) { + if (isupper(*ch)) { + flags &= ~REG_ICASE; + break; + } + } + int error = regcomp(®ex, pattern, flags); + if (error) errx(EX_USAGE, "invalid pattern"); + } + curse(); + draw(); + struct pollfd fds[2] = { + { .fd = STDERR_FILENO, .events = POLLIN }, + { .fd = STDIN_FILENO, .events = POLLIN }, + }; + size_t len = 0; + size_t cap = 4096; + char *buf = malloc(cap); + if (!buf) err(EX_OSERR, "malloc"); + while (poll(fds, (reading ? 2 : 1), -1)) { + if (fds[0].revents) { + input(); + } + if (reading && fds[1].revents) { + ssize_t n = read(fds[1].fd, &buf[len], cap - len); + if (n < 0) err(EX_IOERR, "read"); + if (!n) reading = false; + len += n; + char *ptr = buf; + for ( + char *nl; + (nl = memchr(ptr, '\n', &buf[len] - ptr)); + ptr = &nl[1] + ) { + struct Line line = { .text = strndup(ptr, nl - ptr) }; + if (!line.text) err(EX_OSERR, "strndup"); + parse(line); + } + len -= ptr - buf; + memmove(buf, ptr, len); + if (len == cap) { + cap *= 2; + buf = realloc(buf, cap); + if (!buf) err(EX_OSERR, "realloc"); + } + } + draw(); + } + err(EX_IOERR, "poll"); +} diff --git a/bin/quick.c b/bin/quick.c new file mode 100644 index 00000000..d814873d --- /dev/null +++ b/bin/quick.c @@ -0,0 +1,163 @@ +/* Copyright (C) 2021 June McEnroe <june@causal.agency> + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +#include <arpa/inet.h> +#include <err.h> +#include <fcntl.h> +#include <netdb.h> +#include <netinet/in.h> +#include <poll.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <strings.h> +#include <sys/socket.h> +#include <sys/wait.h> +#include <sysexits.h> +#include <unistd.h> + +static void request(int sock, char *argv[]) { + struct pollfd pfd = { .fd = sock, .events = POLLIN }; + int nfds = poll(&pfd, 1, -1); + if (nfds < 0) err(EX_OSERR, "poll"); + + char buf[4096]; + ssize_t len = recv(sock, buf, sizeof(buf)-1, MSG_PEEK); + if (len < 0) { + warn("recv"); + return; + } + char *blank = memmem(buf, len, "\r\n\r\n", 4); + if (!blank) { + warnx("can't find end of request headers in peek"); + return; + } + len = recv(sock, buf, &blank[4] - buf, 0); + if (len < 0) { + warn("recv"); + return; + } + buf[len] = '\0'; + + char *ptr = buf; + char *req = strsep(&ptr, "\r\n"); + char *method = strsep(&req, " "); + char *query = strsep(&req, " "); + char *path = strsep(&query, "?"); + char *proto = strsep(&req, " "); + if (!method || !path || !proto) { + warnx("invalid request line"); + return; + } + setenv("REQUEST_METHOD", method, 1); + setenv("PATH_INFO", path, 1); + setenv("QUERY_STRING", (query ? query : ""), 1); + setenv("SERVER_PROTOCOL", proto, 1); + + unsetenv("CONTENT_TYPE"); + unsetenv("CONTENT_LENGTH"); + unsetenv("HTTP_HOST"); + while (ptr) { + char *value = strsep(&ptr, "\r\n"); + if (!value[0]) continue; + char *header = strsep(&value, ":"); + if (!header || !value++) { + warnx("invalid header"); + return; + } + if (!strcasecmp(header, "Content-Type")) { + setenv("CONTENT_TYPE", value, 1); + } else if (!strcasecmp(header, "Content-Length")) { + setenv("CONTENT_LENGTH", value, 1); + } else if (!strcasecmp(header, "Host")) { + setenv("HTTP_HOST", value, 1); + } + } + + dprintf(sock, "HTTP/1.1 200 OK\nConnection: close\n"); + pid_t pid = fork(); + if (pid < 0) err(EX_OSERR, "fork"); + if (!pid) { + dup2(sock, STDIN_FILENO); + dup2(sock, STDOUT_FILENO); + execv(argv[0], argv); + warn("%s", argv[0]); + _exit(127); + } + + int status; + pid = wait(&status); + if (pid < 0) err(EX_OSERR, "wait"); + if (WIFEXITED(status) && WEXITSTATUS(status)) { + warnx("%s exited %d", argv[0], WEXITSTATUS(status)); + } else if (WIFSIGNALED(status)) { + warnx("%s killed %d", argv[0], WTERMSIG(status)); + } +} + +int main(int argc, char *argv[]) { + short port = 0; + for (int opt; 0 < (opt = getopt(argc, argv, "p:"));) { + switch (opt) { + break; case 'p': port = atoi(optarg); + break; default: return EX_USAGE; + } + } + if (optind == argc) errx(EX_USAGE, "script required"); + + int server = socket(AF_INET, SOCK_STREAM, 0); + if (server < 0) err(EX_OSERR, "socket"); + fcntl(server, F_SETFD, FD_CLOEXEC); + + int on = 1; + setsockopt(server, SOL_SOCKET, SO_REUSEADDR, &on, sizeof(on)); + + struct sockaddr_in addr = { + .sin_family = AF_INET, + .sin_port = htons(port), + .sin_addr.s_addr = htonl(INADDR_LOOPBACK), + }; + socklen_t addrlen = sizeof(addr); + int error = 0 + || bind(server, (struct sockaddr *)&addr, addrlen) + || getsockname(server, (struct sockaddr *)&addr, &addrlen) + || listen(server, -1); + if (error) err(EX_UNAVAILABLE, "%hd", port); + + char host[NI_MAXHOST], serv[NI_MAXSERV]; + error = getnameinfo( + (struct sockaddr *)&addr, addrlen, + host, sizeof(host), serv, sizeof(serv), + NI_NOFQDN | NI_NUMERICSERV + ); + if (error) errx(EX_UNAVAILABLE, "getnameinfo: %s", gai_strerror(error)); + printf("http://%s:%s/\n", host, serv); + fflush(stdout); + + setenv("SERVER_SOFTWARE", "quick (and dirty)", 1); + setenv("GATEWAY_INTERFACE", "CGI/1.1", 1); + setenv("SERVER_NAME", host, 1); + setenv("SERVER_PORT", serv, 1); + setenv("REMOTE_ADDR", "127.0.0.1", 1); + setenv("REMOTE_HOST", host, 1); + setenv("SCRIPT_NAME", "/", 1); + + for (int sock; 0 <= (sock = accept(server, NULL, NULL)); close(sock)) { + fcntl(sock, F_SETFD, FD_CLOEXEC); + request(sock, &argv[optind]); + } + err(EX_IOERR, "accept"); +} diff --git a/bin/relay.c b/bin/relay.c index aa7913c9..fd799462 100644 --- a/bin/relay.c +++ b/bin/relay.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2019 C. McEnroe <june@causal.agency> +/* Copyright (C) 2019 June McEnroe <june@causal.agency> * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by diff --git a/bin/scheme.c b/bin/scheme.c index 396512c4..2bae8f82 100644 --- a/bin/scheme.c +++ b/bin/scheme.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2018, 2019 C. McEnroe <june@causal.agency> +/* Copyright (C) 2018, 2019 June McEnroe <june@causal.agency> * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by @@ -92,7 +92,7 @@ static void generate(void) { light[White] = x(R, +45.0, 0.3, 0.8); dark[Black] = x(light[Black], 0.0, 1.0, 0.3); - dark[White] = x(light[White], 0.0, 1.0, 0.7); + dark[White] = x(light[White], 0.0, 1.0, 0.75); for (uint i = Red; i < White; ++i) { dark[i] = x(light[i], 0.0, 1.0, 0.8); } @@ -156,6 +156,27 @@ static void outputEnum(const struct HSV *hsv, uint len) { printf("};\n"); } +#define FORMAT_X "rgb:%02hhX/%02hhX/%02hhX" + +static const char *Resources[SchemeLen] = { + [Background] = "background", + [Foreground] = "foreground", + [Bold] = "colorBD", + [Selection] = "highlightColor", + [Cursor] = "cursorColor", +}; + +static void outputXTerm(const struct HSV *hsv, uint len) { + for (uint i = 0; i < len; ++i) { + struct RGB rgb = convert(hsv[i]); + if (Resources[i]) { + printf("XTerm*%s: " FORMAT_X "\n", Resources[i], rgb.r, rgb.g, rgb.b); + } else { + printf("XTerm*color%u: " FORMAT_X "\n", i, rgb.r, rgb.g, rgb.b); + } + } +} + static const char *Mintty[SchemeLen] = { "Black", "Red", "Green", "Yellow", "Blue", "Magenta", "Cyan", "White", @@ -175,13 +196,17 @@ static void outputMintty(const struct HSV *hsv, uint len) { } static void outputCSS(const struct HSV *hsv, uint len) { + printf(":root {\n"); for (uint i = 0; i < len; ++i) { struct RGB rgb = convert(hsv[i]); + printf("\t--ansi%u: #" FORMAT_RGB ";\n", i, rgb.r, rgb.g, rgb.b); + } + printf("}\n"); + for (uint i = 0; i < len; ++i) { printf( - ".fg%u { color: #" FORMAT_RGB "; }\n" - ".bg%u { background-color: #" FORMAT_RGB "; }\n", - i, rgb.r, rgb.g, rgb.b, - i, rgb.r, rgb.g, rgb.b + ".fg%u { color: var(--ansi%u); }\n" + ".bg%u { background-color: var(--ansi%u); }\n", + i, i, i, i ); } } @@ -226,8 +251,9 @@ int main(int argc, char *argv[]) { uint len = 16; int opt; - while (0 < (opt = getopt(argc, argv, "acghilmp:stx"))) { + while (0 < (opt = getopt(argc, argv, "Xacghilmp:stx"))) { switch (opt) { + break; case 'X': output = outputXTerm; break; case 'a': len = 16; break; case 'c': output = outputEnum; break; case 'g': output = outputPNG; diff --git a/bin/sh.l b/bin/sh.l new file mode 100644 index 00000000..8f0f7723 --- /dev/null +++ b/bin/sh.l @@ -0,0 +1,181 @@ +/* Copyright (C) 2021 June McEnroe <june@causal.agency> + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +%option prefix="sh" +%option noinput nounput noyywrap + +%{ +#include <assert.h> +#include <stdbool.h> +#include <string.h> +#include "hilex.h" + +enum { Cap = 64 }; +static int len = 1; +static int stack[Cap]; +static int push(int val) { + if (len < Cap) stack[len++] = val; + return val; +} +static int pop(void) { + if (len > 1) len--; + return stack[len-1]; +} +%} + +%s Param Command Arith Backtick Subshell +%x DQuote HereDocDel HereDoc HereDocLit + +word [[:alnum:]_.-]+ +param [^:=?+%#{}-]+ +reserved [!{}]|else|do|elif|for|done|fi|then|until|while|if|case|esac + +%% + static bool first; + static char *delimiter; + +[[:blank:]]+ { return Normal; } + +"\\". { return Escape; } + +<INITIAL,DQuote,HereDoc,Param,Command,Arith,Subshell>{ + "$"[*@#?$!0-9-] | + "$"[_[:alpha:][_[:alnum:]]* | + "${"[#]?{param}"}" { + return Subst; + } + "${"{param} { + BEGIN(push(Param)); + return Subst; + } + "$(" { + BEGIN(push(Command)); + return Subst; + } + "$((" { + BEGIN(push(Arith)); + return Subst; + } + "`" { + BEGIN(push(Backtick)); + return Subst; + } + "(" { + BEGIN(push(Subshell)); + return Normal; + } +} +<Param>"}" | +<Command>")" | +<Arith>"))" | +<Backtick>"`" { + BEGIN(pop()); + return Subst; +} +<Subshell>")" { + BEGIN(pop()); + return Normal; +} + +"\n" { + first = true; + return Normal; +} +[&();|]|"&&"|";;"|"||" { + first = true; + return Operator; +} +[0-9]?([<>]"&"?|">|"|">>"|"<>") { + return Operator; +} + +{reserved} { + if (first) { + first = false; + return Keyword; + } + return Normal; +} + +{word}/[[:blank:]]*"()" { return Ident; } + +[0-9]?("<<"|"<<-") { + BEGIN(push(HereDocDel)); + return Operator; +} +<HereDocDel>{ + [[:blank:]]+ { return Normal; } + {word} { + delimiter = strdup(yytext); + assert(delimiter); + BEGIN(pop(), push(HereDoc)); + return Ident; + } + "'"{word}"'" { + delimiter = strndup(&yytext[1], strlen(yytext)-2); + assert(delimiter); + BEGIN(pop(), push(HereDocLit)); + return Ident; + } +} +<HereDoc,HereDocLit>{ + ^"\t"*{word} { + if (strcmp(&yytext[strspn(yytext, "\t")], delimiter)) REJECT; + free(delimiter); + BEGIN(pop()); + return Ident; + } +} +<HereDoc>{ + [^$`\n]+ { return String; } + .|\n { return String; } +} +<HereDocLit>{ + .*\n { return String; } +} + +"'"[^'']*"'" { return String; } + +"\""/[^$`\\] { + BEGIN(push(DQuote)); + yymore(); +} +"\"" { + BEGIN(push(DQuote)); + return String; +} + +<DQuote>{ + [^\\$`""]*"\"" { + BEGIN(pop()); + return String; + } + "\\"[$`""\\\n] { return Escape; } + [^\\$`""]+|. { return String; } +} + +<INITIAL,Command,Backtick,Arith>"#".* { return Comment; } + +{word} { + first = false; + return Normal; +} + +.|\n { return Normal; } + +%% + +const struct Lexer LexSh = { yylex, &yyin, &yytext }; diff --git a/bin/shotty.c b/bin/shotty.c deleted file mode 100644 index 83b00313..00000000 --- a/bin/shotty.c +++ /dev/null @@ -1,648 +0,0 @@ -/* Copyright (C) 2019 C. McEnroe <june@causal.agency> - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -#include <assert.h> -#include <err.h> -#include <locale.h> -#include <stdbool.h> -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <sys/ioctl.h> -#include <sysexits.h> -#include <unistd.h> -#include <wchar.h> - -#define BIT(x) x##Bit, x = 1 << x##Bit, x##Bit_ = x##Bit - -typedef unsigned uint; - -enum { - NUL, SOH, STX, ETX, EOT, ENQ, ACK, BEL, - BS, HT, NL, VT, NP, CR, SO, SI, - DLE, DC1, DC2, DC3, DC4, NAK, SYN, ETB, - CAN, EM, SUB, ESC, FS, GS, RS, US, - DEL = 0x7F, -}; - -enum Attr { - BIT(Bold), - BIT(Dim), - BIT(Italic), - BIT(Underline), - BIT(Blink), - BIT(Reverse), -}; - -struct Style { - enum Attr attr; - int bg, fg; -}; - -struct Cell { - struct Style style; - wchar_t ch; -}; - -static uint rows = 24, cols = 80; -static struct Cell *cells; - -static struct Cell *cell(uint y, uint x) { - assert(y <= rows); - assert(x <= cols); - assert(y * cols + x <= rows * cols); - return &cells[y * cols + x]; -} - -static uint y, x; -static struct Style style = { .bg = -1, .fg = -1 }; - -static struct { - uint y, x; -} save; - -enum { ParamCap = 16 }; -static struct { - uint s[ParamCap]; - uint n, i; -} param; - -static uint p(uint i, uint z) { - return (i < param.n ? param.s[i] : z); -} - -static uint min(uint a, uint b) { - return (a < b ? a : b); -} - -#define _ch ch __attribute__((unused)) -typedef void Action(wchar_t ch); - -static void nop(wchar_t _ch) { -} - -static void csi(wchar_t _ch) { - memset(¶m, 0, sizeof(param)); -} - -static void csiSep(wchar_t _ch) { - if (param.n == ParamCap) return; - if (!param.n) param.n++; - param.n++; - param.i++; -} - -static void csiDigit(wchar_t ch) { - param.s[param.i] *= 10; - param.s[param.i] += ch - L'0'; - if (!param.n) param.n++; -} - -static void bs(wchar_t _ch) { if (x) x--; } -static void ht(wchar_t _ch) { x = min(x - x % 8 + 8, cols - 1); } -static void cr(wchar_t _ch) { x = 0; } -static void cuu(wchar_t _ch) { y -= min(p(0, 1), y); } -static void cud(wchar_t _ch) { y = min(y + p(0, 1), rows - 1); } -static void cuf(wchar_t _ch) { x = min(x + p(0, 1), cols - 1); } -static void cub(wchar_t _ch) { x -= min(p(0, 1), x); } -static void cnl(wchar_t _ch) { x = 0; cud(0); } -static void cpl(wchar_t _ch) { x = 0; cuu(0); } -static void cha(wchar_t _ch) { x = min(p(0, 1) - 1, cols - 1); } -static void vpa(wchar_t _ch) { y = min(p(0, 1) - 1, rows - 1); } -static void cup(wchar_t _ch) { - y = min(p(0, 1) - 1, rows - 1); - x = min(p(1, 1) - 1, cols - 1); -} -static void decsc(wchar_t _ch) { - save.y = y; - save.x = x; -} -static void decrc(wchar_t _ch) { - y = save.y; - x = save.x; -} - -static void move(struct Cell *dst, struct Cell *src, size_t len) { - memmove(dst, src, sizeof(*dst) * len); -} - -static void erase(struct Cell *at, struct Cell *to) { - for (; at < to; ++at) { - at->style = style; - at->ch = L' '; - } -} - -static void ed(wchar_t _ch) { - erase( - (p(0, 0) == 0 ? cell(y, x) : cell(0, 0)), - (p(0, 0) == 1 ? cell(y, x) : cell(rows - 1, cols)) - ); -} -static void el(wchar_t _ch) { - erase( - (p(0, 0) == 0 ? cell(y, x) : cell(y, 0)), - (p(0, 0) == 1 ? cell(y, x) : cell(y, cols)) - ); -} -static void ech(wchar_t _ch) { - erase(cell(y, x), cell(y, min(x + p(0, 1), cols))); -} - -static void dch(wchar_t _ch) { - uint n = min(p(0, 1), cols - x); - move(cell(y, x), cell(y, x + n), cols - x - n); - erase(cell(y, cols - n), cell(y, cols)); -} -static void ich(wchar_t _ch) { - uint n = min(p(0, 1), cols - x); - move(cell(y, x + n), cell(y, x), cols - x - n); - erase(cell(y, x), cell(y, x + n)); -} - -static struct { - uint top, bot; -} scroll; - -static void scrollUp(uint top, uint n) { - n = min(n, scroll.bot - top); - move(cell(top, 0), cell(top + n, 0), cols * (scroll.bot - top - n)); - erase(cell(scroll.bot - n, 0), cell(scroll.bot, 0)); -} - -static void scrollDown(uint top, uint n) { - n = min(n, scroll.bot - top); - move(cell(top + n, 0), cell(top, 0), cols * (scroll.bot - top - n)); - erase(cell(top, 0), cell(top + n, 0)); -} - -static void decstbm(wchar_t _ch) { - scroll.bot = min(p(1, rows), rows); - scroll.top = min(p(0, 1) - 1, scroll.bot); -} - -static void su(wchar_t _ch) { scrollUp(scroll.top, p(0, 1)); } -static void sd(wchar_t _ch) { scrollDown(scroll.top, p(0, 1)); } -static void dl(wchar_t _ch) { scrollUp(min(y, scroll.bot), p(0, 1)); } -static void il(wchar_t _ch) { scrollDown(min(y, scroll.bot), p(0, 1)); } - -static void nl(wchar_t _ch) { - if (y + 1 == scroll.bot) { - scrollUp(scroll.top, 1); - } else { - y = min(y + 1, rows - 1); - } -} -static void ri(wchar_t _ch) { - if (y == scroll.top) { - scrollDown(scroll.top, 1); - } else { - if (y) y--; - } -} - -static enum Mode { - BIT(Insert), - BIT(Wrap), - BIT(Cursor), -} mode = Wrap | Cursor; - -static enum Mode paramMode(void) { - enum Mode mode = 0; - for (uint i = 0; i < param.n; ++i) { - switch (param.s[i]) { - break; case 4: mode |= Insert; - break; default: warnx("unhandled SM/RM %u", param.s[i]); - } - } - return mode; -} - -static enum Mode paramDECMode(void) { - enum Mode mode = 0; - for (uint i = 0; i < param.n; ++i) { - switch (param.s[i]) { - break; case 1: // DECCKM - break; case 7: mode |= Wrap; - break; case 12: // "Start Blinking Cursor" - break; case 25: mode |= Cursor; - break; default: { - if (param.s[i] < 1000) { - warnx("unhandled DECSET/DECRST %u", param.s[i]); - } - } - } - } - return mode; -} - -static void sm(wchar_t _ch) { mode |= paramMode(); } -static void rm(wchar_t _ch) { mode &= ~paramMode(); } -static void decset(wchar_t _ch) { mode |= paramDECMode(); } -static void decrst(wchar_t _ch) { mode &= ~paramDECMode(); } - -enum { - Reset, - SetBold, - SetDim, - SetItalic, - SetUnderline, - SetBlink, - SetReverse = 7, - - UnsetBoldDim = 22, - UnsetItalic, - UnsetUnderline, - UnsetBlink, - UnsetReverse = 27, - - SetFg0 = 30, - SetFg7 = 37, - SetFg, - ResetFg, - SetBg0 = 40, - SetBg7 = 47, - SetBg, - ResetBg, - - SetFg8 = 90, - SetFgF = 97, - SetBg8 = 100, - SetBgF = 107, - - Color256 = 5, -}; - -static void sgr(wchar_t _ch) { - uint n = param.i + 1; - for (uint i = 0; i < n; ++i) { - switch (param.s[i]) { - break; case Reset: style = (struct Style) { .bg = -1, .fg = -1 }; - - break; case SetBold: style.attr |= Bold; style.attr &= ~Dim; - break; case SetDim: style.attr |= Dim; style.attr &= ~Bold; - break; case SetItalic: style.attr |= Italic; - break; case SetUnderline: style.attr |= Underline; - break; case SetBlink: style.attr |= Blink; - break; case SetReverse: style.attr |= Reverse; - - break; case UnsetBoldDim: style.attr &= ~(Bold | Dim); - break; case UnsetItalic: style.attr &= ~Italic; - break; case UnsetUnderline: style.attr &= ~Underline; - break; case UnsetBlink: style.attr &= ~Blink; - break; case UnsetReverse: style.attr &= ~Reverse; - - break; case SetFg: { - if (++i < n && param.s[i] == Color256) { - if (++i < n) style.fg = param.s[i]; - } - } - break; case SetBg: { - if (++i < n && param.s[i] == Color256) { - if (++i < n) style.bg = param.s[i]; - } - } - - break; case ResetFg: style.fg = -1; - break; case ResetBg: style.bg = -1; - - break; default: { - uint p = param.s[i]; - if (p >= SetFg0 && p <= SetFg7) { - style.fg = p - SetFg0; - } else if (p >= SetBg0 && p <= SetBg7) { - style.bg = p - SetBg0; - } else if (p >= SetFg8 && p <= SetFgF) { - style.fg = 8 + p - SetFg8; - } else if (p >= SetBg8 && p <= SetBgF) { - style.bg = 8 + p - SetBg8; - } else { - warnx("unhandled SGR %u", p); - } - } - } - } -} - -static enum { - USASCII, - DECSpecial, -} charset; - -static void usascii(wchar_t _ch) { charset = USASCII; } -static void decSpecial(wchar_t _ch) { charset = DECSpecial; } - -static const wchar_t AltCharset[128] = { - ['`'] = L'◆', ['a'] = L'▒', ['f'] = L'°', ['g'] = L'±', ['i'] = L'␋', - ['j'] = L'┘', ['k'] = L'┐', ['l'] = L'┌', ['m'] = L'└', ['n'] = L'┼', - ['o'] = L'⎺', ['p'] = L'⎻', ['q'] = L'─', ['r'] = L'⎼', ['s'] = L'⎽', - ['t'] = L'├', ['u'] = L'┤', ['v'] = L'┴', ['w'] = L'┬', ['x'] = L'│', - ['y'] = L'≤', ['z'] = L'≥', ['{'] = L'π', ['|'] = L'≠', ['}'] = L'£', - ['~'] = L'·', -}; - -static void add(wchar_t ch) { - if (charset == DECSpecial && ch < 128 && AltCharset[ch]) { - ch = AltCharset[ch]; - } - - int width = wcwidth(ch); - if (width < 0) { - warnx("unhandled \\u%02X", ch); - return; - } - - if (mode & Insert) { - uint n = min(width, cols - x); - move(cell(y, x + n), cell(y, x), cols - x - n); - } - if (mode & Wrap && x + width > cols) { - cr(0); - nl(0); - } - - cell(y, x)->style = style; - cell(y, x)->ch = ch; - for (int i = 1; i < width && x + i < cols; ++i) { - cell(y, x + i)->style = style; - cell(y, x + i)->ch = L'\0'; - } - x = min(x + width, (mode & Wrap ? cols : cols - 1)); -} - -static void html(void); -static void mc(wchar_t _ch) { - if (p(0, 0) == 10) { - html(); - } else { - warnx("unhandled CSI %u MC", p(0, 0)); - } -} - -static enum { - Data, - Esc, - G0, - CSI, - CSILt, - CSIEq, - CSIGt, - CSIQm, - CSIInter, - OSC, - OSCEsc, -} state; - -static void escDefault(wchar_t ch) { - warnx("unhandled ESC %lc", ch); -} - -static void g0Default(wchar_t ch) { - warnx("unhandled G0 %lc", ch); - charset = USASCII; -} - -static void csiInter(wchar_t ch) { - switch (state) { - break; case CSI: warnx("unhandled CSI %lc ...", ch); - break; case CSILt: warnx("unhandled CSI < %lc ...", ch); - break; case CSIEq: warnx("unhandled CSI = %lc ...", ch); - break; case CSIGt: warnx("unhandled CSI > %lc ...", ch); - break; case CSIQm: warnx("unhandled CSI ? %lc ...", ch); - break; default: abort(); - } -} - -static void csiFinal(wchar_t ch) { - switch (state) { - break; case CSI: warnx("unhandled CSI %lc", ch); - break; case CSILt: warnx("unhandled CSI < %lc", ch); - break; case CSIEq: warnx("unhandled CSI = %lc", ch); - break; case CSIGt: warnx("unhandled CSI > %lc", ch); - break; case CSIQm: warnx("unhandled CSI ? %lc", ch); - break; case CSIInter: warnx("unhandled CSI ... %lc", ch); - break; default: abort(); - } -} - -#define S(s) break; case s: switch (ch) -#define A(c, a, s) break; case c: a(ch); state = s -#define D(a, s) break; default: a(ch); state = s -static void update(wchar_t ch) { - switch (state) { - default: abort(); - - S(Data) { - A(BEL, nop, Data); - A(BS, bs, Data); - A(HT, ht, Data); - A(NL, nl, Data); - A(CR, cr, Data); - A(ESC, nop, Esc); - D(add, Data); - } - - S(Esc) { - A('(', nop, G0); - A('7', decsc, Data); - A('8', decrc, Data); - A('=', nop, Data); - A('>', nop, Data); - A('M', ri, Data); - A('[', csi, CSI); - A(']', nop, OSC); - D(escDefault, Data); - } - S(G0) { - A('0', decSpecial, Data); - A('B', usascii, Data); - D(g0Default, Data); - } - - S(CSI) { - A(' ' ... '/', csiInter, CSIInter); - A('0' ... '9', csiDigit, CSI); - A(':', nop, CSI); - A(';', csiSep, CSI); - A('<', nop, CSILt); - A('=', nop, CSIEq); - A('>', nop, CSIGt); - A('?', nop, CSIQm); - A('@', ich, Data); - A('A', cuu, Data); - A('B', cud, Data); - A('C', cuf, Data); - A('D', cub, Data); - A('E', cnl, Data); - A('F', cpl, Data); - A('G', cha, Data); - A('H', cup, Data); - A('J', ed, Data); - A('K', el, Data); - A('L', il, Data); - A('M', dl, Data); - A('P', dch, Data); - A('S', su, Data); - A('T', sd, Data); - A('X', ech, Data); - A('d', vpa, Data); - A('h', sm, Data); - A('i', mc, Data); - A('l', rm, Data); - A('m', sgr, Data); - A('r', decstbm, Data); - A('t', nop, Data); - D(csiFinal, Data); - } - - S(CSILt ... CSIGt) { - A(' ' ... '/', csiInter, CSIInter); - A('0' ... '9', csiDigit, state); - A(':', nop, state); - A(';', csiSep, state); - D(csiFinal, Data); - } - - S(CSIQm) { - A(' ' ... '/', csiInter, CSIInter); - A('0' ... '9', csiDigit, CSIQm); - A(':', nop, CSIQm); - A(';', csiSep, CSIQm); - A('h', decset, Data); - A('l', decrst, Data); - D(csiFinal, Data); - } - - S(CSIInter) { - D(csiFinal, Data); - } - - S(OSC) { - A(BEL, nop, Data); - A(ESC, nop, OSCEsc); - D(nop, OSC); - } - S(OSCEsc) { - A('\\', nop, Data); - D(nop, OSC); - } - } -} - -static bool bright; -static int defaultBg = 0; -static int defaultFg = 7; - -static void span(const struct Style *prev, const struct Cell *cell) { - struct Style style = cell->style; - if (!prev || memcmp(prev, &style, sizeof(*prev))) { - if (prev) printf("</span>"); - if (style.bg < 0) style.bg = defaultBg; - if (style.fg < 0) style.fg = defaultFg; - if (bright && style.attr & Bold) { - if (style.fg < 8) style.fg += 8; - style.attr ^= Bold; - } - printf( - "<span style=\"%s%s%s\" class=\"bg%u fg%u\">", - (style.attr & Bold ? "font-weight:bold;" : ""), - (style.attr & Italic ? "font-style:italic;" : ""), - (style.attr & Underline ? "text-decoration:underline;" : ""), - (style.attr & Reverse ? style.fg : style.bg), - (style.attr & Reverse ? style.bg : style.fg) - ); - } - switch (cell->ch) { - break; case '&': printf("&"); - break; case '<': printf("<"); - break; case '>': printf(">"); - break; default: printf("%lc", (wint_t)cell->ch); - } -} - -static bool mediaCopy; -static void html(void) { - mediaCopy = true; - if (mode & Cursor) cell(y, x)->style.attr ^= Reverse; - printf( - "<pre style=\"width: %uch;\" class=\"bg%u fg%u\">", - cols, defaultBg, defaultFg - ); - for (uint y = 0; y < rows; ++y) { - for (uint x = 0; x < cols; ++x) { - if (!cell(y, x)->ch) continue; - span(x ? &cell(y, x - 1)->style : NULL, cell(y, x)); - } - printf("</span>\n"); - } - printf("</pre>\n"); - if (mode & Cursor) cell(y, x)->style.attr ^= Reverse; -} - -int main(int argc, char *argv[]) { - setlocale(LC_CTYPE, ""); - - bool debug = false; - bool size = false; - bool hide = false; - - int opt; - while (0 < (opt = getopt(argc, argv, "Bb:df:h:nsw:"))) { - switch (opt) { - break; case 'B': bright = true; - break; case 'b': defaultBg = strtol(optarg, NULL, 0); - break; case 'd': debug = true; - break; case 'f': defaultFg = strtol(optarg, NULL, 0); - break; case 'h': rows = strtoul(optarg, NULL, 0); - break; case 'n': hide = true; - break; case 's': size = true; - break; case 'w': cols = strtoul(optarg, NULL, 0); - break; default: return EX_USAGE; - } - } - - FILE *file = stdin; - if (optind < argc) { - file = fopen(argv[optind], "r"); - if (!file) err(EX_NOINPUT, "%s", argv[optind]); - } - - if (size) { - struct winsize window; - int error = ioctl(STDERR_FILENO, TIOCGWINSZ, &window); - if (error) err(EX_IOERR, "ioctl"); - rows = window.ws_row; - cols = window.ws_col; - } - scroll.bot = rows; - - cells = calloc(rows * cols, sizeof(*cells)); - if (!cells) err(EX_OSERR, "calloc"); - erase(cell(0, 0), cell(rows - 1, cols)); - - wint_t ch; - while (WEOF != (ch = getwc(file))) { - uint prev = state; - update(ch); - if (debug && state != prev && state == Data) html(); - } - if (ferror(file)) err(EX_IOERR, "getwc"); - - if (!mediaCopy) { - if (hide) mode &= ~Cursor; - html(); - } -} diff --git a/bin/shotty.l b/bin/shotty.l new file mode 100644 index 00000000..dcac43ec --- /dev/null +++ b/bin/shotty.l @@ -0,0 +1,597 @@ +/* Copyright (C) 2019, 2021 June McEnroe <june@causal.agency> + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +%option noinput nounput noyywrap + +%{ + +#include <assert.h> +#include <err.h> +#include <locale.h> +#include <stdbool.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <sys/ioctl.h> +#include <sysexits.h> +#include <unistd.h> +#include <wchar.h> + +#define Q(...) #__VA_ARGS__ +#define BIT(x) x##Bit, x = 1 << x##Bit, x##Bit_ = x##Bit + +#define ENUM_CODE \ + X(BS) \ + X(CHA) \ + X(CNL) \ + X(CPL) \ + X(CR) \ + X(CUB) \ + X(CUD) \ + X(CUF) \ + X(CUP) \ + X(CUU) \ + X(DCH) \ + X(DECRC) \ + X(DECRST) \ + X(DECSC) \ + X(DECSET) \ + X(DECSTBM) \ + X(DL) \ + X(ECH) \ + X(ED) \ + X(EL) \ + X(HT) \ + X(ICH) \ + X(IL) \ + X(MC) \ + X(NL) \ + X(RI) \ + X(RM) \ + X(SD) \ + X(SGR) \ + X(SM) \ + X(SU) \ + X(VPA) + +enum Code { + Data = 1, +#define X(code) code, + ENUM_CODE +#undef X +}; + +static enum { + USASCII, + DECSpecial, +} g0; + +static const wchar_t AltCharset[128] = { + ['`'] = L'\u25C6', ['a'] = L'\u2592', ['f'] = L'\u00B0', ['g'] = L'\u00B1', + ['i'] = L'\u240B', ['j'] = L'\u2518', ['k'] = L'\u2510', ['l'] = L'\u250C', + ['m'] = L'\u2514', ['n'] = L'\u253C', ['o'] = L'\u23BA', ['p'] = L'\u23BB', + ['q'] = L'\u2500', ['r'] = L'\u23BC', ['s'] = L'\u23BD', ['t'] = L'\u251C', + ['u'] = L'\u2524', ['v'] = L'\u2534', ['w'] = L'\u252C', ['x'] = L'\u2502', + ['y'] = L'\u2264', ['z'] = L'\u2265', ['{'] = L'\u03C0', ['|'] = L'\u2260', + ['}'] = L'\u00A3', ['~'] = L'\u00B7', +}; + +static int pn; +static int ps[16]; +static wchar_t ch; + +%} + +ESC \x1B + +%x CSI CSI_LT CSI_EQ CSI_GT CSI_QM +%x OSC + +%% + pn = 0; + +{ESC}"[" BEGIN(CSI); +{ESC}"[<" BEGIN(CSI_LT); +{ESC}"[=" BEGIN(CSI_EQ); +{ESC}"[>" BEGIN(CSI_GT); +{ESC}"[?" BEGIN(CSI_QM); +{ESC}"]" BEGIN(OSC); + +<CSI,CSI_LT,CSI_EQ,CSI_GT,CSI_QM>{ + [0-9]+;? if (pn < 16) ps[pn++] = atoi(yytext); + ; if (pn < 16) ps[pn++] = 0; +} + +<OSC>{ + \x07 BEGIN(0); + {ESC}\\ BEGIN(0); + .|\n ; +} + +\b return BS; +\t return HT; +\n return NL; +\r return CR; + +{ESC}7 return DECSC; +{ESC}8 return DECRC; +{ESC}= // DECKPAM +{ESC}> // DECKPNM +{ESC}M return RI; + +{ESC}"(0" g0 = DECSpecial; +{ESC}"(B" g0 = USASCII; + +<CSI>@ BEGIN(0); return ICH; +<CSI>A BEGIN(0); return CUU; +<CSI>B BEGIN(0); return CUD; +<CSI>C BEGIN(0); return CUF; +<CSI>D BEGIN(0); return CUB; +<CSI>E BEGIN(0); return CNL; +<CSI>F BEGIN(0); return CPL; +<CSI>G BEGIN(0); return CHA; +<CSI>H BEGIN(0); return CUP; +<CSI>J BEGIN(0); return ED; +<CSI>K BEGIN(0); return EL; +<CSI>L BEGIN(0); return IL; +<CSI>M BEGIN(0); return DL; +<CSI>P BEGIN(0); return DCH; +<CSI>S BEGIN(0); return SU; +<CSI>T BEGIN(0); return SD; +<CSI>X BEGIN(0); return ECH; +<CSI>d BEGIN(0); return VPA; +<CSI>h BEGIN(0); return SM; +<CSI>i BEGIN(0); return MC; +<CSI>l BEGIN(0); return RM; +<CSI>m BEGIN(0); return SGR; +<CSI>r BEGIN(0); return DECSTBM; +<CSI>t BEGIN(0); // XTWINOPS + +<CSI_QM>h BEGIN(0); return DECSET; +<CSI_QM>l BEGIN(0); return DECRST; + +<CSI>[ -/]*. BEGIN(0); warnx("unhandled CSI %s", yytext); +<CSI_LT>[ -/]*. BEGIN(0); warnx("unhandled CSI < %s", yytext); +<CSI_EQ>[ -/]*. BEGIN(0); warnx("unhandled CSI = %s", yytext); +<CSI_GT>[ -/]*. BEGIN(0); warnx("unhandled CSI > %s", yytext); +<CSI_QM>[ -/]*. BEGIN(0); warnx("unhandled CSI ? %s", yytext); + +[\x00-\x7F] { + ch = yytext[0]; + if (g0 == DECSpecial && AltCharset[ch]) { + ch = AltCharset[ch]; + } + return Data; +} +[\xC0-\xDF][\x80-\xBF] { + ch = (wchar_t)(yytext[0] & 0x1F) << 6 + | (wchar_t)(yytext[1] & 0x3F); + return Data; +} +[\xE0-\xEF]([\x80-\xBF]{2}) { + ch = (wchar_t)(yytext[0] & 0x0F) << 12 + | (wchar_t)(yytext[1] & 0x3F) << 6 + | (wchar_t)(yytext[2] & 0x3F); + return Data; +} +[\xF0-\xF7]([\x80-\xBF]{3}) { + ch = (wchar_t)(yytext[0] & 0x07) << 18 + | (wchar_t)(yytext[1] & 0x3F) << 12 + | (wchar_t)(yytext[2] & 0x3F) << 6 + | (wchar_t)(yytext[3] & 0x3F); + return Data; +} + +. ch = yytext[0]; return Data; + +%% + +static int rows = 24; +static int cols = 80; + +static struct Cell { + enum { + BIT(Bold), + BIT(Italic), + BIT(Underline), + BIT(Reverse), + } attr; + int bg, fg; + wchar_t ch; +} *cells; + +static int y, x; +static struct { + int y, x; +} sc; +static struct { + int top, bot; +} scr; + +static enum Mode { + BIT(Insert), + BIT(Wrap), + BIT(Cursor), +} mode = Wrap | Cursor; + +static struct Cell sgr = { + .bg = -1, + .fg = -1, + .ch = L' ', +}; + +static struct Cell *cell(int y, int x) { + assert(y <= rows); + assert(x <= cols); + assert(y * cols + x <= rows * cols); + return &cells[y * cols + x]; +} + +static int p(int i, int d) { + return (i < pn ? ps[i] : d); +} + +static int bound(int a, int x, int b) { + if (x < a) return a; + if (x > b) return b; + return x; +} + +static void move(struct Cell *dst, struct Cell *src, size_t len) { + memmove(dst, src, sizeof(*dst) * len); +} +static void erase(struct Cell *at, struct Cell *to) { + for (; at < to; ++at) { + *at = sgr; + } +} + +static void scrup(int top, int n) { + n = bound(0, n, scr.bot - top); + move(cell(top, 0), cell(top+n, 0), cols * (scr.bot-top-n)); + erase(cell(scr.bot-n, 0), cell(scr.bot, 0)); +} +static void scrdn(int top, int n) { + n = bound(0, n, scr.bot - top); + move(cell(top+n, 0), cell(top, 0), cols * (scr.bot-top-n)); + erase(cell(top, 0), cell(top+n, 0)); +} + +static enum Mode pmode(void) { + enum Mode mode = 0; + for (int i = 0; i < pn; ++i) { + switch (ps[i]) { + break; case 4: mode |= Insert; + break; default: warnx("unhandled SM/RM %d", ps[i]); + } + } + return mode; +} +static enum Mode pdmode(void) { + enum Mode mode = 0; + for (int i = 0; i < pn; ++i) { + switch (ps[i]) { + break; case 1: // DECCKM + break; case 7: mode |= Wrap; + break; case 12: // "Start Blinking Cursor" + break; case 25: mode |= Cursor; + break; default: { + if (ps[i] < 1000) warnx("unhandled DECSET/DECRST %d", ps[i]); + } + } + } + return mode; +} + +static void update(enum Code cc) { + switch (cc) { + break; case BS: x--; + break; case HT: x = x - x % 8 + 8; + break; case CR: x = 0; + break; case CUU: y -= p(0, 1); + break; case CUD: y += p(0, 1); + break; case CUF: x += p(0, 1); + break; case CUB: x -= p(0, 1); + break; case CNL: x = 0; y += p(0, 1); + break; case CPL: x = 0; y -= p(0, 1); + break; case CHA: x = p(0, 1) - 1; + break; case VPA: y = p(0, 1) - 1; + break; case CUP: y = p(0, 1) - 1; x = p(1, 1) - 1; + break; case DECSC: sc.y = y; sc.x = x; + break; case DECRC: y = sc.y; x = sc.x; + + break; case ED: erase( + (p(0, 0) == 0 ? cell(y, x) : cell(0, 0)), + (p(0, 0) == 1 ? cell(y, x) : cell(rows-1, cols)) + ); + break; case EL: erase( + (p(0, 0) == 0 ? cell(y, x) : cell(y, 0)), + (p(0, 0) == 1 ? cell(y, x) : cell(y, cols)) + ); + break; case ECH: erase( + cell(y, x), cell(y, bound(0, x + p(0, 1), cols)) + ); + + break; case DCH: { + int n = bound(0, p(0, 1), cols-x); + move(cell(y, x), cell(y, x+n), cols-x-n); + erase(cell(y, cols-n), cell(y, cols)); + } + break; case ICH: { + int n = bound(0, p(0, 1), cols-x); + move(cell(y, x+n), cell(y, x), cols-x-n); + erase(cell(y, x), cell(y, x+n)); + } + + break; case DECSTBM: { + scr.bot = bound(0, p(1, rows), rows); + scr.top = bound(0, p(0, 1) - 1, scr.bot); + } + break; case SU: scrup(scr.top, p(0, 1)); + break; case SD: scrdn(scr.top, p(0, 1)); + break; case DL: scrup(bound(0, y, scr.bot), p(0, 1)); + break; case IL: scrdn(bound(0, y, scr.bot), p(0, 1)); + + break; case NL: { + if (y+1 == scr.bot) { + scrup(scr.top, 1); + } else { + y++; + } + } + break; case RI: { + if (y == scr.top) { + scrdn(scr.top, 1); + } else { + y--; + } + } + + break; case SM: mode |= pmode(); + break; case RM: mode &= ~pmode(); + break; case DECSET: mode |= pdmode(); + break; case DECRST: mode &= ~pdmode(); + + break; case SGR: { + if (!pn) ps[pn++] = 0; + for (int i = 0; i < pn; ++i) { + switch (ps[i]) { + break; case 0: sgr.attr = 0; sgr.bg = -1; sgr.fg = -1; + break; case 1: sgr.attr |= Bold; + break; case 3: sgr.attr |= Italic; + break; case 4: sgr.attr |= Underline; + break; case 7: sgr.attr |= Reverse; + break; case 22: sgr.attr &= ~Bold; + break; case 23: sgr.attr &= ~Italic; + break; case 24: sgr.attr &= ~Underline; + break; case 27: sgr.attr &= ~Reverse; + break; case 30 ... 37: sgr.fg = ps[i] - 30; + break; case 38: { + if (++i < pn && ps[i] == 5) { + if (++i < pn) sgr.fg = ps[i]; + } + } + break; case 39: sgr.fg = -1; + break; case 40 ... 47: sgr.bg = ps[i] - 40; + break; case 48: { + if (++i < pn && ps[i] == 5) { + if (++i < pn) sgr.bg = ps[i]; + } + } + break; case 49: sgr.bg = -1; + break; case 90 ... 97: sgr.fg = 8 + ps[i] - 90; + break; case 100 ... 107: sgr.bg = 8 + ps[i] - 100; + break; default: warnx("unhandled SGR %d", ps[i]); + } + } + } + + break; case Data: { + int w = wcwidth(ch); + if (w < 0) { + warnx("unhandled \\u%04X", ch); + return; + } + if (mode & Insert) { + int n = bound(0, w, cols-x); + move(cell(y, x+n), cell(y, x), cols-x-n); + } + if (mode & Wrap && x+w > cols) { + update(CR); + update(NL); + } + *cell(y, x) = sgr; + cell(y, x)->ch = ch; + for (int i = 1; i < w && x+i < cols; ++i) { + *cell(y, x+i) = sgr; + cell(y, x+i)->ch = L'\0'; + } + x = bound(0, x+w, (mode & Wrap ? cols : cols-1)); + return; + } + break; case MC:; + } + + x = bound(0, x, cols-1); + y = bound(0, y, rows-1); +} + +static bool bright; +static bool colors; +static int defaultBg = 0; +static int defaultFg = 7; + +static const unsigned Palette[256] = { + 0x000000, 0xCD0000, 0x00CD00, 0xCDCD00, 0x0000EE, 0xCD00CD, 0x00CDCD, + 0xE5E5E5, 0x7F7F7F, 0xFF0000, 0x00FF00, 0xFFFF00, 0x5C5CFF, 0xFF00FF, + 0x00FFFF, 0xFFFFFF, 0x000000, 0x00005F, 0x000087, 0x0000AF, 0x0000D7, + 0x0000FF, 0x005F00, 0x005F5F, 0x005F87, 0x005FAF, 0x005FD7, 0x005FFF, + 0x008700, 0x00875F, 0x008787, 0x0087AF, 0x0087D7, 0x0087FF, 0x00AF00, + 0x00AF5F, 0x00AF87, 0x00AFAF, 0x00AFD7, 0x00AFFF, 0x00D700, 0x00D75F, + 0x00D787, 0x00D7AF, 0x00D7D7, 0x00D7FF, 0x00FF00, 0x00FF5F, 0x00FF87, + 0x00FFAF, 0x00FFD7, 0x00FFFF, 0x5F0000, 0x5F005F, 0x5F0087, 0x5F00AF, + 0x5F00D7, 0x5F00FF, 0x5F5F00, 0x5F5F5F, 0x5F5F87, 0x5F5FAF, 0x5F5FD7, + 0x5F5FFF, 0x5F8700, 0x5F875F, 0x5F8787, 0x5F87AF, 0x5F87D7, 0x5F87FF, + 0x5FAF00, 0x5FAF5F, 0x5FAF87, 0x5FAFAF, 0x5FAFD7, 0x5FAFFF, 0x5FD700, + 0x5FD75F, 0x5FD787, 0x5FD7AF, 0x5FD7D7, 0x5FD7FF, 0x5FFF00, 0x5FFF5F, + 0x5FFF87, 0x5FFFAF, 0x5FFFD7, 0x5FFFFF, 0x870000, 0x87005F, 0x870087, + 0x8700AF, 0x8700D7, 0x8700FF, 0x875F00, 0x875F5F, 0x875F87, 0x875FAF, + 0x875FD7, 0x875FFF, 0x878700, 0x87875F, 0x878787, 0x8787AF, 0x8787D7, + 0x8787FF, 0x87AF00, 0x87AF5F, 0x87AF87, 0x87AFAF, 0x87AFD7, 0x87AFFF, + 0x87D700, 0x87D75F, 0x87D787, 0x87D7AF, 0x87D7D7, 0x87D7FF, 0x87FF00, + 0x87FF5F, 0x87FF87, 0x87FFAF, 0x87FFD7, 0x87FFFF, 0xAF0000, 0xAF005F, + 0xAF0087, 0xAF00AF, 0xAF00D7, 0xAF00FF, 0xAF5F00, 0xAF5F5F, 0xAF5F87, + 0xAF5FAF, 0xAF5FD7, 0xAF5FFF, 0xAF8700, 0xAF875F, 0xAF8787, 0xAF87AF, + 0xAF87D7, 0xAF87FF, 0xAFAF00, 0xAFAF5F, 0xAFAF87, 0xAFAFAF, 0xAFAFD7, + 0xAFAFFF, 0xAFD700, 0xAFD75F, 0xAFD787, 0xAFD7AF, 0xAFD7D7, 0xAFD7FF, + 0xAFFF00, 0xAFFF5F, 0xAFFF87, 0xAFFFAF, 0xAFFFD7, 0xAFFFFF, 0xD70000, + 0xD7005F, 0xD70087, 0xD700AF, 0xD700D7, 0xD700FF, 0xD75F00, 0xD75F5F, + 0xD75F87, 0xD75FAF, 0xD75FD7, 0xD75FFF, 0xD78700, 0xD7875F, 0xD78787, + 0xD787AF, 0xD787D7, 0xD787FF, 0xD7AF00, 0xD7AF5F, 0xD7AF87, 0xD7AFAF, + 0xD7AFD7, 0xD7AFFF, 0xD7D700, 0xD7D75F, 0xD7D787, 0xD7D7AF, 0xD7D7D7, + 0xD7D7FF, 0xD7FF00, 0xD7FF5F, 0xD7FF87, 0xD7FFAF, 0xD7FFD7, 0xD7FFFF, + 0xFF0000, 0xFF005F, 0xFF0087, 0xFF00AF, 0xFF00D7, 0xFF00FF, 0xFF5F00, + 0xFF5F5F, 0xFF5F87, 0xFF5FAF, 0xFF5FD7, 0xFF5FFF, 0xFF8700, 0xFF875F, + 0xFF8787, 0xFF87AF, 0xFF87D7, 0xFF87FF, 0xFFAF00, 0xFFAF5F, 0xFFAF87, + 0xFFAFAF, 0xFFAFD7, 0xFFAFFF, 0xFFD700, 0xFFD75F, 0xFFD787, 0xFFD7AF, + 0xFFD7D7, 0xFFD7FF, 0xFFFF00, 0xFFFF5F, 0xFFFF87, 0xFFFFAF, 0xFFFFD7, + 0xFFFFFF, 0x080808, 0x121212, 0x1C1C1C, 0x262626, 0x303030, 0x3A3A3A, + 0x444444, 0x4E4E4E, 0x585858, 0x626262, 0x6C6C6C, 0x767676, 0x808080, + 0x8A8A8A, 0x949494, 0x9E9E9E, 0xA8A8A8, 0xB2B2B2, 0xBCBCBC, 0xC6C6C6, + 0xD0D0D0, 0xDADADA, 0xE4E4E4, 0xEEEEEE, +}; + +static void span(const struct Cell *prev, const struct Cell *cell) { + if ( + !prev || + cell->attr != prev->attr || + cell->bg != prev->bg || + cell->fg != prev->fg + ) { + if (prev) printf("</span>"); + int attr = cell->attr; + int bg = (attr & Reverse ? cell->fg : cell->bg); + int fg = (attr & Reverse ? cell->bg : cell->fg); + if (bg < 0) bg = (attr & Reverse ? defaultFg : defaultBg); + if (fg < 0) fg = (attr & Reverse ? defaultBg : defaultFg); + if (bright && cell->attr & Bold) { + if (fg < 8) fg += 8; + attr &= ~Bold; + } + printf(Q(<span class="bg%d fg%d"), bg, fg); + if (attr || colors) printf(" style=\""); + if (attr & Bold) printf("font-weight:bold;"); + if (attr & Italic) printf("font-style:italic;"); + if (attr & Underline) printf("text-decoration:underline;"); + if (colors && bg < 256 && fg < 256) { + printf( + "background-color:#%06X;color:#%06X;", + Palette[bg], Palette[fg] + ); + } + printf("%s>", (attr || colors ? "\"" : "")); + } + switch (cell->ch) { + break; case L'&': printf("&"); + break; case L'<': printf("<"); + break; case L'>': printf(">"); + break; case L'"': printf("""); + break; default: printf("%lc", (wint_t)cell->ch); + } +} + +static void html(void) { + if (mode & Cursor) cell(y, x)->attr ^= Reverse; + printf( + Q(<pre style="width: %dch;" class="bg%d fg%d">), + cols, defaultBg, defaultFg + ); + for (int y = 0; y < rows; ++y) { + for (int x = 0; x < cols; ++x) { + if (!cell(y, x)->ch) continue; + span((x ? cell(y, x-1) : NULL), cell(y, x)); + } + printf("</span>\n"); + } + printf("</pre>\n"); + if (mode & Cursor) cell(y, x)->attr ^= Reverse; +} + +static const char *Debug[] = { +#define X(code) [code] = #code, + ENUM_CODE +#undef X +}; + +int main(int argc, char *argv[]) { + setlocale(LC_CTYPE, ""); + + bool debug = false; + bool size = false; + bool hide = false; + + for (int opt; 0 < (opt = getopt(argc, argv, "Bb:df:h:insw:"));) { + switch (opt) { + break; case 'B': bright = true; + break; case 'b': defaultBg = atoi(optarg); + break; case 'd': debug = true; + break; case 'f': defaultFg = atoi(optarg); + break; case 'h': rows = atoi(optarg); + break; case 'i': colors = true; + break; case 'n': hide = true; + break; case 's': size = true; + break; case 'w': cols = atoi(optarg); + break; default: return EX_USAGE; + } + } + if (optind < argc) { + yyin = fopen(argv[optind], "r"); + if (!yyin) err(EX_NOINPUT, "%s", argv[optind]); + } + + if (size) { + struct winsize win; + int error = ioctl(STDERR_FILENO, TIOCGWINSZ, &win); + if (error) err(EX_IOERR, "ioctl"); + cols = win.ws_col; + rows = win.ws_row; + } + scr.bot = rows; + + cells = calloc(cols * rows, sizeof(*cells)); + if (!cells) err(EX_OSERR, "calloc"); + erase(cell(0, 0), cell(rows-1, cols)); + + bool mc = false; + for (int cc; (cc = yylex());) { + if (cc == MC) { + mc = true; + html(); + } else { + update(cc); + } + if (debug && cc != Data) { + printf("%s", Debug[cc]); + for (int i = 0; i < pn; ++i) { + printf("%s%d", (i ? ", " : " "), ps[i]); + } + printf("\n"); + html(); + } + } + if (hide) mode &= ~Cursor; + if (!mc) html(); +} diff --git a/bin/sup.sh b/bin/sup.sh new file mode 100644 index 00000000..32e282d1 --- /dev/null +++ b/bin/sup.sh @@ -0,0 +1,283 @@ +#!/bin/sh +set -eu + +service=$1 +email=${2:-$(git config fetchemail.imapUser)} + +generate() { + openssl rand -base64 33 +} +copy() { + printf '%s' "$1" | pbcopy +} +unwrap() { + sed ' + :x + /=$/ { + N + s/=\n//g + bx + } + ' +} + +asciinema() { + echo 'Fetching CSRF token...' + jar=$(mktemp -t sup) + trap 'rm "${jar}"' EXIT + csrf=$( + curl -Ss -c "${jar}" 'https://asciinema.org/login/new' | + sed -n 's/.*name="_csrf_token".*value="\([^"]*\)".*/\1/p' + ) + echo 'Submitting form...' + curl -Ss -X POST -b "${jar}" \ + -F "_csrf_token=${csrf}" -F "login[email]=${email}" \ + 'https://asciinema.org/login' \ + >/dev/null + echo 'Waiting for email...' + url=$( + git fetch-email -i -M Trash \ + -F 'hello@asciinema.org' -T "${email}" \ + -S 'Login to asciinema.org' | + grep -m 1 '^https://asciinema\.org/session/new' + ) + open "${url}" +} + +bugzilla() { + echo 'Fetching CSRF token...' + csrf=$( + curl -Ss "${bugzillaBase}/" | + sed -n ' + /name="token"/N + s/.*name="token"[[:space:]]*value="\([^"]*\)".*/\1/p + ' | head -n 1 + ) + echo 'Submitting form...' + curl -Ss -X POST \ + -F "loginname=${email}" -F "token=${csrf}" -F 'a=reqpw' \ + "${bugzillaBase}/token.cgi" \ + >/dev/null + echo 'Waiting for email...' + token=$( + git fetch-email -i -M Trash \ + -F "${bugzillaFrom}" -T "${email}" \ + -S 'Bugzilla Change Password Request' | + sed -n 's/.*t=3D\([^&]*\).*/\1/p' | + head -n 1 + ) + password=$(generate) + echo 'Setting password...' + curl -Ss -X POST \ + -F "t=${token}" -F 'a=chgpw' \ + -F "password=${password}" -F "matchpassword=${password}" \ + "${bugzillaBase}/token.cgi" \ + >/dev/null + copy "${password}" + open "${bugzillaBase}/" +} + +freebsdbugzilla() { + bugzillaBase='https://bugs.freebsd.org/bugzilla' + bugzillaFrom='bugzilla-noreply@freebsd.org' + bugzilla +} + +discogs() { + echo 'Submitting form...' + curl -Ss -X POST \ + -F "email=${email}" -F 'Action.EmailResetInstructions=submit' \ + 'https://www.discogs.com/users/forgot_password' \ + >/dev/null + echo 'Waiting for email...' + url=$( + git fetch-email -i -M Trash \ + -F 'noreply@discogs.com' -T "${email}" \ + -S 'Discogs Account Password Reset Instructions' | + sed -n 's/^To proceed, follow the instructions here: \(.*\)/\1/p' + ) + echo 'Fetching token...' + token=$(curl -ISs --url "${url}" | sed -n 's/.*[?]token=\([^&]*\).*/\1/p') + password=$(generate) + echo 'Setting password...' + curl -Ss -X POST \ + -F "token=${token}" \ + -F "password0=${password}" -F "password1=${password}" \ + -F 'Action.ChangePassword=submit' \ + 'https://www.discogs.com/users/forgot_password' \ + >/dev/null + copy "${password}" + open 'https://discogs.com/login' +} + +gitea() { + echo 'Fetching CSRF token...' + csrf=$( + curl -Ss "${giteaBase}/user/forgot_password" | + sed -n 's/.*name="_csrf" value="\([^"]*\)".*/\1/p' + ) + echo 'Submitting form...' + curl -Ss -X POST \ + -F "email=${email}" -F "_csrf=${csrf}" \ + "${giteaBase}/user/forgot_password" \ + >/dev/null + echo 'Waiting for email...' + code=$( + git fetch-email -i -M Trash \ + -F "${giteaFrom}" -T "${email}" -S 'Recover your account' | + unwrap | sed -n 's/.*code=3D\(.*\)/\1/p' | head -n 1 + ) + echo 'Fetching CSRF token...' + csrf=$( + curl -Ss "${giteaBase}/user/recover_account" | + sed -n 's/.*name="_csrf" value="\([^"]*\)".*/\1/p' + ) + password=$(generate) + echo 'Setting password...' + curl -Ss -X POST \ + -F "_csrf=${csrf}" -F "code=${code}" \ + -F "password=${password}" \ + "${giteaBase}/user/recover_account" \ + >/dev/null + copy "${password}" + open "${giteaBase}/user/login" +} + +liberapay() { + echo 'Fetching CSRF token...' + csrf=$( + curl -Ss 'https://liberapay.com/sign-in' | + sed -n 's/.*name="csrf_token".*value="\([^"]*\)".*/\1/p' + ) + echo 'Submitting form...' + curl -Ss -X POST \ + -b "csrf_token=${csrf}" -F "csrf_token=${csrf}" \ + -F "log-in.id=${email}" \ + 'https://liberapay.com/sign-in' \ + >/dev/null + echo 'Waiting for email...' + url=$( + git fetch-email -i -M Trash \ + -F 'support@liberapay.com' -T "${email}" \ + -S 'Log in to Liberapay' | + grep -m 1 '^https://liberapay\.com/' + ) + open "${url}" +} + +lobsters() { + : ${lobstersBase:=https://lobste.rs} + : ${lobstersFrom:=nobody@lobste.rs} + echo 'Fetching CSRF token...' + csrf=$( + curl -Ss "${lobstersBase}/login/forgot_password" | + sed -n 's/.*name="authenticity_token" value="\([^"]*\)".*/\1/p' + ) + echo 'Submitting form...' + curl -Ss -X POST \ + -F "authenticity_token=${csrf}" \ + -F "email=${email}" -F 'commit=submit' \ + "${lobstersBase}/login/reset_password" \ + >/dev/null + echo 'Waiting for email...' + token=$( + git fetch-email -i -M Trash \ + -F "${lobstersFrom}" -T "${email}" \ + -S 'Reset your password' | + sed -n 's|^https://.*[?]token=\([^&]*\).*|\1|p' + ) + echo 'Fetching CSRF token...' + csrf=$( + curl -Ss "${lobstersBase}/login/set_new_password?token=${token}" | + sed -n 's/.*name="authenticity_token" value="\([^"]*\)".*/\1/p' + ) + password=$(generate) + echo 'Setting password...' + curl -Ss -X POST \ + -F "authenticity_token=${csrf}" -F "token=${token}" \ + -F "password=${password}" -F "password_confirmation=${password}" \ + -F 'commit=submit' \ + "${lobstersBase}/login/set_new_password" \ + >/dev/null + copy "${password}" + open "${lobstersBase}/login" +} + +lwn() { + username=$email + echo 'Submitting form...' + curl -Ss -X POST -F "username=${username}" \ + 'https://lwn.net/Login/MailPWLink' \ + >/dev/null + echo 'Waiting for email...' + key=$( + git fetch-email -i -M Trash \ + -F 'lwn@lwn.net' -S 'A link to set your LWN.net password' | + sed -n 's|.*/Login/SetPassword/.*/\(.*\)|\1|p' + ) + echo 'Retrieving UID...' + uid=$( + curl -Ss "https://lwn.net/Login/SetPassword/${username}/${key}" | + sed -n 's/.*name="uid" value="\([^"]*\)".*/\1/p' + ) + password=$(generate) + echo 'Setting password...' + curl -Ss -X POST \ + -F "uid=${uid}" -F "key=${key}" \ + -F "new1=${password}" -F "new2=${password}" \ + 'https://lwn.net/Login/DoSetPassword' \ + >/dev/null + copy "${password}" + open 'https://lwn.net/Login/' +} + +patreon() { + readonly patreonAPI='https://www.patreon.com/api' + echo 'Submitting form...' + curl -Ss -X POST -d @- \ + -H 'Content-Type: application/vnd.api+json' \ + "${patreonAPI}/auth/forgot-password?json-api-version=1.0" <<-EOF + {"data":{"email":"${email}"}} + EOF + echo 'Waiting for email...' + url=$( + git fetch-email -i -M Trash \ + -F 'password@patreon.com' -T "${email}" \ + -S 'Patreon Password Reset' | + unwrap | + grep -o -m 1 'https://email[.]mailgun[.]patreon[.]com/.*' + ) + echo 'Fetching token...' + location=$(curl -ISs --url "${url}" | grep -i '^Location: ' | tr -d '\r') + u=$(echo "${location}" | sed 's/.*[?&]u=\([^&]*\).*/\1/') + sec=$(echo "${location}" | sed 's/.*[?&]sec=\([^&]*\).*/\1/') + password=$(generate) + echo 'Setting password...' + curl -Ss -X POST -d @- \ + -H 'Content-Type: application/vnd.api+json' \ + "${patreonAPI}/auth/forgot-password/change?json-api-version=1.0" <<-EOF + { + "data":{ + "user_id":"${u}", + "security_token":"${sec}", + "password":"${password}" + } + } + EOF + copy "${password}" + open 'https://www.patreon.com/login' +} + +tildegit() { + giteaBase='https://tildegit.org' + giteaFrom='git@tildegit.org' + gitea +} + +tildenews() { + lobstersBase='https://tilde.news' + lobstersFrom='nobody@tilde.news' + lobsters +} + +$service diff --git a/bin/title.c b/bin/title.c index 9cf444e8..47ff720a 100644 --- a/bin/title.c +++ b/bin/title.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2019 C. McEnroe <june@causal.agency> +/* Copyright (C) 2019 June McEnroe <june@causal.agency> * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by @@ -84,7 +84,7 @@ static void showTitle(const char *title) { static CURL *curl; static bool title; static struct { - char buf[8192]; + char buf[64 * 1024]; size_t len; } body; @@ -136,7 +136,7 @@ static CURLcode fetchTitle(const char *url) { body.len = 0; title = false; - curl_easy_setopt(curl, CURLOPT_NOBODY, 0L); + curl_easy_setopt(curl, CURLOPT_HTTPGET, 1L); code = curl_easy_perform(curl); return code; } @@ -158,7 +158,10 @@ int main(int argc, char *argv[]) { curl_easy_setopt(curl, CURLOPT_ERRORBUFFER, error); curl_easy_setopt(curl, CURLOPT_PROTOCOLS, CURLPROTO_HTTP | CURLPROTO_HTTPS); - curl_easy_setopt(curl, CURLOPT_USERAGENT, "curl/7.54.0"); + curl_easy_setopt( + curl, CURLOPT_USERAGENT, + "curl/7.54.0 facebookexternalhit/1.1 Twitterbot/1.0" + ); curl_easy_setopt(curl, CURLOPT_ACCEPT_ENCODING, ""); curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L); curl_easy_setopt(curl, CURLOPT_MAXREDIRS, 3L); diff --git a/bin/ttpre.c b/bin/ttpre.c deleted file mode 100644 index 4917be37..00000000 --- a/bin/ttpre.c +++ /dev/null @@ -1,66 +0,0 @@ -/* Copyright (C) 2018 C. McEnroe <june@causal.agency> - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -#include <locale.h> -#include <stdio.h> -#include <stdlib.h> -#include <wchar.h> - -static void put(wchar_t ch) { - switch (ch) { - break; case L'&': printf("&"); - break; case L'<': printf("<"); - break; case L'>': printf(">"); - break; default: printf("%lc", (wint_t)ch); - } -} - -static void tag(const char *open) { - static const char *close = NULL; - if (close == open) return; - if (close) printf("</%s>", close); - if (open) printf("<%s>", open); - close = open; -} - -static void push(wchar_t ch) { - static wchar_t q[3]; - if (q[1] == L'\b' && q[0] == L'_') { - tag("i"); - put(q[2]); - q[0] = q[1] = q[2] = 0; - } else if (q[1] == L'\b' && q[0] == q[2]) { - tag("b"); - put(q[2]); - q[0] = q[1] = q[2] = 0; - } else if (q[0]) { - tag(NULL); - put(q[0]); - } - q[0] = q[1]; - q[1] = q[2]; - q[2] = ch; -} - -int main(void) { - setlocale(LC_CTYPE, ""); - printf("<pre>"); - wint_t ch; - while (WEOF != (ch = getwchar())) push(ch); - push(0); push(0); push(0); - printf("</pre>\n"); - return EXIT_SUCCESS; -} diff --git a/bin/up.sh b/bin/up.sh index e65d4522..6305b1ee 100644 --- a/bin/up.sh +++ b/bin/up.sh @@ -2,68 +2,86 @@ set -eu readonly Host='temp.causal.agency' +readonly Root='/var/www' +temp= +temp() { + temp=$(mktemp -d) + trap 'rm -r "$temp"' EXIT +} + +warn= upload() { - local src ext ts rand url src=$1 ext=${src##*.} - ts=$(date +'%s') - rand=$(openssl rand -hex 4) - url=$(printf '%s/%x%s.%s' "$Host" "$ts" "$rand" "$ext") - scp -q "$src" "${Host}:/usr/local/www/${url}" + name=$(printf '%x%s' "$(date +%s)" "$(openssl rand -hex 4)") + url="${Host}/${name}.${ext}" + scp -q "$src" "${Host}:${Root}/${url}" + if test -n "$warn"; then + test -n "$temp" || temp + cat >"${temp}/warn.html" <<-EOF + <!DOCTYPE html> + <title>${warn}</title> + <meta http-equiv="refresh" content="0;url=${name}.${ext}"> + EOF + url="${Host}/${name}.html" + scp -q "${temp}/warn.html" "${Host}:${Root}/${url}" + fi echo "https://${url}" } -temp() { - temp=$(mktemp -d) - trap "rm -r '$temp'" EXIT -} - uploadText() { temp - cat > "${temp}/input.txt" + cat >"${temp}/input.txt" upload "${temp}/input.txt" } uploadCommand() { temp - echo "$ $*" > "${temp}/exec.txt" - "$@" >> "${temp}/exec.txt" 2>&1 || true + echo "$ $1" >"${temp}/exec.txt" + $SHELL -c "$1" >>"${temp}/exec.txt" 2>&1 || true upload "${temp}/exec.txt" } -uploadHi() { +uploadHilex() { temp - hi -f html -o document,anchor,tab=4 "$@" > "${temp}/hi.html" - upload "${temp}/hi.html" + hilex -f html -o document,tab=4 "$@" >"${temp}/hilex.html" + upload "${temp}/hilex.html" } uploadScreen() { temp - screencapture -i "$@" "${temp}/capture.png" - pngo "${temp}/capture.png" || true + if command -v screencapture >/dev/null; then + screencapture -i "$@" "${temp}/capture.png" + else + scrot -s "$@" "${temp}/capture.png" + fi + pngo "${temp}/capture.png" upload "${temp}/capture.png" } uploadTerminal() { temp - cat > "${temp}/term.html" <<-EOF + cat >"${temp}/term.html" <<-EOF <!DOCTYPE html> + <meta charset="utf-8"> <title>${1}</title> <style> $(scheme -s) </style> EOF - ptee "$@" | shotty -Bs >> "${temp}/term.html" + ptee $SHELL -c "$1" >"${temp}/term.pty" + shotty -Bs "${temp}/term.pty" >>"${temp}/term.html" upload "${temp}/term.html" } -while getopts 'chst' opt; do - case "$opt" in +while getopts 'chstw:' opt; do + case $opt in (c) fn=uploadCommand;; - (h) fn=uploadHi;; + (h) fn=uploadHilex;; (s) fn=uploadScreen;; (t) fn=uploadTerminal;; + (w) warn=$OPTARG;; (?) exit 1;; esac done diff --git a/bin/when.y b/bin/when.y index 5367b3b3..46651ebb 100644 --- a/bin/when.y +++ b/bin/when.y @@ -1,4 +1,4 @@ -/* Copyright (C) 2019 C. McEnroe <june@causal.agency> +/* Copyright (C) 2019, 2022 June McEnroe <june@causal.agency> * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by @@ -18,6 +18,9 @@ #include <ctype.h> #include <err.h> +#include <errno.h> +#include <limits.h> +#include <stdbool.h> #include <stdio.h> #include <stdlib.h> #include <strings.h> @@ -30,12 +33,13 @@ static int yylex(void); #define YYSTYPE struct tm static const char *Days[7] = { - "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat", + "Sunday", "Monday", "Tuesday", "Wednesday", + "Thursday", "Friday", "Saturday", }; static const char *Months[12] = { - "Jan", "Feb", "Mar", "Apr", "May", "Jun", - "Jul", "Aug", "Sep", "Oct", "Nov", "Dec", + "January", "February", "March", "April", "May", "June", + "July", "August", "September", "October", "November", "December", }; static const struct tm Week = { .tm_mday = 7 }; @@ -103,12 +107,24 @@ static struct tm dateSub(struct tm date, struct tm scalar) { } static struct tm dateDiff(struct tm a, struct tm b) { + time_t atime = timegm(&a), btime = timegm(&b); + if (atime < btime) { + struct tm x = a; + a = b; + b = x; + time_t xtime = atime; + atime = btime; + btime = xtime; + } struct tm diff = { .tm_year = a.tm_year - b.tm_year, .tm_mon = a.tm_mon - b.tm_mon, .tm_mday = a.tm_mday - b.tm_mday, }; - if (a.tm_mon < b.tm_mon) { + if ( + a.tm_mon < b.tm_mon || + (a.tm_mon == b.tm_mon && a.tm_mday < b.tm_mday) + ) { diff.tm_year--; diff.tm_mon += 12; } @@ -117,20 +133,54 @@ static struct tm dateDiff(struct tm a, struct tm b) { diff.tm_mday = 0; while (dateAdd(b, diff).tm_mday != a.tm_mday) diff.tm_mday++; } - time_t atime = timegm(&a), btime = timegm(&b); diff.tm_yday = (atime - btime) / 24 / 60 / 60; return diff; } +static struct { + size_t cap, len; + struct tm *ptr; +} dates; + +static struct tm getDate(const char *name) { + for (size_t i = 0; i < dates.len; ++i) { + if (!strcmp(dates.ptr[i].tm_zone, name)) return dates.ptr[i]; + } + return (struct tm) {0}; +} + +static void setDate(const char *name, struct tm date) { + for (size_t i = 0; i < dates.len; ++i) { + if (strcmp(dates.ptr[i].tm_zone, name)) continue; + char *tm_zone = dates.ptr[i].tm_zone; + dates.ptr[i] = date; + dates.ptr[i].tm_zone = tm_zone; + return; + } + if (dates.len == dates.cap) { + dates.cap = (dates.cap ? dates.cap * 2 : 8); + dates.ptr = realloc(dates.ptr, sizeof(*dates.ptr) * dates.cap); + if (!dates.ptr) err(EX_OSERR, "realloc"); + } + dates.ptr[dates.len] = date; + dates.ptr[dates.len].tm_zone = strdup(name); + if (!dates.ptr[dates.len].tm_zone) err(EX_OSERR, "strdup"); + dates.len++; +} + +static bool silent; + static void printDate(struct tm date) { + if (silent) return; printf( - "%s %s %d %d\n", + "%.3s %.3s %d %d\n", Days[date.tm_wday], Months[date.tm_mon], date.tm_mday, 1900 + date.tm_year ); } static void printScalar(struct tm scalar) { + if (silent) return; if (scalar.tm_year) printf("%dy ", scalar.tm_year); if (scalar.tm_mon) printf("%dm ", scalar.tm_mon); if (scalar.tm_mday % 7) { @@ -138,15 +188,24 @@ static void printScalar(struct tm scalar) { } else if (scalar.tm_mday) { printf("%dw ", scalar.tm_mday / 7); } - if (scalar.tm_yday && scalar.tm_mon) printf("(%dd) ", scalar.tm_yday); + if (scalar.tm_yday && scalar.tm_mon) { + if (scalar.tm_yday >= 7) { + printf("(%dw", scalar.tm_yday / 7); + if (scalar.tm_yday % 7) { + printf(" %dd", scalar.tm_yday % 7); + } + printf(") "); + } + printf("(%dd) ", scalar.tm_yday); + } printf("\n"); } %} -%token Number Month Day +%token Name Number Month Day %left '+' '-' -%right '<' '>' +%right '=' '<' '>' %% @@ -157,6 +216,8 @@ expr: date: dateLit + | Name { $$ = getDate($1.tm_zone); free($1.tm_zone); } + | Name '=' date { setDate($1.tm_zone, $3); free($1.tm_zone); $$ = $3; } | '(' date ')' { $$ = $2; } | '<' date { $$ = dateSub($2, Week); } | '>' date { $$ = dateAdd($2, Week); } @@ -206,35 +267,77 @@ static int yylex(void) { return Number; } - for (int i = 0; i < 7; ++i) { - if (strncasecmp(input, Days[i], 3)) continue; - while (isalpha(*input)) input++; - yylval.tm_wday = i; - return Day; + size_t len; + for (len = 0; isalnum(input[len]) || input[len] == '_'; ++len); + + if (len >= 3) { + for (int i = 0; i < 7; ++i) { + if (strncasecmp(input, Days[i], len)) continue; + yylval.tm_wday = i; + input += len; + return Day; + } + + for (int i = 0; i < 12; ++i) { + if (strncasecmp(input, Months[i], len)) continue; + yylval.tm_mon = i; + input += len; + return Month; + } } - for (int i = 0; i < 12; ++i) { - if (strncasecmp(input, Months[i], 3)) continue; - while (isalpha(*input)) input++; - yylval.tm_mon = i; - return Month; + if (len && (len != 1 || !strchr("dwmy", *input))) { + yylval.tm_zone = strndup(input, len); + if (!yylval.tm_zone) err(EX_OSERR, "strndup"); + input += len; + return Name; } return *input++; } int main(int argc, char *argv[]) { + size_t cap = 0; + char *line = NULL; + + char path[PATH_MAX]; + const char *configHome = getenv("XDG_CONFIG_HOME"); + if (configHome) { + snprintf(path, sizeof(path), "%s/when/dates", configHome); + } else { + snprintf(path, sizeof(path), "%s/.config/when/dates", getenv("HOME")); + } + + FILE *file = fopen(path, "r"); + if (file) { + silent = true; + while (0 < getline(&line, &cap, file)) { + input = line; + yyparse(); + } + fclose(file); + silent = false; + } else if (errno != ENOENT) { + err(EX_CONFIG, "%s", path); + } + if (argc > 1) { - input = argv[1]; - return yyparse(); + if (strcmp(argv[1], "-")) { + input = argv[1]; + return yyparse(); + } else { + for (size_t i = 0; i < dates.len; ++i) { + printf("%s: ", dates.ptr[i].tm_zone); + printScalar(dateDiff(today(), dates.ptr[i])); + } + return EX_OK; + } } struct tm date = today(); printDate(date); printf("\n"); - char *line = NULL; - size_t cap = 0; while (0 < getline(&line, &cap, stdin)) { if (line[0] == '\n') continue; diff --git a/bin/xx.c b/bin/xx.c index 6d04f2f5..39d7ec07 100644 --- a/bin/xx.c +++ b/bin/xx.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2017 C. McEnroe <june@causal.agency> +/* Copyright (C) 2017 June McEnroe <june@causal.agency> * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by diff --git a/doc/rfc/.gitignore b/doc/rfc/.gitignore new file mode 100644 index 00000000..cc3245d4 --- /dev/null +++ b/doc/rfc/.gitignore @@ -0,0 +1,2 @@ +rfc +rfctags diff --git a/doc/rfc/Makefile b/doc/rfc/Makefile new file mode 100644 index 00000000..3078dcd3 --- /dev/null +++ b/doc/rfc/Makefile @@ -0,0 +1,38 @@ +PREFIX ?= ~/.local +MANDIR ?= ${PREFIX}/share/man + +MODULE = ftp.rfc-editor.org::rfcs +RFCS = ${MODULE}/rfc-index.txt ${MODULE}/'rfc[1-9]*.txt' ${MODULE}/'rfc*.json' + +all: rfc rfctags + +.SUFFIXES: .in .pl + +.in: + sed 's|%%PREFIX%%|${PREFIX}|g' $< > $@ + chmod a+x $@ + +.pl: + cp -f $< $@ + chmod a+x $@ + +clean: + rm -f rfc rfctags + +install: rfc rfctags rfc.1 + install -d ${PREFIX}/bin ${MANDIR}/man1 + install rfc rfctags ${PREFIX}/bin + install -m 644 rfc.1 ${MANDIR}/man1 + ln -fs rfc.1 ${MANDIR}/man1/rfctags.1 + +sync: + install -d ${PREFIX}/share + rsync -ptz ${RFCS} ${PREFIX}/share/rfc + +compress: + find ${PREFIX}/share/rfc -name '*.txt' | xargs gzip -9f + +uninstall: + rm -f ${PREFIX}/bin/rfc ${PREFIX}/bin/rfctags + rm -f ${MANDIR}/man1/rfc.1 ${MANDIR}/man1/rfctags.1 + rm -fr ${PREFIX}/share/rfc diff --git a/doc/rfc/rfc.1 b/doc/rfc/rfc.1 new file mode 100644 index 00000000..da393e8b --- /dev/null +++ b/doc/rfc/rfc.1 @@ -0,0 +1,60 @@ +.Dd January 3, 2022 +.Dt RFC 1 +.Os +. +.Sh NAME +.Nm rfc , +.Nm rfctags +.Nd view IETF RFCs +. +.Sh SYNOPSIS +.Nm rfc +.Op Ar number +.Nm rfc +.Fl b Ar number +.Nm rfctags +.Op Ar +. +.Sh DESCRIPTION +The +.Nm rfc +utility displays +an IETF RFC by number, +or the RFC index if no number is specified. +The RFC is displayed in the +.Ev PAGER +with a tags file generated by +.Nm rfctags . +The +.Fl b +option outputs an +.Xr mdoc 7 +bibliographic block. +. +.Pp +The +.Nm rfctags +utility generates tags +for RFC text file +section numbers, +section names +and bracketed references. +. +.Sh ENVIRONMENT +.Bl -tag -width Ds +.It Ev PAGER +The program used to display RFCs. +It must accept the +.Fl T +flag for specifying +the path of the tags file. +The default is +.Ev PAGER=less . +.El +. +.Sh SEE ALSO +.Xr ctags 1 , +.Xr less 1 +. +.Sh AUTHORS +.An June Bug Aq Mt june@causal.agency diff --git a/doc/rfc/rfc.in b/doc/rfc/rfc.in new file mode 100644 index 00000000..abeb293f --- /dev/null +++ b/doc/rfc/rfc.in @@ -0,0 +1,41 @@ +#!/bin/sh +set -eu + +mktemp='mktemp -t rfc' +[ "$(uname)" = 'OpenBSD' ] && mktemp="${mktemp}.XXXXXXXXXX" + +bib= +while getopts 'b:' opt; do + case $opt in + (b) bib=$OPTARG;; + (?) exit 1;; + esac +done +shift $((OPTIND - 1)) + +if test -n "${bib}"; then + exec jq -r ' + ".Rs", + (.authors[] | ".%A \(.)"), + ".%T \(.title | ltrimstr(" "))", + ".%I IETF", + ".%R \(.doc_id)", + ".%U https://tools.ietf.org/html/\(.doc_id | ascii_downcase)", + ".%D \(.pub_date)", + ".Re" + ' %%PREFIX%%/share/rfc/"rfc${bib}.json" +fi + +rfc=%%PREFIX%%/share/rfc/"rfc${1:--index}.txt" +tags=$($mktemp) +trap 'rm "${tags}"' EXIT + +if test -f "${rfc}.gz"; then + txt=$($mktemp) + trap 'rm "${txt}" "${tags}"' EXIT + gunzip -c "${rfc}.gz" >"${txt}" + rfc=$txt +fi + +%%PREFIX%%/bin/rfctags "${rfc}" >"${tags}" +${PAGER:-less} -T "${tags}" "${rfc}" diff --git a/doc/rfc/rfctags.pl b/doc/rfc/rfctags.pl new file mode 100644 index 00000000..05173d00 --- /dev/null +++ b/doc/rfc/rfctags.pl @@ -0,0 +1,21 @@ +#!/usr/bin/env perl +use strict; +use warnings; +use open ':encoding(ISO-8859-1)'; + +($,, $\) = ("\t", "\n"); +while (<>) { + chomp; + # Section headings + if (/^([\d.]+|[A-Z][.])\s+([^\t]+)?/) { + print $1, $ARGV, $.; + print $2, $ARGV, $. if $2; + print $1, $ARGV, $. if $1 =~ /^([\d.]+)[.]$/; + } + # References + if (/^\s*(\[[\w-]+\])\s{2,}/) { + print $1, $ARGV, $.; + print "\\$1", $ARGV, $.; # vim ^] prepends \ to [ + } + close ARGV if eof; +} diff --git a/doc/zlib/Makefile b/doc/zlib/Makefile new file mode 100644 index 00000000..6cfd4a42 --- /dev/null +++ b/doc/zlib/Makefile @@ -0,0 +1,87 @@ +PREFIX ?= ~/.local +MANDIR ?= ${PREFIX}/share/man + +MAN += adler32.3 +MAN += adler32_combine.3 +MAN += compress.3 +MAN += compressBound.3 +MAN += crc32.3 +MAN += crc32_combine.3 +MAN += deflate.3 +MAN += deflateBound.3 +MAN += deflateCopy.3 +MAN += deflateEnd.3 +MAN += deflateGetDictionary.3 +MAN += deflateInit.3 +MAN += deflateInit2.3 +MAN += deflateParams.3 +MAN += deflatePending.3 +MAN += deflatePrime.3 +MAN += deflateReset.3 +MAN += deflateSetDictionary.3 +MAN += deflateSetHeader.3 +MAN += deflateTune.3 +MAN += gzbuffer.3 +MAN += gzclose.3 +MAN += gzdirect.3 +MAN += gzeof.3 +MAN += gzerror.3 +MAN += gzflush.3 +MAN += gzfread.3 +MAN += gzfwrite.3 +MAN += gzgetc.3 +MAN += gzgets.3 +MAN += gzoffset.3 +MAN += gzopen.3 +MAN += gzprintf.3 +MAN += gzputc.3 +MAN += gzputs.3 +MAN += gzread.3 +MAN += gzseek.3 +MAN += gzsetparams.3 +MAN += gzungetc.3 +MAN += gzwrite.3 +MAN += inflate.3 +MAN += inflateBack.3 +MAN += inflateBackEnd.3 +MAN += inflateBackInit.3 +MAN += inflateCopy.3 +MAN += inflateEnd.3 +MAN += inflateGetDictionary.3 +MAN += inflateGetHeader.3 +MAN += inflateInit.3 +MAN += inflateInit2.3 +MAN += inflateMark.3 +MAN += inflatePrime.3 +MAN += inflateReset.3 +MAN += inflateSetDictionary.3 +MAN += inflateSync.3 +MAN += uncompress.3 +MAN += zlibCompileFlags.3 +MAN += zlibVersion.3 + +MLINKS += adler32.3 adler32_z.3 +MLINKS += compress.3 compress2.3 +MLINKS += crc32.3 crc32_z.3 +MLINKS += gzclose.3 gzclose_r.3 +MLINKS += gzclose.3 gzclose_w.3 +MLINKS += gzerror.3 gzclearerr.3 +MLINKS += gzopen.3 gzdopen.3 +MLINKS += gzseek.3 gzrewind.3 +MLINKS += gzseek.3 gztell.3 +MLINKS += inflateReset.3 inflateReset2.3 +MLINKS += uncompress.3 uncompress2.3 + +lint: + mandoc -T lint ${MAN} | grep -v 'referenced manual not found' + +install: + install -d ${MANDIR}/man3 + install -m 644 ${MAN} ${MANDIR}/man3 + set -- ${MLINKS}; while [ -n "$$*" ]; do \ + ln -fs $$1 ${MANDIR}/man3/$$2; shift 2; done + +uninstall: + rm -f ${MAN:%=${MANDIR}/man3/%} + set -- ${MLINKS}; while [ -n "$$*" ]; do \ + rm -f ${MANDIR}/man3/$$2; shift 2; done diff --git a/doc/zlib/adler32.3 b/doc/zlib/adler32.3 new file mode 100644 index 00000000..c58a34e7 --- /dev/null +++ b/doc/zlib/adler32.3 @@ -0,0 +1,65 @@ +.Dd January 15, 2017 +.Dt ADLER32 3 +.Os +. +.Sh NAME +.Nm adler32 , +.Nm adler32_z +.Nd update Adler-32 checksum +. +.Sh LIBRARY +.Lb libz +. +.Sh SYNOPSIS +.In zlib.h +.Ft uLong +.Fn adler32 "uLong adler" "const Bytef *buf" "uInt len" +.Ft uLong +.Fn adler32_z "uLong adler" "const Bytef *buf" "z_size_t len" +. +.Sh DESCRIPTION +Update a running Adler-32 checksum with the bytes +.Fa "buf[0..len-1]" +and return the updated checksum. +If +.Fa buf +is +.Dv Z_NULL , +this function returns +the required initial value for the checksum. +. +.Pp +An Adler-32 checksum is almost as reliable as a CRC-32 +but can be computed much faster. +. +.Pp +.Fn adler32_z +is the same as +.Fn adler32 , +but with a +.Vt size_t +length. +. +.Sh EXAMPLES +.Bd -literal -offset indent +uLong adler = adler32(0L, Z_NULL, 0); + +while (read_buffer(buffer, length) != EOF) { + adler = adler32(adler, buffer, length); +} +if (adler != original_adler) error(); +.Ed +. +.Sh SEE ALSO +.Xr adler32_combine 3 , +.Xr crc32 3 +. +.Sh HISTORY +This manual page was converted from +.In zlib.h +to mdoc format by +.An June McEnroe Aq Mt june@causal.agency . +. +.Sh AUTHORS +.An Jean-loup Gailly Aq Mt jloup@gzip.org +.An Mark Adler Aq Mt madler@alumni.caltech.edu diff --git a/doc/zlib/adler32_combine.3 b/doc/zlib/adler32_combine.3 new file mode 100644 index 00000000..55e801e9 --- /dev/null +++ b/doc/zlib/adler32_combine.3 @@ -0,0 +1,63 @@ +.Dd January 15, 2017 +.Dt ADLER32_COMBINE 3 +.Os +. +.Sh NAME +.Nm adler32_combine +.Nd combine Adler-32 checksums +. +.Sh LIBRARY +.Lb libz +. +.Sh SYNOPSIS +.In zlib.h +.Ft uLong +.Fn adler32_combine "uLong adler1" "uLong adler2" "z_off_t len2" +. +.Sh DESCRIPTION +Combine two Adler-32 checksums into one. +For two sequences of bytes, +.Va seq1 +and +.Va seq2 +with lengths +.Va len1 +and +.Va len2 , +Adler-32 checksums were calculated for each, +.Va adler1 +and +.Va adler2 . +.Fn adler32_combine +returns the Adler-32 checksum of +.Va seq1 +and +.Va seq2 +concatenated, +requiring only +.Fa adler1 , +.Fa adler2 , +and +.Fa len2 . +Note that the +.Vt z_off_t +type +.Pq like Vt off_t +is a signed integer. +If +.Fa len2 +is negative, +the result has no meaning or utility. +. +.Sh SEE ALSO +.Xr adler32 3 +. +.Sh HISTORY +This manual page was converted from +.In zlib.h +to mdoc format by +.An June McEnroe Aq Mt june@causal.agency . +. +.Sh AUTHORS +.An Jean-loup Gailly Aq Mt jloup@gzip.org +.An Mark Adler Aq Mt madler@alumni.caltech.edu diff --git a/doc/zlib/compress.3 b/doc/zlib/compress.3 new file mode 100644 index 00000000..16445e2f --- /dev/null +++ b/doc/zlib/compress.3 @@ -0,0 +1,84 @@ +.Dd January 15, 2017 +.Dt COMPRESS 3 +.Os +. +.Sh NAME +.Nm compress , +.Nm compress2 +.Nd compress source buffer into destination buffer +. +.Sh LIBRARY +.Lb libz +. +.Sh SYNOPSIS +.In zlib.h +. +.Ft int +.Fo compress +.Fa "Bytef *dest" +.Fa "uLongf *destLen" +.Fa "const Bytef *source" +.Fa "uLong sourceLen" +.Fc +. +.Ft int +.Fo compress2 +.Fa "Bytef *dest" +.Fa "uLongf *destLen" +.Fa "const Bytef *source" +.Fa "uLong sourceLen" +.Fa "int level" +.Fc +. +.Sh DESCRIPTION +Compresses the source buffer into the destination buffer. +.Fa sourceLen +is the byte length of the source buffer. +Upon entry, +.Fa destLen +is the total size of the destination buffer, +which must be at least the value returned by +.Fn compressBound sourceLen . +Upon exit, +.Fa destLen +is the actual size of the compressed data. +. +.Pp +.Fn compress +is equivalent to +.Fn compress2 +with a +.Fa level +parameter of +.Dv Z_DEFAULT_COMPRESSION . +. +.Sh RETURN VALUES +.Fn compress +and +.Fn compress2 +return +.Dv Z_OK +on success, +.Dv Z_MEM_ERROR +if there was not enough memory, +.Dv Z_BUF_ERROR +if there was not enough room in the output buffer, +.Dv Z_STREAM_ERROR +if the +.Fa level +parameter is invalid. +. +.Sh SEE ALSO +.Xr compressBound 3 , +.Xr deflateInit 3 , +.Xr uncompress 3 +. +.Sh HISTORY +This manual page was converted from +.In zlib.h +to mdoc format by +.An June McEnroe Aq Mt june@causal.agency . +. +.Sh AUTHORS +.An Jean-loup Gailly Aq Mt jloup@gzip.org +.An Mark Adler Aq Mt madler@alumni.caltech.edu diff --git a/doc/zlib/compressBound.3 b/doc/zlib/compressBound.3 new file mode 100644 index 00000000..d61891eb --- /dev/null +++ b/doc/zlib/compressBound.3 @@ -0,0 +1,44 @@ +.Dd January 15, 2017 +.Dt COMPRESSBOUND 3 +.Os +. +.Sh NAME +.Nm compressBound +.Nd compressed size upper bound +. +.Sh LIBRARY +.Lb libz +. +.Sh SYNOPSIS +.In zlib.h +.Ft uLong +.Fn compressBound "uLong sourceLen" +. +.Sh DESCRIPTION +.Fn compressBound +returns an upper bound on the compressed size after +.Xr compress 3 +or +.Xr compress2 3 +on +.Fa sourceLen +bytes. +It would be used before a +.Xr compress 3 +or +.Xr compress2 3 +call to allocate the destination buffer. +. +.Sh SEE ALSO +.Xr compress 3 , +.Xr deflateBound 3 +. +.Sh HISTORY +This manual page was converted from +.In zlib.h +to mdoc format by +.An June McEnroe Aq Mt june@causal.agency . +. +.Sh AUTHORS +.An Jean-loup Gailly Aq Mt jloup@gzip.org +.An Mark Adler Aq Mt madler@alumni.caltech.edu diff --git a/doc/zlib/crc32.3 b/doc/zlib/crc32.3 new file mode 100644 index 00000000..a42df2af --- /dev/null +++ b/doc/zlib/crc32.3 @@ -0,0 +1,66 @@ +.Dd January 15, 2017 +.Dt CRC32 3 +.Os +. +.Sh NAME +.Nm crc32 , +.Nm crc32_z +.Nd update CRC-32 checksum +. +.Sh LIBRARY +.Lb libz +. +.Sh SYNOPSIS +.In zlib.h +.Ft uLong +.Fn crc32 "uLong crc" "const Bytef *buf" "uInt len" +.Ft uLong +.Fn crc32_z "uLong crc" "const Bytef *buf" "z_size_t len" +. +.Sh DESCRIPTION +Update a running CRC-32 with the bytes +.Fa "buf[0..len-1]" +and return the updated CRC-32. +If +.Fa buf +is +.Dv Z_NULL , +this function returns +the required initial value for the CRC. +Pre- and post-conditioning +(one's complement) +is performed within this function +so it shouldn't be done +by the application. +. +.Pp +.Fn crc32_z +is the same as +.Fn crc32 , +but with a +.Vt size_t +length. +. +.Sh EXAMPLES +.Bd -literal -offset indent +uLong crc = crc32(0L, Z_NULL, 0); + +while (read_buffer(buffer, length) != EOF) { + crc = crc32(crc, buffer, length); +} +if (crc != original_crc) error(); +.Ed +. +.Sh SEE ALSO +.Xr adler32 3 , +.Xr crc32_combine 3 +. +.Sh HISTORY +This manual page was converted from +.In zlib.h +to mdoc format by +.An June McEnroe Aq Mt june@causal.agency . +. +.Sh AUTHORS +.An Jean-loup Gailly Aq Mt jloup@gzip.org +.An Mark Adler Aq Mt madler@alumni.caltech.edu diff --git a/doc/zlib/crc32_combine.3 b/doc/zlib/crc32_combine.3 new file mode 100644 index 00000000..b25da679 --- /dev/null +++ b/doc/zlib/crc32_combine.3 @@ -0,0 +1,54 @@ +.Dd January 15, 2017 +.Dt CRC32_COMBINE 3 +.Os +. +.Sh NAME +.Nm crc32_combine +.Nd combine CRC-32 checksums +. +.Sh LIBRARY +.Lb libz +. +.Sh SYNOPSIS +.In zlib.h +.Ft uLong +.Fn crc32_combine "uLong crc1" "uLong crc2" "z_off_t len2" +. +.Sh DESCRIPTION +Combine two CRC-32 check values into one. +For two sequences of bytes, +.Va seq1 +and +.Va seq2 +with lengths +.Va len1 +and +.Va len2 , +CRC-32 check values were calculated for each, +.Va crc1 +and +.Va crc2 . +.Fn crc32_combine +returns the CRC-32 check value of +.Va seq1 +and +.Va seq2 +concatenated, +requiring only +.Fa crc1 , +.Fa crc2 , +and +.Fa len2 . +. +.Sh SEE ALSO +.Xr crc32 3 +. +.Sh HISTORY +This manual page was converted from +.In zlib.h +to mdoc format by +.An June McEnroe Aq Mt june@causal.agency . +. +.Sh AUTHORS +.An Jean-loup Gailly Aq Mt jloup@gzip.org +.An Mark Adler Aq Mt madler@alumni.caltech.edu diff --git a/doc/zlib/deflate.3 b/doc/zlib/deflate.3 new file mode 100644 index 00000000..be182d96 --- /dev/null +++ b/doc/zlib/deflate.3 @@ -0,0 +1,370 @@ +.Dd January 15, 2017 +.Dt DEFLATE 3 +.Os +. +.Sh NAME +.Nm deflate +.Nd deflate compression +. +.Sh LIBRARY +.Lb libz +. +.Sh SYNOPSIS +.In zlib.h +.Ft int +.Fn deflate "z_streamp strm" "int flush" +. +.Sh DESCRIPTION +.Fn deflate +compresses as much data as possible, +and stops when the input buffer becomes empty +or the output buffer becomes full. +It may introduce some output latency +(reading input without producing any output) +except when forced the flush. +. +.Pp +The detailed semantics are as follows. +.Fn deflate +performs one or both of the following actions: +. +.Bl -dash +.It +Compress more input starting at +.Fa next_in +and update +.Fa next_in +and +.Fa avail_in +accordingly. +If not all input can be processed +(because there is not enough room in the output buffer), +.Fa next_in +and +.Fa avail_in +are updated +and processing will resume at this point +for the next call of +.Fn deflate . +. +.It +Generate more output starting at +.Fa next_out +and update +.Fa next_out +and +.Fa avail_out +accordingly. +This action is forced if the parameter +.Fa flush +is non-zero. +Forcing flush frequently degrades the compression ratio, +so this parameter should be set only when necessary. +Some output may be provided even if +.Fa flush +is zero. +.El +. +.Pp +Before the call of +.Fn deflate , +the application should ensure that +at least one of the actions is possible, +by providing more input +and/or consuming more output, +and updating +.Fa avail_in +or +.Fa avail_out +accordingly; +.Fa avail_out +should never be zero before the call. +The application can consume the compressed output +when it wants, +for example when the output buffer is full +.Po +.Fa avail_out +== 0 +.Pc , +or after each call of +.Fn deflate . +If +.Fn deflate +returns +.Dv Z_OK +and with zero +.Fa avail_out , +it must be called again after making room in the output buffer +because there might be more output pending. +See +.Xr deflatePending 3 , +which can be used if desired to determine +whether or not there is more output in that case. +. +.Pp +Normally the parameter +.Fa flush +is set to +.Dv Z_NO_FLUSH , +which allows +.Fn deflate +to decide how much data to accumulate before producing output, +in order to maximize compression. +. +.Pp +If the parameter +.Fa flush +is set to +.Dv Z_SYNC_FLUSH , +all pending output is flushed to the output buffer +and the output is aligned on a byte boundary, +so that the decompressor can get all input data available so far. +.Po +In particular +.Fa avail_in +is zero after the call if enough output space +has been provided before the call. +.Pc \& +Flushing may degrade compression for some compression algorithms +and so it should be used only when necessary. +This completes the current deflate block +and follows it with an empty stored block +that is three bits plus filler bits to the next byte, +followed by four bytes +(00 00 ff ff). +. +.Pp +If +.Fa flush +is set to +.Dv Z_PARTIAL_FLUSH , +all pending output is flushed to the output buffer, +but the output is not aligned to a byte boundary. +All of the input data so far will be available to the decompressor, +as for +.Dv Z_SYNC_FLUSH . +This completes the current deflate block +and follows it with an empty fixed codes block +that is 10 bits long. +This assures that enough bytes are output +in order for the decompressor to finish the block +before the empty fixed codes block. +. +.Pp +If +.Fa flush +is set to +.Dv Z_BLOCK , +a deflate block is completed and emitted, +as for +.Dv Z_SYNC_FLUSH , +but the output is not aligned on a byte boundary, +and up to seven bits of the current block +are held to be written as the next byte +after the next deflate block is completed. +In this case, +the decompressor may not be provided enough bits +at this point in order to complete decompression +of the data provided so far to the compressor. +It may need to wait for the next block to be emitted. +This is for advanced applications +that need to control the emission of deflate blocks. +. +.Pp +If +.Fa flush +is set to +.Dv Z_FULL_FLUSH , +all output is flushed as with +.Dv Z_SYNC_FLUSH , +and the compression state is reset +so that decompression can restart from this point +if previous compressed data has been damaged +or if random access is desired. +Using +.Dv Z_FULL_FLUSH +too often can seriously degrade compression. +. +.Pp +If +.Fn deflate +returns with +.Fa avail_out +== 0, +this function must be called again +with the same value of the +.Fa flush +parameter +and more output space +.Po +updated +.Fa avail_out +.Pc , +until the flush is complete +.Po +.Fn deflate +returns with non-zero +.Fa avail_out +.Pc . +In the case of a +.Dv Z_FULL_FLUSH +or +.Dv Z_SYNC_FLUSH , +make sure that +.Fa avail_out +is greater than six +to avoid repeated flush markers +due to +.Fa avail_out +== 0 +on return. +. +.Pp +If the parameter +.Fa flush +is set to +.Dv Z_FINISH , +pending input is processed, +pending output is flushed and +.Fn deflate +returns with +.Dv Z_STREAM_END +if there was enough output space. +If +.Fn deflate +returns with +.Dv Z_OK +or +.Dv Z_BUF_ERROR , +this function must be called again with +.Dv Z_FINISH +and more output space +.Pq updated Fa avail_out +but no more input data, +until it returns with +.Dv Z_STREAM_END +or an error. +After +.Fn deflate +has returned +.Dv Z_STREAM_END , +the only possible operations on the stream are +.Xr deflateReset 3 +or +.Xr deflateEnd 3 . +. +.Pp +.Dv Z_FINISH +can be used in the first +.Fn deflate +call after +.Xr deflateInit 3 +if all the compression is to be done in a single step. +In order to complete in one call, +.Fa avail_out +must be at least the value returned by +.Xr deflateBound 3 . +Then +.Fn deflate +is guaranteed to return +.Dv Z_STREAM_END . +If not enough output space is provided, +.Fn deflate +will not return +.Dv Z_STREAM_END , +and it must be called again as described above. +. +.Pp +.Fn deflate +sets +.Fa strm->adler +to the Adler-32 checksum +of all input read so far +.Po +that is, +.Fa total_in +bytes +.Pc . +If a gzip stream is being generated, +then +.Fa strm->adler +will be the CRC-32 checksum of the input read so far. +See +.Xr deflateInit2 3 . +. +.Pp +.Fn deflate +may update +.Fa strm->data_type +if it can make a good guess +about the input data type +.Po +.Dv Z_BINARY +or +.Dv Z_TEXT +.Pc . +If in doubt, +the date is considered binary. +This field is only for information purposes +and does not affect the compression algorithm in any manner. +. +.Sh RETURN VALUES +.Fn deflate +returns +.Dv Z_OK +if some progress has been made +(more input processed or more output produced), +.Dv Z_STREAM_END +if all input has been consumed +and all output has been produced +.Po +only when +.Fa flush +is set to +.Dv Z_FINISH +.Pc , +.Dv Z_STREAM_ERROR +if the stream state was inconsistent +.Po +for example if +.Fa next_in +or +.Fa next_out +was +.Dv Z_NULL +or the state was inadvertently written over +by the application +.Pc , +or +.Dv Z_BUF_ERROR +if no progress is possible +.Po +for example +.Fa avail_in +or +.Fa avail_out +was zero +.Pc . +Note that +.Dv Z_BUF_ERROR +is not fatal, +and +.Fn deflate +can be called again with more input and more output space +to continue compressing. +. +.Sh SEE ALSO +.Xr deflateEnd 3 , +.Xr deflateInit 3 , +.Xr deflatePending 3 , +.Xr inflate 3 +. +.Sh HISTORY +This manual page was converted from +.In zlib.h +to mdoc format by +.An June McEnroe Aq Mt june@causal.agency . +. +.Sh AUTHORS +.An Jean-loup Gailly Aq Mt jloup@gzip.org +.An Mark Adler Aq Mt madler@alumni.caltech.edu diff --git a/doc/zlib/deflateBound.3 b/doc/zlib/deflateBound.3 new file mode 100644 index 00000000..be97494c --- /dev/null +++ b/doc/zlib/deflateBound.3 @@ -0,0 +1,71 @@ +.Dd January 15, 2017 +.Dt DEFLATEBOUND 3 +.Os +. +.Sh NAME +.Nm deflateBound +.Nd compressed size upper bound +. +.Sh LIBRARY +.Lb libz +. +.Sh SYNOPSIS +.In zlib.h +.Ft uLong +.Fn deflateBound "z_streamp strm" "uLong sourceLen" +. +.Sh DESCRIPTION +.Fn deflateBound +returns an upper bound +on the compressed size +after deflation of +.Fa sourceLen +bytes. +It must be called after +.Xr deflateInit 3 +or +.Xr deflateInit2 3 , +and after +.Xr deflateSetHeader 3 , +if used. +This would be used +to allocate an output buffer +for deflation in a single pass, +and so would be called before +.Xr deflate 3 . +If that first +.Fn deflate +call is provided the +.Fa sourceLen +input bytes, +an output buffer allocated +to the size returned by +.Fn deflateBound , +and the flush value +.Dv Z_FINISH , +then +.Fn deflate +is guaranteed to return +.Dv Z_STREAM_END . +Note that it is possible +for the compressed size +to be larger than the value returned by +.Fn deflateBound +if flush options other than +.Dv Z_FINISH +or +.Dv Z_NO_FLUSH +are used. +. +.Sh SEE ALSO +.Xr compressBound 3 +. +.Sh HISTORY +This manual page was converted from +.In zlib.h +to mdoc format by +.An June McEnroe Aq Mt june@causal.agency . +. +.Sh AUTHORS +.An Jean-loup Gailly Aq Mt jloup@gzip.org +.An Mark Adler Aq Mt madler@alumni.caltech.edu diff --git a/doc/zlib/deflateCopy.3 b/doc/zlib/deflateCopy.3 new file mode 100644 index 00000000..f20e0a9e --- /dev/null +++ b/doc/zlib/deflateCopy.3 @@ -0,0 +1,66 @@ +.Dd January 15, 2017 +.Dt DEFLATECOPY 3 +.Os +. +.Sh NAME +.Nm deflateCopy +.Nd copy deflate stream +. +.Sh LIBRARY +.Lb libz +. +.Sh SYNOPSIS +.In zlib.h +.Ft int +.Fn deflateCopy "z_streamp dest" "z_streamp source" +. +.Sh DESCRIPTION +Sets the destination stream +as a complete copy of the source stream. +. +.Pp +This function can be useful when +several compression strategies will be tried, +for example when there are several ways of +pre-processing the input data with a filter. +The streams that will be discarded +should then be freed by calling +.Xr deflateEnd 3 . +Note that +.Fn deflateCopy +duplicates the internal compression state +which can be quite large, +so this strategy is slow +and can consume lots of memory. +. +.Sh RETURN VALUES +.Fn deflateCopy +returns +.Dv Z_OK +if success, +.Dv Z_MEM_ERROR +if there was not enough memory, +.Dv Z_STREAM_ERROR +if the source stream state was inconsistent +.Po +such as +.Fa zalloc +being +.Dv Z_NULL +.Pc . +.Fa msg +is left unchanged +in both source and destination. +. +.Sh SEE ALSO +.Xr deflateInit 3 +. +.Sh HISTORY +This manual page was converted from +.In zlib.h +to mdoc format by +.An June McEnroe Aq Mt june@causal.agency . +. +.Sh AUTHORS +.An Jean-loup Gailly Aq Mt jloup@gzip.org +.An Mark Adler Aq Mt madler@alumni.caltech.edu diff --git a/doc/zlib/deflateEnd.3 b/doc/zlib/deflateEnd.3 new file mode 100644 index 00000000..0abaabe1 --- /dev/null +++ b/doc/zlib/deflateEnd.3 @@ -0,0 +1,50 @@ +.Dd January 15, 2017 +.Dt DEFLATEEND 3 +.Os +. +.Sh NAME +.Nm deflateEnd +.Nd free deflate stream +. +.Sh LIBRARY +.Lb libz +. +.Sh SYNOPSIS +.In zlib.h +.Ft int +.Fn deflateEnd "z_streamp strm" +. +.Sh DESCRIPTION +All dynamically allocated data structures +for this stream are freed. +This function discards any unprocessed input +and does not flush any pending output. +. +.Sh RETURN VALUES +.Fn deflateEnd +returns +.Dv Z_OK +if success, +.Dv Z_STREAM_ERROR +if the stream state was inconsistent, +.Dv Z_DATA_ERROR +if the stream was freed prematurely +(some input or output was discarded). +In the error case, +.Fa msg +may be set but then points to a static string +(which must not be deallocated). +. +.Sh SEE ALSO +.Xr deflate 3 , +.Xr deflateInit 3 +. +.Sh HISTORY +This manual page was converted from +.In zlib.h +to mdoc format by +.An June McEnroe Aq Mt june@causal.agency . +. +.Sh AUTHORS +.An Jean-loup Gailly Aq Mt jloup@gzip.org +.An Mark Adler Aq Mt madler@alumni.caltech.edu diff --git a/doc/zlib/deflateGetDictionary.3 b/doc/zlib/deflateGetDictionary.3 new file mode 100644 index 00000000..b9dabfe2 --- /dev/null +++ b/doc/zlib/deflateGetDictionary.3 @@ -0,0 +1,79 @@ +.Dd January 15, 2017 +.Dt DEFLATEGETDICTIONARY 3 +.Os +. +.Sh NAME +.Nm deflateGetDictionary +.Nd deflate sliding dictionary +. +.Sh LIBRARY +.Lb libz +. +.Sh SYNOPSIS +.In zlib.h +.Ft int +.Fo deflateGetDictionary +.Fa "z_streamp strm" +.Fa "Bytef *dictionary" +.Fa "uInt *dictLength" +.Fc +. +.Sh DESCRIPTION +Returns the sliding dictionary +being maintained by deflate. +.Fa dictLength +is set to the number of bytes in the dictionary, +and that many bytes are copied to +.Fa dictionary . +.Fa dictionary +must have enough space, +where 32768 bytes is always enough. +If +.Fn deflateGetDictionary +is called with +.Fa dictionary +equal to +.Dv Z_NULL , +then only the dictionary length is returned, +and nothing is copied. +Similarly, +if +.Fa dictLength +is +.Dv Z_NULL , +then it is not set. +. +.Pp +.Fn deflateGetDictionary +may return a length less than the window size, +even when more than the window size in input +has been provided. +It may return up to 258 bytes less in that case, +due to how zlib's implementation of deflate +manages the sliding window and lookahead for matches, +where matches can be up to 258 bytes long. +If the application needs the last window-size bytes of input, +then that would need to be saved by the application +outside of zlib. +. +.Sh RETURN VALUES +.Fn deflateGetDictionary +returns +.Dv Z_OK +on success, +or +.Dv Z_STREAM_ERROR +if the stream state is inconsistent. +. +.Sh SEE ALSO +.Xr deflateSetDictionary 3 +. +.Sh HISTORY +This manual page was converted from +.In zlib.h +to mdoc format by +.An June McEnroe Aq Mt june@causal.agency . +. +.Sh AUTHORS +.An Jean-loup Gailly Aq Mt jloup@gzip.org +.An Mark Adler Aq Mt madler@alumni.caltech.edu diff --git a/doc/zlib/deflateInit.3 b/doc/zlib/deflateInit.3 new file mode 100644 index 00000000..52179883 --- /dev/null +++ b/doc/zlib/deflateInit.3 @@ -0,0 +1,178 @@ +.Dd January 15, 2017 +.Dt DEFLATEINIT 3 +.Os +. +.Sh NAME +.Nm deflateInit +.Nd initialize deflate stream +. +.Sh LIBRARY +.Lb libz +. +.Sh SYNOPSIS +.In zlib.h +. +.Ft typedef voidpf +.Fo (*alloc_func) +.Fa "voidpf opaque" +.Fa "uInt items" +.Fa "uInt size" +.Fc +. +.Ft typedef void +.Fo (*free_func) +.Fa "voidpf opaque" +.Fa "voidpf address" +.Fc +. +.Bd -literal +typedef struct z_stream_s { + z_const Bytef *next_in; + uInt avail_in; + uLong total_in; + + Bytef *next_out; + uInt avail_out; + uLong total_out; + + z_const char *msg; + struct internal_state FAR *state; + + alloc_func zalloc; + free_func zfree; + voidpf opaque; + + int data_type; + uLong adler; + uLong reserved; +} z_stream; +.Ed +. +.Pp +.Vt typedef z_stream FAR *z_streamp; +. +.Ft int +.Fn deflateInit "z_streamp strm" "int level" +. +.Sh DESCRIPTION +Initializes the internal stream state for compression. +The fields +.Fa zalloc , +.Fa zfree +and +.Fa opaque +must be initialized before by the caller. +If +.Fa zalloc +and +.Fa zfree +are set to +.Dv Z_NULL , +.Fn deflateInit +updates them to use default allocation functions. +.Fn deflateInit +does not perform any compression: +this will be done by +.Xr deflate 3 . +. +.Pp +The compression +.Fa level +must be +.Dv Z_DEFAULT_COMPRESSION , +or between 0 and 9: +1 gives best speed, +9 gives best compression, +0 gives no compression at all +(the input data is simply copied a block at a time). +.Dv Z_DEFAULT_COMPRESSION +requests a default compromise between speed and compression +(currently equivalent to level 6). +. +.Pp +The fields of +.Vt z_stream +are as follows: +. +.Bl -tag -width "data_type" +.It Fa next_in +next input byte +.It Fa avail_in +number of bytes available at +.Fa next_in +.It Fa total_in +total number of input bytes read so far +.It Fa next_out +next output byte will go here +.It Fa avail_out +remaining free space at +.Fa next_out +.It Fa total_out +total number of bytes output so far +.It Fa msg +last error message, +.Dv NULL +if no error +.It Fa state +not visible by applications +.It Fa zalloc +used to allocate the internal state +.It Fa zfree +used to free the internal state +.It Fa opaque +private data object passed to +.Fa zalloc +and +.Fa zfree +.It data_type +best guess about the data type: +binary or text for +.Xr deflate 3 , +or the decoding state for +.Xr inflate 3 +.It adler +Adler-32 or CRC-32 value of the uncompressed data +.It reserved +reserved for future use +.El +. +.Sh RETURN VALUES +.Fn deflateInit +returns +.Dv Z_OK +if success, +.Dv Z_MEM_ERROR +if there was not enough memory, +.Dv Z_STREAM_ERROR +if +.Fa level +is not a valid compression level, +or +.Dv Z_VERSION_ERROR +if the zlib library version +.Pq Xr zlibVersion 3 +is incompatible with the version assumed by the caller +.Pq Dv ZLIB_VERSION . +.Fa msg +is set to null +if there is no error message. +. +.Sh SEE ALSO +.Xr deflate 3 , +.Xr deflateCopy 3 , +.Xr deflateEnd 3 , +.Xr deflateInit2 3 , +.Xr deflatePrime 3 , +.Xr deflateReset 3 , +.Xr deflateSetDictionary 3 , +.Xr deflateTune 3 +. +.Sh HISTORY +This manual page was converted from +.In zlib.h +to mdoc format by +.An June McEnroe Aq Mt june@causal.agency . +. +.Sh AUTHORS +.An Jean-loup Gailly Aq Mt jloup@gzip.org +.An Mark Adler Aq Mt madler@alumni.caltech.edu diff --git a/doc/zlib/deflateInit2.3 b/doc/zlib/deflateInit2.3 new file mode 100644 index 00000000..a7d68b99 --- /dev/null +++ b/doc/zlib/deflateInit2.3 @@ -0,0 +1,227 @@ +.Dd January 15, 2017 +.Dt DEFLATEINIT2 3 +.Os +. +.Sh NAME +.Nm deflateInit2 +.Nd deflate compression options +. +.Sh LIBRARY +.Lb libz +. +.Sh SYNOPSIS +.In zlib.h +.Ft int +.Fo deflateInit2 +.Fa "z_streamp strm" +.Fa "int level" +.Fa "int method" +.Fa "int windowBits" +.Fa "int memLevel" +.Fa "int strategy" +.Fc +. +.Sh DESCRIPTION +This is another version of +.Xr deflateInit 3 +with more compression options. +The fields +.Fa next_in , +.Fa zalloc , +.Fa zfree +and +.Fa opaque +must be initialized before by the caller. +. +.Pp +The +.Fa method +parameter is the compression method. +It must be +.Dv Z_DEFLATED +in this version of the library. +. +.Pp +The +.Fa windowBits +parameter is the base two logarithm +of the window size +(the size of the history buffer). +It should be in the range 8..15 +for this version of the library. +Larger values of this parameter +result in better compression +at the expense of memory usage. +The default value is 15 if +.Xr deflateInit 3 +is used instead. +. +.Pp +For the current implementation of +.Xr deflate 3 , +a +.Fa windowBits +value of 8 +(a window size of 256 bytes) +is not supported. +As a result, +a request for 8 +will result in 9 +(a 512-byte window). +In that case, +providing 8 to +.Xr inflateInit2 3 +will result in an error +when the zlib header with 9 +is checked against the initialization of +.Xr inflate 3 . +The remedy is to not use 8 with +.Fn deflateInit2 +with this initialization, +or at least in that case use 9 with +.Xr inflateInit2 3 . +. +.Pp +.Fa windowBits +can also be -8..-15 for raw deflate. +In this case, +.Fa -windowBits +determines the window size. +.Xr deflate 3 +will then generate raw deflate data +with no zlib header or trailer, +and will not compute a check value. +. +.Pp +.Fa windowBits +can also be greater than 15 +for optional gzip encoding. +Add 16 to +.Fa windowBits +to write a simple gzip header and trailer +around the compressed data +instead of a zlib wrapper. +The gzip header will have +no file name, +no extra data, +no comment, +no modification time (set to zero), +no header CRC, +and the operating system will be set +to the appropriate value, +if the operating system was determined at compile time. +If a gzip stream is being written, +.Fa strm->adler +is a CRC-32 instead of an Adler-32. +. +.Pp +For raw deflate or gzip encoding, +a request for a 256-byte window +is rejected as invalid, +since only the zlib header provides +a means of transmitting the window size +to the decompressor. +. +.Pp +The +.Fa memLevel +parameter specifies how much memory should be allocated +for the internal compression state. +.Fa memLevel=1 +uses minimum memory +but is slow and reduces compression ratio; +.Fa memLevel=9 +uses maximum memory for optimal speed. +The default value is 8. +See +.In zconf.h +for total memory usage +as a function of +.Fa windowBits +and +.Fa memLevel . +. +.Pp +The +.Fa strategy +parameter is used to tune the compression algorithm. +Use the value +.Dv Z_DEFAULT_STRATEGY +for normal data, +.Dv Z_FILTERED +for data produced by a filter +(or predictor), +.Dv Z_HUFFMAN_ONLY +to force Huffman encoding only +(no string match), +or +.Dv Z_RLE +to limit match distances to one +(run-length encoding). +Filtered data consists mostly of small values +with a somewhat random distribution. +In this case, +the compression algorithm +is tuned to compress them better. +The effect of +.Dv Z_FILTERED +is to force more Huffman coding +and less string matching; +it is somewhat intermediate between +.Dv Z_DEFAULT_STRATEGY +and +.Dv Z_HUFFMAN_ONLY . +.Dv Z_RLE +is designed to be almost as fast as +.Dv Z_HUFFMAN_ONLY , +but give better compression for PNG image data. +The +.Fa strategy +parameter only affects the compression ratio +but not the correctness of the compressed output +even if it is not set appropriately. +.Dv Z_FIXED +prevents the use of dynamic Huffman codes, +allowing for a simpler decoder +for special applications. +. +.Pp +.Fn deflateInit2 +does not perform any compression: +this will be done by +.Xr deflate 3 . +. +.Sh RETURN VALUES +.Fn deflateInit2 +returns +.Dv Z_OK +if success, +.Dv Z_MEM_ERROR +if there was not enough memory, +.Dv Z_STREAM_ERROR +if any parameter is invalid +(such as invalid method), +or +.Dv Z_VERSION_ERROR +if the zlib library version +.Pq Xr zlibVersion 3 +is incompatible with the version assumed by the caller +.Pq Dv ZLIB_VERSION . +.Fa msg +is set to null if there is no error message. +. +.Sh SEE ALSO +.Xr deflate 3 , +.Xr deflateInit 3 , +.Xr deflateParams 3 , +.Xr deflateSetHeader 3 +. +.Sh HISTORY +This manual page was converted from +.In zlib.h +to mdoc format by +.An June McEnroe Aq Mt june@causal.agency . +. +.Sh AUTHORS +.An Jean-loup Gailly Aq Mt jloup@gzip.org +.An Mark Adler Aq Mt madler@alumni.caltech.edu diff --git a/doc/zlib/deflateParams.3 b/doc/zlib/deflateParams.3 new file mode 100644 index 00000000..9eb5ca16 --- /dev/null +++ b/doc/zlib/deflateParams.3 @@ -0,0 +1,123 @@ +.Dd January 15, 2017 +.Dt DEFLATEPARAMS 3 +.Os +. +.Sh NAME +.Nm deflateParams +.Nd update compression level and strategy +. +.Sh LIBRARY +.Lb libz +. +.Sh SYNOPSIS +.In zlib.h +.Ft int +.Fn deflateParams "z_streamp strm" "int level" "int strategy" +. +.Sh DESCRIPTION +Dynamically update the compression level +and compression strategy. +The interpretation of +.Fa level +and +.Fa strategy +is as in +.Xr deflateInit2 3 . +This can be used to switch between compression +and straight copy of the input data, +or to switch to a different kind of input data +requiring a different strategy. +If the compression approach +(which is a function of the level) +or the strategy is changed, +and if any input has been consumed +in a previous +.Xr deflate 3 +call, +then the input available so far is compressed +with the old level and strategy using +.Fn deflate strm Z_BLOCK . +There are three approaches +for the compression levels +0, 1..3, and 4..9 respectively. +The new level and strategy +will take effect at the next call of +.Xr deflate 3 . +. +.Pp +If a +.Fn deflate strm Z_BLOCK +is performed by +.Fn deflateParams , +and it does not have enough output space to complete, +then the parameter change will not take effect. +In this case, +.Fn deflateParams +can be called again +with the same parameters +and more output space +to try again. +. +.Pp +In order to assure a change in the parameters +on the first try, +the deflate stream should be flushed using +.Xr deflate 3 +with +.Dv Z_BLOCK +or other flush request until +.Fa strm.avail_out +is not zero, +before calling +.Fn deflateParams . +Then no more input data +should be provided before the +.Fn deflateParams +call. +If this is done, +the old level and strategy +will be applied +to the data compressed before +.Fn deflateParams , +and the new level and strategy +will be applied +to the data compressed after +.Fn deflateParams . +. +.Sh RETURN VALUES +.Fn deflateParams +returns +.Dv Z_OK +on success, +.Dv Z_STREAM_ERROR +if the source stream state was inconsistent +or if a parameter was invalid, +or +.Dv Z_BUF_ERROR +if there was not enough output space +to complete the compression +of the available input data +before a change in the strategy or approach. +Note that in the case of a +.Dv Z_BUF_ERROR , +the parameters are not changed. +A return value of +.Dv Z_BUF_ERROR +is not fatal, +in which case +.Fn deflateParams +can be retried +with more output space. +. +.Sh SEE ALSO +.Xr deflateInit2 3 +. +.Sh HISTORY +This manual page was converted from +.In zlib.h +to mdoc format by +.An June McEnroe Aq Mt june@causal.agency . +. +.Sh AUTHORS +.An Jean-loup Gailly Aq Mt jloup@gzip.org +.An Mark Adler Aq Mt madler@alumni.caltech.edu diff --git a/doc/zlib/deflatePending.3 b/doc/zlib/deflatePending.3 new file mode 100644 index 00000000..35fa6d38 --- /dev/null +++ b/doc/zlib/deflatePending.3 @@ -0,0 +1,56 @@ +.Dd January 15, 2017 +.Dt DEFLATEPENDING 3 +.Os +. +.Sh NAME +.Nm deflatePending +.Nd pending deflate output +. +.Sh LIBRARY +.Lb libz +. +.Sh SYNOPSIS +.In zlib.h +.Ft int +.Fn deflatePending "z_streamp strm" "unsigned *pending" "int *bits" +. +.Sh DESCRIPTION +.Fn deflatePending +returns the number of bytes and bits +of output that have been generated, +but not yet provided in the available output. +The bytes not provided would be due to +the available output space having been consumed. +The number of bits of output not provided +are between 0 and 7, +where they await more bits to join them +in order to fill out a full byte. +If +.Fa pending +or +.Fa bits +are +.Dv Z_NULL , +then those values are not set. +. +.Sh RETURN VALUES +.Fn deflatePending +returns +.Dv Z_OK +if success, +or +.Dv Z_STREAM_ERROR +if the source stream state was inconsistent. +. +.Sh SEE ALSO +.Xr deflate 3 +. +.Sh HISTORY +This manual page was converted from +.In zlib.h +to mdoc format by +.An June McEnroe Aq Mt june@causal.agency . +. +.Sh AUTHORS +.An Jean-loup Gailly Aq Mt jloup@gzip.org +.An Mark Adler Aq Mt madler@alumni.caltech.edu diff --git a/doc/zlib/deflatePrime.3 b/doc/zlib/deflatePrime.3 new file mode 100644 index 00000000..10a2924b --- /dev/null +++ b/doc/zlib/deflatePrime.3 @@ -0,0 +1,64 @@ +.Dd January 15, 2017 +.Dt DEFLATEPRIME 3 +.Os +. +.Sh NAME +.Nm deflatePrime +.Nd insert bits in deflate stream +. +.Sh LIBRARY +.Lb libz +. +.Sh SYNOPSIS +.In zlib.h +.Ft int +.Fn deflatePrime "z_streamp strm" "int bits" "int value" +. +.Sh DESCRIPTION +.Fn deflatePrime +inserts bits in the deflate output stream. +The intent is that this function +is used to start off the deflate output +with the bits leftover +from a previous deflate stream +when appending to it. +As such, +this function can only be used for raw deflate, +and must be used before the first +.Xr deflate 3 +call +after a +.Xr deflateInit2 3 +or +.Xr deflateReset 3 . +.Fa bits +must be less than or equal to 16, +and that many of the least significant bits of +.Fa value +will be inserted in the output. +. +.Sh RETURN VALUES +.Fn deflatePrime +returns +.Dv Z_OK +if success, +.Dv Z_BUF_ERROR +if there was not enough room +in the internal buffer +to insert the bits, +or +.Dv Z_STREAM_ERROR +if the source stream state was inconsistent. +. +.Sh SEE ALSO +.Xr deflateInit2 3 +. +.Sh HISTORY +This manual page was converted from +.In zlib.h +to mdoc format by +.An June McEnroe Aq Mt june@causal.agency . +. +.Sh AUTHORS +.An Jean-loup Gailly Aq Mt jloup@gzip.org +.An Mark Adler Aq Mt madler@alumni.caltech.edu diff --git a/doc/zlib/deflateReset.3 b/doc/zlib/deflateReset.3 new file mode 100644 index 00000000..1a18c507 --- /dev/null +++ b/doc/zlib/deflateReset.3 @@ -0,0 +1,57 @@ +.Dd January 15, 2017 +.Dt DEFLATERESET 3 +.Os +. +.Sh NAME +.Nm deflateReset +.Nd reset deflate stream +. +.Sh LIBRARY +.Lb libz +. +.Sh SYNOPSIS +.In zlib.h +.Ft int +.Fn deflateReset "z_streamp strm" +. +.Sh DESCRIPTION +This function is equivalent to +.Xr deflateEnd 3 +followed by +.Xr deflateInit 3 , +but does not free and reallocate +the internal compression state. +The stream will leave the compression level +and any other attributes +that may have been set unchanged. +. +.Sh RETURN VALUES +.Fn deflateReset +returns +.Dv Z_OK +if success, +or +.Dv Z_STREAM_ERROR +if the source stream state was inconsistent +.Po +such as +.Fa zalloc +or +.Fa state +being +.Dv Z_NULL +.Pc . +. +.Sh SEE ALSO +.Xr deflateEnd 3 , +.Xr deflateInit 3 +. +.Sh HISTORY +This manual page was converted from +.In zlib.h +to mdoc format by +.An June McEnroe Aq Mt june@causal.agency . +. +.Sh AUTHORS +.An Jean-loup Gailly Aq Mt jloup@gzip.org +.An Mark Adler Aq Mt madler@alumni.caltech.edu diff --git a/doc/zlib/deflateSetDictionary.3 b/doc/zlib/deflateSetDictionary.3 new file mode 100644 index 00000000..3e66d3cf --- /dev/null +++ b/doc/zlib/deflateSetDictionary.3 @@ -0,0 +1,142 @@ +.Dd January 15, 2017 +.Dt DEFLATESETDICTIONARY 3 +.Os +. +.Sh NAME +.Nm deflateSetDictionary +.Nd initialize compression dictionary +. +.Sh LIBRARY +.Lb libz +. +.Sh SYNOPSIS +.In zlib.h +.Ft int +.Fo deflateSetDictionary +.Fa "z_streamp strm" +.Fa "const Bytef *dictionary" +.Fa "uInt dictLength" +.Fc +. +.Sh DESCRIPTION +.Fn deflateSetDictionary +initializes the compression dictionary +from the given byte sequence +without producing any compressed output. +When using the zlib format, +this function must be called immediately after +.Xr deflateInit 3 , +.Xr deflateInit2 3 , +or +.Xr deflateReset 3 , +and before any call of +.Xr deflate 3 . +When doing raw deflate, +this function must be called +either before any call of +.Xr deflate 3 , +or immediately after the completion of a deflate block, +i.e. after all input has been consumed +and all output has been delivered +when using any of the flush options +.Dv Z_BLOCK , +.Dv Z_PARTIAL_FLUSH , +.Dv Z_SYNC_FLUSH , +or +.Dv Z_FULL_FLUSH . +The compressor and decompressor +must use exactly the same dictionary +.Po +see +.Xr inflateSetDictionary 3 +.Pc . +. +.Pp +The dictionary should consist of strings +(byte sequences) +that are likely to be encountered later +in the data to be compressed, +with the most commonly used strings +preferably put towards the end of the dictionary. +Using a dictionary is most useful +when the data to be compressed is short +and can be predicted with good accuracy; +the data can then be compressed better than +with the default empty dictionary. +. +.Pp +Depending on the size of +the compression data structures selected by +.Xr deflateInit 3 +or +.Xr deflateInit2 3 , +a part of the dictionary may in effect be discarded, +for example if the dictionary is larger +than the window size provided in +.Xr deflateInit 3 +or +.Xr deflateInit2 3 . +Thus the strings most likely to be useful +should be put at the end of the dictionary, +not at the front. +In addition, +the current implementation of deflate +will use at most the window size minus 262 bytes +of the provided dictionary. +. +.Pp +Upon return of this function, +.Fa strm->adler +is set to the Adler-32 value +of the dictionary; +the decompressor may later use this value +to determine which dictionary has been used +by the compressor. +(The Adler-32 value applies to the whole dictionary +even if only a subset of the dictionary +is actually used by the compressor.) +If a raw deflate was requested, +then the Adler-32 value is not computed and +.Fa strm->adler +is not set. +. +.Pp +.Fn deflateSetDictionary +does not perform any compression: +this will be done by +.Xr deflate 3 . +. +.Sh RETURN VALUES +.Fn deflateSetDictionary +returns +.Dv Z_OK +if success, +or +.Dv Z_STREAM_ERROR +if a parameter is invalid +.Po +e.g. dictionary being +.Dv Z_NULL +.Pc +or the stream state is inconsistent +.Po +for example if +.Xr deflate 3 +has already been called for this stream +or if not at a block boundary +for raw deflate +.Pc . +. +.Sh SEE ALSO +.Xr deflateGetDictionary 3 , +.Xr inflateSetDictionary 3 +. +.Sh HISTORY +This manual page was converted from +.In zlib.h +to mdoc format by +.An June McEnroe Aq Mt june@causal.agency . +. +.Sh AUTHORS +.An Jean-loup Gailly Aq Mt jloup@gzip.org +.An Mark Adler Aq Mt madler@alumni.caltech.edu diff --git a/doc/zlib/deflateSetHeader.3 b/doc/zlib/deflateSetHeader.3 new file mode 100644 index 00000000..03d4f4d3 --- /dev/null +++ b/doc/zlib/deflateSetHeader.3 @@ -0,0 +1,180 @@ +.Dd January 15, 2017 +.Dt DEFLATESETHEADER 3 +.Os +. +.Sh NAME +.Nm deflateSetHeader +.Nd set gzip header +. +.Sh LIBRARY +.Lb libz +. +.Sh SYNOPSIS +.In zlib.h +. +.Bd -literal +typedef struct gz_header_s { + int text; + uLong time; + int xflags; + int os; + Bytef *extra; + uInt extra_len; + uInt extra_max; + Bytef *name; + uInt name_max; + Bytef *comment; + uInt comm_max; + int hcrc; + int done; +} gz_header; +.Ed +. +.Pp +.Vt typedef gz_header FAR *gz_headerp; +. +.Ft int +.Fn deflateSetHeader "z_streamp strm" "gz_headerp head" +. +.Sh DESCRIPTION +.Fn deflateSetHeader +provides gzip header information +for when a gzip stream +is requested by +.Xr deflateInit2 3 . +.Fn deflateSetHeader +may be called after +.Xr deflateInit2 3 +or +.Xr deflateReset 3 +and before the first call of +.Xr deflate 3 . +The +text, +time, +OS, +extra field, +name, +and comment +information in the provided +.Vt gz_header +structure +are written to the gzip header +.Po +.Fa xflag +is ignored \(em +the extra flags are set +according to the compression level +.Pc . +The caller must assure that, +if not +.Dv Z_NULL , +.Fa name +and +.Fa comment +are terminated with a zero byte, +and that if +.Fa extra +is not +.Dv Z_NULL , +that +.Fa extra_len +bytes are available there. +If +.Fa hcrc +is true, +a gzip header CRC is included. +Note that the current versions +of the command-line version of +.Xr gzip 1 +(up through version 1.3.x) +do not support header CRCs, +and will report that it is a +"multi-part gzip file" +and give up. +. +.Pp +If +.Fn deflateSetHeader +is not used, +the default gzip header has +text false, +the time set to zero, +and OS set to 255, +with no extra, name, or comment fields. +The gzip header is returned +to the default state by +.Xr deflateReset 3 . +. +.Pp +The fields of +.Vt gz_header +are as follows: +. +.Bl -tag -width "extra_len" +.It Fa text +true if compressed data believed to be text +.It Fa time +modification time +.It Fa xflags +extra flags +(not used when writing a gzip file) +.It Fa os +operating system +.It Fa extra +pointer to extra field or +.Dv Z_NULL +if none +.It Fa extra_len +extra field length +.Po +valid if +.Fa extra +!= +.Dv Z_NULL +.Pc +.It Fa extra_max +space at extra +(only when reading header) +.It Fa name +pointer to zero-terminated file name or +.Dv Z_NULL +.It Fa name_max +space at +.Fa name +(only when reading header) +.It Fa comment +pointer to zero-terminated comment or +.Dv Z_NULL +.It Fa comm_max +space at comment +(only when reading header) +.It Fa hcrc +true if there was or will be a header CRC +.It Fa done +true when done reading gzip header +(not used when writing a gzip file) +.El +. +.Sh RETURN VALUES +.Fn deflateSetHeader +returns +.Dv Z_OK +if success, +or +.Dv Z_STREAM_ERROR +if the source stream state was inconsistent. +. +.Sh SEE ALSO +.Xr gzip 1 , +.Xr deflateInit2 3 +. +.Sh HISTORY +This manual page was converted from +.In zlib.h +to mdoc format by +.An June McEnroe Aq Mt june@causal.agency . +. +.Sh AUTHORS +.An Jean-loup Gailly Aq Mt jloup@gzip.org +.An Mark Adler Aq Mt madler@alumni.caltech.edu diff --git a/doc/zlib/deflateTune.3 b/doc/zlib/deflateTune.3 new file mode 100644 index 00000000..ea4dd915 --- /dev/null +++ b/doc/zlib/deflateTune.3 @@ -0,0 +1,70 @@ +.Dd January 15, 2017 +.Dt DEFLATETUNE 3 +.Os +. +.Sh NAME +.Nm deflateTune +.Nd fine tune compression parameters +. +.Sh LIBRARY +.Lb libz +. +.Sh SYNOPSIS +.In zlib.h +.Ft int +.Fo deflateTune +.Fa "z_streamp strm" +.Fa "int good_length" +.Fa "int max_lazy" +.Fa "int nice_length" +.Fa "int max_chain" +.Fc +. +.Sh DESCRIPTION +Fine tune deflate's internal compression parameters. +This should only be used +by someone who understands the algorithm +used by zlib's deflate +for searching for the best matching string, +and even then only by the most fanatic optimizer +trying to squeeze out the last compressed bit +for their specific input data. +Read the +.Pa deflate.c +source code for the meaning of the +.Fa max_lazy , +.Fa good_length , +.Fa nice_length , +and +.Fa max_chain +parameters. +. +.Pp +.Fn deflateTune +can be called after +.Xr deflateInit 3 +or +.Xr deflateInit2 3 . +. +.Sh RETURN VALUES +.Fn deflateTune +returns +.Dv Z_OK +on success, +or +.Dv Z_STREAM_ERROR +for an invalid deflate stream. +. +.Sh SEE ALSO +.Xr deflateInit 3 , +.Xr deflateInit2 3 +. +.Sh HISTORY +This manual page was converted from +.In zlib.h +to mdoc format by +.An June McEnroe Aq Mt june@causal.agency . +. +.Sh AUTHORS +.An Jean-loup Gailly Aq Mt jloup@gzip.org +.An Mark Adler Aq Mt madler@alumni.caltech.edu diff --git a/doc/zlib/gzbuffer.3 b/doc/zlib/gzbuffer.3 new file mode 100644 index 00000000..92438c48 --- /dev/null +++ b/doc/zlib/gzbuffer.3 @@ -0,0 +1,59 @@ +.Dd January 15, 2017 +.Dt GZBUFFER 3 +.Os +. +.Sh NAME +.Nm gzbuffer +.Nd set buffer size +. +.Sh LIBRARY +.Lb libz +. +.Sh SYNOPSIS +.In zlib.h +.Ft int +.Fn gzbuffer "gzFile file" "unsigned size" +. +.Sh DESCRIPTION +Set the internal buffer size +used by this library's functions. +The default buffer size is 8192 bytes. +This function must be called after +.Xr gzopen 3 +or +.Xr gzdopen 3 , +and before any other calls +that read or write the file. +The buffer memory allocation +is always deferred to the first read or write. +Three times that size in buffer space is allocated. +A larger buffer size of, +for example, +64K or 128K bytes +will noticeably increase the speed +of decompression (reading). +. +.Pp +The new buffer size also affects +the maximum length for +.Xr gzprintf 3 . +. +.Sh RETURN VALUES +.Fn gzbuffer +returns 0 on success, +or -1 on failure, +such as being called too late. +. +.Sh SEE ALSO +.Xr gzopen 3 , +.Xr gzprintf 3 +. +.Sh HISTORY +This manual page was converted from +.In zlib.h +to mdoc format by +.An June McEnroe Aq Mt june@causal.agency . +. +.Sh AUTHORS +.An Jean-loup Gailly Aq Mt jloup@gzip.org +.An Mark Adler Aq Mt madler@alumni.caltech.edu diff --git a/doc/zlib/gzclose.3 b/doc/zlib/gzclose.3 new file mode 100644 index 00000000..bfcc583e --- /dev/null +++ b/doc/zlib/gzclose.3 @@ -0,0 +1,97 @@ +.Dd January 15, 2017 +.Dt GZCLOSE 3 +.Os +. +.Sh NAME +.Nm gzclose , +.Nm gzclose_r , +.Nm gzclose_w +.Nd close compressed file +. +.Sh LIBRARY +.Lb libz +. +.Sh SYNOPSIS +.In zlib.h +.Ft int +.Fn gzclose "gzFile file" +.Ft int +.Fn gzclose_r "gzFile file" +.Ft int +.Fn gzclose_w "gzFile file" +. +.Sh DESCRIPTION +Flushes all pending output if necessary, +closes the compressed file +and deallocates the (de)compression state. +Note that once +.Fa file +is closed, +you cannot call +.Xr gzerror 3 +with +.Fa file , +since its structures +have been deallocated. +.Fn gzclose +must not be called more than once +on the same file, +just as +.Xr free 3 +must not be called more than once +on the same allocation. +. +.Pp +.Fn gzclose_r +and +.Fn gzclose_w +are the same as +.Fn gzclose , +but +.Fn gzclose_r +is only for use when reading, +and +.Fn gzclose_w +is only for use when writing or appending. +The advantage to using these instead of +.Fn gzclose +is that they avoid linking in +zlib compression or decompression code +that is not used when only reading +or only writing respectively. +If +.Fn gzclose +is used, +then both compression and decompression code +will be included in the application +when linking to a static zlib library. +. +.Sh RETURN VALUES +.Fn gzclose +will return +.Dv Z_STREAM_ERROR +if +.Fa file +is not valid, +.Dv Z_ERRNO +on a file operator error, +.Dv Z_MEM_ERROR +if out of memory, +.Dv Z_BUF_ERROR +if the last read ended in the middle of a gzip stream, +or +.Dv Z_OK +on success. +. +.Sh SEE ALSO +.Xr gzopen 3 +. +.Sh HISTORY +This manual page was converted from +.In zlib.h +to mdoc format by +.An June McEnroe Aq Mt june@causal.agency . +. +.Sh AUTHORS +.An Jean-loup Gailly Aq Mt jloup@gzip.org +.An Mark Adler Aq Mt madler@alumni.caltech.edu diff --git a/doc/zlib/gzdirect.3 b/doc/zlib/gzdirect.3 new file mode 100644 index 00000000..640fd4c5 --- /dev/null +++ b/doc/zlib/gzdirect.3 @@ -0,0 +1,85 @@ +.Dd January 15, 2017 +.Dt GZDIRECT 3 +.Os +. +.Sh NAME +.Nm gzdirect +.Nd check direct copy +. +.Sh LIBRARY +.Lb libz +. +.Sh SYNOPSIS +.In zlib.h +.Ft int +.Fn gzdirect "gzFile file" +. +.Sh DESCRIPTION +Returns true (1) if +.Fa file +is being copied directly while reading, +or false (0) if +.Fa file +is a gzip stream being decompressed. +. +.Pp +If the input file is empty, +.Fn gzdirect +will return true, +since the input does not contain a gzip stream. +. +.Pp +If +.Fn gzdirect +is used immediately after +.Xr gzopen 3 +or +.Xr gzdopen 3 +it will cause buffers to be allocated +to allow reading the file +to determine if it is a gzip file. +Therefore if +.Xr gzbuffer 3 +is used, +it should be called before +.Fn gzdirect . +. +.Pp +When writing, +.Fn gzdirect +returns true (1) +if transparent writing was requested +.Po +.Dq wT +for the +.Xr gzopen 3 +mode +.Pc , +or false (0) otherwise. +.Po +Note: +.Fn gzdirect +is not needed when writing. +Transparent writing +must be explicitly requested, +so the application already knows the answer. +When linking statically, +using +.Fn gzdirect +will include all of the zlib code +for gzip file reading and decompression, +which may not be desired. +.Pc +. +.Sh SEE ALSO +.Xr gzopen 3 +. +.Sh HISTORY +This manual page was converted from +.In zlib.h +to mdoc format by +.An June McEnroe Aq Mt june@causal.agency . +. +.Sh AUTHORS +.An Jean-loup Gailly Aq Mt jloup@gzip.org +.An Mark Adler Aq Mt madler@alumni.caltech.edu diff --git a/doc/zlib/gzeof.3 b/doc/zlib/gzeof.3 new file mode 100644 index 00000000..ba823aa6 --- /dev/null +++ b/doc/zlib/gzeof.3 @@ -0,0 +1,63 @@ +.Dd January 15, 2017 +.Dt GZEOF 3 +.Os +. +.Sh NAME +.Nm gzeof +.Nd check end-of-file indicator +. +.Sh LIBRARY +.Lb libz +. +.Sh SYNOPSIS +.In zlib.h +.Ft int +.Fn gzeof "gzFile file" +. +.Sh DESCRIPTION +Returns true (1) +if the end-of-file indicator +has been set while reading, +false (0) otherwise. +Note that the end-of-file indicator +is set only if the read +tried to go past the end of the input, +but came up short. +Therefore, +just like +.Xr feof 3 , +.Fn gzeof +may return false +even if there is no more data to read, +in the event that the last read request +was for the exact number of bytes +remaining in the input file. +This will happen if the input file size +is an exact multiple of the buffer size. +. +.Pp +If +.Fn gzeof +returns true, +then the read functions +will return no more data, +unless the end-of-file indicator +is reset by +.Xr gzclearerr 3 +and the input file +has grown since the previous +end of file was detected. +. +.Sh SEE ALSO +.Xr gzerror 3 , +.Xr gzread 3 +. +.Sh HISTORY +This manual page was converted from +.In zlib.h +to mdoc format by +.An June McEnroe Aq Mt june@causal.agency . +. +.Sh AUTHORS +.An Jean-loup Gailly Aq Mt jloup@gzip.org +.An Mark Adler Aq Mt madler@alumni.caltech.edu diff --git a/doc/zlib/gzerror.3 b/doc/zlib/gzerror.3 new file mode 100644 index 00000000..a9e175fc --- /dev/null +++ b/doc/zlib/gzerror.3 @@ -0,0 +1,75 @@ +.Dd January 15, 2017 +.Dt GZERROR 3 +.Os +. +.Sh NAME +.Nm gzerror , +.Nm gzclearerr +.Nd check and reset compressed file error +. +.Sh LIBRARY +.Lb libz +. +.Sh SYNOPSIS +.In zlib.h +.Ft const char * +.Fn gzerror "gzFile file" "int *errnum" +.Ft void +.Fn gzclearerr "gzFile file" +. +.Sh DESCRIPTION +.Fn gzerror +returns the error message for the last error +which occured on the given compressed file. +.Fa errnum +is set to the zlib error number. +If an error occurred in the file system +and not in the compression library, +.Fa errnum +is set to +.Dv Z_ERRNO +and the application may consult +.Va errno +to get the exact error code. +. +.Pp +The application must not modify the returned string. +Future calls to this function +may invalidate the previously returned string. +If +.Fa file +is closed, +then the string previously returned by +.Fn gzerror +will no longer be available. +. +.Pp +.Fn gzerror +should be used to distinguish errors from end-of-file +for those functions that do not distinguish those cases +in their return values. +. +.Pp +.Fn gzclearerr +clears the error and end-of-file for +.Fa file . +This is analogous to the +.Xr clearerr 3 +function in stdio. +This is useful for continuing to read a gzip file +that is being written concurrently. +. +.Sh SEE ALSO +.Xr gzeof 3 , +.Xr gzread 3 , +.Xr gzwrite 3 +. +.Sh HISTORY +This manual page was converted from +.In zlib.h +to mdoc format by +.An June McEnroe Aq Mt june@causal.agency . +. +.Sh AUTHORS +.An Jean-loup Gailly Aq Mt jloup@gzip.org +.An Mark Adler Aq Mt madler@alumni.caltech.edu diff --git a/doc/zlib/gzflush.3 b/doc/zlib/gzflush.3 new file mode 100644 index 00000000..476f7c09 --- /dev/null +++ b/doc/zlib/gzflush.3 @@ -0,0 +1,73 @@ +.Dd January 15, 2017 +.Dt GZFLUSH 3 +.Os +. +.Sh NAME +.Nm gzflush +.Nd flush output to compressed file +. +.Sh LIBRARY +.Lb libz +. +.Sh SYNOPSIS +.In zlib.h +.Ft int +.Fn gzflush "gzFile file" "int flush" +. +.Sh DESCRIPTION +Flushes all pending output +into the compressed file. +The parameter +.Fa flush +is as in the +.Xr deflate 3 +function. +.Fn gzflush +is only permitted when writing. +. +.Pp +If the +.Fa flush +parameter is +.Dv Z_FINISH , +the remaining data is written +and the gzip stream +is completed in the output. +If +.Xr gzwrite 3 +is called again, +a new gzip stream +will be started in the output. +.Xr gzread 3 +is able to read +such concatenated gzip streams. +. +.Pp +.Fn gzflush +should be called only when strictly necessary +because it will degrade compression +if called too often. +. +.Sh RETURN VALUES +The return value +is the zlib error number +.Po +see function +.Xr gzerror 3 +.Pc . +. +.Sh SEE ALSO +.Xr deflate 3 , +.Xr gzerror 3 , +.Xr gzread 3 , +.Xr gzwrite 3 +. +.Sh HISTORY +This manual page was converted from +.In zlib.h +to mdoc format by +.An June McEnroe Aq Mt june@causal.agency . +. +.Sh AUTHORS +.An Jean-loup Gailly Aq Mt jloup@gzip.org +.An Mark Adler Aq Mt madler@alumni.caltech.edu diff --git a/doc/zlib/gzfread.3 b/doc/zlib/gzfread.3 new file mode 100644 index 00000000..7bf57fc5 --- /dev/null +++ b/doc/zlib/gzfread.3 @@ -0,0 +1,107 @@ +.Dd January 15, 2017 +.Dt GZFREAD 3 +.Os +. +.Sh NAME +.Nm gzfread +.Nd read from compressed file +. +.Sh LIBRARY +.Lb libz +. +.Sh SYNOPSIS +.In zlib.h +.Ft z_size_t +.Fn gzfread "voidp buf" "z_size_t size" "z_size_t nitems" "gzFile file" +. +.Sh DESCRIPTION +Read up to +.Fa nitems +of size +.Fa size +from +.Fa file +to +.Fa buf , +otherwise operating as +.Xr gzread 3 +does. +This duplicates the interface of stdio's +.Xr fread 3 , +with +.Vt size_t +request and return types. +If the library defines +.Vt size_t , +then +.Vt z_size_t +is identical to +.Vt size_t . +If not, +then +.Vt z_size_t +is an unsigned integer type +that can contain a pointer. +. +.Pp +In the event that the end of file is reached +and only a partial item is available at the end, +i.e. the remaining uncompressed data length +is not a multiple of +.Fa size , +then the file partial item +is nevertheless read into +.Fa buf +and the end-of-file flag is set. +The length of the partial item read +is not provided, +but could be inferred from the result of +.Xr gztell 3 . +This behavior is the same as the behavior of +.Xr fread 3 +implementations in common libraries, +but it prevents the direct use of +.Fn gzfread +to read a concurrently written file, +reseting and retrying on end-of-file, +when +.Fa size +is not 1. +. +.Sh RETURN VALUES +.Fn gzfread +returns the number of full items read of size +.Fa size , +or zero if the end of the file was reached +and a full item could not be read, +or if there was an error. +.Xr gzerror 3 +must be consulted if zero is returned +in order to determine if there was an error. +If the multiplication of +.Fa size +and +.Fa nitems +overflows, +i.e. the product does not fit in +.Vt z_size_t , +then nothing is read, +zero is returned, +and the error state is set to +.Dv Z_STREAM_ERROR . +. +.Sh SEE ALSO +.Xr gzeof 3 , +.Xr gzerror 3 , +.Xr gzopen 3 , +.Xr gzread 3 +. +.Sh HISTORY +This manual page was converted from +.In zlib.h +to mdoc format by +.An June McEnroe Aq Mt june@causal.agency . +. +.Sh AUTHORS +.An Jean-loup Gailly Aq Mt jloup@gzip.org +.An Mark Adler Aq Mt madler@alumni.caltech.edu diff --git a/doc/zlib/gzfwrite.3 b/doc/zlib/gzfwrite.3 new file mode 100644 index 00000000..6835db3a --- /dev/null +++ b/doc/zlib/gzfwrite.3 @@ -0,0 +1,75 @@ +.Dd January 15, 2017 +.Dt GZFWRITE 3 +.Os +. +.Sh NAME +.Nm gzfwrite +.Nd write to compressed file +. +.Sh LIBRARY +.Lb libz +. +.Sh SYNOPSIS +.In zlib.h +.Ft z_size_t +.Fn gzfwrite "voidpc buf" "z_size_t size" "z_size_t nitems" "gzFile file" +. +.Sh DESCRIPTION +.Fn gzfwrite +writes +.Fa nitems +items of size +.Fa size +from +.Fa buf +to +.Fa file , +duplicating the interface of stdio's +.Xr fwrite 3 , +with +.Vt size_t +request and return types. +If the library defines +.Vt size_t , +then +.Vt z_size_t +is identical to +.Vt size_t . +If not, +then +.Vt z_size_t +is an unsigned integer type +that can contain a pointer. +. +.Sh RETURN VALUES +.Fn gzfwrite +returns the number of full items +written of size +.Fa size , +or zero if there was an error. +If the multiplication of +.Fa size +and +.Fa nitems +overflows, +i.e. the product does not fit in a +.Vt z_size_t , +then nothing is written, +zero is returned, +and the error state is set to +.Dv Z_STREAM_ERROR . +. +.Sh SEE ALSO +.Xr gzerror 3 , +.Xr gzopen 3 , +.Xr gzwrite 3 +. +.Sh HISTORY +This manual page was converted from +.In zlib.h +to mdoc format by +.An June McEnroe Aq Mt june@causal.agency . +. +.Sh AUTHORS +.An Jean-loup Gailly Aq Mt jloup@gzip.org +.An Mark Adler Aq Mt madler@alumni.caltech.edu diff --git a/doc/zlib/gzgetc.3 b/doc/zlib/gzgetc.3 new file mode 100644 index 00000000..db9143ec --- /dev/null +++ b/doc/zlib/gzgetc.3 @@ -0,0 +1,55 @@ +.Dd January 15, 2017 +.Dt GZGETC 3 +.Os +. +.Sh NAME +.Nm gzgetc +.Nd get character from compressed file +. +.Sh LIBRARY +.Lb libz +. +.Sh SYNOPSIS +.In zlib.h +.Ft int +.Fn gzgetc "gzFile file" +. +.Sh DESCRIPTION +Reads one byte from the compressed file. +This is implemented as a macro for speed. +As such, +it does not do all of the checking +the other functions do. +I.e.\& +it does not check to see if +.Fa file +is +.Dv NULL , +nor whether the structure +.Fa file +points to has been clobbered or not. +. +.Sh RETURN VALUES +.Fn gzgetc +returns the byte +or -1 in case of +end of file +or error. +. +.Sh SEE ALSO +.Xr gzeof 3 , +.Xr gzerror 3 , +.Xr gzgets 3 , +.Xr gzopen 3 , +.Xr gzread 3 , +.Xr gzungetc 3 +. +.Sh HISTORY +This manual page was converted from +.In zlib.h +to mdoc format by +.An June McEnroe Aq Mt june@causal.agency . +. +.Sh AUTHORS +.An Jean-loup Gailly Aq Mt jloup@gzip.org +.An Mark Adler Aq Mt madler@alumni.caltech.edu diff --git a/doc/zlib/gzgets.3 b/doc/zlib/gzgets.3 new file mode 100644 index 00000000..c1435b39 --- /dev/null +++ b/doc/zlib/gzgets.3 @@ -0,0 +1,67 @@ +.Dd January 15, 2017 +.Dt GZGETS 3 +.Os +. +.Sh NAME +.Nm gzgets +.Nd read line from compressed file +. +.Sh LIBRARY +.Lb libz +. +.Sh SYNOPSIS +.In zlib.h +.Ft char * +.Fn gzgets "gzFile file" "char *buf" "int len" +. +.Sh DESCRIPTION +Reads bytes from the compressed file +until +.Fa len-1 +characters are read, +or a newline character +is read and transferred to +.Fa buf , +or an end-of-file condition +is encountered. +If any characters are read or if +.Fa len +== 1, +the string is terminated +with a null character. +If no characters are read +due to an end-of-file or +.Fa len +< 1, +then the buffer is left untouched. +. +.Sh RETURN VALUES +.Fn gzgets +returns +.Fa buf +which is a null-terminated string, +or it returns +.Dv NULL +for end-of-file +or in case of error. +If there was an error, +the contents at +.Fa buf +are indeterminate. +. +.Sh SEE ALSO +.Xr gzeof 3 , +.Xr gzerror 3 , +.Xr gzgetc 3 , +.Xr gzopen 3 , +.Xr gzread 3 +. +.Sh HISTORY +This manual page was converted from +.In zlib.h +to mdoc format by +.An June McEnroe Aq Mt june@causal.agency . +. +.Sh AUTHORS +.An Jean-loup Gailly Aq Mt jloup@gzip.org +.An Mark Adler Aq Mt madler@alumni.caltech.edu diff --git a/doc/zlib/gzoffset.3 b/doc/zlib/gzoffset.3 new file mode 100644 index 00000000..b03c557e --- /dev/null +++ b/doc/zlib/gzoffset.3 @@ -0,0 +1,51 @@ +.Dd January 15, 2017 +.Dt GZOFFSET 3 +.Os +. +.Sh NAME +.Nm gzoffset +.Nd offset in compressed file +. +.Sh LIBRARY +.Lb libz +. +.Sh SYNOPSIS +.In zlib.h +.Ft z_off_t +.Fn gzoffset "gzFile file" +. +.Sh DESCRIPTION +Returns the current offset +in the file being read or written. +This offset includes +the count of bytes +that precede the gzip stream, +for example when appending +or when using +.Xr gzdopen 3 +for reading. +When reading, +the offset does not include +as yet unused buffered input. +This information can be used +for a progress indicator. +. +.Sh RETURN VALUES +On error, +.Fn gzoffset +returns -1. +. +.Sh SEE ALSO +.Xr gzerror 3 , +.Xr gzopen 3 , +.Xr gzseek 3 +. +.Sh HISTORY +This manual page was converted from +.In zlib.h +to mdoc format by +.An June McEnroe Aq Mt june@causal.agency . +. +.Sh AUTHORS +.An Jean-loup Gailly Aq Mt jloup@gzip.org +.An Mark Adler Aq Mt madler@alumni.caltech.edu diff --git a/doc/zlib/gzopen.3 b/doc/zlib/gzopen.3 new file mode 100644 index 00000000..9da647e1 --- /dev/null +++ b/doc/zlib/gzopen.3 @@ -0,0 +1,261 @@ +.Dd January 15, 2017 +.Dt GZOPEN 3 +.Os +. +.Sh NAME +.Nm gzopen , +.Nm gzdopen +.Nd open gzip file +. +.Sh LIBRARY +.Lb libz +. +.Sh SYNOPSIS +.In zlib.h +.Ft gzFile +.Fn gzopen "const char *path" "const char *mode" +.Ft gzFile +.Fn gzdopen "int fd" "const char *mode" +. +.Sh DESCRIPTION +Opens a gzip (.gz) file +for reading or writing. +The +.Fa mode +parameter is as in +.Xr fopen 3 +.Po +.Dq rb +or +.Dq wb +.Pc +but can also include a compression level +.Pq Dq wb9 +or a strategy: +.Sq f +for filtered data as in +.Dq wb6f , +.Sq h +for Huffman-only compression as in +.Dq wb1h , +.Sq R +for run-length encoding as in +.Dq wb1R , +or +.Sq F +for fixed code compression as in +.Dq wb9F . +.Po +See the description of +.Xr deflateInit2 3 +for more information about the +.Fa strategy +parameter. +.Pc \& +.Sq T +will request transparent writing or appending +with no compression +and not using the gzip format. +. +.Pp +.Dq a +can be used instead of +.Dq w +to request that the gzip stream +that will be written +be appended to the file. +.Dq + +will result in an error, +since reading and writing +to the same gzip file +is not supported. +The addition of +.Dq x +when writing will create the file exclusively, +which fails if the file already exists. +On systems that support it, +the addition of +.Dq e +when reading or writing +will set the flag to close the file on an +.Xr execve 2 +call. +. +.Pp +These functions, +as well as +.Xr gzip 1 , +will read and decode +a sequence of gzip streams in a file. +The append function of +.Fn gzopen +can be used to create such a file. +.Po +Also see +.Xr gzflush 3 +for another way to do this. +.Pc \& +When appending, +.Fn gzopen +does not test whether the file begins with a gzip stream, +nor does it look for the end of the gzip streams +to begin appending. +.Fn gzopen +will simply append a gzip stream +to the existing file. +. +.Pp +.Fn gzopen +can be used to read a file which is not in gzip format; +in this case +.Xr gzread 3 +will directly read from the file without decompression. +When reading, +this will be detected automatically +by looking for the magic two-byte gzip header. +. +.Pp +.Fn gzdopen +associates at +.Vt gzFile +with the file descriptor +.Fa fd . +File descriptors +are obtained from calls like +.Xr open 2 , +.Xr dup 2 , +.Xr creat 2 , +.Xr pipe 2 +or +.Xr fileno 3 +.Po +if the file has been previously opened with +.Xr fopen 3 +.Pc . +The +.Fa mode +parameter is as in +.Fn gzopen . +. +.Pp +The next call of +.Xr gzclose 3 +on the returned +.Vt gzFile +will also close the file descriptor +.Fa fd , +just like +.Xr fclose 3 . +If you want to keep +.Fa fd +open, +use +.Li "fd = dup(fd_keep); gz = gzdopen(fd, mode)" . +The duplicated descriptor should be saved +to avoid a leak, +since +.Fn gzdopen +does not close +.Fa fd +if it fails. +If you are using +.Xr fileno 3 +to get the file descriptor from a +.Vt FILE * , +then you will have to use +.Xr dup 2 +to avoid double-closing +the file descriptor. +Both +.Xr gzclose 3 +and +.Xr flcose 3 +will close the associated file descriptor, +so they need to have different file descriptors. +. +.Sh RETURN VALUES +.Fn gzopen +and +.Fn gzdopen +return +.Dv NULL +if the file could not be opened, +if there was insufficient memory +to allocate the +.Vt gzFile +state, +or if an invalid +.Fa mode +was specified +.Po +an +.Sq r , +.Sq w , +or +.Sq a +was not provided, +or +.Sq + +was provided +.Pc , +or if +.Fa fd +is -1. +The file descriptor +is not used until the next +gz* read, write, seek, or close operation, +so +.Fn gzdopen +will not detect if +.Fa fd +is invalid +.Po +unless +.Fa fd +is -1 +.Pc . +.Va errno +can be checked +to determine if the reason +.Fn gzopen +failed was that the file +could not be opened. +. +.Sh ERRORS +The +.Fn gzopen +function may fail and set +.Va errno +for any of the errors specified +for the routine +.Xr fopen 3 . +. +.Sh SEE ALSO +.Xr deflateInit2 3 , +.Xr fopen 3 , +.Xr gzbuffer 3 , +.Xr gzclose 3 , +.Xr gzdirect 3 , +.Xr gzeof 3 , +.Xr gzerror 3 , +.Xr gzflush 3 , +.Xr gzgetc 3 , +.Xr gzgets 3 , +.Xr gzoffset 3 , +.Xr gzprintf 3 , +.Xr gzputc 3 , +.Xr gzputs 3 , +.Xr gzread 3 , +.Xr gzseek 3 , +.Xr gzsetparams 3 , +.Xr gzwrite 3 +. +.Sh HISTORY +This manual page was converted from +.In zlib.h +to mdoc format by +.An June McEnroe Aq Mt june@causal.agency . +. +.Sh AUTHORS +.An Jean-loup Gailly Aq Mt jloup@gzip.org +.An Mark Adler Aq Mt madler@alumni.caltech.edu diff --git a/doc/zlib/gzprintf.3 b/doc/zlib/gzprintf.3 new file mode 100644 index 00000000..a2a241a2 --- /dev/null +++ b/doc/zlib/gzprintf.3 @@ -0,0 +1,71 @@ +.Dd January 15, 2017 +.Dt GZPRINTF 3 +.Os +. +.Sh NAME +.Nm gzprintf +.Nd format output to compressed file +. +.Sh LIBRARY +.Lb libz +. +.Sh SYNOPSIS +.In zlib.h +.Ft int +.Fn gzprintf "gzFile file" "const char *format" "..." +. +.Sh DESCRIPTION +Converts, formats, and writes the arguments +to the compressed file +under control of the format string, +as in +.Xr fprintf 3 . +. +.Sh RETURN VALUES +.Fn gzprintf +returns the number of +uncompressed bytes actually written, +or a negative zlib error code +in case of error. +The number of uncompressed bytes written +is limited to 8191, +or one less than the buffer size given to +.Xr gzbuffer 3 . +The caller should assure that +this limit is not exceeded. +If it is exceeded, +then +.Fn gzprintf +will return an error (0) +with nothing written. +In this case, +there may also be a buffer overflow +with unpredictable consequences, +which is possibly only if zlib +was compiled with the insecure functions +.Xr sprintf 3 +or +.Xr vsprintf 3 +because the secure +.Xr snprintf 3 +or +.Xr vsnprintf 3 +functions +were not available. +This can be determined using +.Xr zlibCompileFlags 3 . +. +.Sh SEE ALSO +.Xr fprintf 3 , +.Xr gzerror 3 , +.Xr gzopen 3 +. +.Sh HISTORY +This manual page was converted from +.In zlib.h +to mdoc format by +.An June McEnroe Aq Mt june@causal.agency . +. +.Sh AUTHORS +.An Jean-loup Gailly Aq Mt jloup@gzip.org +.An Mark Adler Aq Mt madler@alumni.caltech.edu diff --git a/doc/zlib/gzputc.3 b/doc/zlib/gzputc.3 new file mode 100644 index 00000000..66897b5e --- /dev/null +++ b/doc/zlib/gzputc.3 @@ -0,0 +1,43 @@ +.Dd January 15, 2017 +.Dt GZPUTC 3 +.Os +. +.Sh NAME +.Nm gzputc +.Nd write character to compressed file +. +.Sh LIBRARY +.Lb libz +. +.Sh SYNOPSIS +.In zlib.h +.Ft int +.Fn gzputc "gzFile file" "int c" +. +.Sh DESCRIPTION +Writes +.Fa c , +converted to an +.Vt unsigned char , +into the compressed file. +. +.Sh RETURN VALUES +.Fn gzputc +returns the value that was written, +or -1 in case of error. +. +.Sh SEE ALSO +.Xr gzerror 3 , +.Xr gzopen 3 , +.Xr gzputs 3 , +.Xr gzwrite 3 +. +.Sh HISTORY +This manual page was converted from +.In zlib.h +to mdoc format by +.An June McEnroe Aq Mt june@causal.agency . +. +.Sh AUTHORS +.An Jean-loup Gailly Aq Mt jloup@gzip.org +.An Mark Adler Aq Mt madler@alumni.caltech.edu diff --git a/doc/zlib/gzputs.3 b/doc/zlib/gzputs.3 new file mode 100644 index 00000000..71833ab2 --- /dev/null +++ b/doc/zlib/gzputs.3 @@ -0,0 +1,41 @@ +.Dd January 15, 2017 +.Dt GZPUTS 3 +.Os +. +.Sh NAME +.Nm gzputs +.Nd write string to compressed file +. +.Sh LIBRARY +.Lb libz +. +.Sh SYNOPSIS +.In zlib.h +.Ft int +.Fn gzputs "gzFile file" "const char *s" +. +.Sh DESCRIPTION +Writes the given null-terminated string +to the compressed file, +excluding the terminating null character. +. +.Sh RETURN VALUES +.Fn gzputs +returns the number of characters written, +or -1 in case of error. +. +.Sh SEE ALSO +.Xr gzerror 3 , +.Xr gzopen 3 , +.Xr gzputc 3 , +.Xr gzwrite 3 +. +.Sh HISTORY +This manual page was converted from +.In zlib.h +to mdoc format by +.An June McEnroe Aq Mt june@causal.agency . +. +.Sh AUTHORS +.An Jean-loup Gailly Aq Mt jloup@gzip.org +.An Mark Adler Aq Mt madler@alumni.caltech.edu diff --git a/doc/zlib/gzread.3 b/doc/zlib/gzread.3 new file mode 100644 index 00000000..4118eca7 --- /dev/null +++ b/doc/zlib/gzread.3 @@ -0,0 +1,115 @@ +.Dd January 15, 2017 +.Dt GZREAD 3 +.Os +. +.Sh NAME +.Nm gzread +.Nd read from compressed file +. +.Sh LIBRARY +.Lb libz +. +.Sh SYNOPSIS +.In zlib.h +.Ft int +.Fn gzread "gzFile file" "voidp buf" "unsigned len" +. +.Sh DESCRIPTION +Reads the given number of uncompressed bytes +from the compressed file. +If the input file +is not in gzip format, +.Fn gzread +copies the given number of bytes +into the buffer directly from the file. +. +.Pp +After reaching the end of a gzip stream +in the input, +.Fn gzread +will continue to read, +looking for another gzip stream. +Any number of gzip streams +may be concatenated in the input file, +and will all be decompressed by +.Fn gzread . +If something other than a gzip stream +is encountered after a gzip stream, +that remaining trailing garbage is ignored +(and no error is returned). +. +.Pp +.Fn gzread +can be used to read a gzip file +that is being concurrently written. +Upon reaching the end of the input, +.Fn gzread +will return with the available data. +If the error code returned by +.Xr gzerror 3 +is +.Dv Z_OK +or +.Dv Z_BUF_ERROR , +then +.Xr gzclearerr 3 +can be used +to clear the end of file indicator +in order to permit +.Fn gzread +to be tried again. +.Dv Z_OK +indicates that a gzip stream was completed +on the last +.Fn gzread . +.Dv Z_BUF_ERROR +indicates that the input file +ended in the middle of a gzip stream. +Note that +.Fn gzread +does not return -1 +in the event of an incomplete gzip stream. +This error is deferred until +.Xr gzclose 3 , +which will return +.Dv Z_BUF_ERROR +if the last +.Fn gzread +ended in the middle of a gzip stream. +Alternatively, +.Xr gzerror 3 +can be used before +.Xr gzclose 3 +to detect this case. +. +.Sh RETURN VALUES +.Fn gzread +returns the number of uncompressed bytes actually read, +less than +.Fa len +for end of file, +or -1 for error. +If +.Fa len +is too large to fit in an +.Vt int , +then nothing is read, +-1 is returned, +and the error state is set to +.Dv Z_STREAM_ERROR . +. +.Sh SEE ALSO +.Xr gzeof 3 , +.Xr gzerror 3 , +.Xr gzfread 3 , +.Xr gzopen 3 +. +.Sh HISTORY +This manual page was converted from +.In zlib.h +to mdoc format by +.An June McEnroe Aq Mt june@causal.agency . +. +.Sh AUTHORS +.An Jean-loup Gailly Aq Mt jloup@gzip.org +.An Mark Adler Aq Mt madler@alumni.caltech.edu diff --git a/doc/zlib/gzseek.3 b/doc/zlib/gzseek.3 new file mode 100644 index 00000000..a14b2db6 --- /dev/null +++ b/doc/zlib/gzseek.3 @@ -0,0 +1,108 @@ +.Dd January 15, 2017 +.Dt GZSEEK 3 +.Os +. +.Sh NAME +.Nm gzseek , +.Nm gzrewind , +.Nm gztell +.Nd seek compressed file +. +.Sh LIBRARY +.Lb libz +. +.Sh SYNOPSIS +.In zlib.h +.Ft z_off_t +.Fn gzseek "gzFile file" "z_off_t offset" "int whence" +.Ft int +.Fn gzrewind "gzFile file" +.Ft z_off_t +.Fn gztell "gzFile file" +. +.Sh DESCRIPTION +Sets the starting position +for the next +.Xr gzread 3 +or +.Xr gzwrite 3 +on the given compressed file. +The +.Fa offset +represents a number of bytes +in the uncompressed data stream. +The +.Fa whence +parameter +is defined as in +.Xr lseek 2 ; +the value +.Dv SEEK_END +is not supported. +. +.Pp +If the file is opened for reading, +this function is emulated +but can be extremely slow. +If the file is opened for writing, +only forward seeks are supported; +.Fn gzseek +then compresses a sequence of zeroes +up to the new starting position. +. +.Pp +.Fn gzrewind +rewinds the given file. +This function is supported +only for reading. +. +.Pp +.Fn gzrewind file +is equivalent to +.Li (int) Ns Fn gzseek file 0L SEEK_SET . +. +.Pp +.Fn gztell +returns the starting position +for the next +.Xr gzread 3 +or +.Xr gzwrite 3 +on the given compressed file. +This position represents a number of bytes +in the uncompressed data stream, +and is zero when starting, +even if appending or reading +a gzip stream from the middle of a file using +.Xr gzdopen 3 . +. +.Pp +.Fn gztell file +is equivalent to +.Fn gzseek file 0L SEEK_CUR . +. +.Sh RETURN VALUES +.Fn gzseek +returns the resulting offset location +as measured in bytes +from the beginning of the uncompressed stream, +or -1 in case of error, +in particular if the file +is opened for writing +and the new starting position +would be before the current position. +. +.Sh SEE ALSO +.Xr gzerror 3 , +.Xr gzoffset 3 , +.Xr gzopen 3 +. +.Sh HISTORY +This manual page was converted from +.In zlib.h +to mdoc format by +.An June McEnroe Aq Mt june@causal.agency . +. +.Sh AUTHORS +.An Jean-loup Gailly Aq Mt jloup@gzip.org +.An Mark Adler Aq Mt madler@alumni.caltech.edu diff --git a/doc/zlib/gzsetparams.3 b/doc/zlib/gzsetparams.3 new file mode 100644 index 00000000..f6ff9ed7 --- /dev/null +++ b/doc/zlib/gzsetparams.3 @@ -0,0 +1,51 @@ +.Dd January 15, 2017 +.Dt GZSETPARAMS 3 +.Os +. +.Sh NAME +.Nm gzsetparams +.Nd set compression level and strategy +. +.Sh LIBRARY +.Lb libz +. +.Sh SYNOPSIS +.In zlib.h +.Ft int +.Fn gzsetparams "gzFile file" "int level" "int strategy" +. +.Sh DESCRIPTION +Dynamically update the compression level or strategy. +See the description of +.Xr deflateInit2 3 +for the meaning +of these parameters. +Previously provided data is flushed +before the parameter change. +. +.Sh RETURN VALUES +.Fn gzsetparams +returns +.Dv Z_OK +if success, +.Dv Z_STREAM_ERROR +if the file was not opened for writing, +.Dv Z_ERRNO +if there is an error writing the flushed data, +or +.Dv Z_MEM_ERROR +if there is a memory allocation error. +. +.Sh SEE ALSO +.Xr deflateInit2 3 , +.Xr gzopen 3 +. +.Sh HISTORY +This manual page was converted from +.In zlib.h +to mdoc format by +.An June McEnroe Aq Mt june@causal.agency . +. +.Sh AUTHORS +.An Jean-loup Gailly Aq Mt jloup@gzip.org +.An Mark Adler Aq Mt madler@alumni.caltech.edu diff --git a/doc/zlib/gzungetc.3 b/doc/zlib/gzungetc.3 new file mode 100644 index 00000000..fbe9371c --- /dev/null +++ b/doc/zlib/gzungetc.3 @@ -0,0 +1,67 @@ +.Dd January 15, 2017 +.Dt GZUNGETC 3 +.Os +. +.Sh NAME +.Nm gzungetc +.Nd un-get character from compressed file +. +.Sh LIBRARY +.Lb libz +. +.Sh SYNOPSIS +.In zlib.h +.Ft int +.Fn gzungetc "int c" "gzFile file" +. +.Sh DESCRIPTION +Push one character back onto the stream +to be read as the first character +on the next read. +At least one character of push-back +is allowed. +.Fn gzungetc +will fail if +.Fa c +is -1, +and may fail if a character +has been pushed +but not read yet. +If +.Fn gzungetc +is used immediately after +.Xr gzopen 3 +or +.Xr gzdopen 3 , +at least the output buffer size +of pushed characters is allowed. +.Po +See +.Xr gzbuffer 3 . +.Pc \& +The pushed character will be discarded +if the stream is repositioned with +.Xr gzseek 3 +or +.Xr gzrewind 3 . +. +.Sh RETURN VALUES +.Fn gzungetc +returns the character pushed, +or -1 on failure. +. +.Sh SEE ALSO +.Xr gzbuffer 3 , +.Xr gzerror 3 , +.Xr gzgetc 3 , +.Xr gzopen 3 +. +.Sh HISTORY +This manual page was converted from +.In zlib.h +to mdoc format by +.An June McEnroe Aq Mt june@causal.agency . +. +.Sh AUTHORS +.An Jean-loup Gailly Aq Mt jloup@gzip.org +.An Mark Adler Aq Mt madler@alumni.caltech.edu diff --git a/doc/zlib/gzwrite.3 b/doc/zlib/gzwrite.3 new file mode 100644 index 00000000..73407ef5 --- /dev/null +++ b/doc/zlib/gzwrite.3 @@ -0,0 +1,39 @@ +.Dd January 15, 2017 +.Dt GZWRITE 3 +.Os +. +.Sh NAME +.Nm gzwrite +.Nd write to compressed file +. +.Sh LIBRARY +.Lb libz +. +.Sh SYNOPSIS +.In zlib.h +.Ft int +.Fn gzwrite "gzFile file" "voidpc buf" "unsigned len" +. +.Sh DESCRIPTION +Writes the given number of uncompressed bytes +into the compressed file. +. +.Sh RETURN VALUES +.Fn gzwrite +returns the number of uncompressed bytes written +or 0 in case of error. +. +.Sh SEE ALSO +.Xr gzerror 3 , +.Xr gzfwrite 3 , +.Xr gzopen 3 +. +.Sh HISTORY +This manual page was converted from +.In zlib.h +to mdoc format by +.An June McEnroe Aq Mt june@causal.agency . +. +.Sh AUTHORS +.An Jean-loup Gailly Aq Mt jloup@gzip.org +.An Mark Adler Aq Mt madler@alumni.caltech.edu diff --git a/doc/zlib/inflate.3 b/doc/zlib/inflate.3 new file mode 100644 index 00000000..255e0f84 --- /dev/null +++ b/doc/zlib/inflate.3 @@ -0,0 +1,398 @@ +.Dd January 15, 2017 +.Dt INFLATE 3 +.Os +. +.Sh NAME +.Nm inflate +.Nd deflate decompression +. +.Sh LIBRARY +.Lb libz +. +.Sh SYNOPSIS +.In zlib.h +.Ft int +.Fn inflate "z_streamp strm" "int flush" +. +.Sh DESCRIPTION +.Fn inflate +decompresses as much data as possible, +and stops when the input buffer becomes empty +or the output buffer becomes full. +It may introduce some output latency +(reading input without producing any output) +except when forced to flush. +. +.Pp +The detailed semantics are as follows. +.Fn inflate +performs one or both of the following actions: +. +.Bl -dash +.It +Decompress more input starting at +.Fa next_in +and update +.Fa next_in +and +.Fa avail_in +accordingly. +If not all input can be processed +(because there is not enough room in the output buffer), +then +.Fa next_in +and +.Fa avail_in +are updated accordingly, +and processing will resume at this point +for the next call of +.Fn inflate . +. +.It +Generate more output starting at +.Fa next_out +and update +.Fa next_out +and +.Fa avail_out +accordingly. +.Fn inflate +provides as much output as possible, +until there is no more input data +or no more space in the output buffer +.Po +see below about the +.Fa flush +parameter +.Pc . +.El +. +.Pp +Before the call of +.Fn inflate , +the application should ensure that +at least one of the actions is possible, +by providing more input +and/or consuming more output, +and updating the +.Fa next_* +and +.Fa avail_* +values accordingly. +If the caller of +.Fn inflate +does not provide both available input +and available output space, +it is possible that there will be no progress made. +The application can consume the uncompressed output +when it wants, +for example when the output buffer is full +.Po +.Fa avail_out +== 0 +.Pc , +or after each call of +.Fn inflate . +If +.Fn inflate +returns +.Dv Z_OK +and with zero +.Fa avail)out , +it must be called again after making room +in the output buffer +because there might be more output pending. +. +.Pp +The +.Fa flush +parameter of +.Fn inflate +can be +.Dv Z_NO_FLUSH , +.Dv Z_SYNC_FLUSH , +.Dv Z_FINISH , +.Dv Z_BLOCK , +or +.Dv Z_TREES . +.Dv Z_SYNC_FLUSH +requests that +.Fn inflate +flush as much output as possible +to the output buffer. +.Dv Z_BLOCK +requests that +.Fn inflate +stop if and when it gets to the next deflate block boundary. +When decoding the zlib or gzip format, +this will cause +.Fn inflate +to return immediately after the header +and before the first block. +When doing a raw inflate, +.Fn inflate +will go ahead and process the first block, +and will return when it gets to the end of that block, +or when it runs out of data. +. +.Pp +The +.Dv Z_BLOCK +option assists in appending to +or combining deflate streams. +To assist in this, +on return +.Fn inflate +always sets +.Fa strm->data_type +to the number of unused bits +in the last byte taken from +.Fa strm->next_in , +plus 64 if +.Fn inflate +is currently decoding the last block in the deflate stream, +plus 128 if +.Fn inflate +returned immediately after decoding an end-of-block code +or decoding the complete header up to +just before the first byte of the deflate stream. +The end-of-block will not be indicated +until all of the uncompressed data +from that block has been written to +.Fa strm->next_out . +The number of unused bits may in general be greater than seven, +except when bit 7 of +.Fa data_type +is set, +in which case the number of unused bits +will be less than eight. +.Fa data_type +is set as noted here every time +.Fn inflate +returns for all flush options, +and so can be used to determine +the amount of currently consumed input in bits. +. +.Pp +The +.Dv Z_TREES +option behaves as +.Dv Z_BLOCK +does, +but it also returns +when the end of each deflate block header is reached, +before any actual data in that block is decoded. +This allows the caller to determine +the length of the deflate block header +for later use in random access +within a deflate block. +256 is added to the value of +.Fa strm->data_type +when +.Fn inflate +returns immediately after reaching +the end of the deflate block header. +. +.Pp +.Fn inflate +should normally be called until it returns +.Dv Z_STREAM_END +or an error. +However if all decompression is to be performed +in a single step +.Po +a single call of +.Fn inflate +.Pc , +the parameter +.Fa flush +should be set to +.Dv Z_FINISH . +In this case all pending input is processed +and all pending output is flushed; +.Fa avail_out +must be large enough to hold all of +the uncompressed data for the operation to complete. +(The size of the uncompressed data +may have been saved by the compressor for this purpose.) +The use of +.Dv Z_FINISH +is not required to perform inflation in one step. +However it may be used to inform +.Fn inflate +that a faster approach can be used for the single +.Fn inflate +call. +.Dv Z_FINISH also informs +.Fn inflate +to not maintain a sliding window +if the stream completes, +which reduces +.Fn inflate Ap s +memory footprint. +If the stream does not complete, +either because not all of the stream is provided +or not enough output space is provided, +then a sliding window will be allocated and +.Fn inflate +can be called again to continue the operation as if +.Dv Z_NO_FLUSH +had been used. +. +.Pp +In this implementation, +.Fn inflate +always flushes as much output as possible +to the output buffer, +and always uses the faster approach +on the first call. +So the effects of the +.Fa flush +parameter in this implementation +are on the return value of +.Fn inflate +as noted below, +when +.Fn inflate +returns early when +.Dv Z_BLOCK +or +.Dv Z_TREES +is used, +and when +.Fn inflate +avoids the allocation of memory +for a sliding window when +.Dv Z_FINISH +is used. +. +.Pp +If a preset dictionary is needed after this call +.Po +see +.Xr inflateSetDictionary 3 +.Pc , +.Fn inflate +sets +.Fa strm->adler +to the Adler-32 checksum of the dictionary +chosen by the compressor +and returns +.Dv Z_NEED_DICT ; +otherwise it sets +.Fa strm->adler +to the Adler-32 checksum +of all output produced so far +.Po +that is, +.Fa total_out +bytes +.Pc +and returns +.Dv Z_OK , +.Dv Z_STREAM_END +or an error code +as described in +.Sx RETURN VALUES . +At the end of the stream, +.Fn inflate +checks that its computed Adler-32 checksum +is equal to that saved by the compressor +and returns +.Dv Z_STREAM_END +only if the checksum is correct. +. +.Pp +.Fn inflate +can decompress and check +either zlib-wrapped or gzip-wrapped +deflate data. +The header type is detected automatically, +if requested when initializing with +.Xr inflateInit2 3 . +Any information contained in the gzip header +is not retained unless +.Xr inflateGetHeader 3 +is used. +When processing gzip-wrapped deflate data, +.Fa strm->adler32 +is set to the CRC-32 +of the output produced so far. +The CRC-32 is checked against the gzip trailer, +as is the uncompressed length, +modulo 2^32. +. +.Sh RETURN VALUES +.Fn inflate +returns +.Dv Z_OK +if some progress has been made +(more input processed or more output produced), +.Dv Z_STREAM_END +if the end of the compressed data has been reached +and all uncompressed output has been produced, +.Dv Z_NEED_DICT +if a preset dictionary is needed at this point, +.Dv Z_DATA_ERROR +if the input data was corrupted +.Po +input stream not conforming to the zlib format +or incorrect check value, +in which case +.Fa strm->msg +points to a string with a more specific error +.Pc , +.Dv Z_STREAM_ERROR +if the stream structure was inconsistent +.Po +for example +.Fa next_in +or +.Fa next_out +was +.Dv Z_NULL , +or the state was inadvertently written over +by the application +.Pc , +.Dv Z_MEM_ERROR +if there was not enough memory, +.Dv Z_BUF_ERROR +if no progress was possible +or if there was not enough room +in the output buffer when +.Dv Z_FINISH +is used. +Note that +.Dv Z_BUF_ERROR +is not fatal, +and +.Fn inflate +can be called again with more input +and more output space +to continue decompressing. +If +.Dv Z_DATA_ERROR +is returned, +the application may then call +.Xr inflateSync 3 +to look for a good compression block +if a partial recovery of the data +is to be attempted. +. +.Sh SEE ALSO +.Xr deflate 3 , +.Xr inflateBack 3 , +.Xr inflateEnd 3 , +.Xr inflateInit 3 , +.Xr inflateMark 3 , +.Xr inflateSync 3 +. +.Sh HISTORY +This manual page was converted from +.In zlib.h +to mdoc format by +.An June McEnroe Aq Mt june@causal.agency . +. +.Sh AUTHORS +.An Jean-loup Gailly Aq Mt jloup@gzip.org +.An Mark Adler Aq Mt madler@alumni.caltech.edu diff --git a/doc/zlib/inflateBack.3 b/doc/zlib/inflateBack.3 new file mode 100644 index 00000000..fcda7452 --- /dev/null +++ b/doc/zlib/inflateBack.3 @@ -0,0 +1,285 @@ +.Dd January 15, 2017 +.Dt INFLATEBACK 3 +.Os +. +.Sh NAME +.Nm inflateBack +.Nd inflate call-back interface +. +.Sh LIBRARY +.Lb libz +. +.Sh SYNOPSIS +.In zlib.h +. +.Ft typedef unsigned +.Fo (*in_func) +.Fa "void FAR *" +.Fa "z_const unsigned char FAR * FAR *" +.Fc +. +.Ft typedef int +.Fo (*out_func) +.Fa "void FAR *" +.Fa "unsigned char FAR *" +.Fa "unsigned" +.Fc +. +.Ft int +.Fo inflateBack +.Fa "z_streamp strm" +.Fa "in_func in" +.Fa "void FAR *in_desc" +.Fa "out_func out" +.Fa "void FAR *out_desc" +.Fc +. +.Sh DESCRIPTION +.Fn inflateBack +does a raw inflate +with a single call +using a call-back interface +for input and output. +This is potentially more efficient than +.Xr inflate 3 +for file I/O applications, +in that it avoids copying between the output +and the sliding window +by simply making the window itself the output buffer. +.Xr inflate 3 +can be faster on modern CPUs +when used with large buffers. +.Fn inflateBack +trusts the application to not change +the output buffer passed by the output function, +at least until +.Fn inflateBack +returns. +. +.Pp +.Xr inflateBackInit 3 +must be called first +to allocate the internal state +and to initialize the state +with the user-provided window buffer. +.Fn inflateBack +may then be used multiple times +to inflate a complete, +raw deflate stream +with each call. +.Xr inflateBackEnd 3 +is then called to free the allocated state. +. +.Pp +A raw deflate stream +is one with no zlib or gzip header or trailer. +This routine would normally be used +in a utility that reads zip or gzip files +and write out uncompressed files. +The utility would decode the header +and process the trailer on its own, +hence this routine expects only +the raw deflate stream to decompress. +This is different from the default behaviour of +.Xr inflate 3 , +which expects a zlib header and trailer +around the deflate stream. +. +.Pp +.Fn inflateBack +uses two subroutines +supplied by the caller +that are then called by +.Fn inflateBack +for input and output. +.Fn inflateBack +calls those routines +until it reads a complete deflate stream +and writes out all of the uncompressed data, +or until it encounters an error. +The function's parameters and return types +are defined above in the +.Vt in_func +and +.Vt out_func +typedefs. +.Fn inflateBack +will call +.Fn in in_desc &buf +which should return +the number of bytes of provided input, +and a pointer to that input in +.Fa buf . +If there is no input available, +.Fn in +must return zero \(em +.Fa buf +is ignored in that case \(em +and +.Fn inflateBack +will return a buffer error. +.Fn inflateBack +will call +.Fn out out_desc buf len +to write the uncompressed data +.Fa buf[0..len-1] . +.Fn out +should return zero on success, +or non-zero on failure. +If +.Fn out +returns non-zero, +.Fn inflateBack +will return with an error. +Neither +.Fn in +nor +.Fn out +are permitted to change +the contents of the window provided to +.Xr inflateBackInit 3 , +which is also the buffer that +.Fn out +uses to write from. +The length written by +.Fn out +will be at most the window size. +Any non-zero amount of input +may be provided by +.Fn in . +. +.Pp +For convenience, +.Fn inflateBack +can be provided input on the first call +by setting +.Fa strm->next_in +and +.Fa strm->avail_in . +If that input is exhausted, +then +.Fn in +will be called. +Therefore +.Fa strm->next_in +must be initialized before calling +.Fn inflateBack . +If +.Fa strm->next_in +is +.Dv Z_NULL , +then +.Fn in +will be called immediately for input. +If +.Fa strm->next_in +is not +.Dv Z_NULL , +then +.Fa strm->avail_in +must also be initialized, +and then if +.Fa strm->avail_in +is not zero, +input will initially be taken from +.Fa "strm->next_in[0 .. strm->avail_in - 1]" . +. +.Pp +The +.Fa in_desc +and +.Fa out_desc +parameters of +.Fn inflateBack +is passed as the first parameter of +.Fn in +and +.Fn out +respectively when they are called. +These descriptors can be optionally used +to pass any information that the caller-supplied +.Fn in +and +.Fn out +functions need to do their job. +. +.Sh RETURN VALUES +On return, +.Fn inflateBack +will set +.Fa strm->next_in +and +.Fa strm->avail_in +to pass back any unused input +that was provided by the last +.Fn in +call. +The return values of +.Fn inflateBack +can be +.Dv Z_STREAM_END +on success, +.Dv Z_BUF_ERROR +if +.Fn in +or +.Fn out +returned an error, +.Dv Z_DATA_ERROR +if there was a format error +in the deflate stream +.Po +in which case +.Fa strm->msg +is set to indicate the nature of the error +.Pc , +or +.Dv Z_STREAM_ERROR +if the stream was not properly initialized. +In the case of +.Dv Z_BUF_ERROR , +an input or output error can be distinguished using +.Fa strm->next_in +which will be +.Dv Z_NULL +only if +.Fn in +returned an error. +If +.Fa strm->next_in +is not +.Dv Z_NULL , +then the +.Dv Z_BUF_ERROR +was due to +.Fn out +returning non-zero. +.Po +.Fn in +will always be called before +.Fn out , +so +.Fa strm->next_in +is assured to be defined if +.Fa out +returns non-zero. +.Pc \& +Note that +.Fn inflateBack +cannot return +.Dv Z_OK . +. +.Sh SEE ALSO +.Xr inflate 3 , +.Xr inflateBackEnd 3 , +.Xr inflateBackInit 3 +. +.Sh HISTORY +This manual page was converted from +.In zlib.h +to mdoc format by +.An June McEnroe Aq Mt june@causal.agency . +. +.Sh AUTHORS +.An Jean-loup Gailly Aq Mt jloup@gzip.org +.An Mark Adler Aq Mt madler@alumni.caltech.edu diff --git a/doc/zlib/inflateBackEnd.3 b/doc/zlib/inflateBackEnd.3 new file mode 100644 index 00000000..39fbea8f --- /dev/null +++ b/doc/zlib/inflateBackEnd.3 @@ -0,0 +1,43 @@ +.Dd January 15, 2017 +.Dt INFLATEBACKEND 3 +.Os +. +.Sh NAME +.Nm inflateBackEnd +.Nd free inflateBack stream +. +.Sh LIBRARY +.Lb libz +. +.Sh SYNOPSIS +.In zlib.h +.Ft int +.Fn inflateBackEnd "z_streamp strm" +. +.Sh DESCRIPTION +All memory allocated by +.Xr inflateBackInit 3 +is freed. +. +.Sh RETURN VALUES +.Fn inflateBackEnd +returns +.Dv Z_OK +on success, +or +.Dv Z_STREAM_ERROR +if the stream state was inconsistent. +. +.Sh SEE ALSO +.Xr inflateBack 3 , +.Xr inflateBackInit 3 +. +.Sh HISTORY +This manual page was converted from +.In zlib.h +to mdoc format by +.An June McEnroe Aq Mt june@causal.agency . +. +.Sh AUTHORS +.An Jean-loup Gailly Aq Mt jloup@gzip.org +.An Mark Adler Aq Mt madler@alumni.caltech.edu diff --git a/doc/zlib/inflateBackInit.3 b/doc/zlib/inflateBackInit.3 new file mode 100644 index 00000000..d029542e --- /dev/null +++ b/doc/zlib/inflateBackInit.3 @@ -0,0 +1,84 @@ +.Dd January 15, 2017 +.Dt INFLATEBACKINIT 3 +.Os +. +.Sh NAME +.Nm inflateBackInit +.Nd initialize inflateBack stream +. +.Sh LIBRARY +.Lb libz +. +.Sh SYNOPSIS +.In zlib.h +.Ft int +.Fo inflateBackInit +.Fa "z_streamp strm" +.Fa "int windowBits" +.Fa "unsigned char FAR *window" +.Fc +. +.Sh DESCRIPTION +Initialize the internal stream state +for decompression using +.Xr inflateBack 3 +calls. +The fields +.Fa zalloc , +.Fa zfree +and +.Fa opaque +in +.Fa strm +must be initialized before the call. +If +.Fa zalloc +and +.Fa zfree +are +.Dv Z_NULL , +then the default +library-derived memory allocation routines are used. +.Fa windowBits +is the base two logarithm of the window size, +in the range 8..15. +.Fa window +is a caller supplied buffer of that size. +Except for special applications +where it is assured that deflate +was used with small window sizes, +.Fa windowBits +must be 15 +and a 32K byte +.Fa window +must be supplied +to be able to decompress general deflate streams. +. +.Sh RETURN VALUES +.Fn inflateBackInit +will return +.Dv Z_OK +on success, +.Dv Z_STREAM_ERROR +if any of the parameters are invalid, +.Dv Z_MEM_ERROR +if the internal state could not be allocated, +or +.Dv Z_VERSION_ERROR +if the version of the library +does not match the version of the header file. +. +.Sh SEE ALSO +.Xr inflateBack 3 , +.Xr inflateBackEnd 3 , +.Xr inflateInit 3 +. +.Sh HISTORY +This manual page was converted from +.In zlib.h +to mdoc format by +.An June McEnroe Aq Mt june@causal.agency . +. +.Sh AUTHORS +.An Jean-loup Gailly Aq Mt jloup@gzip.org +.An Mark Adler Aq Mt madler@alumni.caltech.edu diff --git a/doc/zlib/inflateCopy.3 b/doc/zlib/inflateCopy.3 new file mode 100644 index 00000000..167b879b --- /dev/null +++ b/doc/zlib/inflateCopy.3 @@ -0,0 +1,59 @@ +.Dd January 15, 2017 +.Dt INFLATECOPY 3 +.Os +. +.Sh NAME +.Nm inflateCopy +.Nd copy inflate stream +. +.Sh LIBRARY +.Lb libz +. +.Sh SYNOPSIS +.In zlib.h +.Ft int +.Fn inflateCopy "z_streamp dest" "z_streamp source" +. +.Sh DESCRIPTION +Sets the destination stream +as a complete copy of the source stream. +. +.Pp +This function can be useful +when randomly accessing a large stream. +The first pass through the stream +can periodically record the inflate state, +allowing restarting inflate at those points +when randomly accessing the stream. +. +.Sh RETURN VALUES +.Fn inflateCopy +returns +.Dv Z_OK +if success, +.Dv Z_MEM_ERROR +if there was not enough memory, +.Dv Z_STREAM_ERROR +if the source stream state was inconsistent +.Po +such as +.Fa zalloc +being +.Dv Z_NULL +.Pc . +.Fa msg +is left unchanged +in both source and destination. +. +.Sh SEE ALSO +.Xr inflateInit 3 +. +.Sh HISTORY +This manual page was converted from +.In zlib.h +to mdoc format by +.An June McEnroe Aq Mt june@causal.agency . +. +.Sh AUTHORS +.An Jean-loup Gailly Aq Mt jloup@gzip.org +.An Mark Adler Aq Mt madler@alumni.caltech.edu diff --git a/doc/zlib/inflateEnd.3 b/doc/zlib/inflateEnd.3 new file mode 100644 index 00000000..54945b50 --- /dev/null +++ b/doc/zlib/inflateEnd.3 @@ -0,0 +1,44 @@ +.Dd January 15, 2017 +.Dt INFLATEEND 3 +.Os +. +.Sh NAME +.Nm inflateEnd +.Nd free inflate stream +. +.Sh LIBRARY +.Lb libz +. +.Sh SYNOPSIS +.In zlib.h +.Ft int +.Fn inflateEnd "z_streamp strm" +. +.Sh DESCRIPTION +All dynamically allocated data structures +for this stream are feed. +This function discards any unprocessed input +and does not flush any pending output. +. +.Sh RETURN VALUES +.Fn inflateEnd +returns +.Dv Z_OK +if success, +or +.Dv Z_STREAM_ERROR +if the stream state was inconsistent. +. +.Sh SEE ALSO +.Xr inflate 3 , +.Xr inflateInit 3 +. +.Sh HISTORY +This manual page was converted from +.In zlib.h +to mdoc format by +.An June McEnroe Aq Mt june@causal.agency . +. +.Sh AUTHORS +.An Jean-loup Gailly Aq Mt jloup@gzip.org +.An Mark Adler Aq Mt madler@alumni.caltech.edu diff --git a/doc/zlib/inflateGetDictionary.3 b/doc/zlib/inflateGetDictionary.3 new file mode 100644 index 00000000..9290850c --- /dev/null +++ b/doc/zlib/inflateGetDictionary.3 @@ -0,0 +1,69 @@ +.Dd January 15, 2017 +.Dt INFLATEGETDICTIONARY 3 +.Os +. +.Sh NAME +.Nm inflateGetDictionary +.Nd inflate sliding dictionary +. +.Sh LIBRARY +.Lb libz +. +.Sh SYNOPSIS +.In zlib.h +.Ft int +.Fo inflateGetDictionary +.Fa "z_streamp strm" +.Fa "Bytef *dictionary" +.Fa "uInt *dictLength" +.Fc +. +.Sh DESCRIPTION +Returns the sliding dictionary +being maintained by +.Xr inflate 3 . +.Fa dictLength +is set to the number of bytes +in the dictionary, +and that many bytes are copied to +.Fa dictionary . +.Fa dictionary +must have enough space, +where 32768 bytes is always enough. +If +.Fn inflateGetDictionary +is called with +.Fa dictionary +equal to +.Dv Z_NULL , +then only the dictionary length is returned, +and nothing is copied. +Similarly, +if +.Fa dictLength +is +.Dv Z_NULL , +then it is not set. +. +.Sh RETURN VALUES +.Fn inflateGetDictionary +returns +.Dv Z_OK +on success, +or +.Dv Z_STREAM_ERROR +if the stream state is inconsistent. +. +.Sh SEE ALSO +.Xr deflateSetDictionary 3 , +.Xr inflateSetDictionary 3 +. +.Sh HISTORY +This manual page was converted from +.In zlib.h +to mdoc format by +.An June McEnroe Aq Mt june@causal.agency . +. +.Sh AUTHORS +.An Jean-loup Gailly Aq Mt jloup@gzip.org +.An Mark Adler Aq Mt madler@alumni.caltech.edu diff --git a/doc/zlib/inflateGetHeader.3 b/doc/zlib/inflateGetHeader.3 new file mode 100644 index 00000000..57f7c443 --- /dev/null +++ b/doc/zlib/inflateGetHeader.3 @@ -0,0 +1,170 @@ +.Dd January 15, 2017 +.Dt INFLATEGETHEADER 3 +.Os +. +.Sh NAME +.Nm inflateGetHeader +.Nd get gzip header +. +.Sh LIBRARY +.Lb libz +. +.Sh SYNOPSIS +.In zlib.h +.Ft int +.Fn inflateGetHeader "z_streamp strm" "gz_headerp head" +. +.Sh DESCRIPTION +.Fn inflateGetHeader +requests that gzip header information +be stored in the provided +.Vt gz_header +structure. +.Fn inflateGetHeader +may be called after +.Xr inflateInit2 3 +or +.Xr inflateReset 3 , +and before the first call of +.Xr inflate 3 . +As +.Xr inflate 3 +processes the gzip stream, +.Fa head->done +is zero until the header is completed, +at which time +.Fa head->done +is set to one. +If a zlib stream is being decoded, +then +.Fa head->done +is set to -1 to indicate that +there will be no gzip header information forthcoming. +Note that +.Dv Z_BLOCK +or +.Dv Z_TREES +can be used to force +.Xr inflate 3 +to return immediately after +header processing is complete +and before any actual data is decompressed. +. +.Pp +The +.Fa text , +.Fa time , +.Fa xflags , +and +.Fa os +fields are filled in with the gzip header contents. +.Fa hcrc +is set to true if there is a header CRC. +.Po +The header CRC was valid if +.Fa done +is set to one. +.Pc \& +If +.Fa extra +is not +.Dv Z_NULL , +then +.Fa extra_max +contains the maximum number of bytes to write to +.Fa extra . +Once +.Fa done +is true, +.Fa extra_len +contains the actual extra field length, +and +.Fa extra +contains the extra field, +or that field truncated if +.Fa extra_max +is less than +.Fa extra_len . +If +.Fa name +is not +.Dv Z_NULL , +then up to +.Fa name_max +characters are written there, +terminated with a zero +unless the length is greater than +.Fa name_max . +If +.Fa comment +is not +.Dv Z_NULL , +then up to +.Fa comm_max +characters are written there, +terminated with a zero +unless the length is greater than +.Fa comm_max . +When any of +.Fa extra , +.Fa name , +or +.Fa comment +are not +.Dv Z_NULL +and the respective field +is not present in the header, +then that field is set to +.Dv Z_NULL +to signal its absence. +This allows the use of +.Xr deflateSetHeader 3 +with the returned structure +to duplicate the header. +However if those fields are set to allocated memory, +then the application will need to +save those pointers elsewhere +so that they can be eventually feed. +. +.Pp +If +.Fn inflateGetHeader +is not used, +then the header information is simply discarded. +The header is always checked for validity, +including the header CRC if present. +.Xr inflateReset 3 +will reset the process to discard the header information. +The application would need to call +.Fn inflateGetHeader +again to retrieve the header from the next gzip stream. +. +.Pp +The +.Vt gz_headerp +type is documented in +.Xr deflateSetHeader 3 . +. +.Sh RETURN VALUES +.Fn inflateGetHeader +returns +.Dv Z_OK +if success, +or +.Dv Z_STREAM_ERROR +if the source stream state was inconsistent. +. +.Sh SEE ALSO +.Xr gzip 1 , +.Xr deflateSetHeader 3 , +.Xr inflateInit2 3 +. +.Sh HISTORY +This manual page was converted from +.In zlib.h +to mdoc format by +.An June McEnroe Aq Mt june@causal.agency . +. +.Sh AUTHORS +.An Jean-loup Gailly Aq Mt jloup@gzip.org +.An Mark Adler Aq Mt madler@alumni.caltech.edu diff --git a/doc/zlib/inflateInit.3 b/doc/zlib/inflateInit.3 new file mode 100644 index 00000000..66a1d4f7 --- /dev/null +++ b/doc/zlib/inflateInit.3 @@ -0,0 +1,101 @@ +.Dd January 15, 2017 +.Dt INFLATEINIT 3 +.Os +. +.Sh NAME +.Nm inflateInit +.Nd initialize inflate stream +. +.Sh LIBRARY +.Lb libz +. +.Sh SYNOPSIS +.In zlib.h +.Ft int +.Fn inflateInit "z_streamp strm" +. +.Sh DESCRIPTION +Initializes the internal stream state for decompression. +The fields +.Fa next_in , +.Fa avail_in , +.Fa zalloc , +.Fa zfree +and +.Fa opaque +must be initialized before by the caller. +In the current version of +.Fn inflateInit , +the provided input is not read or consumed. +The allocation of a sliding window +will be deferred to the first call of +.Xr inflate 3 +(if the decompression does not complete on the first call). +If +.Fa zalloc +and +.Fa zfree +are set to +.Dv Z_NULL , +.Fn inflateInit +updates them to use default allocation functions. +. +.Pp +.Fn inflateInit +does not perform any decompression. +Actual decompression will be done by +.Xr inflate 3 . +So +.Fa next_in , +.Fa avail_in , +.Fa next_out +and +.Fa avail_out +are unused and unchanged. +The current implementation of +.Fn inflateInit +does not process any header information \(em +that is deferred until +.Xr inflate 3 +is called. +. +.Pp +The +.Vt z_streamp +type is documented in +.Xr deflateInit 3 . +. +.Sh RETURN VALUES +.Fn inflateInit +returns +.Dv Z_OK +if success, +.Dv Z_MEM_ERROR +if there was not enough memory, +.Dv Z_VERSION_ERROR +if the zlib library version +is incompatible with the version assumed by the caller, +or +.Dv Z_STREAM_ERROR +if the parameters are invalid, +such as a null pointer to the structure. +.Fa msg +is set to null if there is no error message. +. +.Sh SEE ALSO +.Xr inflate 3 , +.Xr inflateBackInit 3 , +.Xr inflateCopy 3 , +.Xr inflateEnd 3 , +.Xr inflateInit2 3 , +.Xr inflateSetDictionary 3 +. +.Sh HISTORY +This manual page was converted from +.In zlib.h +to mdoc format by +.An June McEnroe Aq Mt june@causal.agency . +. +.Sh AUTHORS +.An Jean-loup Gailly Aq Mt jloup@gzip.org +.An Mark Adler Aq Mt madler@alumni.caltech.edu diff --git a/doc/zlib/inflateInit2.3 b/doc/zlib/inflateInit2.3 new file mode 100644 index 00000000..5b8b49ac --- /dev/null +++ b/doc/zlib/inflateInit2.3 @@ -0,0 +1,181 @@ +.Dd January 15, 2017 +.Dt INFLATEINIT2 3 +.Os +. +.Sh NAME +.Nm inflateInit2 +.Nd inflate compression options +. +.Sh LIBRARY +.Lb libz +. +.Sh SYNOPSIS +.In zlib.h +.Ft int +.Fn inflateInit2 "z_streamp strm" "int windowBits" +. +.Sh DESCRIPTION +This is another version of +.Xr inflateInit 3 +with an extra parameter. +The fields +.Fa next_in , +.Fa avail_in , +.Fa zalloc , +.Fa zfree +and +.Fa opaque +must be initialized before by the caller. +. +.Pp +The +.Fa windowBits +parameter is the base two logarithm +of the maximum window size +(the size of the history buffer). +It should be in the range 8..15 +for this version of the library. +The default value is 15 if +.Xr inflateInit 3 +is used instead. +.Fa windowBits +must be greater than or equal to the +.Fa windowBits +value provided to +.Xr deflateInit2 3 +while compressing, +or it must be equal to 15 if +.Xr deflateInit2 3 +was not used. +If a compressed stream with a larger window size +is given as input, +.Xr inflate 3 +will return with the error code +.Dv Z_DATA_ERROR +instead of trying to allocate a larger window. +. +.Pp +.Fa windowBits +can also be zero +to request that +.Xr inflate 3 +use the window size +in the zlib header +of the compressed stream. +. +.Pp +.Fa windowBits +can also be -8..-15 +for raw inflate. +In this case, +.Fa -windowBits +determines the window size. +.Xr inflate 3 +will then process raw deflate data, +not looking for a zlib or gzip header, +not generating a check value, +and not looking for any check values +for comparison at the end of the stream. +This is for use with other formats +that use the deflate compressed data format +such as zip. +Those formats provide their own check values. +If a custom format is developed +using the raw deflate format for compressed data, +it is recommended that a check value +such as an Adler-32 or a CRC-32 +be applied to the uncompressed data +as is done in the zlib, gzip and zip formats. +For most applications, +the zlib format should be used as is. +Note that comments above on the use in +.Xr deflateInit2 3 +applies to the magnitude of +.Fa windowBits . +. +.Pp +.Fa windowBits +can also be greater than 15 +for optional gzip decoding. +Add 32 to +.Fa windowBits +to enable zlib and gzip decoding +with automatic header detection, +or add 16 to decode only the gzip format +.Po +the zlib format will return a +.Dv Z_DATA_ERROR +.Pc . +If a gzip stream is being decoded, +.Fa strm->adler +is a CRC-32 instead of an Adler-32. +Unlike the +.Xr gunzip 1 +utility and +.Xr gzread 3 , +.Xr inflate 3 +will not automatically decode +concatenated gzip streams. +.Xr inflate 3 +will return +.Dv Z_STREAM_END +at the end of the gzip stream. +The state would need to be reset +to continue decoding a subsequent gzip stream. +. +.Pp +.Fn inflateInit2 +does not perform any decompression +apart from possibly reading the zlib header if present: +actual decompression will be done by +.Xr inflate 3 . +.Po +So +.Fa next_in +and +.Fa avail_in +may be modified, +but +.Fa next_out +and +.Fa avail_out +are unused and unchanged. +.Pc \& +The current implementation of +.Fn inflateInit2 +does not process any header information \(em +that is deferred until +.Xr inflate 3 +is called. +. +.Sh RETURN VALUES +.Fn inflateInit2 +returns +.Dv Z_OK +if success, +.Dv Z_MEM_ERROR +if there was not enough memory, +.Dv Z_VERSION_ERROR +if the zlib library version +is incompatible with the version assumed by the caller, +or +.Dv Z_STREAM_ERROR +if the parameters are invalid, +such as a null pointer to the structure. +.Fa msg +is set to null if there is no error message. +. +.Sh SEE ALSO +.Xr deflateInit2 3 , +.Xr inflateInit 3 , +.Xr inflatePrime 3 +. +.Sh HISTORY +This manual page was converted from +.In zlib.h +to mdoc format by +.An June McEnroe Aq Mt june@causal.agency . +. +.Sh AUTHORS +.An Jean-loup Gailly Aq Mt jloup@gzip.org +.An Mark Adler Aq Mt madler@alumni.caltech.edu diff --git a/doc/zlib/inflateMark.3 b/doc/zlib/inflateMark.3 new file mode 100644 index 00000000..90e2ee0b --- /dev/null +++ b/doc/zlib/inflateMark.3 @@ -0,0 +1,88 @@ +.Dd January 15, 2017 +.Dt INFLATEMARK 3 +.Os +. +.Sh NAME +.Nm inflateMark +.Nd mark location for random access +. +.Sh LIBRARY +.Lb libz +. +.Sh SYNOPSIS +.In zlib.h +.Ft long +.Fn inflateMark "z_streamp strm" +. +.Sh DESCRIPTION +This function returns two values, +one in the lower 16 bits of the return value, +and the other in the remaining upper bits, +obtained by shifting the return value down 16 bits. +If the upper value is -1 +and the lower value is zero, +then +.Xr inflate 3 +is currently decoding information outside of a block. +If the upper value is -1 +and the lower value is non-zero, +then +.Xr inflate 3 +is in the middle of a stored block, +with the lower value equaling +the number of bytes from the input remaining to copy. +If the upper value is not -1, +then it is the number of bits +back from the current bit position +in the input of the code +(literal of length/distance pair) +currently being processed. +In that case the lower value +is the number of bytes +already emitted for that code. +. +.Pp +A code is being processed if +.Xr inflate 3 +is waiting for more input to complete +decoding of the code, +or if it has completed decoding +but is waiting for more output space +to write the literal or match data. +. +.Pp +.Fn inflateMark +is used to mark locations in the input data +for random access, +which may be at bit positions, +and to note those cases where +the output of a code may span boundaries +of random access blocks. +The current location in the input stream +can be determined from +.Fa avail_in +and +.Fa data_type +as noted in the description for the +.Dv Z_BLOCK +.Fa flush +parameter for +.Xr inflate 3 . +. +.Sh RETURN VALUES +.Fn inflateMark +returns the value noted above, +or -65536 if the provided source stream state was inconsistent. +. +.Sh SEE ALSO +.Xr inflate 3 +. +.Sh HISTORY +This manual page was converted from +.In zlib.h +to mdoc format by +.An June McEnroe Aq Mt june@causal.agency . +. +.Sh AUTHORS +.An Jean-loup Gailly Aq Mt jloup@gzip.org +.An Mark Adler Aq Mt madler@alumni.caltech.edu diff --git a/doc/zlib/inflatePrime.3 b/doc/zlib/inflatePrime.3 new file mode 100644 index 00000000..66953665 --- /dev/null +++ b/doc/zlib/inflatePrime.3 @@ -0,0 +1,73 @@ +.Dd January 15, 2017 +.Dt INFLATEPRIME 3 +.Os +. +.Sh NAME +.Nm inflatePrime +.Nd insert bits in inflate stream +. +.Sh LIBRARY +.Lb libz +. +.Sh SYNOPSIS +.In zlib.h +.Ft int +.Fn inflatePrime "z_streamp strm" "int bits" "int value" +. +.Sh DESCRIPTION +This function inserts bits +in the inflate input stream. +The intent is that this function +is used to start inflating +at a bit position +in the middle of a byte. +The provided bits will be used +before any bytes are used from +.Fa next_in . +This function should only be used with raw inflate, +and should be used before the first +.Xr inflate 3 +call after +.Xr inflateInit2 3 +or +.Xr inflateReset 3 . +.Fa bits +must be less than or equal to 16, +and that many of the least significant bits of +.Fa value +will be inserted in the input. +. +.Pp +If +.Fa bits +is negative, +then the input stream bit buffer is emptied. +Then +.Fn inflatePrime +can be called again +to put bits in the buffer. +This is used to clear out bits leftover +after feeding inflate a block description +prior to feeding inflate codes. +. +.Sh RETURN VALUES +.Fn inflatePrime +returns +.Dv Z_OK +if success, +or +.Dv Z_STREAM_ERROR +if the source stream state was inconsistent. +. +.Sh SEE ALSO +.Xr inflateInit2 3 +. +.Sh HISTORY +This manual page was converted from +.In zlib.h +to mdoc format by +.An June McEnroe Aq Mt june@causal.agency . +. +.Sh AUTHORS +.An Jean-loup Gailly Aq Mt jloup@gzip.org +.An Mark Adler Aq Mt madler@alumni.caltech.edu diff --git a/doc/zlib/inflateReset.3 b/doc/zlib/inflateReset.3 new file mode 100644 index 00000000..53c4ffe2 --- /dev/null +++ b/doc/zlib/inflateReset.3 @@ -0,0 +1,81 @@ +.Dd January 15, 2017 +.Dt INFLATERESET 3 +.Os +. +.Sh NAME +.Nm inflateReset , +.Nm inflateReset2 +.Nd reset inflate stream +. +.Sh LIBRARY +.Lb libz +. +.Sh SYNOPSIS +.In zlib.h +.Ft int +.Fn inflateReset "z_streamp strm" +.Ft int +.Fn inflateReset2 "z_streamp strm" "int windowBits" +. +.Sh DESCRIPTION +This function is equivalent to +.Xr inflateEnd 3 +followed by +.Xr inflateInit 3 , +but does not free and reallocate +the internal decompression state. +The stream will keep attributes +that may have been set by +.Xr inflateInit2 3 . +. +.Pp +.Fn inflateReset2 +is the same as +.Fn inflateReset , +but it also permits changing +the wrap and window size requests. +The +.Fa windowBits +parameter is interpreted the same as it is for +.Xr inflateInit2 3 . +If the window size is changed, +then the memory allocated for the window is freed, +and the window will be reallocated by +.Xr inflate 3 +if needed. +. +.Sh RETURN VALUES +.Fn inflateReset +and +.Fn inflateReset2 +return +.Dv Z_OK +if success, +or +.Dv Z_STREAM_ERROR +if the source stream state was inconsistent +.Po +such as +.Fa zalloc +or +.Fa state +being +.Dv Z_NULL +.Pc , +or if the +.Fa windowBits +parameter is invalid. +. +.Sh SEE ALSO +.Xr inflateEnd 3 , +.Xr inflateInit 3 +. +.Sh HISTORY +This manual page was converted from +.In zlib.h +to mdoc format by +.An June McEnroe Aq Mt june@causal.agency . +. +.Sh AUTHORS +.An Jean-loup Gailly Aq Mt jloup@gzip.org +.An Mark Adler Aq Mt madler@alumni.caltech.edu diff --git a/doc/zlib/inflateSetDictionary.3 b/doc/zlib/inflateSetDictionary.3 new file mode 100644 index 00000000..291c97e8 --- /dev/null +++ b/doc/zlib/inflateSetDictionary.3 @@ -0,0 +1,85 @@ +.Dd January 15, 2017 +.Dt INFLATESETDICTIONARY 3 +.Os +. +.Sh NAME +.Nm inflateSetDictionary +.Nd initialize decompression dictionary +. +.Sh LIBRARY +.Lb libz +. +.Sh SYNOPSIS +.In zlib.h +.Ft int +.Fo inflateSetDictionary +.Fa "z_streamp strm" +.Fa "const Bytef *dictionary" +.Fa "uInt dictLength" +.Fc +. +.Sh DESCRIPTION +Initializes the decompression dictionary +from the given uncompressed byte sequence. +This function must be called +immediately after a call of +.Xr inflate 3 , +if that call returned +.Dv Z_NEED_DICT . +The dictionary chosen by the compressor +can be determined from the Adler-32 value +returned by that call of +.Xr inflate 3 . +The compressor and decompressor +must use exactly the same dictionary +.Po +see +.Xr deflateSetDictionary 3 +.Pc . +For raw inflate, +this function can be called at any time +to set the dictionary. +If the provided dictionary +is smaller than the window +and there is already data in the window, +then the provided dictionary +will amend what's there. +The application must insure that the dictionary +that was used for compression is provided. +. +.Pp +.Fn inflateSetDictionary +does not perform any decompression: +this will be done by subsequent calls of +.Xr inflate 3 . +. +.Sh RETURN VALUES +.Fn inflateSetDictionary +returns +.Dv Z_OK +if success, +.Dv Z_STREAM_ERROR +if a parameter is invalid +.Po +e.g. dictionary being +.Dv Z_NULL +.Pc +or the stream state is inconsistent, +.Dv Z_DATA_ERROR +if the given dictionary +doesn't match the expected one +(incorrect Adler-32 value). +. +.Sh SEE ALSO +.Xr deflateGetDictionary 3 , +.Xr inflateGetDictionary 3 +. +.Sh HISTORY +This manual page was converted from +.In zlib.h +to mdoc format by +.An June McEnroe Aq Mt june@causal.agency . +. +.Sh AUTHORS +.An Jean-loup Gailly Aq Mt jloup@gzip.org +.An Mark Adler Aq Mt madler@alumni.caltech.edu diff --git a/doc/zlib/inflateSync.3 b/doc/zlib/inflateSync.3 new file mode 100644 index 00000000..56d3ca28 --- /dev/null +++ b/doc/zlib/inflateSync.3 @@ -0,0 +1,72 @@ +.Dd January 15, 2017 +.Dt INFLATESYNC 3 +.Os +. +.Sh NAME +.Nm inflateSync +.Nd skip invalid data +. +.Sh LIBRARY +.Lb libz +. +.Sh SYNOPSIS +.In zlib.h +.Ft int +.Fn inflateSync "z_streamp strm" +. +.Sh DESCRIPTION +Skips invalid compressed data +until a possible full flush point +.Po +see +.Xr deflate 3 +for the description of +.Dv Z_FULL_FLUSH +.Pc +can be found, +or until all available input is skipped. +No output is provided. +. +.Pp +.Fn inflateSync +searches for a 00 00 FF FF pattern +in the compressed data. +All full flush points have this pattern, +but not all occurrences of this pattern +are full flush points. +. +.Sh RETURN VALUES +.Fn inflateSync +returns +.Dv Z_OK +if a possible full flush point has been found, +.Dv Z_BUF_ERROR +if no more input was provided, +.Dv Z_DATA_ERROR +if no flush point has been found, +or +.Dv Z_STREAM_ERROR +if the stream structure was inconsistent. +In the success case, +the application may save the current value of +.Fa total_in +which indicates where valid compressed data was found. +In the error case, +the application may repeatedly call +.Fn inflateSync , +providing more input each time, +until success or the end of the input data. +. +.Sh SEE ALSO +.Xr deflate 3 , +.Xr inflate 3 +. +.Sh HISTORY +This manual page was converted from +.In zlib.h +to mdoc format by +.An June McEnroe Aq Mt june@causal.agency . +. +.Sh AUTHORS +.An Jean-loup Gailly Aq Mt jloup@gzip.org +.An Mark Adler Aq Mt madler@alumni.caltech.edu diff --git a/doc/zlib/uncompress.3 b/doc/zlib/uncompress.3 new file mode 100644 index 00000000..1047ad91 --- /dev/null +++ b/doc/zlib/uncompress.3 @@ -0,0 +1,92 @@ +.Dd January 15, 2017 +.Dt UNCOMPRESS 3 +.Os +. +.Sh NAME +.Nm uncompress , +.Nm uncompress2 +.Nd decompress source buffer into destination buffer +. +.Sh LIBRARY +.Lb libz +. +.Sh SYNOPSIS +.In zlib.h +. +.Ft int +.Fo uncompress +.Fa "Bytef *dest" +.Fa "uLongf *destLen" +.Fa "const Bytef *source" +.Fa "uLong sourceLen" +.Fc +. +.Ft int +.Fo uncompress2 +.Fa "Bytef *dest" +.Fa "uLongf *destLen" +.Fa "const Bytef *source" +.Fa "uLong *sourceLen" +.Fc +. +.Sh DESCRIPTION +Decompresses the source buffer into the destination buffer. +.Fa sourceLen +is the byte length of the source buffer. +Upon entry, +.Fa destLen +is the total size of the destination buffer, +which must be large enough to hold the entire uncompressed data. +.Po +The size of the uncompressed data +must have been saved previously by the compressor +and transmitted to the decompressor +by some mechanism outside the scope of this compression library. +.Pc \& +Upon exit, +.Fa destLen +is the actual size of the uncompressed data. +. +.Pp +.Fn uncompress2 +is the same as +.Fn uncompress , +except that +.Fa sourceLen +is a pointer, +where the length of the source is +.Fa *sourceLen . +On return, +.Fa *sourceLen +is the number of source bytes consumed. +. +.Sh RETURN VALUES +.Fn uncompress +returns +.Dv Z_OK +if success, +.Dv Z_MEM_ERROR +if there was not enough memory, +.Dv Z_BUF_ERROR +if there was not enough room in the output buffer, +or +.Dv Z_DATA_ERROR +if the input data was corrupted or incomplete. +In the case where there is not enough room, +.Fn uncompress +will fill the output buffer +with the uncompressed data up to that point. +. +.Sh SEE ALSO +.Xr compress 3 , +.Xr inflate 3 +. +.Sh HISTORY +This manual page was converted from +.In zlib.h +to mdoc format by +.An June McEnroe Aq Mt june@causal.agency . +. +.Sh AUTHORS +.An Jean-loup Gailly Aq Mt jloup@gzip.org +.An Mark Adler Aq Mt madler@alumni.caltech.edu diff --git a/doc/zlib/zlibCompileFlags.3 b/doc/zlib/zlibCompileFlags.3 new file mode 100644 index 00000000..59cc24a8 --- /dev/null +++ b/doc/zlib/zlibCompileFlags.3 @@ -0,0 +1,163 @@ +.Dd January 15, 2017 +.Dt ZLIBCOMPILEFLAGS 3 +.Os +. +.Sh NAME +.Nm zlibCompileFlags +.Nd zlib compile-time options +. +.Sh LIBRARY +.Lb libz +. +.Sh SYNOPSIS +.In zlib.h +.Ft uLong +.Fn zlibCompileFlags void +. +.Sh DESCRIPTION +Return flags indicating compile-time options. +. +.Ss Type sizes +Two bits each, +00 = 16 bits, +01 = 32 bits, +10 = 64 bits, +11 = other. +. +.Pp +.Bl -tag -width Ds -compact +.It 1.0 +size of +.Vt uInt +.It 3.2 +size of +.Vt uLong +.It 5.4 +size of +.Vt voidpf +(pointer) +.It 7.6 +size of +.Vt z_off_t +.El +. +.Ss Compiler, assembler, and debug options +.Bl -tag -width Ds -compact +.It 8 +.Dv ZLIB_DEBUG +.It 9 +.Dv ASMV +or +.Dv ASMINF +\(em +use ASM code +.It 10 +.Dv ZLIB_WINAPI +\(em +exported functions use the WINAPI calling convention +.It 11 +0 (reserved) +.El +. +.Ss One-time table building +Smaller code, +but not thread-safe if true. +. +.Pp +.Bl -tag -width Ds -compact +.It 12 +.Dv BUILDFIXED +\(em +build static block decoding tables when needed +.It 13 +.Dv DYNAMIC_CRC_TABLE +\(em +build CRC calculation tables when needed +.It 14,15 +0 (reserved) +.El +. +.Ss Library content +Indicates missing functionality. +. +.Pp +.Bl -tag -width Ds -compact +.It 16 +.Dv NO_GZCOMPRESS +\(em +gz* functions cannot compress +(to avoid linking deflate code when not needed) +.It 17 +.Dv NO_GZIP +\(em +.Xr deflate 3 +can't write gzip streams, +and +.Xr inflate 3 +can't detect and decode gzip streams +(to avoid linking crc code) +.It 18-19 +0 (reserved) +.El +. +.Ss Operation variations +Changes in library functionality. +. +.Pp +.Bl -tag -width Ds -compact +.It 20 +.Dv PKZIP_BUG_WORKAROUND +\(em +slightly more permissive +.Xr inflate 3 +.It 21 +.Dv FASTEST +\(em +deflate algorithm with only one, +lowest compression level +.It 22,23 +0 (reserved) +.El +. +.Ss sprintf variant used by gzprintf +Zero is best. +. +.Pp +.Bl -tag -width Ds -compact +.It 24 +0 = vs*, +1 = s* +\(em +1 means limited to 20 arguments after the format +.It 25 +0 = *nprintf, +1 = *printf +\(em +1 means +.Xr gzprintf 3 +not secure! +.It 26 +0 = returns value, +1 = void +\(em +1 means inferred string length returned +.El +. +.Ss Remainder +.Bl -tag -width Ds -compact +.It 27-31 +0 (reserved) +.El +. +.Sh SEE ALSO +.Xr zlibVersion 3 +. +.Sh HISTORY +This manual page was converted from +.In zlib.h +to mdoc format by +.An June McEnroe Aq Mt june@causal.agency . +. +.Sh AUTHORS +.An Jean-loup Gailly Aq Mt jloup@gzip.org +.An Mark Adler Aq Mt madler@alumni.caltech.edu diff --git a/doc/zlib/zlibVersion.3 b/doc/zlib/zlibVersion.3 new file mode 100644 index 00000000..04377527 --- /dev/null +++ b/doc/zlib/zlibVersion.3 @@ -0,0 +1,45 @@ +.Dd January 15, 2017 +.Dt ZLIBVERSION 3 +.Os +. +.Sh NAME +.Nm zlibVersion +.Nd check zlib version +. +.Sh LIBRARY +.Lb libz +. +.Sh SYNOPSIS +.In zlib.h +.Fd #define ZLIB_VERSION \(dq1.2.11\(dq +.Ft "const char *" +.Fn zlibVersion void +. +.Sh DESCRIPTION +The application can compare +.Fn zlibVersion +and +.Dv ZLIB_VERSION +for consistency. +If the first character differs, +the library code actually used +is not compatible with the +.In zlib.h +header file used by the application. +This check is automatically made by +.Xr deflateInit 3 +and +.Xr inflateInit 3 . +. +.Sh SEE ALSO +.Xr zlibCompileFlags 3 +. +.Sh HISTORY +This manual page was converted from +.In zlib.h +to mdoc format by +.An June McEnroe Aq Mt june@causal.agency . +. +.Sh AUTHORS +.An Jean-loup Gailly Aq Mt jloup@gzip.org +.An Mark Adler Aq Mt madler@alumni.caltech.edu diff --git a/etc/Dark.terminal b/etc/Dark.terminal index 8e06eb2f..983489e0 100644 --- a/etc/Dark.terminal +++ b/etc/Dark.terminal @@ -4,1383 +4,1356 @@ <dict> <key>ANSIBlackColor</key> <data> - YnBsaXN0MDDUAQIDBAUGKyxYJHZlcnNpb25YJG9iamVjdHNZJGFyY2hpdmVyVCR0b3AS - AAGGoKcHCBMZHSQoVSRudWxs1QkKCwwNDg8QERJcTlNDb21wb25lbnRzVU5TUkdCXE5T - Q29sb3JTcGFjZV8QEk5TQ3VzdG9tQ29sb3JTcGFjZVYkY2xhc3NPECswLjA4NjQxNDgy - MTQ1IDAuMDgyNjczMjQ0MTggMC4wNjE3NjQxODgxMSAxTxApMC4wNjg1NjU0ODc4NiAw - LjA2NjU1MDExMzI2IDAuMDUzMTg5MzQ0NwAQAYACgAbTFBUNFhcYVE5TSURVTlNJQ0MQ - B4ADgAXSGg0bHFdOUy5kYXRhTxEMSAAADEhMaW5vAhAAAG1udHJSR0IgWFlaIAfOAAIA - CQA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+Rz5PzlhOYN5pbnH+ep6DLovOlG6dDqW+rl63Dr++yG + 7RHtnO4o7rTvQO/M8Fjw5fFy8f/yjPMZ86f0NPTC9VD13vZt9vv3ivgZ+Kj5OPnH+lf6 + 5/t3/Af8mP0p/br+S/7c/23//9IfICEiWiRjbGFzc25hbWVYJGNsYXNzZXNcTlNDb2xv + clNwYWNloiMkXE5TQ29sb3JTcGFjZVhOU09iamVjdNIfICYnV05TQ29sb3KiJiQACAAR + ABoAJAApADIANwBJAEwAUQBTAFoAYABrAHgAfgCLAKAApwDVAQIBBAEGAQgBDwEUARoB + HAEeASANbA1xDXwNhQ2SDZUNog2rDbANuAAAAAAAAAIBAAAAAAAAACgAAAAAAAAAAAAA + AAAAAA27 </data> <key>Bell</key> <false/> + <key>BellBounceCritical</key> + <false/> <key>CursorColor</key> <data> - YnBsaXN0MDDUAQIDBAUGKyxYJHZlcnNpb25YJG9iamVjdHNZJGFyY2hpdmVyVCR0b3AS - AAGGoKcHCBMZHSQoVSRudWxs1QkKCwwNDg8QERJcTlNDb21wb25lbnRzVU5TUkdCXE5T - Q29sb3JTcGFjZV8QEk5TQ3VzdG9tQ29sb3JTcGFjZVYkY2xhc3NPECgwLjQ0ODEzNDAw - NTEgMC40MTMyMDIxNjY2IDAuMzA4MjAzMzA5OCAxTxAnMC4zNzE5NDUwMjM1IDAuMzQw - NzI1NTcwOSAwLjI0MTcyNTMyNTYAEAGAAoAG0xQVDRYXGFROU0lEVU5TSUNDEAeAA4AF - 0hoNGxxXTlMuZGF0YU8RDEgAAAxITGlubwIQAABtbnRyUkdCIFhZWiAHzgACAAkABgAx - AABhY3NwTVNGVAAAAABJRUMgc1JHQgAAAAAAAAAAAAAAAAAA9tYAAQAAAADTLUhQICAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABFjcHJ0 - AAABUAAAADNkZXNjAAABhAAAAGx3dHB0AAAB8AAAABRia3B0AAACBAAAABRyWFl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Cm6+cHJyJnPedZJ3SnkCerp8dn4uf+qBpoNihR6G2oiailqMG + o3aj5qRWpMelOKWpphqmi6b9p26n4KhSqMSpN6mpqhyqj6sCq3Wr6axcrNCtRK24ri2u + oa8Wr4uwALB1sOqxYLHWskuywrM4s660JbSctRO1irYBtnm28Ldot+C4WbjRuUq5wro7 + urW7LrunvCG8m70VvY++Cr6Evv+/er/1wHDA7MFnwePCX8Lbw1jD1MRRxM7FS8XIxkbG + w8dBx7/IPci8yTrJuco4yrfLNsu2zDXMtc01zbXONs62zzfPuNA50LrRPNG+0j/SwdNE + 08bUSdTL1U7V0dZV1tjXXNfg2GTY6Nls2fHadtr724DcBdyK3RDdlt4c3qLfKd+v4Dbg + veFE4cziU+Lb42Pj6+Rz5PzlhOYN5pbnH+ep6DLovOlG6dDqW+rl63Dr++yG7RHtnO4o + 7rTvQO/M8Fjw5fFy8f/yjPMZ86f0NPTC9VD13vZt9vv3ivgZ+Kj5OPnH+lf65/t3/Af8 + mP0p/br+S/7c/23//9IfICEiWiRjbGFzc25hbWVYJGNsYXNzZXNcTlNDb2xvclNwYWNl + oiMkXE5TQ29sb3JTcGFjZVhOU09iamVjdNIfICYnV05TQ29sb3KiJiQACAARABoAJAAp + ADIANwBJAEwAUQBTAFoAYABrAHgAfgCLAKAApwDSAPwA/gEAAQIBCQEOARQBFgEYARoN + Zg1rDXYNfw2MDY8NnA2lDaoNsgAAAAAAAAIBAAAAAAAAACgAAAAAAAAAAAAAAAAAAA21 </data> <key>DisableANSIColor</key> <false/> <key>Font</key> <data> - YnBsaXN0MDDUAQIDBAUGGBlYJHZlcnNpb25YJG9iamVjdHNZJGFyY2hpdmVyVCR0b3AS - AAGGoKQHCBESVSRudWxs1AkKCwwNDg8QVk5TU2l6ZVhOU2ZGbGFnc1ZOU05hbWVWJGNs - YXNzI0AmAAAAAAAAEBCAAoADVkdvTW9ub9ITFBUWWiRjbGFzc25hbWVYJGNsYXNzZXNW - TlNGb250ohUXWE5TT2JqZWN0XxAPTlNLZXllZEFyY2hpdmVy0RobVHJvb3SAAQgRGiMt - Mjc8QktSW2JpcnR2eH+Ej5ifoqu9wMUAAAAAAAABAQAAAAAAAAAcAAAAAAAAAAAAAAAA + YnBsaXN0MDDUAQIDBAUGBwpYJHZlcnNpb25ZJGFyY2hpdmVyVCR0b3BYJG9iamVjdHMS + AAGGoF8QD05TS2V5ZWRBcmNoaXZlctEICVRyb290gAGkCwwVFlUkbnVsbNQNDg8QERIT + FFZOU1NpemVYTlNmRmxhZ3NWTlNOYW1lViRjbGFzcyNAKgAAAAAAABAQgAKAA1ZHb01v + bm/SFxgZGlokY2xhc3NuYW1lWCRjbGFzc2VzVk5TRm9udKIZG1hOU09iamVjdAgRGiQp + MjdJTFFTWF5nbnd+hY6QkpSboKu0u74AAAAAAAABAQAAAAAAAAAcAAAAAAAAAAAAAAAA AAAAxw== </data> <key>FontAntialias</key> @@ -1390,82 +1363,81 @@ <key>FontWidthSpacing</key> <integer>1</integer> <key>ProfileCurrentVersion</key> - <real>2.0600000000000001</real> + <real>2.0699999999999998</real> <key>SelectionColor</key> <data> - YnBsaXN0MDDUAQIDBAUGKyxYJHZlcnNpb25YJG9iamVjdHNZJGFyY2hpdmVyVCR0b3AS - AAGGoKcHCBMZHSQoVSRudWxs1QkKCwwNDg8QERJcTlNDb21wb25lbnRzVU5TUkdCXE5T - Q29sb3JTcGFjZV8QEk5TQ3VzdG9tQ29sb3JTcGFjZVYkY2xhc3NPECkwLjYzNzg1MDc2 - MTQgMC4yNTM4NjgzNzEyIDAuMDYwOTk5MzExNTEgMU8QKDAuNTY0MDcwNzAxNiAwLjE4 - NDY3ODM2MDggMC4wNTY1MzkxODUzNQAQAYACgAbTFBUNFhcYVE5TSURVTlNJQ0MQB4AD - gAXSGg0bHFdOUy5kYXRhTxEMSAAADEhMaW5vAhAAAG1udHJSR0IgWFlaIAfOAAIACQAG - ADEAAGFjc3BNU0ZUAAAAAElFQyBzUkdCAAAAAAAAAAAAAAAAAAD21gABA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ZIrKizCLlov8jGOMyo0x + jZiN/45mjs6PNo+ekAaQbpDWkT+RqJIRknqS45NNk7aUIJSKlPSVX5XJljSWn5cKl3WX + 4JhMmLiZJJmQmfyaaJrVm0Kbr5wcnImc951kndKeQJ6unx2fi5/6oGmg2KFHobaiJqKW + owajdqPmpFakx6U4pammGqaLpv2nbqfgqFKoxKk3qamqHKqPqwKrdavprFys0K1Erbiu + La6hrxavi7AAsHWw6rFgsdayS7LCszizrrQltJy1E7WKtgG2ebbwt2i34LhZuNG5SrnC + uju6tbsuu6e8IbybvRW9j74KvoS+/796v/XAcMDswWfB48JfwtvDWMPUxFHEzsVLxcjG + RsbDx0HHv8g9yLzJOsm5yjjKt8s2y7bMNcy1zTXNtc42zrbPN8+40DnQutE80b7SP9LB + 00TTxtRJ1MvVTtXR1lXW2Ndc1+DYZNjo2WzZ8dp22vvbgNwF3IrdEN2W3hzeot8p36/g + NuC94UThzOJT4tvjY+Pr5HPk/OWE5g3mlucf56noMui86Ubp0Opb6uXrcOv77IbtEe2c + 7ijutO9A78zwWPDl8XLx//KM8xnzp/Q09ML1UPXe9m32+/eK+Bn4qPk4+cf6V/rn+3f8 + B/yY/Sn9uv5L/tz/bf//0h8gISJaJGNsYXNzbmFtZVgkY2xhc3Nlc1xOU0NvbG9yU3Bh + Y2WiIyRcTlNDb2xvclNwYWNlWE5TT2JqZWN00h8gJidXTlNDb2xvcqImJAAIABEAGgAk + ACkAMgA3AEkATABRAFMAWgBgAGsAeAB+AIsAoACnANMA/gEAAQIBBAELARABFgEYARoB + HA1oDW0NeA2BDY4NkQ2eDacNrA20AAAAAAAAAgEAAAAAAAAAKAAAAAAAAAAAAAAAAAAA + Dbc= </data> <key>ShowActiveProcessInTabTitle</key> <false/> @@ -1476,13 +1448,15 @@ <key>ShowCommandKeyInTitle</key> <false/> <key>ShowComponentsWhenTabHasCustomTitle</key> - <false/> + <true/> <key>ShowDimensionsInTitle</key> <false/> <key>ShowRepresentedURLInTabTitle</key> <false/> <key>ShowRepresentedURLInTitle</key> <false/> + <key>ShowRepresentedURLPathInTabTitle</key> + <true/> <key>ShowRepresentedURLPathInTitle</key> <false/> <key>ShowShellCommandInTitle</key> @@ -1495,155 +1469,151 @@ <string>xterm</string> <key>TextBoldColor</key> <data> - YnBsaXN0MDDUAQIDBAUGKyxYJHZlcnNpb25YJG9iamVjdHNZJGFyY2hpdmVyVCR0b3AS - AAGGoKcHCBMZHSQoVSRudWxs1QkKCwwNDg8QERJcTlNDb21wb25lbnRzVU5TUkdCXE5T - Q29sb3JTcGFjZV8QEk5TQ3VzdG9tQ29sb3JTcGFjZVYkY2xhc3NPECgwLjgwMTk4NTU2 - MTggMC43MzU3NzAwNDY3IDAuNTU1MDUzNTMyMSAxTxAnMC43NTY0MTcxNTUzIDAuNjg1 - MjI5MjQxOCAwLjQ4MjY3MjM5MzMAEAGAAoAG0xQVDRYXGFROU0lEVU5TSUNDEAeAA4AF - 0hoNGxxXTlMuZGF0YU8RDEgAAAxITGlubwIQAABtbnRyUkdCIFhZWiAHzgACAAkABgAx - AABhY3NwTVNGVAAAAABJRUMgc1JHQgAAAAAAAAAAAAAAAAAA9tYAAQAAAADTLUhQICAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABFjcHJ0 - AAABUAAAADNkZXNjAAABhAAAAGx3dHB0AAAB8AAAABRia3B0AAACBAAAABRyWFlaAAAC - GAAAABRnWFlaAAACLAAAABRiWFlaAAACQAAAABRkbW5kAAACVAAAAHBkbWRkAAACxAAA - AIh2dWVkAAADTAAAAIZ2aWV3AAAD1AAAACRsdW1pAAAD+AAAABRtZWFzAAAEDAAAACR0 - ZWNoAAAEMAAAAAxyVFJDAAAEPAAACAxnVFJDAAAEPAAACAxiVFJDAAAEPAAACAx0ZXh0 - AAAAAENvcHlyaWdodCAoYykgMTk5OCBIZXdsZXR0LVBhY2thcmQgQ29tcGFueQAAZGVz - YwAAAAAAAAASc1JHQiBJRUM2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+Ln/qgaaDYoUehtqImopajBqN2 + o+akVqTHpTilqaYapoum/adup+CoUqjEqTepqaocqo+rAqt1q+msXKzQrUStuK4trqGv + Fq+LsACwdbDqsWCx1rJLssKzOLOutCW0nLUTtYq2AbZ5tvC3aLfguFm40blKucK6O7q1 + uy67p7whvJu9Fb2Pvgq+hL7/v3q/9cBwwOzBZ8Hjwl/C28NYw9TEUcTOxUvFyMZGxsPH + Qce/yD3IvMk6ybnKOMq3yzbLtsw1zLXNNc21zjbOts83z7jQOdC60TzRvtI/0sHTRNPG + 1EnUy9VO1dHWVdbY11zX4Nhk2OjZbNnx2nba+9uA3AXcit0Q3ZbeHN6i3ynfr+A24L3h + ROHM4lPi2+Nj4+vkc+T85YTmDeaW5x/nqegy6LzpRunQ6lvq5etw6/vshu0R7ZzuKO60 + 70DvzPBY8OXxcvH/8ozzGfOn9DT0wvVQ9d72bfb794r4Gfio+Tj5x/pX+uf7d/wH/Jj9 + Kf26/kv+3P9t///SHyAhIlokY2xhc3NuYW1lWCRjbGFzc2VzXE5TQ29sb3JTcGFjZaIj + JFxOU0NvbG9yU3BhY2VYTlNPYmplY3TSHyAmJ1dOU0NvbG9yoiYkAAgAEQAaACQAKQAy + ADcASQBMAFEAUwBaAGAAawB4AH4AiwCgAKcA0AD6APwA/gEAAQcBDAESARQBFgEYDWQN + aQ10DX0Nig2NDZoNow2oDbAAAAAAAAACAQAAAAAAAAAoAAAAAAAAAAAAAAAAAAANsw== </data> <key>UseBoldFonts</key> <false/> @@ -1673,12 +1643,12 @@ </dict> </array> <key>rowCount</key> - <integer>25</integer> + <integer>24</integer> <key>shellExitAction</key> <integer>1</integer> <key>type</key> <string>Window Settings</string> <key>useOptionAsMetaKey</key> - <false/> + <true/> </dict> </plist> diff --git a/etc/daticns.c b/etc/daticns.c new file mode 100644 index 00000000..63f1649d --- /dev/null +++ b/etc/daticns.c @@ -0,0 +1,62 @@ +/* Copyright (C) 2022 June McEnroe <june@causal.agency> + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +#include <err.h> +#include <stdint.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <sysexits.h> + +int main(int argc, char *argv[]) { + if (argc < 2) return EX_USAGE; + + FILE *file = fopen(argv[1], "r"); + if (!file) err(EX_NOINPUT, "%s", argv[1]); + + size_t cap = 0x10000; + uint8_t *buf = malloc(cap); + if (!buf) err(EX_OSERR, "malloc"); + + size_t len = 0; + for (size_t n; 0 < (n = fread(&buf[len], 1, cap - len, file)); len += n) { + buf = realloc(buf, (cap *= 2)); + if (!buf) err(EX_OSERR, "realloc"); + } + + unsigned nr = 0; + for ( + uint8_t *ptr = buf; + NULL != (ptr = memmem(ptr, &buf[len] - ptr, "icns", 4)); + ptr += 4 + ) { + if (&ptr[8] > &buf[len]) break; + size_t len = ptr[4] << 24 | ptr[5] << 16 | ptr[6] << 8 | ptr[7]; + + char path[64]; + snprintf(path, sizeof(path), "icon%04u.icns", ++nr); + printf("%s\n", path); + + FILE *icon = fopen(path, "w"); + if (!icon) err(EX_CANTCREAT, "%s", path); + + size_t n = fwrite(ptr, 8 + len, 1, icon); + if (!n) err(EX_IOERR, "%s", path); + + int error = fclose(icon); + if (error) err(EX_IOERR, "%s", path); + } +} diff --git a/etc/layout.txt b/etc/layout.txt new file mode 100644 index 00000000..3aa2ed2b --- /dev/null +++ b/etc/layout.txt @@ -0,0 +1,9 @@ + ` ! @ # $ % ^ & * ( ) _ = backspace +tab q w e r t y u i o p { } | +esc a s d f g h j k l ; ' enter +shift z x c v b n m , . / shift + + ~ 1 2 3 4 5 6 7 8 9 0 - + backspace +tab Q W E R T Y U I O P [ ] \ +esc A S D F G H J K L : " enter +shift Z X C V B N M < > ? shift diff --git a/etc/psf/.gitignore b/etc/psf/.gitignore deleted file mode 100644 index 446e6b46..00000000 --- a/etc/psf/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -*.png -*.psfu diff --git a/etc/psf/Makefile b/etc/psf/Makefile deleted file mode 100644 index e92178cd..00000000 --- a/etc/psf/Makefile +++ /dev/null @@ -1,24 +0,0 @@ -TABLE = default.u - -FONTS += sans6x8.psfu -FONTS += sans6x10.psfu -FONTS += sans6x12.psfu - -PNGS = $(FONTS:psfu=png) - -all: $(FONTS) - -png: $(PNGS) - -$(FONTS): $(TABLE) - -.SUFFIXES: .psf .psfu .png - -.psf.psfu: - psfaddtable $< $(TABLE) $@ - -.psf.png: - psf2png $< > $@ - -clean: - rm -f $(FONTS) $(PNGS) diff --git a/etc/psf/default.u b/etc/psf/default.u deleted file mode 100644 index 790ad92b..00000000 --- a/etc/psf/default.u +++ /dev/null @@ -1,259 +0,0 @@ -# -# Character table extracted from font default8x16.psfu -# -0x000 U+2008 -0x001 U+263a -0x002 U+263b -0x003 U+2665 -0x004 U+2666 -0x005 U+2663 -0x006 U+2660 -0x007 U+2022 -0x008 U+25d8 -0x009 U+25cb -0x00a U+25d9 -0x00b U+2642 -0x00c U+2640 -0x00d U+266a -0x00e U+266b U+266c -0x00f U+263c -0x010 U+25b6 U+25ba -0x011 U+25c0 U+25c4 -0x012 U+2195 -0x013 U+203c -0x014 U+00b6 -0x015 U+00a7 -0x016 U+25ac -0x017 U+21a8 -0x018 U+2191 -0x019 U+2193 -0x01a U+2192 -0x01b U+2190 -0x01c U+221f U+2319 -0x01d U+2194 -0x01e U+25b2 -0x01f U+25bc -0x020 U+0020 U+00a0 U+2000 U+2001 U+2002 U+2003 U+2004 U+2005 U+2006 U+2007 U+2008 U+2009 U+200a U+202f -0x021 U+0021 -0x022 U+0022 -0x023 U+0023 -0x024 U+0024 -0x025 U+0025 -0x026 U+0026 -0x027 U+0027 -0x028 U+0028 -0x029 U+0029 -0x02a U+002a -0x02b U+002b -0x02c U+002c -0x02d U+002d -0x02e U+002e -0x02f U+002f -0x030 U+0030 -0x031 U+0031 -0x032 U+0032 -0x033 U+0033 -0x034 U+0034 -0x035 U+0035 -0x036 U+0036 -0x037 U+0037 -0x038 U+0038 -0x039 U+0039 -0x03a U+003a -0x03b U+003b -0x03c U+003c -0x03d U+003d -0x03e U+003e -0x03f U+003f -0x040 U+0040 -0x041 U+0041 -0x042 U+0042 -0x043 U+0043 -0x044 U+0044 -0x045 U+0045 -0x046 U+0046 -0x047 U+0047 -0x048 U+0048 -0x049 U+0049 -0x04a U+004a -0x04b U+004b -0x04c U+004c -0x04d U+004d -0x04e U+004e -0x04f U+004f -0x050 U+0050 -0x051 U+0051 -0x052 U+0052 -0x053 U+0053 -0x054 U+0054 -0x055 U+0055 -0x056 U+0056 -0x057 U+0057 -0x058 U+0058 -0x059 U+0059 -0x05a U+005a -0x05b U+005b -0x05c U+005c -0x05d U+005d -0x05e U+005e -0x05f U+005f -0x060 U+0060 -0x061 U+0061 -0x062 U+0062 -0x063 U+0063 -0x064 U+0064 -0x065 U+0065 -0x066 U+0066 -0x067 U+0067 -0x068 U+0068 -0x069 U+0069 -0x06a U+006a -0x06b U+006b -0x06c U+006c -0x06d U+006d -0x06e U+006e -0x06f U+006f -0x070 U+0070 -0x071 U+0071 -0x072 U+0072 -0x073 U+0073 -0x074 U+0074 -0x075 U+0075 -0x076 U+0076 -0x077 U+0077 -0x078 U+0078 -0x079 U+0079 -0x07a U+007a -0x07b U+007b -0x07c U+007c -0x07d U+007d -0x07e U+007e -0x07f U+2302 -0x080 U+00c7 -0x081 U+00fc -0x082 U+00e9 -0x083 U+00e2 -0x084 U+00e4 -0x085 U+00e0 -0x086 U+00e5 -0x087 U+00e7 -0x088 U+00ea -0x089 U+00eb -0x08a U+00e8 -0x08b U+00ef -0x08c U+00ee -0x08d U+00ec -0x08e U+00c4 -0x08f U+00c5 U+212b -0x090 U+00c9 -0x091 U+00e6 -0x092 U+00c6 -0x093 U+00f4 -0x094 U+00f6 -0x095 U+00f2 -0x096 U+00fb -0x097 U+00f9 -0x098 U+00ff -0x099 U+00d6 -0x09a U+00dc -0x09b U+00a2 -0x09c U+00a3 -0x09d U+00a5 -0x09e U+20a7 -0x09f U+0192 -0x0a0 U+00e1 -0x0a1 U+00ed -0x0a2 U+00f3 -0x0a3 U+00fa -0x0a4 U+00f1 -0x0a5 U+00d1 -0x0a6 U+00aa -0x0a7 U+00ba -0x0a8 U+00bf -0x0a9 U+2310 -0x0aa U+00ac -0x0ab U+00bd -0x0ac U+00bc -0x0ad U+00a1 -0x0ae U+00ab -0x0af U+00bb -0x0b0 U+2591 -0x0b1 U+2592 -0x0b2 U+2593 -0x0b3 U+2502 -0x0b4 U+2524 -0x0b5 U+2561 -0x0b6 U+2562 -0x0b7 U+2556 -0x0b8 U+2555 -0x0b9 U+2563 -0x0ba U+2551 -0x0bb U+2557 -0x0bc U+255d -0x0bd U+255c -0x0be U+255b -0x0bf U+2510 -0x0c0 U+2514 -0x0c1 U+2534 -0x0c2 U+252c -0x0c3 U+251c -0x0c4 U+2500 -0x0c5 U+253c -0x0c6 U+255e -0x0c7 U+255f -0x0c8 U+255a -0x0c9 U+2554 -0x0ca U+2569 -0x0cb U+2566 -0x0cc U+2560 -0x0cd U+2550 -0x0ce U+256c -0x0cf U+2567 -0x0d0 U+2568 -0x0d1 U+2564 -0x0d2 U+2565 -0x0d3 U+2559 -0x0d4 U+2558 -0x0d5 U+2552 -0x0d6 U+2553 -0x0d7 U+256b -0x0d8 U+256a -0x0d9 U+2518 -0x0da U+250c -0x0db U+2588 -0x0dc U+2584 -0x0dd U+258c -0x0de U+2590 -0x0df U+2580 -0x0e0 U+03b1 -0x0e1 U+00df U+03b2 -0x0e2 U+0393 -0x0e3 U+03c0 -0x0e4 U+03a3 -0x0e5 U+03c3 -0x0e6 U+00b5 U+03bc -0x0e7 U+03c4 -0x0e8 U+03a6 -0x0e9 U+0398 -0x0ea U+03a9 U+2126 -0x0eb U+03b4 -0x0ec U+221e -0x0ed U+03c6 U+2205 U+2300 -0x0ee U+03b5 U+2208 -0x0ef U+2229 -0x0f0 U+2261 -0x0f1 U+00b1 -0x0f2 U+2265 -0x0f3 U+2264 -0x0f4 U+2320 -0x0f5 U+2321 -0x0f6 U+00f7 -0x0f7 U+2248 -0x0f8 U+00b0 -0x0f9 U+2219 U+22c5 -0x0fa U+00b7 -0x0fb U+221a -0x0fc U+207f -0x0fd U+00b2 -0x0fe U+220e U+25a0 -0x0ff U+00a0 diff --git a/etc/psf/sans6x10.psf b/etc/psf/sans6x10.psf deleted file mode 100644 index 09bb1af6..00000000 --- a/etc/psf/sans6x10.psf +++ /dev/null Binary files differdiff --git a/etc/psf/sans6x12.psf b/etc/psf/sans6x12.psf deleted file mode 100644 index 75c1fd49..00000000 --- a/etc/psf/sans6x12.psf +++ /dev/null Binary files differdiff --git a/etc/psf/sans6x8.psf b/etc/psf/sans6x8.psf deleted file mode 100644 index fef671d8..00000000 --- a/etc/psf/sans6x8.psf +++ /dev/null Binary files differdiff --git a/etc/samba_mdns b/etc/samba_mdns deleted file mode 100644 index 66b13af7..00000000 --- a/etc/samba_mdns +++ /dev/null @@ -1,26 +0,0 @@ -#!/bin/sh - -# PROVIDE: samba_mdns -# REQUIRE: samba_server mdnsd -# KEYWORD: shutdown - -. /etc/rc.subr - -name="samba_mdns" -rcvar="samba_mdns_enable" - -load_rc_config $name - -: ${samba_mdns_enable:="NO"} -: ${samba_mdns_name:="${hostname}"} -: ${samba_mdns_port:="445"} -: ${samba_mdns_text:=""} - -procname="/usr/local/sbin/mdnsctl" -command="/usr/sbin/daemon" -pidfile="/var/run/${name}.pid" - -publish_args="${samba_mdns_name} smb tcp ${samba_mdns_port} '${samba_mdns_text}'" -command_args="-T mdnsctl -p ${pidfile} -- ${procname} publish ${publish_args}" - -run_rc_command "$1" diff --git a/etc/tf/cfg/autoexec.cfg b/etc/tf/cfg/autoexec.cfg deleted file mode 100644 index c584dadd..00000000 --- a/etc/tf/cfg/autoexec.cfg +++ /dev/null @@ -1,17 +0,0 @@ -cl_interp 0 -bind = "exec autoexec" -bind p "record p; stop" -bind \ kill -bind ' explode -bind / toggle_duck -bind mouse2 +attack2 -alias sens1 "sensitivity 1.7" -alias sens2 "sensitivity 1.7" -alias sens3 "sensitivity 3" -bind 1 "slot1; sens1" -bind 2 "slot2; sens2" -bind 3 "slot3; sens3" -bind mouse3 "voicemenu 2 6" -bind mouse4 "voicemenu 0 7" -bind mouse5 "voicemenu 1 4" -tf_contract_progress_show 0 diff --git a/etc/tf/cfg/engineer.cfg b/etc/tf/cfg/engineer.cfg deleted file mode 100644 index c1763c74..00000000 --- a/etc/tf/cfg/engineer.cfg +++ /dev/null @@ -1,3 +0,0 @@ -alias sens1 "sensitivity 1.5" -bind mouse3 "destroy 2; build 2" -bind mouse5 "voicemenu 2 6" diff --git a/etc/tf/cfg/medic.cfg b/etc/tf/cfg/medic.cfg deleted file mode 100644 index 56444145..00000000 --- a/etc/tf/cfg/medic.cfg +++ /dev/null @@ -1,3 +0,0 @@ -alias +uber "say_team === UBER USED MOVE FORWARD ===; +attack2" -alias -uber -attack2 -bind mouse2 +uber diff --git a/etc/tf/cfg/scout.cfg b/etc/tf/cfg/scout.cfg deleted file mode 100644 index 91e3fd94..00000000 --- a/etc/tf/cfg/scout.cfg +++ /dev/null @@ -1,2 +0,0 @@ -alias sens1 "sensitivity 1.4" -alias sens2 "sensitivity 1.4" diff --git a/etc/tf/cfg/sniper.cfg b/etc/tf/cfg/sniper.cfg deleted file mode 100644 index 39ce4a18..00000000 --- a/etc/tf/cfg/sniper.cfg +++ /dev/null @@ -1 +0,0 @@ -alias sens1 "sensitivity 1" diff --git a/etc/tf/link.sh b/etc/tf/link.sh deleted file mode 100644 index 03bd25e5..00000000 --- a/etc/tf/link.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/sh -set -eu - -tf="${HOME}/Library/Application Support/Steam/steamapps/common/Team Fortress 2/tf" -for cfg in cfg/*.cfg; do - ln -fs "${PWD}/${cfg}" "${tf}/${cfg}" -done diff --git a/etc/wsconsctl.conf b/etc/wsconsctl.conf new file mode 100644 index 00000000..05f29b6a --- /dev/null +++ b/etc/wsconsctl.conf @@ -0,0 +1,26 @@ +display.brightness=50% +keyboard.backlight=0% + +mouse1.tp.tapping=1 +mouse1.tp.scaling=0.2 +mouse1.reverse_scrolling=1 + +keyboard1.repeat.del1=200 +keyboard1.repeat.deln=50 + +keyboard1.map+='keycode 30 = exclam 1' +keyboard1.map+='keycode 31 = at 2' +keyboard1.map+='keycode 32 = numbersign 3' +keyboard1.map+='keycode 33 = dollar 4' +keyboard1.map+='keycode 34 = percent 5' +keyboard1.map+='keycode 35 = asciicircum 6' +keyboard1.map+='keycode 36 = ampersand 7' +keyboard1.map+='keycode 37 = asterisk 8' +keyboard1.map+='keycode 38 = parenleft 9' +keyboard1.map+='keycode 39 = parenright 0' +keyboard1.map+='keycode 45 = underscore minus' +keyboard1.map+='keycode 47 = braceleft bracketleft' +keyboard1.map+='keycode 48 = braceright bracketright' +keyboard1.map+='keycode 49 = bar backslash' +keyboard1.map+='keycode 50 = bar backslash' +keyboard1.map+='keycode 57 = Escape' diff --git a/etc/gpl.c b/gpl.c index bed24ff0..8ff4916d 100644 --- a/etc/gpl.c +++ b/gpl.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2020 C. McEnroe <june@causal.agency> +/* Copyright (C) 2024 June McEnroe <june@causal.agency> * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -17,4 +17,3 @@ #include <err.h> #include <stdio.h> #include <stdlib.h> -#include <sysexits.h> diff --git a/home/.bash_profile b/home/.bash_profile deleted file mode 100644 index 8dd976b3..00000000 --- a/home/.bash_profile +++ /dev/null @@ -1,2 +0,0 @@ -. ~/.profile -. ~/.bashrc diff --git a/home/.bashrc b/home/.bashrc deleted file mode 100644 index 61c9d191..00000000 --- a/home/.bashrc +++ /dev/null @@ -1,13 +0,0 @@ -. ~/.shrc - -alias ls='ls -p --color=auto' -alias grep='grep --color=auto' - -_PS0=${PS0/$'\n'/} -unset PS0 -RPS1=${RPS1/'\?'/'${?/#0/}'} - -rprompt() { - printf '%*s\r' $((COLUMNS - 1)) "${RPS1@P}" -} -PS1='\n\[${_PS0@P}$(rprompt)\]'"${PS1}" diff --git a/home/.config/X/modmap b/home/.config/X/modmap new file mode 100644 index 00000000..b0b1ea79 --- /dev/null +++ b/home/.config/X/modmap @@ -0,0 +1,16 @@ +clear Lock +keysym Caps_Lock = Escape +keysym 1 = exclam 1 +keysym 2 = at 2 +keysym 3 = numbersign 3 +keysym 4 = dollar 4 +keysym 5 = percent 5 +keysym 6 = asciicircum 6 +keysym 7 = ampersand 7 +keysym 8 = asterisk 8 +keysym 9 = parenleft 9 +keysym 0 = parenright 0 +keysym minus = underscore minus +keysym bracketleft = braceleft bracketleft +keysym bracketright = braceright bracketright +keysym backslash = bar backslash diff --git a/home/.config/X/resources b/home/.config/X/resources new file mode 100644 index 00000000..f4603cd9 --- /dev/null +++ b/home/.config/X/resources @@ -0,0 +1,52 @@ +Xft.dpi: 144 +Xft.antialias: true +Xft.hinting: false + +Xcursor.size: 64 +Xcursor.theme: dmz-aa + +XLock.usefirst: false +XLock.echokeys: true + +*Background: rgb:14/13/0E +*Foreground: rgb:B7/A9/80 +*BorderColor: rgb:99/8D/6B + +XTerm*utf8: true +XTerm*metaSendsEscape: true +XTerm*alternateScroll: true +XTerm*allowMouseOps: false +XTerm*disallowedMouseOps: X10,Locator,VT200*,Any*,Extended,SGR,URXVT +XTerm*bellIsUrgent: true +XTerm*charClass: 33:48,36-47:48,58-59:48,61:48,63-64:48,95:48,126:48 + +XTerm*VT100*translations: #override \n\ + Super <Key>C: copy-selection(CLIPBOARD) \n\ + Super <Key>V: insert-selection(CLIPBOARD) \n\ + <Btn4Down>: scroll-back(1,line,m) \n\ + <Btn5Down>: scroll-forw(1,line,m) + +XTerm*faceName: Go Mono:size=12 +XTerm*internalBorder: 6 +XTerm*colorBDMode: true +XTerm*scrollBar: false +XTerm*pointerMode: 2 + +XTerm*color0: rgb:16/15/10 +XTerm*color1: rgb:A3/28/10 +XTerm*color2: rgb:72/7A/18 +XTerm*color3: rgb:A3/77/20 +XTerm*color4: rgb:3D/62/66 +XTerm*color5: rgb:7A/49/55 +XTerm*color6: rgb:55/7A/55 +XTerm*color7: rgb:99/8D/6B +XTerm*color8: rgb:4C/46/35 +XTerm*color9: rgb:CC/32/14 +XTerm*color10: rgb:8E/99/1E +XTerm*color11: rgb:CC/95/28 +XTerm*color12: rgb:4C/7B/7F +XTerm*color13: rgb:99/5B/6B +XTerm*color14: rgb:6B/99/6B +XTerm*color15: rgb:CC/BC/8E +XTerm*colorBD: rgb:CC/BC/8E +XTerm*cursorColor: rgb:7A/71/55 diff --git a/home/.config/cwm/cwmrc b/home/.config/cwm/cwmrc new file mode 100644 index 00000000..d72ec163 --- /dev/null +++ b/home/.config/cwm/cwmrc @@ -0,0 +1,87 @@ +sticky yes +snapdist 10 +moveamount 10 + +ignore clock +autogroup 0 clock,XTerm +gap 38 0 0 0 + +unbind-key all +bind-key 4-n terminal +bind-key 4-t "firefox -new-tab about:blank" +bind-key 4-Delete lock +bind-key 4-Down window-lower +bind-key 4-Up window-raise +bind-key 4-slash menu-window +bind-key 4-Tab group-cycle +bind-key 4S-Tab group-rcycle +bind-key 4-grave window-cycle +bind-key 4S-grave window-rcycle +bind-key 4-w window-close +bind-key 4-exclam group-only-1 +bind-key 4-at group-only-2 +bind-key 4-numbersign group-only-3 +bind-key 4-dollar group-only-4 +bind-key 4-percent group-only-5 +bind-key 4-asciicircum group-only-6 +bind-key 4-ampersand group-only-7 +bind-key 4-asterisk group-only-8 +bind-key 4-parenleft group-only-9 +bind-key 4S-exclam window-movetogroup-1 +bind-key 4S-at window-movetogroup-2 +bind-key 4S-numbersign window-movetogroup-3 +bind-key 4S-dollar window-movetogroup-4 +bind-key 4S-percent window-movetogroup-5 +bind-key 4S-asciicircum window-movetogroup-6 +bind-key 4S-ampersand window-movetogroup-7 +bind-key 4S-asterisk window-movetogroup-8 +bind-key 4S-parenleft window-movetogroup-9 +bind-key 4-f window-fullscreen +bind-key 4-m window-maximize +bind-key 4-equal window-vmaximize +bind-key 4S-equal window-hmaximize +bind-key 4-underscore window-vtile +bind-key 4S-underscore window-htile +bind-key 4-h window-move-left-big +bind-key 4-j window-move-down-big +bind-key 4-k window-move-up-big +bind-key 4-l window-move-right-big +bind-key 4S-h window-move-left +bind-key 4S-j window-move-down +bind-key 4S-k window-move-up +bind-key 4S-l window-move-right +bind-key 4S-y window-snap-up-left +bind-key 4S-u window-snap-up-right +bind-key 4S-b window-snap-down-left +bind-key 4S-n window-snap-down-right +bind-key 4M-h window-resize-left +bind-key 4M-j window-resize-down +bind-key 4M-k window-resize-up +bind-key 4M-l window-resize-right +bind-key 4MS-h window-resize-left-big +bind-key 4MS-j window-resize-down-big +bind-key 4MS-k window-resize-up-big +bind-key 4MS-l window-resize-right-big +bind-key 4-space menu-exec +bind-key 4S-r restart +bind-key 4S-q quit + +bind-key F1 "xbacklight -steps 1 -5" +bind-key F2 "xbacklight -steps 1 +5" +bind-key F10 "sndioctl output.mute=!" +bind-key F11 "sndioctl output.level=-0.05" +bind-key F12 "sndioctl output.level=+0.05" + +unbind-mouse all +bind-mouse 4-1 window-move +bind-mouse 4S-1 window-resize + +fontname "Go Mono:size=11" +borderwidth 2 +color inactiveborder rgb:4C/46/35 +color activeborder rgb:99/8D/6B +color urgencyborder rgb:A3/77/20 +color menubg rgb:14/13/0E +color menufg rgb:B7/A9/80 +color font rgb:B7/A9/80 +color selfont rgb:14/13/0E diff --git a/home/.config/git/config b/home/.config/git/config index 5c12c079..c990de2c 100644 --- a/home/.config/git/config +++ b/home/.config/git/config @@ -1,18 +1,34 @@ [user] - name = C. McEnroe + name = June McEnroe email = june@causal.agency +[branch] + sort = committerdate + [commit] verbose = true +[diff] + colorMoved = default + colorMovedWS = allow-indentation-change + [merge] conflictStyle = diff3 +[push] + autoSetupRemote = true + +[pull] + rebase = true + [rebase] autosquash = true [pretty] log = %Cred%h %Creset%s%C(yellow)%d %Cgreen(%ar) %Cblue<%aN> +[alias] + forgive = blame + [include] path = ./private diff --git a/home/.config/htop/htoprc b/home/.config/htop/htoprc index beb3031e..705323ef 100644 --- a/home/.config/htop/htoprc +++ b/home/.config/htop/htoprc @@ -1,9 +1,10 @@ # Beware! This file is rewritten by htop when settings are changed in the interface. # The parser is also very primitive, and not human-friendly. -fields=0 48 39 2 46 49 1 +fields=0 48 39 2 46 49 1 sort_key=47 sort_direction=1 -hide_threads=0 +tree_sort_key=0 +tree_sort_direction=1 hide_kernel_threads=1 hide_userland_threads=1 shadow_other_users=0 @@ -12,15 +13,26 @@ show_program_path=1 highlight_base_name=1 highlight_megabytes=1 highlight_threads=1 +highlight_changes=0 +highlight_changes_delay_secs=5 +find_comm_in_cmdline=1 +strip_exe_from_cmdline=1 +show_merged_command=0 tree_view=1 +tree_view_always_by_pid=0 +all_branches_collapsed=0 header_margin=0 detailed_cpu_time=0 -cpu_count_from_zero=0 +cpu_count_from_one=1 +show_cpu_usage=1 +show_cpu_frequency=0 update_process_names=0 account_guest_in_cpu_meter=0 color_scheme=0 +enable_mouse=0 delay=15 -left_meters=AllCPUs2 -left_meter_modes=1 -right_meters=Memory Swap -right_meter_modes=1 1 +left_meters=AllCPUs2 +left_meter_modes=1 +right_meters=Memory Swap +right_meter_modes=1 1 +hide_function_bar=2 diff --git a/home/.config/nvim/colors/trivial.vim b/home/.config/nvim/colors/trivial.vim deleted file mode 100644 index 3ebe8d97..00000000 --- a/home/.config/nvim/colors/trivial.vim +++ /dev/null @@ -1,65 +0,0 @@ -hi clear -syntax reset -let colors_name = 'trivial' - -hi Normal ctermbg=NONE ctermfg=NONE - -hi ColorColumn ctermbg=0 -hi EndOfBuffer ctermfg=8 -hi VertSplit cterm=NONE ctermbg=NONE ctermfg=8 -hi LineNr ctermfg=8 -hi MatchParen ctermbg=NONE ctermfg=3 -hi ModeMsg ctermfg=8 -hi MoreMsg ctermfg=2 -hi! link Question MoreMsg -hi WarningMsg ctermfg=1 -hi NonText ctermfg=8 -hi Search ctermbg=NONE ctermfg=11 -hi StatusLine cterm=NONE ctermbg=0 ctermfg=7 -hi StatusLineNC cterm=NONE ctermbg=0 ctermfg=8 -hi Folded ctermbg=0 ctermfg=8 -hi Visual cterm=inverse ctermbg=NONE -hi Title ctermfg=5 -hi Directory ctermfg=4 - -hi Comment ctermfg=4 - -hi! link Constant Normal -hi String ctermfg=6 -hi link Character String - -hi! link Identifier Normal - -hi Statement ctermfg=7 -hi link Operator Normal - -hi PreProc ctermfg=2 - -hi! link Type Normal -hi link StorageClass Statement -hi link Structure StorageClass -hi link Typedef Structure - -hi! link Special Normal -hi SpecialComment ctermfg=12 -hi SpecialKey ctermfg=5 - -hi Underlined ctermfg=NONE -hi Error ctermbg=NONE ctermfg=9 -hi SpellBad ctermbg=NONE ctermfg=1 -hi! link Todo SpecialComment - -hi cFormat ctermfg=14 - -hi diffAdded ctermfg=10 -hi diffRemoved ctermfg=9 - -hi manUnderline cterm=italic - -hi link pythonInclude Statement - -hi link rubyDefine Structure -hi link rubyStringDelimiter String -hi link rubySymbol String - -hi link rustModPath Identifier diff --git a/home/.config/nvim/ftdetect/mdoc.vim b/home/.config/nvim/ftdetect/mdoc.vim deleted file mode 100644 index b845fee6..00000000 --- a/home/.config/nvim/ftdetect/mdoc.vim +++ /dev/null @@ -1 +0,0 @@ -autocmd BufRead,BufNewFile *.[1-9] set filetype=mdoc diff --git a/home/.config/nvim/init.vim b/home/.config/nvim/init.vim deleted file mode 100644 index 9245ccf4..00000000 --- a/home/.config/nvim/init.vim +++ /dev/null @@ -1,37 +0,0 @@ -set hidden -set undofile -set shortmess=atI -set wildmode=list:longest wildignore=*.o -set splitbelow splitright -command! W w -command! Q q - -set tabstop=4 shiftwidth=4 shiftround -set smartindent cinoptions=l1(sU1m1 -set ignorecase smartcase inccommand=nosplit -nmap <leader><leader> :nohlsearch<CR> -set foldmethod=syntax foldlevel=99 foldopen-=block -let asmsyntax = "nasm" -let c_syntax_for_h = 1 -let is_posix = 1 -let man_hardwrap = 1 - -set title laststatus=1 -set scrolloff=1 -set noruler colorcolumn=80 -set list listchars=tab:\ \ ,trail:· -colorscheme trivial - -autocmd TermOpen * setlocal statusline=%{b:term_title} -autocmd BufEnter term://* startinsert -tmap <C-w> <C-\><C-n><C-w> - -let g:clipboard = {'copy':{'+':'pbcopy'},'paste':{'+':'pbpaste'}} -nmap gp `[v`] - -nmap <leader>s vip:sort<CR> -nmap <leader>S $vi{:sort<CR> -nmap <leader>a m':0/^#include <<CR>:nohlsearch<CR>O#include < -nmap <leader>l :0read ~/src/etc/agpl.c<CR>'' -nmap <leader>L :0read ~/src/etc/gpl.c<CR>'' -nmap <leader>d :0delete<CR>:0read !date +'.Dd \%B \%e, \%Y'<CR> diff --git a/home/.config/nvim/syntax/mdoc.vim b/home/.config/nvim/syntax/mdoc.vim deleted file mode 100644 index d9d587f5..00000000 --- a/home/.config/nvim/syntax/mdoc.vim +++ /dev/null @@ -1,12 +0,0 @@ -if exists("b:current_syntax") - finish -endif - -runtime! syntax/nroff.vim -unlet! b:current_syntax - -setlocal sections+=ShSs -syntax match mdocBlank /^\.$/ conceal -setlocal conceallevel=2 - -let b:current_syntax = "mdoc" diff --git a/home/.local/bin/clock b/home/.local/bin/clock new file mode 100755 index 00000000..ef8cd6d8 --- /dev/null +++ b/home/.local/bin/clock @@ -0,0 +1,17 @@ +#!/bin/sh +set -eu + +tput civis +sleep=$(( 60 - $(date +'%S' | sed 's/^0//') )) +while :; do + if [ $(apm -a) -eq 1 ]; then + printf '%3s%%' "$(apm -l)" + else + test $(apm -b) -eq 2 && tput setaf 1 bold + printf '%3.3sm' "$(apm -m)" + tput sgr0 + fi + printf ' %s\r' "$(date +'%a %H:%M')" + sleep $sleep + sleep=60 +done diff --git a/home/.local/bin/deg b/home/.local/bin/deg new file mode 100755 index 00000000..216029ed --- /dev/null +++ b/home/.local/bin/deg @@ -0,0 +1,6 @@ +#!/bin/sh +set -eu +cat <<EOF +${1}°F = $(dc -e "1k $(echo "$1" | sed 's/^-/_/') 32-1.8/p")°C +${1}°C = $(dc -e "1k $(echo "$1" | sed 's/^-/_/') 1.8*32+p")°F +EOF diff --git a/home/.local/bin/mdate b/home/.local/bin/mdate new file mode 100755 index 00000000..daff50dc --- /dev/null +++ b/home/.local/bin/mdate @@ -0,0 +1,2 @@ +#!/bin/sh +exec date +'.Dd %B %e, %Y' diff --git a/home/.local/bin/mins b/home/.local/bin/mins new file mode 100755 index 00000000..9cbd5fa8 --- /dev/null +++ b/home/.local/bin/mins @@ -0,0 +1,4 @@ +#!/bin/sh +exec dc <<EOF +$1 60~rn[h]nn[m]p +EOF diff --git a/home/.local/bin/nasd b/home/.local/bin/nasd index d64b2c3a..60241395 100755 --- a/home/.local/bin/nasd +++ b/home/.local/bin/nasd @@ -2,8 +2,13 @@ set -eu dir=$(mktemp -d) -echo 'bits 64' > "${dir}/input" -cat >> "${dir}/input" -nasm -o "${dir}/output" "${dir}/input" || true -ndisasm -b 64 "${dir}/output" || true -rm -r "$dir" +trap 'rm -r "$dir"' EXIT + +echo 'bits 64' >"${dir}/input" +for ins; do + printf '%s\n' "$ins" >>"${dir}/input" +done +[ $# -eq 0 ] && cat >>"${dir}/input" + +nasm -o "${dir}/output" "${dir}/input" +ndisasm -b 64 "${dir}/output" diff --git a/home/.local/bin/np b/home/.local/bin/np index 7d54574c..b0eb2326 100755 --- a/home/.local/bin/np +++ b/home/.local/bin/np @@ -1,6 +1,6 @@ #!/usr/bin/osascript -tell application "iTunes" +tell application "Music" tell current track get "/me is listening to " & artist & " — " & name end tell diff --git a/home/.local/bin/open b/home/.local/bin/open new file mode 100755 index 00000000..9439f07d --- /dev/null +++ b/home/.local/bin/open @@ -0,0 +1,19 @@ +#!/bin/sh +set -eu + +if [ -n "${SSH_CLIENT:-}" ]; then + exec pbd -o "$@" +fi + +case "$1" in + (*.gif|*.jpeg|*.jpg|*.png) + curl -LSs "$1" | imv - + ;; + (https://youtu.be/*|https://www.youtube.com/watch*|https://twitch.tv/*) + ulimit -c 0 # mpv segfaults on exit every time on OpenBSD... + exec mpv "$1" >/dev/null 2>&1 + ;; + (*) + exec firefox -new-tab "$1" >/dev/null 2>&1 + ;; +esac diff --git a/home/.local/bin/pbcopy b/home/.local/bin/pbcopy new file mode 100755 index 00000000..a804f836 --- /dev/null +++ b/home/.local/bin/pbcopy @@ -0,0 +1,11 @@ +#!/bin/sh +set -eu + +if [ -n "${SSH_CLIENT:-}" ]; then + exec pbd -c +elif [ -n "${DISPLAY:-}" ]; then + exec xsel -bi +else + echo "${0}: don't know what to do" >&2 + exit 1 +fi diff --git a/home/.local/bin/pbpaste b/home/.local/bin/pbpaste new file mode 100755 index 00000000..2924f01e --- /dev/null +++ b/home/.local/bin/pbpaste @@ -0,0 +1,11 @@ +#!/bin/sh +set -eu + +if [ -n "${SSH_CLIENT:-}" ]; then + exec pbd -p +elif [ -n "${DISPLAY:-}" ]; then + exec xsel -bo +else + echo "${0}: don't know what to do" >&2 + exit 1 +fi diff --git a/home/.local/bin/versions b/home/.local/bin/versions new file mode 100755 index 00000000..25e5ff72 --- /dev/null +++ b/home/.local/bin/versions @@ -0,0 +1,9 @@ +#!/bin/sh +set -u + +for repo in ~/src/git/*; do + version=$(git -C "${repo}" describe --dirty 2>/dev/null) + if [ $? -eq 0 ]; then + echo "${repo##*/}-${version#v}" + fi +done | sort -nr -t '-' -k 3 | column -t -s '-' diff --git a/home/.local/bin/wcfix b/home/.local/bin/wcfix deleted file mode 100755 index b31bd19b..00000000 --- a/home/.local/bin/wcfix +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/sh -set -eu - -export DYLD_FORCE_FLAT_NAMESPACE=1 -export DYLD_INSERT_LIBRARIES=~/.local/lib/libwcwidth.dylib - -exec "$@" diff --git a/home/.local/bin/whinclude b/home/.local/bin/whinclude new file mode 100755 index 00000000..26445cdc --- /dev/null +++ b/home/.local/bin/whinclude @@ -0,0 +1,11 @@ +#!/bin/sh +set -eu + +echo "#include <${1}>" | +cc ${CFLAGS:-} -E -x c - | +sed -En ' + /^# [0-9]+ "[^<]/{ + s/.*"([^"]+)".*/\1/p + q + } +' diff --git a/home/.profile b/home/.profile index 031d2e1e..7d4ba822 100644 --- a/home/.profile +++ b/home/.profile @@ -1,22 +1,28 @@ _PATH=$PATH PATH= -path() { [ -d "$1" ] && PATH="${PATH}${PATH:+:}${1}"; } -for prefix in '' /usr/local /usr/pkg /usr /opt/pkg ~/.local; do +path() { test -d "$1" && PATH="${PATH}${PATH:+:}${1}"; } +for prefix in '' /usr/local /opt/local /usr ~/.local ~/.cargo; do path "${prefix}/sbin" path "${prefix}/bin" done +path /usr/X11R6/bin path /usr/games +export MANPATH=:~/.local/share/man +export EDITOR=vi +command -v nvi >/dev/null && EDITOR=nvi +export EXINIT='set ai extended iclower sm sw=4 ts=4 para=BlBdPpIt sect=ShSs +map gg 1G' export PAGER=less -export LESS=FRX -export EDITOR=nvim -export MANPAGER='nvim +Man!' -export MANSECT=2:3:1:8:6:5:7:4:9 +export LESS=FRXix4 export CLICOLOR=1 -export GPG_TTY=$(tty) +export MANSECT=2:3:1:8:6:5:7:4:9 export NETHACKOPTIONS='pickup_types:$!?+/=, color, DECgraphics' +command -v diff-highlight >/dev/null && +export GIT_PAGER="diff-highlight | $PAGER" + +test -e /usr/share/mk/sys.mk || export CFLAGS=-O +test -d /usr/home && cd -type nvim >/dev/null || EDITOR=vim -[ -e /usr/share/mk/sys.mk ] || export CFLAGS=-O -[ -d /usr/home ] && cd +test -f ~/.profile.local && . ~/.profile.local export ENV=~/.shrc diff --git a/home/.shrc b/home/.shrc index 65dda9da..afa87fe5 100644 --- a/home/.shrc +++ b/home/.shrc @@ -1,38 +1,54 @@ set -o noclobber -o nounset -o vi -HISTFILE=~/.history CDPATH=:~ -alias vim=$EDITOR +alias vi=$EDITOR alias ls='LC_COLLATE=C ls -p' alias ll='ls -hl' +alias ff='find . -type f -name' alias bc='bc -l' +alias ag='ag --pager=$PAGER' alias gs='git status --short --branch || ls' gd='git diff' alias gsh='git show' gl='git log --graph --pretty=log' alias gco='git checkout' gb='git branch' gm='git merge' gst='git stash' -alias ga='git add' gr='git reset' gmv='git mv' grm='git rm' +alias ga='git add' gmv='git mv' grm='git rm' alias gc='git commit' gca='gc --amend' gt='git tag' alias gp='git push' gu='git pull' gf='git fetch' +alias gr='git rebase' grc='git rebase --continue' alias rand='openssl rand -base64 33' alias private='eval "$(gpg -d ~/.private)"' -type doas 2>/dev/null && alias sudo=doas +command -v doas >/dev/null || alias doas=sudo + +man() { + test $# -ne 1 && { command man "$@"; return $?; } + (IFS=: + for sect in $MANSECT; do + command man -w $sect "$1" >/dev/null 2>&1 && exec man $sect "$1" + done + exec command man "$1") +} cd() { + local path if [ $# -eq 0 ]; then - builtin cd + command cd + elif [ "${1%%:*}" != "$1" ]; then + path=${1#*:} + [ -n "${path}" ] || path=${PWD#${HOME}/} + SSH_CD=$path ssh -o SendEnv=SSH_CD "${1%%:*}" elif [ -e "$1" -a ! -d "$1" ]; then - builtin cd "${1%/*}" && $EDITOR "${1##*/}" + command cd "${1%/*}" && $EDITOR "${1##*/}" else - builtin cd "$@" + command cd "$@" fi } +if [ -n "${SSH_CD:-}" ]; then + cd "${SSH_CD}" + unset SSH_CD +fi -PS0=$'\n' -PS1='\$ ' -RPS1="\? ${SSH_CLIENT:+\h:}\w" +export LESS_TERMCAP_us=$(tput sitm) +export LESS_TERMCAP_ue=$(tput ritm) -if [ "${TERM%-*}" = 'xterm' ]; then - tsl=$'\e]0;' - fsl=$'\e\\' - PS0="${tsl}${SSH_CLIENT:+\h:}\W${fsl}${PS0}" -fi +PS1='\[\033]0;${SSH_CLIENT:+\\h:}\W\a\] +${?#0}$ ' diff --git a/home/.ssh/config b/home/.ssh/config index 5dad0aba..f579ae9f 100644 --- a/home/.ssh/config +++ b/home/.ssh/config @@ -1,17 +1,16 @@ IgnoreUnknown Include Include config_private -HashKnownHosts yes - +AddKeysToAgent yes SendEnv LANG LC_* -Host monday beastie puffy toaster tux +Host tuesday beastie puffy toaster tux progynova HostName %h.local ForwardAgent yes RemoteForward 7062 127.0.0.1:7062 -Host june july - HostName %h.nyc3.do.causal.agency +Host scout soldier pyro demo heavy engi medic sniper spy + HostName %h.causal.agency Port 2222 Host git.causal.agency temp.causal.agency diff --git a/home/.xsession b/home/.xsession new file mode 100644 index 00000000..1e05126c --- /dev/null +++ b/home/.xsession @@ -0,0 +1,14 @@ +. ~/.profile +export LC_CTYPE=en_US.UTF-8 + +xset r rate 175 m 5/4 0 +xmodmap ~/.config/X/modmap +xrdb -load ~/.config/X/resources + +fg=998D6B +command -v scheme && fg=$(scheme -p $(jot -r 1 1 8)) +xsetroot -bitmap /usr/X11R6/include/X11/bitmaps/escherknot \ + -bg '#14130E' -fg "#${fg}" + +xterm -name clock -geometry 14x1-0+0 -sl 0 -e clock & +exec cwm -c ~/.config/cwm/cwmrc diff --git a/install.sh b/install.sh index 55e071fa..11269fb7 100644 --- a/install.sh +++ b/install.sh @@ -1,58 +1,39 @@ #!/bin/sh set -eu -pkgAny='curl htop sl the_silver_searcher tree' -pkgDarwin="${pkgAny}" -pkgFreeBSD="${pkgAny} ddate neovim" -pkgLinux="${pkgAny} bc ctags gdb neovim openssh" -pkgNetBSD="${pkgAny} vim" -pkgOpenBSD="${pkgAny} neovim" +X= +while getopts 'X' opt; do + case "$opt" in + (X) X=1;; + (?) exit 1;; + esac +done -pkgsrcTag='20171103' -neovimTag='v0.4.3' -Darwin() { - xcode-select --install || true - if [ ! -d /opt/pkg ]; then - tar="bootstrap-trunk-x86_64-${pkgsrcTag}.tar.gz" - url="https://pkgsrc.joyent.com/packages/Darwin/bootstrap/${tar}" - curl -O "$url" - sudo tar -pxz -f "$tar" -C / - rm "$tar" - fi - sudo pkgin update - sudo pkgin install $pkgDarwin - sudo ln -fs /opt/pkg/bin/gpg2 /usr/local/bin/gpg - if [ ! -f /usr/local/bin/nvim ]; then - tar='nvim-macos.tar.gz' - base='https://github.com/neovim/neovim/releases/download' - url="${base}/${neovimTag}/${tar}" - curl -L -O "$url" - sudo tar -x -f "$tar" -C /usr/local --strip-components 1 - rm "$tar" - fi -} +packages='curl htop sl the_silver_searcher tree' FreeBSD() { - pkg install $pkgFreeBSD + pkg install ddate $packages } -Linux() { - pacman -Sy --needed $pkgLinux +OpenBSD() { + pkg_add $packages + if test $X; then + pkg_add firefox go-fonts imv scrot sct w3m-- xcursor-dmz xsel + fi } -NetBSD() { - if [ ! -f /usr/pkg/bin/pkgin ]; then - base="ftp://ftp.NetBSD.org/pub/pkgsrc/packages" - export PKG_PATH="${base}/$(uname -s)/$(uname -p)/$(uname -r)/All" - pkg_add pkgin - echo "$PKG_PATH" > /usr/pkg/etc/pkgin/repositories.conf - fi - pkgin update - pkgin install $pkgNetBSD +Linux() { + packages=$( + echo $packages | sed 's/the_silver_searcher/silversearcher-ag/' + ) + apt-get install bc build-essential exuberant-ctags gdb nvi $packages } -OpenBSD() { - pkg_add $pkgOpenBSD +Darwin() { + packages=$(echo $packages | sed 's/the_silver_searcher/ag/') + cd git/jorts + git pull + ./Install git mandoc nvi $packages } $(uname) diff --git a/pdf/.gitignore b/pdf/.gitignore deleted file mode 100644 index a1363379..00000000 --- a/pdf/.gitignore +++ /dev/null @@ -1 +0,0 @@ -*.pdf diff --git a/pdf/Makefile b/pdf/Makefile deleted file mode 100644 index 91de32b7..00000000 --- a/pdf/Makefile +++ /dev/null @@ -1,31 +0,0 @@ -PDFS += abi.pdf -PDFS += c11.pdf -PDFS += elf.pdf -PDFS += intel-64-opt.pdf -PDFS += intel-64-sdm-vol-1.pdf -PDFS += intel-64-sdm-vol-2.pdf -PDFS += intel-64-sdm-vol-3.pdf -PDFS += intel-64-sdm-vol-4.pdf -PDFS += multiboot.pdf - -ELF = http://refspecs.linuxbase.org/elf -INTEL = https://software.intel.com/sites/default/files/managed - -URL_abi.pdf = ${ELF}/x64_64-abi-0.99.pdf -URL_c11.pdf = http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1570.pdf -URL_elf.pdf = ${ELF}/elf.pdf -URL_intel-64-opt.pdf = ${INTEL}/9e/bc/64-ia-32-architectures-optimization-manual.pdf -URL_intel-64-sdm-vol-1.pdf = ${INTEL}/a4/60/253665-sdm-vol-1.pdf -URL_intel-64-sdm-vol-2.pdf = ${INTEL}/a4/60/325383-sdm-vol-2abcd.pdf -URL_intel-64-sdm-vol-3.pdf = ${INTEL}/a4/60/325384-sdm-vol-3abcd.pdf -URL_intel-64-sdm-vol-4.pdf = ${INTEL}/22/0d/335592-sdm-vol-4.pdf -URL_multiboot.pdf = https://www.gnu.org/software/grub/manual/multiboot/multiboot.pdf - -all: ${PDFS} - -${PDFS}: - curl -o $@ ${URL_$@} - chmod 444 $@ - -clean: - rm -f ${PDFS} diff --git a/port/ddate/.gitignore b/port/ddate/.gitignore new file mode 100644 index 00000000..eaa8a5fd --- /dev/null +++ b/port/ddate/.gitignore @@ -0,0 +1 @@ +ddate diff --git a/port/ddate/Makefile b/port/ddate/Makefile new file mode 100644 index 00000000..c1bc4553 --- /dev/null +++ b/port/ddate/Makefile @@ -0,0 +1,15 @@ +PREFIX ?= ~/.local +MANDIR ?= ${PREFIX}/share/man + +ddate: + +clean: + rm -f ddate + +install: ddate ddate.1 + install -d ${PREFIX}/bin ${MANDIR}/man1 + install ddate ${PREFIX}/bin + install -m 644 ddate.1 ${MANDIR}/man1 + +uninstall: + rm -f ${PREFIX}/bin/ddate ${MANDIR}/man1/ddate.1 diff --git a/port/ddate/ddate.1 b/port/ddate/ddate.1 new file mode 100644 index 00000000..c340578f --- /dev/null +++ b/port/ddate/ddate.1 @@ -0,0 +1,117 @@ +.\" All Rites Reversed. This file is in the PUBLIC DOMAIN. +.\" Kallisti. +.TH DDATE 1 "Bureaucracy 3161" "ddate" "Emperor Norton User Command" +.SH NAME +ddate \- convert Gregorian dates to Discordian dates +.SH SYNOPSIS +.B ddate +.RI [ \fB+\fPformat] +.RI [ date ] +.SH DESCRIPTION +.B ddate +prints the date in Discordian date format. +.PP +If called with no arguments, +.B ddate +will get the current system date, convert this to the Discordian +date format and print this on the standard output. Alternatively, a +Gregorian date may be specified on the command line, in the form of a numerical +day, month and year. +.PP +If a format string is specified, the Discordian date will be printed in +a format specified by the string. This mechanism works similarly to the +format string mechanism of +.B date(1), +only almost completely differently. The fields are: +.IP %A +Full name of the day of the week (i.e., Sweetmorn) +.IP %a +Abbreviated name of the day of the week (i.e., SM) +.IP %B +Full name of the season (i.e., Chaos) +.IP %b +Abbreviated name of the season (i.e., Chs) +.IP %d +Cardinal number of day in season (i.e., 23) +.IP %e +Ordinal number of day in season (i.e., 23rd) +.IP %H +Name of current Holyday, if any +.IP %N +Magic code to prevent rest of format from being printed unless today is +a Holyday. +.IP %n +Newline +.IP %t +Tab +.IP %X +Number of days remaining until X-Day. (Not valid if the SubGenius options +are not compiled in.) +.IP %Y +The year of our Lady Discord (i.e., 3182) +.IP %{ +.IP %} +Used to enclose the part of the string which is to be replaced with the +words "St. Tib's Day" if the current day is St. Tib's Day. +.IP %\. +Try it and see. +.bp +.SH EXAMPLES +.nf +% ddate +.br +Sweetmorn, Bureaucracy 42, 3161 YOLD +.PP +% ddate +'Today is %{%A, the %e of %B%}, %Y. %N%nCelebrate %H' +.br +Today is Sweetmorn, the 42nd of Bureaucracy, 3161. +.PP +% ddate +"It's %{%A, the %e of %B%}, %Y. %N%nCelebrate %H" 26 9 1995 +.br +It's Prickle-Prickle, the 50th of Bureaucracy, 3161. +.br +Celebrate Bureflux +.PP +% ddate +"Today's %{%A, the %e of %B%}, %Y. %N%nCelebrate %H" 29 2 1996 +.br +Today's St. Tib's Day, 3162. +.br + +.SH BUGS + +.B ddate(1) +will produce undefined behavior if asked to produce the date for St. Tib's +day and its format string does not contain the St. Tib's Day delimiters +%{ and %}. + +.SH NOTE + +After `X-Day' passed without incident, the Church of the SubGenius +declared that it had got the year upside down - X-Day is actually in 8661 AD +rather than 1998 AD. Thus, the True X-Day is Cfn 40, 9827. + +.SH AUTHOR +.nh +Original program by Druel the Chaotic aka Jeremy Johnson (mpython@gnu.ai.mit.edu) +.br +Major rewrite by Lee H:. O:. Smith, KYTP, aka Andrew Bulhak (acb@dev.null.org) +.br +Gregorian B.C.E. dates fixed by Chaplain Nyan the Wiser, aka Dan Dart (ntw@dandart.co.uk) +.br +Five tons of flax. + +.SH DISTRIBUTION POLICY + +Public domain. All rites reversed. + +.SH SEE ALSO + +date(1), +.br +http://www.subgenius.com/ +.br +Malaclypse the Younger, +.I "Principia Discordia, Or How I Found Goddess And What I Did To Her When I Found Her" + +.SH AVAILABILITY +The ddate command is available from https://github.com/bo0ts/ddate. diff --git a/port/ddate/ddate.c b/port/ddate/ddate.c new file mode 100644 index 00000000..c0a6bf37 --- /dev/null +++ b/port/ddate/ddate.c @@ -0,0 +1,399 @@ +/* $ DVCS ID: $jer|,523/lhos,KYTP!41023161\b"?" <<= DO NOT DELETE! */ + +/* ddate.c .. converts boring normal dates to fun Discordian Date -><- + written the 65th day of The Aftermath in the Year of Our Lady of + Discord 3157 by Druel the Chaotic aka Jeremy Johnson aka + mpython@gnu.ai.mit.edu + 28 Sever St Apt #3 + Worcester MA 01609 + + and I'm not responsible if this program messes anything up (except your + mind, I'm responsible for that) + + (k) YOLD 3161 and all time before and after. + Reprint, reuse, and recycle what you wish. + This program is in the public domain. Distribute freely. Or not. + + Majorly hacked, extended and bogotified/debogotified on + Sweetmorn, Bureaucracy 42, 3161 YOLD, by Lee H:. O:. Smith, KYTP, + aka Andrew Bulhak, aka acb@dev.null.org + + Slightly hackled and crackled by a sweet firey stove on + Boomtime, the 53rd day of Bureaucracy in the YOLD 3179, + by Chaplain Nyan the Wiser, aka Dan Dart, aka ntw@dandart.co.uk + + and I'm not responsible if this program messes anything up (except your + mind, I'm responsible for that) (and that goes for me as well --lhos) + + Version history: + Bureflux 3161: First release of enhanced ddate with format strings + 59 Bcy, 3161: PRAISE_BOB and KILL_BOB options split, other minor + changes. + 53 Bcy, 3179: Fixed gregorian date conversions less than YOLD 1167 + + 1999-02-22 Arkadiusz Miskiewicz <misiek@pld.ORG.PL> + - added Native Language Support + + 2000-03-17 Burt Holzman <holzman+ddate@gmail.com> + - added range checks for dates + + 2014-06-07 William Woodruff <william@tuffbizz.com> + - removed gettext dependent locale code + + 15th of Confusion, 3180: + - call out adherents of the wrong fruit + + FIVE TONS OF FLAX +*/ + +/* configuration options VVVVV READ THIS!!! */ + +/* If you wish ddate(1) to print the date in the same format as Druel's + * original ddate when called in immediate mode, define OLD_IMMEDIATE_FMT + */ + +#define OLD_IMMEDIATE_FMT + +/* If you wish to use the US format for aneristic dates (m-d-y), as opposed to + * the Commonwealth format, define US_FORMAT. + */ + +/* #define US_FORMAT */ + +/* If you are ideologically, theologically or otherwise opposed to the + * Church of the SubGenius and do not wish your copy of ddate(1) to contain + * code for counting down to X-Day, undefine KILL_BOB */ + +#define KILL_BOB 13013 + +/* If you wish ddate(1) to contain SubGenius slogans, define PRAISE_BOB */ + +/*#define PRAISE_BOB 13013*/ + +#include <stdlib.h> +#include <string.h> +#include <time.h> +#include <stdio.h> + + +// work around includes and defines from formerly c.h +#ifndef ARRAY_SIZE +# define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr)) +#endif + +/* &a[0] degrades to a pointer: a different type from an array */ +# define __must_be_array(a) \ + BUILD_BUG_ON_ZERO(__builtin_types_compatible_p(__typeof__(a), __typeof__(&a[0]))) + +#define BUILD_BUG_ON_ZERO(e) (sizeof(struct { int:-!!(e); })) + +/* work around hacks for standalone package */ +#define PACKAGE "ddate" +#define PACKAGE_STRING "Stand Alone" + +#ifndef __GNUC__ +#define inline /* foo */ +#endif + +#ifdef KILL_BOB +int xday_countdown(int yday, int year); +#endif + + +/* string constants */ + +char *day_long[5] = { + "Sweetmorn", "Boomtime", "Pungenday", "Prickle-Prickle", "Setting Orange" +}; + +char *day_short[5] = {"SM","BT","PD","PP","SO"}; + +char *season_long[5] = { + "Chaos", "Discord", "Confusion", "Bureaucracy", "The Aftermath" +}; + +char *season_short[5] = {"Chs", "Dsc", "Cfn", "Bcy", "Afm"}; + +char *holyday[5][2] = { + { "Mungday", "Chaoflux" }, + { "Mojoday", "Discoflux" }, + { "Syaday", "Confuflux" }, + { "Zaraday", "Bureflux" }, + { "Maladay", "Afflux" } +}; + +struct disc_time { + int season; /* 0-4 */ + int day; /* 0-72 */ + int yday; /* 0-365 */ + int year; /* 3066- */ +}; + +char *excl[] = { + "Hail Eris!", "All Hail Discordia!", "Kallisti!", "Fnord.", "Or not.", + "Wibble.", "Pzat!", "P'tang!", "Frink!", +#ifdef PRAISE_BOB + "Slack!", "Praise \"Bob\"!", "Or kill me.", +#endif /* PRAISE_BOB */ + /* randomness, from the Net and other places. Feel free to add (after + checking with the relevant authorities, of course). */ + "Grudnuk demand sustenance!", "Keep the Lasagna flying!", + "You are what you see.", + "Or is it?", "This statement is false.", + "Lies and slander, sire!", "Hee hee hee!", +#if defined(linux) || defined (__linux__) || defined (__linux) + "Hail Eris, Hack Linux!", +#elif defined(__APPLE__) + "This Fruit is not the True Fruit of Discord.", +#endif + "" +}; + +char default_fmt[] = "%{%A, %B %d%}, %Y YOLD"; +char *default_immediate_fmt= +#ifdef OLD_IMMEDIATE_FMT +"Today is %{%A, the %e day of %B%} in the YOLD %Y%N%nCelebrate %H" +#else +default_fmt +#endif +; + +#define DY(y) (y+1166) + +static inline char *ending(int i) { + return i/10==1?"th":(i%10==1?"st":(i%10==2?"nd":(i%10==3?"rd":"th"))); +} + +static inline int leapp(int i) { + return (!(DY(i)%4))&&((DY(i)%100)||(!(DY(i)%400))); +} + +/* select a random string */ +static inline char *sel(char **strings, int num) { + return(strings[random()%num]); +} + +void print(struct disc_time,char **); /* old */ +void format(char *buf, const char* fmt, struct disc_time dt); +/* read a fortune file */ +int load_fortunes(char *fn, char *delim, char** result); + +struct disc_time convert(int,int); +struct disc_time makeday(int,int,int); + +int +main (int argc, char *argv[]) { + time_t t; + struct tm *eris; + int bob,raw; + struct disc_time hastur; + char schwa[23*17], *fnord=0; + int pi; + char *progname, *p; + + progname = argv[0]; + if ((p = strrchr(progname, '/')) != NULL) + progname = p+1; + + srandom(time(NULL)); + /* do args here */ + for(pi=1; pi<argc; pi++) { + switch(argv[pi][0]) { + case '+': fnord=argv[pi]+1; break; + case '-': + switch(argv[pi][1]) { + case 'V': + printf(("%s (%s)\n"), progname, PACKAGE_STRING); + default: goto usage; + } + default: goto thud; + } + } + + thud: + if (argc-pi==3){ + int moe=atoi(argv[pi]), larry=atoi(argv[pi+1]), curly=atoi(argv[pi+2]); + hastur=makeday( +#ifdef US_FORMAT + moe,larry, +#else + larry,moe, +#endif + curly); + if (hastur.season == -1) { + printf("Invalid date -- out of range\n"); + return -1; + } + fnord=fnord?fnord:default_fmt; + } else if (argc!=pi) { + usage: + fprintf(stderr,("usage: %s [+format] [day month year]\n"), argv[0]); + exit(1); + } else { + t= time(NULL); + eris=localtime(&t); + bob=eris->tm_yday; /* days since Jan 1. */ + raw=eris->tm_year; /* years since 1980 */ + hastur=convert(bob,raw); + fnord=fnord?fnord:default_immediate_fmt; + } + format(schwa, fnord, hastur); + printf("%s\n", schwa); + + return 0; +} + +void format(char *buf, const char* fmt, struct disc_time dt) +{ + int tib_start=-1, tib_end=0; + int i, fmtlen=strlen(fmt); + char *bufptr=buf; + +/* fprintf(stderr, "format(%p, \"%s\", dt)\n", buf, fmt);*/ + + /* first, find extents of St. Tib's Day area, if defined */ + for(i=0; i<fmtlen; i++) { + if(fmt[i]=='%') { + switch(fmt[i+1]) { + case 'A': + case 'a': + case 'd': + case 'e': + if(tib_start>0) tib_end=i+1; + else tib_start=i; + break; + case '{': tib_start=i; break; + case '}': tib_end=i+1; break; + } + } + } + + /* now do the formatting */ + buf[0]=0; + + for(i=0; i<fmtlen; i++) { + if((i==tib_start) && (dt.day==-1)) { + /* handle St. Tib's Day */ + strcpy(bufptr, ("St. Tib's Day")); + bufptr += strlen(bufptr); + i=tib_end; + } else { + if(fmt[i]=='%') { + char *wibble=0, snarf[23]; + switch(fmt[++i]) { + case 'A': wibble=day_long[dt.yday%5]; break; + case 'a': wibble=day_short[dt.yday%5]; break; + case 'B': wibble=season_long[dt.season]; break; + case 'b': wibble=season_short[dt.season]; break; + case 'd': sprintf(snarf, "%d", dt.day+1); wibble=snarf; break; + case 'e': sprintf(snarf, "%d%s", dt.day+1, ending(dt.day+1)); + wibble=snarf; break; + case 'H': if(dt.day==4||dt.day==49) + wibble=holyday[dt.season][dt.day==49]; break; + case 'N': if(dt.day!=4&&dt.day!=49) goto eschaton; break; + case 'n': *(bufptr++)='\n'; break; + case 't': *(bufptr++)='\t'; break; + + case 'Y': sprintf(snarf, "%d", dt.year); wibble=snarf; break; + case '.': wibble=sel(excl, ARRAY_SIZE(excl)); + break; +#ifdef KILL_BOB + case 'X': sprintf(snarf, "%d", + xday_countdown(dt.yday, dt.year)); + wibble = snarf; break; +#endif /* KILL_BOB */ + } + if(wibble) { +/* fprintf(stderr, "wibble = (%s)\n", wibble);*/ + strcpy(bufptr, wibble); bufptr+=strlen(wibble); + } + } else { + *(bufptr++) = fmt[i]; + } + } + } + eschaton: + *(bufptr)=0; +} + +struct disc_time makeday(int imonth,int iday,int iyear) /*i for input */ +{ + struct disc_time funkychickens; + + int cal[12] = { 31,28,31,30,31,30,31,31,30,31,30,31 }; + int dayspast=0; + + memset(&funkychickens,0,sizeof(funkychickens)); + /* basic range checks */ + if (imonth < 1 || imonth > 12 || iyear == 0) { + funkychickens.season = -1; + return funkychickens; + } + if (iday < 1 || iday > cal[imonth-1]) { + if (!(imonth == 2 && iday == 29 && iyear%4 == 0 && + (iyear%100 != 0 || iyear%400 == 0))) { + funkychickens.season = -1; + return funkychickens; + } + } + + imonth--; + /* note: gregorian year 0 doesn't exist so + * add one if user specifies a year less than 0 */ + funkychickens.year= iyear+1166 + ((0 > iyear)?1:0); + while(imonth>0) { dayspast+=cal[--imonth]; } + funkychickens.day=dayspast+iday-1; + funkychickens.season=0; + if((funkychickens.year%4)==2) { + if (funkychickens.day==59 && iday==29) funkychickens.day=-1; + } + funkychickens.yday=funkychickens.day; +/* note: EQUAL SIGN...hopefully that fixes it */ + while(funkychickens.day>=73) { + funkychickens.season++; + funkychickens.day-=73; + } + return funkychickens; +} + +struct disc_time convert(int nday, int nyear) +{ struct disc_time funkychickens; + + funkychickens.year = nyear+3066; + funkychickens.day=nday; + funkychickens.season=0; + if ((funkychickens.year%4)==2) + {if (funkychickens.day==59) + funkychickens.day=-1; + else if (funkychickens.day >59) + funkychickens.day-=1; + } + funkychickens.yday=funkychickens.day; + while (funkychickens.day>=73) + { funkychickens.season++; + funkychickens.day-=73; + } + return funkychickens; + + } + +#ifdef KILL_BOB + +/* Code for counting down to X-Day, X-Day being Cfn 40, 3164 + * + * After `X-Day' passed without incident, the CoSG declared that it had + * got the year upside down --- X-Day is actually in 8661 AD rather than + * 1998 AD. + * + * Thus, the True X-Day is Cfn 40, 9827. + * + */ + +int xday_countdown(int yday, int year) { + int r=(185-yday)+(((yday<59)&&(leapp(year)))?1:0); + while(year<9827) r+=(leapp(++year)?366:365); + while(year>9827) r-=(leapp(year--)?366:365); + return r; +} + +#endif diff --git a/port/wcwidth/.gitignore b/port/wcwidth/.gitignore deleted file mode 100644 index aa25f78d..00000000 --- a/port/wcwidth/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -*.o -*.dylib diff --git a/port/wcwidth/COPYRIGHT b/port/wcwidth/COPYRIGHT deleted file mode 100644 index e6472371..00000000 --- a/port/wcwidth/COPYRIGHT +++ /dev/null @@ -1,190 +0,0 @@ -musl as a whole is licensed under the following standard MIT license: - ----------------------------------------------------------------------- -Copyright © 2005-2020 Rich Felker, et al. - -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY -CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ----------------------------------------------------------------------- - -Authors/contributors include: - -A. Wilcox -Ada Worcester -Alex Dowad -Alex Suykov -Alexander Monakov -Andre McCurdy -Andrew Kelley -Anthony G. Basile -Aric Belsito -Arvid Picciani -Bartosz Brachaczek -Benjamin Peterson -Bobby Bingham -Boris Brezillon -Brent Cook -Chris Spiegel -Clément Vasseur -Daniel Micay -Daniel Sabogal -Daurnimator -David Carlier -David Edelsohn -Denys Vlasenko -Dmitry Ivanov -Dmitry V. Levin -Drew DeVault -Emil Renner Berthing -Fangrui Song -Felix Fietkau -Felix Janda -Gianluca Anzolin -Hauke Mehrtens -He X -Hiltjo Posthuma -Isaac Dunham -Jaydeep Patil -Jens Gustedt -Jeremy Huntwork -Jo-Philipp Wich -Joakim Sindholt -John Spencer -Julien Ramseier -Justin Cormack -Kaarle Ritvanen -Khem Raj -Kylie McClain -Leah Neukirchen -Luca Barbato -Luka Perkov -M Farkas-Dyck (Strake) -Mahesh Bodapati -Markus Wichmann -Masanori Ogino -Michael Clark -Michael Forney -Mikhail Kremnyov -Natanael Copa -Nicholas J. Kain -orc -Pascal Cuoq -Patrick Oppenlander -Petr Hosek -Petr Skocik -Pierre Carrier -Reini Urban -Rich Felker -Richard Pennington -Ryan Fairfax -Samuel Holland -Segev Finer -Shiz -sin -Solar Designer -Stefan Kristiansson -Stefan O'Rear -Szabolcs Nagy -Timo Teräs -Trutz Behn -Valentin Ochs -Will Dietz -William Haddon -William Pitcock - -Portions of this software are derived from third-party works licensed -under terms compatible with the above MIT license: - -The TRE regular expression implementation (src/regex/reg* and -src/regex/tre*) is Copyright © 2001-2008 Ville Laurikari and licensed -under a 2-clause BSD license (license text in the source files). The -included version has been heavily modified by Rich Felker in 2012, in -the interests of size, simplicity, and namespace cleanliness. - -Much of the math library code (src/math/* and src/complex/*) is -Copyright © 1993,2004 Sun Microsystems or -Copyright © 2003-2011 David Schultz or -Copyright © 2003-2009 Steven G. Kargl or -Copyright © 2003-2009 Bruce D. Evans or -Copyright © 2008 Stephen L. Moshier or -Copyright © 2017-2018 Arm Limited -and labelled as such in comments in the individual source files. All -have been licensed under extremely permissive terms. - -The ARM memcpy code (src/string/arm/memcpy_el.S) is Copyright © 2008 -The Android Open Source Project and is licensed under a two-clause BSD -license. It was taken from Bionic libc, used on Android. - -The implementation of DES for crypt (src/crypt/crypt_des.c) is -Copyright © 1994 David Burren. It is licensed under a BSD license. - -The implementation of blowfish crypt (src/crypt/crypt_blowfish.c) was -originally written by Solar Designer and placed into the public -domain. The code also comes with a fallback permissive license for use -in jurisdictions that may not recognize the public domain. - -The smoothsort implementation (src/stdlib/qsort.c) is Copyright © 2011 -Valentin Ochs and is licensed under an MIT-style license. - -The x86_64 port was written by Nicholas J. Kain and is licensed under -the standard MIT terms. - -The mips and microblaze ports were originally written by Richard -Pennington for use in the ellcc project. The original code was adapted -by Rich Felker for build system and code conventions during upstream -integration. It is licensed under the standard MIT terms. - -The mips64 port was contributed by Imagination Technologies and is -licensed under the standard MIT terms. - -The powerpc port was also originally written by Richard Pennington, -and later supplemented and integrated by John Spencer. It is licensed -under the standard MIT terms. - -All other files which have no copyright comments are original works -produced specifically for use as part of this library, written either -by Rich Felker, the main author of the library, or by one or more -contibutors listed above. Details on authorship of individual files -can be found in the git version control history of the project. The -omission of copyright and license comments in each file is in the -interest of source tree size. - -In addition, permission is hereby granted for all public header files -(include/* and arch/*/bits/*) and crt files intended to be linked into -applications (crt/*, ldso/dlstart.c, and arch/*/crt_arch.h) to omit -the copyright notice and permission notice otherwise required by the -license, and to use these files without any requirement of -attribution. These files include substantial contributions from: - -Bobby Bingham -John Spencer -Nicholas J. Kain -Rich Felker -Richard Pennington -Stefan Kristiansson -Szabolcs Nagy - -all of whom have explicitly granted such permission. - -This file previously contained text expressing a belief that most of -the files covered by the above exception were sufficiently trivial not -to be subject to copyright, resulting in confusion over whether it -negated the permissions granted in the license. In the spirit of -permissive licensing, and of not having licensing issues being an -obstacle to adoption, that text has been removed. diff --git a/port/wcwidth/Makefile b/port/wcwidth/Makefile deleted file mode 100644 index f6932d6d..00000000 --- a/port/wcwidth/Makefile +++ /dev/null @@ -1,19 +0,0 @@ -PREFIX = ~/.local - -OBJS = wcwidth.o wcswidth.o -DYLIB = libwcwidth.dylib - -${DYLIB}: ${OBJS} - ${CC} -dynamiclib ${LDFLAGS} ${OBJS} -o $@ - -wcwidth.o: nonspacing.h wide.h - -clean: - rm -f ${DYLIB} ${OBJS} - -install: ${DYLIB} - install -d ${PREFIX}/lib - install -m 644 ${DYLIB} ${PREFIX}/lib - -uninstall: - rm -f ${PREFIX}/lib/${DYLIB} diff --git a/port/wcwidth/nonspacing.h b/port/wcwidth/nonspacing.h deleted file mode 100644 index 5d05a3d1..00000000 --- a/port/wcwidth/nonspacing.h +++ /dev/null @@ -1,89 +0,0 @@ -16,16,16,18,19,20,21,22,23,24,25,26,27,28,29,30,31,16,16,32,16,16,16,33,34,35, -36,37,38,39,16,16,40,16,16,16,16,16,16,16,16,16,16,16,41,42,16,16,43,16,16,16, -16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16, -16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16, -16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16, -16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16, -16,16,16,16,16,16,16,16,16,16,44,16,45,46,47,48,16,16,16,16,16,16,16,16,16,16, -16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16, -16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16, -16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,49,16,16,50, -51,16,52,53,54,16,16,16,16,16,16,55,16,16,56,16,57,58,59,60,61,62,63,64,65,66, -67,68,16,69,70,71,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16, -16,72,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16, -16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16, -16,16,16,73,74,16,16,16,75,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16, -16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16, -16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16, -16,16,16,16,16,16,16,76,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16, -16,16,77,78,16,16,16,16,16,16,16,79,16,16,16,16,16,80,81,82,16,16,16,16,16,83, -84,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16, -16,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255, -255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, -255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, -255,255,255,255,255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,248,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,254,255,255,255,255,191,182,0,0,0,0,0,0,0,63,0,255,23,0,0,0,0,0,248,255, -255,0,0,1,0,0,0,0,0,0,0,0,0,0,0,192,191,159,61,0,0,0,128,2,0,0,0,255,255,255, -7,0,0,0,0,0,0,0,0,0,0,192,255,1,0,0,0,0,0,0,248,15,32,0,0,192,251,239,62,0,0, -0,0,0,14,0,0,0,0,0,0,0,0,0,0,0,0,0,0,248,255,255,255,255, -255,7,0,0,0,0,0,0,20,254,33,254,0,12,0,0,0,2,0,0,0,0,0,0,16,30,32,0,0,12,0,0, -64,6,0,0,0,0,0,0,16,134,57,2,0,0,0,35,0,6,0,0,0,0,0,0,16,190,33,0,0,12,0,0, -252,2,0,0,0,0,0,0,144,30,32,64,0,12,0,0,0,4,0,0,0,0,0,0,0,1,32,0,0,0,0,0,0,17, -0,0,0,0,0,0,192,193,61,96,0,12,0,0,0,2,0,0,0,0,0,0,144,64,48,0,0,12,0,0,0,3,0, -0,0,0,0,0,24,30,32,0,0,12,0,0,0,0,0,0,0,0,0,0,0,0,4,92,0,0,0,0,0,0,0,0,0,0,0, -242,7,128,127,0,0,0,0,0,0,0,0,0,0,0,0,242,31,0,63,0,0,0,0,0,0,0,0,0,3,0,0,160, -2,0,0,0,0,0,0,254,127,223,224,255,254,255,255,255,31,64,0,0,0,0,0,0,0,0,0,0,0, -0,224,253,102,0,0,0,195,1,0,30,0,100,32,0,32,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,224,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,28,0, -0,0,28,0,0,0,12,0,0,0,12,0,0,0,0,0,0,0,176,63,64,254,15,32,0,0,0,0,0,120,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,96,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,135,1,4,14,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,128,9,0,0,0,0,0,0,64,127, -229,31,248,159,0,0,0,0,0,0,255,127,0,0,0,0,0,0,0,0,15,0,0,0,0,0,208,23,4,0,0, -0,0,248,15,0,3,0,0,0,60,59,0,0,0,0,0,0,64,163,3,0,0,0,0,0,0,240,207,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,247,255,253,33,16,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,255,255,255,255,255,255,255, -251,0,248,0,0,0,124,0,0,0,0,0,0,223,255,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255, -255,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,128,3,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,128,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,0,0,0,0, -0,60,0,0,0,0,0,0,0,0,0,0,0,0,0,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,128,247,63,0,0,0,192,0,0,0,0,0,0,0,0,0,0,3,0,68,8,0,0,96,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,48,0,0,0,255,255,3,128,0,0,0,0,192,63,0,0,128,255,3,0, -0,0,0,0,7,0,0,0,0,0,200,51,0,0,0,0,32,0,0,0,0,0,0,0,0,126,102,0,8,16,0,0,0,0, -0,16,0,0,0,0,0,0,157,193,2,0,0,0,0,48,64, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,32,33,0,0,0,0,0,64, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,0,0,255,255,0, -0,0,0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,0,0, -128,255,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,240,12,1,0,0,0,254,7,0,0,0,0,248,121,128,0, -126,14,0,0,0,0,0,252,127,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,127,191,0,0,0, -0,0,0,0,0,0,0,252,255,255,252,109,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,126,180,191,0, -0,0,0,0,0,0,0,0,163,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,24, -0,0,0,0,0,0,0,255,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,31,0,0,0,0,0,0,0,127,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,128,0,0,0,0,0,0, -0,128,7,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,96,15, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,128,3,248,255,231,15,0,0,0,60,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,28,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,255,255,255,255,255,255,127,248,255,255,255,255,255,31,32,0,16,0,0,248, -254,255,0,0,0,0,0,0,0,0,0, -0,127,255,255,249,219,7,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,127,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,240,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,127,0,0,0,0,0,0,0,0,0,0,0,0,0,240,7,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0, diff --git a/port/wcwidth/wcswidth.c b/port/wcwidth/wcswidth.c deleted file mode 100644 index 5c8a5a4d..00000000 --- a/port/wcwidth/wcswidth.c +++ /dev/null @@ -1,8 +0,0 @@ -#include <wchar.h> - -int wcswidth(const wchar_t *wcs, size_t n) -{ - int l=0, k=0; - for (; n-- && *wcs && (k = wcwidth(*wcs)) >= 0; l+=k, wcs++); - return (k < 0) ? k : l; -} diff --git a/port/wcwidth/wcwidth.c b/port/wcwidth/wcwidth.c deleted file mode 100644 index 36256a53..00000000 --- a/port/wcwidth/wcwidth.c +++ /dev/null @@ -1,29 +0,0 @@ -#include <wchar.h> - -static const unsigned char table[] = { -#include "nonspacing.h" -}; - -static const unsigned char wtable[] = { -#include "wide.h" -}; - -int wcwidth(wchar_t wc) -{ - if (wc < 0xffU) - return (wc+1 & 0x7f) >= 0x21 ? 1 : wc ? -1 : 0; - if ((wc & 0xfffeffffU) < 0xfffe) { - if ((table[table[wc>>8]*32+((wc&255)>>3)]>>(wc&7))&1) - return 0; - if ((wtable[wtable[wc>>8]*32+((wc&255)>>3)]>>(wc&7))&1) - return 2; - return 1; - } - if ((wc & 0xfffe) == 0xfffe) - return -1; - if (wc-0x20000U < 0x20000) - return 2; - if (wc == 0xe0001 || wc-0xe0020U < 0x5f || wc-0xe0100U < 0xef) - return 0; - return 1; -} diff --git a/port/wcwidth/wide.h b/port/wcwidth/wide.h deleted file mode 100644 index e403c9a5..00000000 --- a/port/wcwidth/wide.h +++ /dev/null @@ -1,65 +0,0 @@ -16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,18,16,16,16,16,16,16,16,16, -16,16,16,16,16,16,16,16,16,19,16,20,21,22,16,16,16,23,16,16,24,25,26,27,28,17, -17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,29, -17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17, -17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17, -17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17, -17,17,17,17,17,17,17,17,30,16,16,16,16,31,16,16,17,17,17,17,17,17,17,17,17,17, -17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17, -17,17,17,17,17,17,17,32,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16, -16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,17,17,16,16,16,33, -34,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16, -16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16, -16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16, -16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16, -16,16,16,16,16,16,16,16,35,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17, -17,17,17,17,17,17,36,17,17,37,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16, -16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,17,38,39,16,16, -16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16, -16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16, -16,16,16,16,16,16,16,40,41,42,43,44,45,46,47,16,48,49,16,16,16,16, -16,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255, -255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, -255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, -255,255,255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,12,0,6,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,30,9,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,96,0,0,48,0,0,0,0,0,0,255,15,0,0,0,0,128,0,0,8, -0,2,12,0,96,48,64,16,0,0,4,44,36,32,12,0,0,0,1,0,0,0,80,184,0,0,0,0,0,0,0,224, -0,0,0,1,128,0,0,0,0,0,0,0,0,0,0,0,24,0,0,0,0,0,0,33,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,251,255,255,255,255,255,255,255, -255,255,255,15,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, -255,255,255,255,255,255,255,255,255,255,255,63,0,0,0,255,15,255,255,255,255, -255,255,255,127,254,255,255,255,255,255,255,255,255,255,127,254,255,255,255, -255,255,255,255,255,255,255,255,255,224,255,255,255,255,255,254,255,255,255, -255,255,255,255,255,255,255,127,255,255,255,255,255,7,255,255,255,255,15,0, -255,255,255,255,255,127,255,255,255,255,255,0,255,255,255,255,255,255,255,255, -255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, -255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,0, -0,0,0,0,0,0,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, -255,31,255,255,255,255,255,255,127,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255, -255,255,31,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, -255,15,0,0,0,0,0,0,0,0,0,0,0,0,0,255,3,0,0,255,255,255,255,247,255,127,15,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,254,255,255,255,255,255,255,255,255,255,255, -255,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,127,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,15,0,0,0,255,255,255,255,255,255,255,255,255,255,255, -255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, -255,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, -255,255,255,255,255,255,255,255,255,255,255,255,7,0,255,255,255,127,0,0,0,0,0, -0,7,0,240,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, -255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, -255,255,255,255,255,255,255,255,255,255,255,255,255,255, -15,16,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,128,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,64,254,7,0,0,0,0,0,0,0,0,0,0,0,0,7,0,255,255,255, -255,255,15,255,1,3,0,63,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255, -1,224,191,255,255,255,255,255,255,255,255,223,255,255,15,0,255,255,255,255, -255,135,15,0,255,255,17,255,255,255,255,255,255,255,255,127,253,255,255,255, -255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, -159,255,255,255,255,255,255,255,63,0,120,255,255,255,0,0,4,0,0,96,0,16,0,0,0, -0,0,0,0,0,0,0,248,255,255,255,255,255,255,255,255,255,255,0,0,0,0,0,0,255,255, -255,255,255,255,255,255,63,16,39,0,0,24,240,7,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,255,15,0, -0,0,224,255,255,255,255,255,255,255,255,255,255,255,255,123,252,255,255,255, -255,231,199,255,255,255,231,255,255,255,255,255,255,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,15,7,7,0,63,0,0,0,0,0,0,0,0,0,0,0,0,0, diff --git a/prune.sh b/prune.sh index d41c6bc6..fabe865f 100644 --- a/prune.sh +++ b/prune.sh @@ -1,7 +1,7 @@ #!/bin/sh set -eu -find -L ~ -type l -lname "${PWD}/*" | while read -r link; do +find -L ~/.config ~/.local -type l -lname "${PWD}/*" | while read -r link; do echo "$link" rm "$link" done diff --git a/txt/books.txt b/txt/books.txt index 46397211..7ebae70c 100644 --- a/txt/books.txt +++ b/txt/books.txt @@ -1,5 +1,65 @@ +[ 2023 ] + + 7. ★★☆ Alix E. Harrow, Starling House + 6. ★★☆ Alix E. Harrow, A Mirror Mended + 5. ★★★ Alix E. Harrow, A Spindle Splintered + 4. ★★☆ Alyson Greaves, The Sisters of Dorley (ch. 1-15) + 3. ★☆☆ Nnedi Okorafor, Noor + 2. ★★☆ Nnedi Okorafor, Remote Control + 1. ★★☆ Becky Chambers, A Prayer for the Crown-Shy + +[ 2022 ] + + 15. ★★★ Becky Chambers, The Long Way To a Small Angry Planet + 14. ★★★ ed. Tristan Taormino, Take Me There + 13. ★★★★ Becky Chambers, A Closed and Common Orbit + 12. ★★☆ Sybil Lamb, I've Got a Time Bomb + 11. ☆☆☆ Ruth Ozeki, The Book of Form and Emptiness + 10. ★☆☆ Sally Rooney, Conversations With Friends + 9. ★☆☆ Sally Rooney, Normal People + 8. ★★★ Andrea Stewart, The Bone Shard Emperor + 7. ★★☆ ed. Gwen Benaway, Maiden, Mother, Crone + 6. ★★★ Andrea Stewart, The Bone Shard Daughter + 5. ★☆☆ Madeline Miller, Circe + 4. ★★★ Natalie Zina Walschots, Hench + 3. ★★★ V. E. Schwab, The Invisible Life of Addie LaRue + 2. ★★☆ Sayaka Murata, Convenience Store Woman + 1. ★★★★ Becky Chambers, The Galaxy, and the Ground Within + +[ 2021 ] + + 26. ★★☆ Charlie Jane Anders, The City in the Middle of the Night + 25. ★★☆ Charlie Jane Anders, Six Months, Three Days, Five Others + 24. ★★☆ Rivers Solomon, Sorrowland + 23. ★★★ Becky Chambers, A Psalm for the Wild-Built + 22. ★★★ Susanna Clarke, Piranesi + 21. ★☆☆ Kentaro Miura, Berserk, vols. 1–3 + 20. ★☆☆ Ursula Le Guin, A Wizard of Earthsea + 19. ★★☆ Sayaka Murata, Earthlings + 18. ★★☆ J. R. R. Tolkien, The Hobbit + 17. ★★☆ Octavia E. Butler, Clay's Ark + 16. ★★★ Arkady Martine, A Desolation Called Peace + 15. ★★☆ Martha Wells, Fugitive Telemetry + 14. ★★☆ ed. Ann & Jeff VanderMeer, Sisters of the Revolution + 13. ★☆☆ Margaret Atwood, Oryx and Crake + 12. ★★☆ Margaret Atwood, The Year of the Flood + 11. ★★☆ Charlie Jane Anders, All the Birds in the Sky + 10. ★☆☆ Margaret Atwood, The Penelopiad + 9. ★★★ Alix E. Harrow, The Once and Future Witches + 8. ★★☆ Mary Robinette Kowal, The Relentless Moon + 7. ★☆☆ Connie Willis, Bellwether + 6. ★★☆ Carmen Maria Machado, Her Body and Other Parties + 5. ★★☆ N. K. Jemisin, The City We Became + 4. ★★★ Martha Wells, Network Effect + 3. ★★☆ Nnedi Okorafor, Binti + 2. ★★☆ Kai Cheng Thom, I Hope We Choose Love + 1. ★★☆ Tade Thompson, The Rosewater Redemption + [ 2020 ] + 19. ★★★ N. K. Jemisin, The Awakened Kingdom + 18. ★★☆ N. K. Jemisin, The Kingdom of Gods + 17. ★★☆ N. K. Jemisin, The Broken Kingdoms 16. ★★☆ Ann Leckie, Ancillary Justice 15. ★★☆ Madeline Miller, The Song of Achilles 14. ★★☆ N. K. Jemisin, The Hundred Thousand Kingdoms diff --git a/txt/diminishing-shine.txt b/txt/diminishing-shine.txt new file mode 100644 index 00000000..f51faf20 --- /dev/null +++ b/txt/diminishing-shine.txt @@ -0,0 +1,32 @@ +you gotta get yourself a cheap plair-- +you gotta get yourself a cheap pair of plastic sunglasses +or a really cheap pair of plastic wraparounds +you can get em just down the street +it's four bucks for the pair +you should stock up +you should buy three or four pairs +really, no one ever fucks with you +you put em on +and no one fucks with you +and they're cheap +it's better than-- +better than a wig +or a really stupid haircut +or a nose ring + +you get afraid on the bus? +when you ever get-- +you ever get scared on the bus? +or the subway? +you ever get afraid, and-- + +we were all really high +and I was sitting on the couch +we were all sitting on the couch +we were all really high +the TV was on and no one was talking and no one was saying a word +and no one had said a word for a long, long time +everyone was just staring at the TV set +and I got the fear +I got the fear really bad +I remember thinking, this is it, I'm going to die diff --git a/txt/music.txt b/txt/music.txt index 2a5fdc56..efcd8fbe 100644 --- a/txt/music.txt +++ b/txt/music.txt @@ -1,3 +1,24 @@ +The Shaggs — My Pal Foot Foot +<https://youtu.be/k5T2kaFiFgg> + +Philip Glass — Einstein on the Beach Knee Play 1 +<https://youtu.be/jeEobpQMgD4> + +osno1 — SAUSAGE (osno1 RIP vine remix) +<https://osno1.bandcamp.com/track/sausage-osno1-rip-vine-remix> + +Feist — I Feel It All +<https://youtu.be/g-1Gb2rxzlk> + +The Blow — "Come On Petunia" +<https://youtu.be/MO1HSfzK1Ns> + +Black Country, New Road — Sunglasses +<https://youtu.be/UAZhzi9cpkc> + +Mitski, Xiu Xiu — Between the Breaths +<https://youtu.be/HnhTkFl5Imw> + Black Dresses — CREEP U <https://youtu.be/w9RSZmltcVI> diff --git a/txt/plan.7 b/txt/plan.7 deleted file mode 100644 index c1cf86f7..00000000 --- a/txt/plan.7 +++ /dev/null @@ -1,90 +0,0 @@ -.Dd June 26, 2020 -.Dt PLAN 7 -.Os "Causal Agency" -. -.Sh NAME -.Nm plan -.Nd possible future projects -. -.Sh DESCRIPTION -. -.Ss bubger -.Bl -bullet -compact -.It -IMAP mailbox (mailing list) archive generator -.It -export HTML/Atom/mboxrd fragments by UID -.It -assemble fragments into threads using IMAP THREAD -.El -. -.Ss sbubby -.Bl -bullet -compact -.It -mailing list subscription manager for FastMail -.It -process messages from IMAP mailbox -.It -add/remove addresses from CardDAV address book -.It -send confirmations with SMTP -.El -. -.Ss feeds to IMAP -.Bl -bullet -compact -.It -convert Atom/RSS feed entries into Internet Messages -.It -Message-Id derived from entry IDs -.It -append messages to a mailbox for each feed -.It -use -.Ql <link rel="alternate" type="application/mbox"> -if available -(bubger does this, convince public-inbox to?) -.El -. -.Ss litterbox link indexer -.Bl -bullet -compact -.It -scrape links from messages in -.Xr litterbox 1 -.It -index text in contentless FTS table -.It -simple HTML parser to extract text nodes, skipping -.Sy <script> -and -.Sy <style> -.El -. -.Ss RFC man-like -.Bl -bullet -compact -.It -more of a wishlist item -.It -man-like tool to read text versions of IETF RFCs and IDs -.It -vim mode like man.vim to make links work and :RFC -.It -.Lk https://www.rfc-editor.org/retrieve/rsync/ -.El -. -.Ss Password non-manager -.Bl -bullet -compact -.It -password reset flow automation -.It -sets random password and leaves it in clipboard -.It -modules for each service to handle: -.Bl -enum -compact -.It -submitting forgot password form -.It -extracting token from email -.It -submitting password reset form -.El -.El diff --git a/txt/shows.txt b/txt/shows.txt index 62e6a071..2abacf5b 100644 --- a/txt/shows.txt +++ b/txt/shows.txt @@ -1,3 +1,5 @@ +2022-12-18 (SAT) LINGUA IGNOTA +2022-06-04 (MAI) Honeydrip, MAGELLA, BACKXWASH 2020-01-23 (La Sala Rossa) Secondsight, BIG|BRAVE 2019-12-10 (Casa del Popolo) meth, Street Sects 2019-06-22 (Casa del Popolo) Persons Unknown, Palissade, Police des Moeurs, Blu Anxiety diff --git a/www/causal.agency/.gitignore b/www/causal.agency/.gitignore index 7935a3c1..b00b1c3c 100644 --- a/www/causal.agency/.gitignore +++ b/www/causal.agency/.gitignore @@ -1,3 +1,4 @@ -*.html +index.html +leveler.html scheme.css scheme.png diff --git a/www/causal.agency/Makefile b/www/causal.agency/Makefile index 407a85d8..8c74f8f1 100644 --- a/www/causal.agency/Makefile +++ b/www/causal.agency/Makefile @@ -1,30 +1,23 @@ -WEBROOT = /usr/local/www/causal.agency +WEBROOT = /var/www/causal.agency -FILES = index.html scheme.png +GEN = index.html scheme.css scheme.png +FILES = ${GEN} style.css alpha.html lands.html all: ${FILES} -install: ${FILES} - install -C -m 644 ${FILES} ${WEBROOT} - -INCLUDES = scheme.css torus.html play.html catgirl.html scheme.html - -index.html: index.html.in index.sed ${INCLUDES} - sed -f index.sed index.html.in > index.html - -FLAGS_torus.pty = -n -h 25 -FLAGS_scheme.pty = -n -h 10 +.SUFFIXES: .7 .html -.SUFFIXES: .html .pty +.7.html: + mandoc -T html -O style=style.css $< > $@ -.pty.html: - shotty ${FLAGS_$<} $< > $@ - -scheme.css: scheme.sed - scheme -s | sed -f scheme.sed > scheme.css +scheme.css: + scheme -st > scheme.css scheme.png: scheme -g > scheme.png +install: ${FILES} + install -C -m 644 ${FILES} ${WEBROOT} + clean: - rm -f *.html scheme.css scheme.png + rm -f ${GEN} diff --git a/www/causal.agency/alpha.html b/www/causal.agency/alpha.html new file mode 100644 index 00000000..0d83f530 --- /dev/null +++ b/www/causal.agency/alpha.html @@ -0,0 +1,92 @@ +<!DOCTYPE html> +<meta name="viewport" content="width=device-width, initial-scale=1.0"> +<title>all 26 letters of the alphabet RANKED</title> +<style> +body, button { font-size: 200%; text-align: center; } +button { margin: 1em; padding: 1ch; } +button#shuffle { font-size: 100%; } +</style> + +which letter do you like more? +<p> +<button id="a">A</button> +<button id="b">B</button> +<p> +<details> +<summary>current ranking</summary> +<p> +<span id="ranking">ABCDEFGHIJKLMNOPQRSTUVWXYZ</span> +<p> +<button id="shuffle">reshuffle</button> +</details> + +<script> +let buttonA = document.getElementById("a"); +let buttonB = document.getElementById("b"); +let ranking = document.getElementById("ranking"); + +let alpha = "ABCDEFGHIJKLMNOPQRSTUVWXYZ".split(""); +let rand = (bound) => Math.floor(Math.random() * bound); +function shuffle() { + for (let i = alpha.length - 1; i > 0; --i) { + let j = rand(i + 1); + let x = alpha[i]; + alpha[i] = alpha[j]; + alpha[j] = x; + } +} +if (localStorage.getItem("alpha")) { + alpha = localStorage.getItem("alpha").split(""); +} else { + shuffle(); +} + +let index = 0; +let even = true; +function choose(o) { + if (o == "b") { + let x = alpha[index]; + alpha[index] = alpha[index + 1]; + alpha[index + 1] = x; + } + index += 2; + if (index > alpha.length - 2) { + even = !even; + index = (even ? 0 : 1); + } + update(); +} + +document.onkeydown = function(event) { + if (event.key.toUpperCase() == alpha[index]) { + choose("a"); + } else if (event.key.toUpperCase() == alpha[index + 1]) { + choose("b"); + } +} + +function update() { + localStorage.setItem("alpha", alpha.join("")); + ranking.innerText = alpha.join(""); + let a = buttonA; + let b = buttonB; + if (rand(2)) { + a = buttonB; + b = buttonA; + } + let lc = (c) => c; + if (rand(2)) lc = (c) => c.toLowerCase(); + a.innerText = lc(alpha[index]); + b.innerText = lc(alpha[index + 1]); + a.onclick = () => choose("a"); + b.onclick = () => choose("b"); +} +update(); + +document.getElementById("shuffle").onclick = function() { + if (confirm("Are you SURE you want to throw away all your hard work?")) { + shuffle(); + update(); + } +} +</script> diff --git a/www/causal.agency/catgirl.pty b/www/causal.agency/catgirl.pty deleted file mode 100644 index 651e83db..00000000 --- a/www/causal.agency/catgirl.pty +++ /dev/null @@ -1,97 +0,0 @@ -[?1049h[22;0;0t[1;24r(B[m[4l[?7h[39;49m[?1h=[?1004h[?2004h[39;49m(B[m[H[2J(B[0;7m[90m 0 <network> [21d(B[0m[95mcatgirl[39m(B[m is GPLv3 fwee softwawe ^w^ code is avaiwable fwom[22;9Hhttps://git.causal.agency/catgirl -Traveling... -]2;chat.freenode.net <network>[H -[3M[21d[31m-adams.freenode.net-[37m *** Looking up your hostname... -[31m-adams.freenode.net-[37m *** Checking Ident -[31m-adams.freenode.net-[37m *** Couldn't look up your hostname -[39m(B[m[H -[M[23d[31m-adams.freenode.net-[37m *** No Ident response -[39m(B[m[H -[M[23dYou arrive in freenode -[H -[6M[18d[90m-[39m(B[m Welcome to adams.freenode.net. Thanks to ATW Internet Kft -[90m-[39m(B[m (http://www.atw.hu) for sponsoring this server! -[90m- --[39m(B[m ADAMS, DOUGLAS (1952-2001). Author of The Hitch Hikers Guide -[90m-[39m(B[m to the Galaxy and many other witty and humourous books, -[90m-[39m(B[m portrayed in his uniquely British irony. He is sorely missed -[H -[6M[18d[90m-[39m(B[m by many millions of devoted fans. "So long and thanks for all -[90m-[39m(B[m the books!" -[90m- --[39m(B[m Welcome to freenode - supporting the free and open source -[90m-[39m(B[m software communities since 1998. -[90m- -[39m(B[m[H -[3M[21d[90m-[39m(B[m By connecting to freenode you indicate that you have read and -[90m-[39m(B[m accept our policies and guidelines as set out on https://freenode.net -[90m- -[39m(B[m[H -[3M[21d[90m-[39m(B[m In the event that you observe behaviour that contravenes our policies, -[90m-[39m(B[m please notify a volunteer staff member via private message, or send us an -[90m-[39m(B[m e-mail to complaints@freenode.net -- we will do our best to address the -[H -[4M[20d[90m-[39m(B[m situation within a reasonable period of time, and we may request further -[90m-[39m(B[m information or, as appropriate, involve other parties such as channel - operators -[90m-[39m(B[m Group Contacts representing an on-topic group. -[H -[6M[18d[90m- --[39m(B[m freenode runs an open proxy scanner. -[90m- --[39m(B[m If you are looking for assistance, you may be able to find a list of -[90m-[39m(B[m volunteer staff on '/stats p' (shows only on-call staff) or by joining -[90m-[39m(B[m #freenode and using the '/who freenode/staff/*' command. You may message -[H -[5M[19d[90m-[39m(B[m any of us at any time. Please note that freenode predominantly provides -[90m-[39m(B[m assistance via private message, and while we have a network channel the -[90m-[39m(B[m primary venue for support requests is via private message to a member -[90m-[39m(B[m of the volunteer staff team. -[90m- -[39m(B[m[H -[5M[19d[90m-[39m(B[m From time to time, volunteer staff may send server-wide notices relating to -[90m-[39m(B[m the project, or the communities that we host. The majority of such notices -[90m-[39m(B[m will be sent as wallops, and you can '/mode <yournick> +w' to ensure that you -[90m-[39m(B[m do not miss them. Important messages relating to the freenode project, - including -[H -[7M[17d[90m-[39m(B[m notices of upcoming maintenance and other scheduled downtime will be issued - as -[90m-[39m(B[m global notices. -[90m- --[39m(B[m Representing an on-topic project? Don't forget to register, more information -[90m-[39m(B[m can be found on the https://freenode.net website under "Group Registration". -[90m- -[39m(B[m[H -[5M[19d[90m-[39m(B[m Thank you also to our server sponsors for the sustained support in keeping - the -[90m-[39m(B[m network going for close to two decades. -[90m- --[39m(B[m Thank you for using freenode! -[1;14H[95m 1 freenode-connect ([97m2[95m) [24d[39m(B[m]2;freenode <network> (+2!)[H[95m 1 freenode-connect ([97m2[95m) (B[0;7m[31m 2 #ascii.town -[39m(B[m[K -[K -[K -[K -[K -[K -[K -[K -[K -[K -[K -[K -[K -[K -[K -[K -[K -[96mcatgirl[39m(B[m arrives in [31m#ascii.town[39m(B[m[K -The sign in [31m#ascii.town[39m(B[m reads: https://ascii.town public SSH services and IRC -things <3 AGPL[K -In [31m#ascii.town[39m(B[m are catgirl, gjabell, danopia, larbob, ep, nonlinear, epilys, -benharri, june, yourfate, josuah -[96m<catgirl> [39m(B[m]2;freenode #ascii.town (+2!) /[Kclose 1[H(B[0;7m[31m 1[39m(B[m[24P [24d[96m<catgirl> [39m(B[m]2;freenode #ascii.townhello, world![H -[M[23;10H -[96m<catgirl> [39m(B[m[2;23r[23;1H[1S[1;24r[1;16H(B[0;7m[31m(1) [23d(B[0m[3m[34m* june[39m(B[0m[3m waves -(B[m]2;freenode #ascii.town (1)[1;16H[K[24;11H]2;freenode #ascii.town \ No newline at end of file diff --git a/www/causal.agency/index.7 b/www/causal.agency/index.7 new file mode 100644 index 00000000..1e019574 --- /dev/null +++ b/www/causal.agency/index.7 @@ -0,0 +1,76 @@ +.Dd April 18, 2024 +.Dt CAUSAL.AGENCY 7 +.Os "Causal Agency" +. +.Sh NAME +.Nm june +.Nd computer enthusiast (she/her) +. +.Sh SYNOPSIS +.Nm mail +.Mt june@causal.agency +.Nm +in +.Li #ascii.town +on tilde.chat +. +.Sh DESCRIPTION +I make mostly IRC software in C. +I like +.Ox +but also the GPL. +I just want to read books +and try to learn to be kinder. +When I can I'd like to talk to strangers +and experience more magic. +. +.Pp +.Lk https://git.causal.agency code +\(em +.Lk https://text.causal.agency words +\(em +.Lk https://photo.causal.agency photos +\(em +.Lk /list/ mailist +. +.Pp +These are some things I've done: +.Bl -tag -width Ds +.It Lk https://git.causal.agency/pounce/about pounce +a multi-client-first IRC bouncer +.It Lk https://git.causal.agency/catgirl/about catgirl +a cosy IRC client +.It Lk https://git.causal.agency/litterbox/about litterbox +a full-text search IRC logger +.It Lk https://git.causal.agency/scooper/about scooper +a web interface for litterbox +.It Lk https://git.causal.agency/kitd/about kitd +a process supervisor +.It Lk https://git.causal.agency/imbox/about "imbox & git-fetch-email" +a tool to pull patches out of IMAP +.It Lk https://git.causal.agency/bubger/about bubger +a mailing list archive generator for IMAP +.It Lk https://git.causal.agency/notemap/about notemap +a tool to mirror text files to IMAP notes +.It Lk https://ascii.town/explore.html torus@ascii.town +a collaborative ASCII art project +.It Lk ssh://play@ascii.town play@ascii.town +some games to play over +.Xr ssh 1 +.It Lk https://git.causal.agency/cards/about cards +a +.Pa CARDS.DLL +loader for SDL +.It Lk scheme.png scheme +an earthy terminal colour scheme +.El +. +.Sh SEE ALSO +.Bl -bullet +.It +.Lk /bin/ bin +.It +.Lk lands.html "Magic lands quiz" +.It +.Lk alpha.html "alphabet ranking game" +.El diff --git a/www/causal.agency/index.html.in b/www/causal.agency/index.html.in deleted file mode 100644 index a8f95926..00000000 --- a/www/causal.agency/index.html.in +++ /dev/null @@ -1,101 +0,0 @@ -<!DOCTYPE html> -<title>Causal Agency</title> -<meta name="viewport" content="width=device-width, initial-scale=1.0"> -<style> -body { - font-family: monospace; - max-width: 80ch; - margin: 2em auto; - padding: 0 1ch; -} -h1 { - font-size: inherit; - margin: 1em 0 0; -} -p { margin: 0 0 1em 4ch; } -a { text-decoration: none; } -/* scheme.css */ -</style> - -<p> -Hi. -I'm an aspiring person. -I'm still trying to figure out how to be. -<p> -You can find me in -<a href="ircs://chat.freenode.net:6697/#ascii.town">#ascii.town</a> -on freenode -or send mail to june@. -<p> -These are things I've made. - -<h1><a href="https://git.causal.agency/pounce/about">pounce</a></h1> -<p> -multi-client IRC bouncer - -<h1><a href="https://git.causal.agency/litterbox/about">litterbox</a></h1> -<p> -full-text search IRC logger - -<h1>catgirl</h1> -<p> -artisanal IRC client -<p> -<a href="ssh://chat@ascii.town">ssh chat@ascii.town</a> --- -<a href="https://git.causal.agency/catgirl/about">git</a> -<p> -<!-- catgirl.html --> - -<h1><a href="https://git.causal.agency/imbox/about">imbox & git-fetch-email</a></h1> -<p> -IMAP to mbox - -<h1><a href="https://git.causal.agency/notemap/about">notemap</a></h1> -<p> -IMAP notes mirror - -<h1>torus</h1> -<p> -collaborative ASCII art project -<p> -<a href="ssh://torus@ascii.town">ssh torus@ascii.town</a> --- -<a href="https://ascii.town/explore.html">explore</a> --- -<a href="https://git.causal.agency/torus">git</a> -<p> -<!-- torus.html --> - -<h1>play</h1> -<p> -2048 clone with scoreboard -<p> -<a href="ssh://play@ascii.town">ssh play@ascii.town</a> --- -<a href="https://git.causal.agency/play">git</a> -<p> -<!-- play.html --> - -<h1><a href="https://git.causal.agency/cards/about">cards</a></h1> -<p> -CARDS.DLL loader for SDL - -<h1>scheme</h1> -<p> -earthy terminal colours -<p> -<a href="scheme.png">palette</a> --- -<a href="bin/scheme.html">src</a> -<!-- scheme.html --> - -<h1><a href="bin/">bin</a></h1> -<p> -little utilities - -<h1>text</h1> -<p> -words about code -<p> -<a href="https://text.causal.agency">text.causal.agency</a> diff --git a/www/causal.agency/index.sed b/www/causal.agency/index.sed deleted file mode 100644 index 0123ec1e..00000000 --- a/www/causal.agency/index.sed +++ /dev/null @@ -1,5 +0,0 @@ -/[*] scheme[.]css/r scheme.css -/!-- torus[.]html/r torus.html -/!-- play[.]html/r play.html -/!-- catgirl[.]html/r catgirl.html -/!-- scheme[.]html/r scheme.html diff --git a/www/causal.agency/lands.html b/www/causal.agency/lands.html new file mode 100644 index 00000000..7aaadd80 --- /dev/null +++ b/www/causal.agency/lands.html @@ -0,0 +1,176 @@ +<!DOCTYPE html> +<title>Lands Quiz</title> +<meta name="viewport" content="width=device-width, initial-scale=1.0"> +<style> +html { font: 14pt sans-serif; line-height: 1.5em; } +body { padding: 1em 1ch; max-width: 78ch; margin: auto; } +h1 { text-align: center; } +h2 { margin-top: 0; } +button { font-size: 100%; padding: 0.5em 1ch; } +img { max-width: 100%; } +div.cols { display: grid; grid-template-columns: 1fr 1fr; gap: 2ch; } +</style> + +<h1 id="loading">Loading...</h1> +<h1 id="error" hidden>Failed to load cards :(</h1> + +<div id="game" hidden> +<h1>Magic Lands Quiz</h1> +<p>Try to guess the colours of mana each land produces!</p> +<div class="cols"> + <div> + <img id="back" src="https://backs.scryfall.io/normal/0/a/0aeebaf5-8c7d-4636-9e82-8c27447861f7.jpg"> + <a id="link" target="_blank"> + <img id="image1" hidden> + <img id="image2" hidden> + </a> + </div> + <div> + <h2 id="name"></h2> + <input type="checkbox" id="w"> <label for="w">White</label><br> + <input type="checkbox" id="u"> <label for="u">Blue</label><br> + <input type="checkbox" id="b"> <label for="b">Black</label><br> + <input type="checkbox" id="r"> <label for="r">Red</label><br> + <input type="checkbox" id="g"> <label for="g">Green</label><br> + <p><button id="submit">Submit</button></p> + <h3>Score: <span id="score">0</span>/<span id="total">0</span></h3> + </div> +</div> +</div> + +<script> +function shuffle(arr) { + let rand = (bound) => Math.floor(Math.random() * bound); + for (let i = arr.length-1; i > 0; --i) { + let j = rand(i+1); + let x = arr[i]; + arr[i] = arr[j]; + arr[j] = x; + } +} + +const CardBack = +"https://backs.scryfall.io/normal/0/a/0aeebaf5-8c7d-4636-9e82-8c27447861f7.jpg"; + +function hideCard() { + document.getElementById("back").hidden = false; + document.getElementById("image1").hidden = true; + document.getElementById("image2").hidden = true; +} + +function showCard(card) { + document.getElementById("back").hidden = true; + document.getElementById("link").href = card.scryfall_uri; + let image1 = document.getElementById("image1"); + let image2 = document.getElementById("image2"); + if (card.card_faces) { + image1.src = card.card_faces[0].image_uris.normal; + image2.src = card.card_faces[1].image_uris.normal; + image1.hidden = false; + image2.hidden = false; + } else { + image1.src = card.image_uris.normal; + image1.hidden = false; + } +} + +function resetChecks() { + for (let c of "wubrg") { + let input = document.getElementById(c); + input.checked = false; + input.disabled = false; + input.labels[0].style.fontWeight = "normal"; + } +} + +function checkChecks(card) { + let score = 0; + let total = 0; + let checked = 0; + for (let c of "wubrg") { + let input = document.getElementById(c); + let produced = card.produced_mana.includes(c.toUpperCase()); + if (produced) { + total++; + input.labels[0].style.fontWeight = "bold"; + if (input.checked) score++; + } + if (input.checked) checked++; + input.disabled = true; + } + if (checked > total) score -= (checked - total); + if (score < 0) score = 0; + return { score: score, total: total }; +} + +document.onkeydown = function(event) { + for (let c of "wubrg") { + if (event.key == c) { + let input = document.getElementById(c); + if (!input.disabled) input.checked ^= true; + } + } + if (event.key == "Enter") { + document.getElementById("submit").click(); + } +} + +let score = 0; +let total = 0; +let cards = []; +let card = null; + +function nextCard() { + hideCard(); + resetChecks(); + card = cards.shift(); + document.getElementById("name").innerText = card.name; +} + +document.getElementById("submit").onclick = function() { + if (card) { + let { score: cardScore, total: cardTotal } = checkChecks(card); + total += cardTotal; + score += cardScore; + document.getElementById("score").innerText = score; + document.getElementById("total").innerText = total; + showCard(card); + card = null; + if (cards.length) { + this.innerText = "Next card"; + } else { + this.disabled = true; + this.innerText = "No more cards"; + } + } else { + nextCard(); + this.innerText = "Submit"; + } +} + +function loadCards(resp) { + let loading = document.getElementById("loading"); + let error = document.getElementById("error"); + let game = document.getElementById("game"); + if (resp.status != 200) { + loading.hidden = true; + error.hidden = false; + } + resp.json().then((json) => { + cards.push(...json.data); + if (json.has_more) { + setTimeout(() => fetch(json.next_page).then(loadCards), 50); + } else { + loading.hidden = true; + game.hidden = false; + shuffle(cards); + nextCard(); + } + }); +} + +const Search = +"https://api.scryfall.com/cards/search?q=t:land+id>=2+produces>=2+produces!=wubrg"; +fetch(Search).then(loadCards); + +</script> diff --git a/www/causal.agency/play.pty b/www/causal.agency/play.pty deleted file mode 100644 index 3da44fb7..00000000 --- a/www/causal.agency/play.pty +++ /dev/null @@ -1,23 +0,0 @@ -[1;24r[m[4l[?12l[?25h[?1h=[39;49m[?25l[?1h=[39;49m[m[H[2J[1;30H0 - - [38;5;7m[48;5;0m [7C[39;49m[mUse the arrow keys to - [38;5;7m[48;5;0m . . . . [7C[39;49m[mslide and merge tiles. - [38;5;7m[48;5;0m [7C[39;49m[mPress q to quit. - [38;5;7m[48;5;0m -[28D . . . . -[28D -[28D [38;5;15m[48;5;1m[1m -[28D[m[38;5;7m[48;5;0m . . [38;5;15m[48;5;1m[1m 2 2 -[28D[m[38;5;7m[48;5;0m [38;5;15m[48;5;1m[1m -[28D[m[38;5;7m[48;5;0m -[28D . . . . -[28D [39;49m[m[1;30H4[6;10H[38;5;15m[48;5;1m[1m [7;10H 2 [8;10H -[14D[38;5;15m[48;5;2m [7C[m[38;5;7m[48;5;0m -[28D[38;5;15m[48;5;2m[1m 4 [7C[m[38;5;7m[48;5;0m . . -[28D[38;5;15m[48;5;2m[1m [7C[m[38;5;7m[48;5;0m [39;49m[m[3;24H[38;5;15m[48;5;1m[1m [4;24H 2 [5;24H [6;10H[m[38;5;7m[48;5;0m [7;10H . [8;10H -[14D -[7D . -[7D -[7D[38;5;15m[48;5;2m[1m [38;5;15m[48;5;1m -[14D[38;5;15m[48;5;2m 4 [38;5;15m[48;5;1m 2 -[14D[38;5;15m[48;5;2m [38;5;15m[48;5;1m [39;49m[m \ No newline at end of file diff --git a/www/causal.agency/scheme.pty b/www/causal.agency/scheme.pty deleted file mode 100644 index 74be2196..00000000 --- a/www/causal.agency/scheme.pty +++ /dev/null @@ -1,10 +0,0 @@ -[40m [41m [42m [43m [44m [45m [46m [47m [m -[40m [41m [42m [43m [44m [45m [46m [47m [m -[40m [41m [42m [43m [44m [45m [46m [47m [m -[40m [41m [42m [43m [44m [45m [46m [47m [m -[40m [41m [42m [43m [44m [45m [46m [47m [m -[100m [101m [102m [103m [104m [105m [106m [107m [m -[100m [101m [102m [103m [104m [105m [106m [107m [m -[100m [101m [102m [103m [104m [105m [106m [107m [m -[100m [101m [102m [103m [104m [105m [106m [107m [m -[100m [101m [102m [103m [104m [105m [106m [107m [m[H diff --git a/www/causal.agency/scheme.sed b/www/causal.agency/scheme.sed deleted file mode 100644 index bf18085b..00000000 --- a/www/causal.agency/scheme.sed +++ /dev/null @@ -1,6 +0,0 @@ -s/[.]bg0/html, &/ -s/[.]fg15/html, &/ -s/[.]fg12/a, &/ -s/[.]fg13/a:visited, &/ - -s/[.]fg8 { color: \([^;]*\); }/pre { border: 1px dashed \1; } &/ diff --git a/www/causal.agency/style.css b/www/causal.agency/style.css new file mode 100644 index 00000000..265c62c2 --- /dev/null +++ b/www/causal.agency/style.css @@ -0,0 +1,28 @@ +@import url("scheme.css"); + +table.head, table.foot { width: 100%; } +td.head-rtitle, td.foot-os { text-align: right; } +td.head-vol { text-align: center; } +div.Pp { margin: 1ex 0ex; } +div.Nd, div.Bf, div.Op { display: inline; } +span.Pa, span.Ad { font-style: italic; } +span.Ms { font-weight: bold; } +dl.Bl-diag > dt { font-weight: bold; } +code.Nm, code.Fl, code.Cm, code.Ic, code.In, code.Fd, code.Fn, +code.Cd { font-weight: bold; font-family: inherit; } + +div.head, div.foot { display: flex; justify-content: space-between; } +.head-ltitle, .foot-date { flex: 1; } +.head-vol { flex: 0 1 auto; text-align: center; } +.head-rtitle, .foot-os { flex: 1; text-align: right; } + +html { font-family: monospace; line-height: 1.25em; } +body { max-width: 80ch; margin: 1em auto; padding: 0 1ch; } +table { border-collapse: collapse; } +table.Nm code.Nm { padding-right: 1ch; } +table.foot { margin-top: 1em; } + +html { background-color: var(--ansi16); color: var(--ansi17); } +a { color: var(--ansi4); } +a:visited { color: var(--ansi5); } +a.permalink { color: var(--ansi3); text-decoration: none; } diff --git a/www/causal.agency/torus.pty b/www/causal.agency/torus.pty deleted file mode 100644 index 1e147970..00000000 --- a/www/causal.agency/torus.pty +++ /dev/null @@ -1,774 +0,0 @@ -[1;25r[m[4l[39;49m[?1h=[?25l[39;49m[38;5;0m[48;5;0m[m[39;49m[38;5;0m[48;5;0m[H[2J[38;5;3m[48;5;0m┌──────────────────────────────────────────────────────────────────────────────┐[2;1H│[38;5;7m[48;5;0m Welcome to [38;5;12m[48;5;0ma[38;5;14m[48;5;0ms[38;5;10m[48;5;0mc[38;5;11m[48;5;0mi[38;5;9m[48;5;0mi[38;5;13m[48;5;0m.[38;5;12m[48;5;0mt[38;5;14m[48;5;0mo[38;5;10m[48;5;0mw[38;5;11m[48;5;0mn[38;5;7m[48;5;0m! [38;5;15m[48;5;0mq[38;5;7m[48;5;0m quit [38;5;15m[48;5;0mQ[38;5;7m[48;5;0m teleport [38;5;15m[48;5;0mm[38;5;7m[48;5;0m mini-map [38;5;15m[48;5;0m?[38;5;7m[48;5;0m help [38;5;3m[48;5;0m│[3;1H│[38;5;7m[48;5;0m [38;5;3m[48;5;0m│[4;1H│[38;5;7m[48;5;0m [38;5;15m[48;5;0mk[38;5;7m[48;5;0m [38;5;8m[48;5;0m0[38;5;7m[48;5;0m [38;5;1m[48;5;0m1[38;5;7m[48;5;0m [38;5;2m[48;5;0m2[38;5;7m[48;5;0m [38;5;3m[48;5;0m3[38;5;7m[48;5;0m [38;5;4m[48;5;0m4[38;5;7m[48;5;0m [38;5;5m[48;5;0m5[38;5;7m[48;5;0m [38;5;6m[48;5;0m6[38;5;7m[48;5;0m 7 [38;5;15m[48;5;0mesc[38;5;7m[48;5;0m navigation mode [38;5;15m[48;5;0ms[38;5;7m[48;5;0m copy [38;5;3m[48;5;0m│[5;1H│[38;5;7m[48;5;0m [38;5;15m[48;5;0my[38;5;7m[48;5;0m ↑ [38;5;15m[48;5;0mu[38;5;7m[48;5;0m [38;5;15m[48;5;0mi[38;5;7m[48;5;0m insert mode [38;5;15m[48;5;0mp[38;5;7m[48;5;0m paste [38;5;3m[48;5;0m│[6;1H│[38;5;7m[48;5;0m [38;5;15m[48;5;0mh[38;5;7m[48;5;0m ←∙→ [38;5;15m[48;5;0ml[38;5;7m[48;5;0m [38;5;8m[48;5;0m)[38;5;7m[48;5;0m [38;5;0m[48;5;1m![38;5;7m[48;5;0m [38;5;0m[48;5;2m@[38;5;7m[48;5;0m [38;5;0m[48;5;3m#[38;5;7m[48;5;0m [38;5;0m[48;5;4m$[38;5;7m[48;5;0m [38;5;0m[48;5;5m%[38;5;7m[48;5;0m [38;5;0m[48;5;6m^[38;5;7m[48;5;0m [38;5;0m[48;5;7m&[38;5;7m[48;5;0m [38;5;15m[48;5;0ma[38;5;7m[48;5;0m insert after [38;5;15m[48;5;0m~[38;5;7m[48;5;0m paint color [38;5;3m[48;5;0m│[7;1H│[38;5;7m[48;5;0m [38;5;15m[48;5;0mb[38;5;7m[48;5;0m ↓ [38;5;15m[48;5;0mn[38;5;7m[48;5;0m [38;5;15m[48;5;0mI[38;5;7m[48;5;0m insert direction [38;5;15m[48;5;0m*[38;5;7m[48;5;0m paint bright [38;5;3m[48;5;0m│[8;1H│[38;5;7m[48;5;0m [38;5;15m[48;5;0mj[38;5;7m[48;5;0m [38;5;15m[48;5;0m8[38;5;7m[48;5;0m bright [38;5;15m[48;5;0m9[38;5;7m[48;5;0m invert [38;5;15m[48;5;0mR[38;5;7m[48;5;0m draw mode [38;5;15m[48;5;0m([38;5;7m[48;5;0m paint invert [38;5;3m[48;5;0m│[9;1H│[38;5;7m[48;5;0m [38;5;15m[48;5;0m`[38;5;7m[48;5;0m pipette [38;5;15m[48;5;0m.[38;5;7m[48;5;0m line mode [38;5;15m[48;5;0mC-a[38;5;7m[48;5;0m increment [38;5;3m[48;5;0m│[10;1H│[38;5;7m[48;5;0m [38;5;15m[48;5;0m\[38;5;7m[48;5;0m fast [38;5;15m[48;5;0mr[38;5;7m[48;5;0m replace [38;5;15m[48;5;0mC-x[38;5;7m[48;5;0m decrement [38;5;3m[48;5;0m│[11;1H│[38;5;7m[48;5;0m [38;5;15m[48;5;0mx[38;5;7m[48;5;0m erase [38;5;15m[48;5;0mHJKLYUBN[38;5;7m[48;5;0m swap cell [38;5;3m[48;5;0m│[12;1H│[38;5;7m[48;5;0m [38;5;3m[48;5;0m│[13;1H│[38;5;7m[48;5;0m [38;5;15m[48;5;0mF1[38;5;7m[48;5;0m @ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmno [38;5;3m[48;5;0m│[14;1H│[38;5;7m[48;5;0m [38;5;15m[48;5;0mF2[38;5;7m[48;5;0m ☺☻♥♦♣♠•◘○◙♂♀♪♫☼►◄↕‼¶§▬↨↑↓→←∟↔▲▼ [38;5;3m[48;5;0m│[15;1H│[38;5;7m[48;5;0m [38;5;15m[48;5;0mF3[38;5;7m[48;5;0m αßΓπΣσµτΦΘΩδ∞φε∩≡±≥≤⌠⌡÷≈°∙·√ⁿ²■ [38;5;3m[48;5;0m│[16;1H│[38;5;7m[48;5;0m [38;5;15m[48;5;0mF4[38;5;7m[48;5;0m ░▒▓│┤╡╢╖╕╣║╗╝╜╛┐└┴┬├─┼╞╟╚╔╩╦╠═╬╧╨╤╥╙╘╒╓╫╪┘┌█▄▌▐▀ [38;5;3m[48;5;0m│[17;1H│[38;5;7m[48;5;0m [38;5;15m[48;5;0mF5[38;5;7m[48;5;0m ÇüéâäàåçêëèïîìÄÅÉæÆôöòûùÿÖÜ¢£¥₧ƒáíóúñѪº¿⌐¬½¼¡«» [38;5;3m[48;5;0m│[18;1H│[38;5;7m[48;5;0m [38;5;3m[48;5;0m│[19;1H│[38;5;7m[48;5;0m [38;5;3m[48;5;0m│[20;1H│[38;5;7m[48;5;0m This is [38;5;3m[48;5;0mAGPLv3[38;5;7m[48;5;0m Free Software! [38;5;3m[48;5;0m│[21;1H│[38;5;7m[48;5;0m Code is available from [38;5;6m[48;5;0m<https://code.causal.agency/june/torus>[38;5;7m[48;5;0m. [38;5;3m[48;5;0m│[22;1H│[38;5;7m[48;5;0m [38;5;3m[48;5;0m│[23;1H│[38;5;7m[48;5;0m [38;5;3m[48;5;0m│[24;1H│[38;5;7m[48;5;0m Press [38;5;15m[48;5;0m? [38;5;7m[48;5;0mto open this help again. Press any key to continue... [38;5;3m[48;5;0m│[25;1H└──────────────────────────────────────────────────────────────────────────────┘[4h─[4l[m[39;49m[38;5;0m[48;5;0m[?12l[?25h[H[38;5;7m[48;5;0mPress [38;5;15m[48;5;0m?[38;5;7m[48;5;0m for help![38;5;3m[48;5;0m│[38;5;7m[48;5;0m this space now frees [38;5;9m[48;5;0m [38;5;5m[48;5;0m\[38;5;7m[48;5;0m [38;5;5m[48;5;0my[38;5;7m[48;5;0m [38;5;5m[48;5;0m\[38;5;7m[48;5;0m [38;5;6m[48;5;0mCP437[38;5;14m[48;5;0m [38;5;11m[48;5;0m☻ [38;5;9m[48;5;7m♥♦[38;5;0m[48;5;7m♣♠[38;5;14m[48;5;0m [38;5;4m[48;5;0m░▒▓█[38;5;3m[48;5;0m [38;5;6m[48;5;0m [38;5;7m[48;5;0m(000,000)[2;1H[38;5;3m[48;5;0m─────────────────┘ [38;5;7m[48;5;0m [38;5;11m[48;5;0mIt's Free Real Estate[38;5;7m[48;5;0m [38;5;1m[48;5;0m [38;5;7m[48;5;0m [38;5;3m[48;5;0m [38;5;5m[48;5;0m\[38;5;3m[48;5;0m [38;5;5m[48;5;0my[38;5;3m[48;5;0m [38;5;5m[48;5;0m\ [38;5;3m[48;5;0m ╒══════════════════════╕[K -[38;5;9m[48;5;0mFor a good [3;25H[38;5;5m[48;5;0m(0_0)[3;41H[m[39;49m[38;5;0m[48;5;0m [7C[38;5;5m[48;5;0m|[38;5;7m[48;5;0m [38;5;5m[48;5;0my[38;5;13m[48;5;0m [38;5;5m[48;5;0m|[38;5;7m[48;5;0m [38;5;3m[48;5;0m│[38;5;7m[48;5;0m [38;5;15m[48;5;0mascii.town guestbook[38;5;7m[48;5;0m [38;5;3m[48;5;0m│[38;5;1m[48;5;0m [38;5;7m[48;5;0m[K -[38;5;9m[48;5;0mtime, go in[38;5;7m[48;5;0m a [m[39;49m[38;5;0m[48;5;0m [38;5;3m[48;5;0m [38;5;5m[48;5;0m|[38;5;3m[48;5;0m [38;5;5m[48;5;0my[38;5;3m[48;5;0m [38;5;5m[48;5;0m|[38;5;3m[48;5;0m ╞[38;5;7m[48;5;0m══════════════════════[38;5;3m[48;5;0m╡[38;5;7m[48;5;0m[K -[38;5;9m[48;5;0many direction.[5;31H[38;5;10m[48;5;0m [38;5;7m[48;5;0m RR w [38;5;5m[48;5;0m [38;5;7m[48;5;0m [38;5;5m[48;5;0m| y[38;5;7m[48;5;0m [38;5;5m[48;5;0m|[38;5;7m[48;5;0m [38;5;3m[48;5;0m│[38;5;7m[48;5;0m [38;5;6m[48;5;0m-[38;5;7m[48;5;0m [38;5;6m[48;5;0mjune [38;5;7m[48;5;0m [38;5;3m[48;5;0m [38;5;7m[48;5;0m[2P -[38;5;12m[48;5;0mPls don't[38;5;7m[48;5;0m publicg@conferencRRRRuRRRRR.forsale [38;5;5m[48;5;0m |[38;5;7m[48;5;0m [38;5;5m[48;5;0my[38;5;7m[48;5;0m [38;5;5m[48;5;0m|[38;5;7m[48;5;0m [38;5;3m[48;5;0m│[38;5;7m[48;5;0m [38;5;13m[48;5;0m-[38;5;5m[48;5;0m [38;5;13m[48;5;0mscott [38;5;7m[48;5;0m [38;5;3m[48;5;0m [38;5;7m[48;5;0m[2P -[38;5;12m[48;5;0mvandal. There[7;28H[38;5;7m[48;5;0mRRRRRRRRRR [38;5;5m[48;5;0m | | [38;5;3m[48;5;0m│ [38;5;4m[48;5;0m- cjm [38;5;3m[48;5;0m [38;5;7m[48;5;0m[2P -[38;5;12m[48;5;0mare huuuuuge[38;5;15m[48;5;0m [38;5;7m[48;5;0m [38;5;4m[48;5;0mhelo woldr[38;5;7m[48;5;0m RRRRRRRR r a [38;5;5m[48;5;0m|[38;5;7m[48;5;0m [38;5;5m[48;5;0ml[38;5;2m[48;5;0m?[38;5;5m[48;5;0m|[38;5;7m[48;5;0m [38;5;3m[48;5;0m│[38;5;7m[48;5;0m [38;5;10m[48;5;0m-[38;5;7m[48;5;0m [38;5;10m[48;5;0merik[38;5;7m[48;5;0m [38;5;3m[48;5;0m [38;5;7m[48;5;0m[2P -[38;5;12m[48;5;0mtracts of [6C[38;5;7m[48;5;0m aaaac RRRRRR What's up?j[38;5;2m[48;5;0m/[38;5;5m[48;5;0m|[38;5;7m[48;5;0m [38;5;3m[48;5;0m│[38;5;7m[48;5;0m [38;5;7m[48;5;5m-[38;5;10m[48;5;0m [38;5;3m[48;5;0mswgillespie[38;5;7m[48;5;0m[2P -[38;5;12m[48;5;0munused land.[10;31H[38;5;7m[48;5;0mRRRR [38;5;9m[48;5;0m [38;5;7m[48;5;0m poop [38;5;5m[48;5;0m|[38;5;7m[48;5;0m [38;5;5m[48;5;0ma[38;5;2m[48;5;0m▼[38;5;5m[48;5;0m|[38;5;7m[48;5;0m [38;5;3m[48;5;0m│[38;5;7m[48;5;0m -[38;5;3m[48;5;0m [38;5;7m[48;5;0mdikaiosune[2P -[38;5;10m[48;5;0mif u do vandal[38;5;3m[48;5;0m [38;5;7m[48;5;0mRR[38;5;3m[48;5;0m [38;5;7m[48;5;0mtest[38;5;3m[48;5;0m [38;5;5m[48;5;0m |[38;5;7m[48;5;0m [38;5;5m[48;5;0mo[38;5;7m[48;5;0m [38;5;12m[48;5;0m-[38;5;7m[48;5;0m [38;5;12m[48;5;0mdanopia[38;5;7m[48;5;0m [38;5;3m[48;5;0m [38;5;7m[48;5;0m[2P -[38;5;10m[48;5;0mmake it funny[38;5;7m[48;5;0m [38;5;7m[48;5;5mbut maybe dont[38;5;7m[48;5;0m [m[39;49m[38;5;0m[48;5;0m [38;5;7m[48;5;0mhey [m[39;49m[38;5;0m[48;5;0m [38;5;1m[48;5;0m000[38;5;7m[48;5;0m sdddddd[38;5;5m[48;5;0m| |[38;5;7m[48;5;3m [38;5;3m[48;5;0m│[38;5;8m[48;5;0m - [38;5;7m[48;5;0mConnor[38;5;8m[48;5;0m_____[38;5;7m[48;5;0m[2P -PROTIP: Press [38;5;15m[48;5;0mESC[38;5;7m[48;5;0m to escape input modes [38;5;1m[48;5;0m [38;5;7m[48;5;0mq,,,,,,[38;5;5m[48;5;0m| a[38;5;7m[48;5;0m [38;5;3m[48;5;0m│[38;5;7m[48;5;0m [38;5;2m[48;5;0m- tokenrove [38;5;3m[48;5;0m│[38;5;7m[48;5;0m[K -[38;5;3m[48;5;0m2048 clone: [38;5;11m[48;5;0mssh play@ascii.town[38;5;7m[48;5;0m <3 aa [38;5;5m[48;5;0m [38;5;7m[48;5;0m [38;5;5m[48;5;0m| y[38;5;7m[48;5;0m [38;5;5m[48;5;0m|[38;5;7m[48;5;0m [38;5;3m[48;5;0m│[38;5;7m[48;5;0m [38;5;3m[48;5;0m-[38;5;7m[48;5;0m [38;5;3m[48;5;0mmykey[14;72H[38;5;5m[48;5;0m [38;5;7m[48;5;0m [38;5;5m[48;5;0m [38;5;1m[48;5;0m [38;5;5m[48;5;0m [38;5;7m[48;5;0m [38;5;3m[48;5;0m│[38;5;7m[48;5;0m[K -[38;5;5m[48;5;0m [38;5;7m[48;5;0mG O O D B Y E W I T C H E S . T Os[38;5;5m[48;5;0mjjj[38;5;7m[48;5;0m :( [38;5;5m[48;5;0m | y |[m[39;49m[38;5;0m[48;5;0m [38;5;3m[48;5;0m│[38;5;2m[48;5;0m [38;5;7m[48;5;0m-[38;5;2m[48;5;0m [38;5;7m[48;5;0mdmrd[38;5;9m[48;5;0m [38;5;1m[48;5;0m [38;5;5m[48;5;0m [38;5;1m[48;5;0m [38;5;7m[48;5;0m [38;5;5m[48;5;0m [38;5;3m[48;5;0m│[38;5;5m[48;5;0m [38;5;7m[48;5;0m[K -[38;5;1m[48;5;0mvim controls, eh?[38;5;7m[48;5;0m.__________________. Con[38;5;5m[48;5;0mj[38;5;7m[48;5;0mor [38;5;5m[48;5;0m |[38;5;7m[48;5;0m [38;5;5m[48;5;0my[38;5;7m[48;5;0m [38;5;5m[48;5;0m|[38;5;7m[48;5;0m [38;5;3m[48;5;0m│[38;5;7m[48;5;0m - hiya [38;5;1m[48;5;0m [38;5;7m[48;5;0m [38;5;9m[48;5;0m [38;5;7m[48;5;0m [38;5;3m[48;5;0m│[C[K -[38;5;11m[48;5;0m [38;5;10m[48;5;0m.[38;5;11m[48;5;0m [38;5;10m[48;5;0m.[38;5;11m[48;5;0m [38;5;10m[48;5;0m.[38;5;13m[48;5;0m [38;5;10m[48;5;0m.[38;5;7m[48;5;0m [38;5;10m[48;5;0m.[38;5;7m[48;5;0m [38;5;10m[48;5;0m.[38;5;7m[48;5;0m [38;5;10m[48;5;0m.[38;5;7m[48;5;0m [38;5;10m[48;5;0m.[38;5;7m[48;5;0m |[38;5;15m[48;5;0m Out of space? [38;5;7m[48;5;0m|[38;5;15m[48;5;0m [38;5;7m[48;5;0mWas[38;5;5m[48;5;0mj[38;5;7m[48;5;0m whut?[38;5;5m[48;5;0m|[38;5;7m[48;5;0m [38;5;5m[48;5;0my[38;5;7m[48;5;0m [38;5;5m[48;5;0m|[38;5;7m[48;5;0m [38;5;3m[48;5;0m│[38;5;7m[48;5;0m - [38;5;1m[48;5;0marke [38;5;7m[48;5;0m[2P -[38;5;10m[48;5;0m.[38;5;13m[48;5;0m [38;5;10m[48;5;0mWelcome to.[38;5;14m[48;5;0m [38;5;10m[48;5;0m.[38;5;14m[48;5;0m [38;5;10m[48;5;0m.[38;5;7m[48;5;0m|[38;5;15m[48;5;0mTry typing[38;5;11m[48;5;0m [38;5;9m[48;5;0m1Q[38;5;15m[48;5;0m,[38;5;11m[48;5;0m [38;5;10m[48;5;0m2Q[38;5;15m[48;5;0m,[38;5;7m[48;5;0m|[38;5;11m[48;5;0m [38;5;7m[48;5;0mHer[38;5;5m[48;5;0mj[38;5;7m[48;5;0m [38;5;5m[48;5;0m [38;5;7m[48;5;0m [38;5;5m[48;5;0m| y[38;5;7m[48;5;0m [38;5;5m[48;5;0m|[38;5;7m[48;5;0m [38;5;3m[48;5;0m│[38;5;7m[48;5;0m - cmr[2P - [38;5;10m[48;5;0m.[38;5;7m[48;5;0m [38;5;10m[48;5;0m.[38;5;7m[48;5;0m [38;5;10m[48;5;0m. the [38;5;12m[48;5;0mT[38;5;9m[48;5;0mO[38;5;11m[48;5;0mW[38;5;14m[48;5;0mN[38;5;10m[48;5;0m.[38;5;7m[48;5;0m |[38;5;11m[48;5;0m3Q[38;5;15m[48;5;0m or [38;5;12m[48;5;0m4Q[38;5;15m[48;5;0m to travel[38;5;7m[48;5;0m|[38;5;15m[48;5;0m [38;5;10m[48;5;0m [38;5;4m[48;5;0mw[38;5;5m[48;5;0mj[38;5;4m[48;5;0mof[38;5;7m[48;5;0mt[38;5;11m[48;5;0m [38;5;5m[48;5;0m | y | [38;5;3m[48;5;0m│[38;5;7m[48;5;0m - [38;5;5m[48;5;0mGrissess (:D)[38;5;6m[48;5;0m [38;5;7m[48;5;0m [38;5;6m[48;5;0m [38;5;9m[48;5;0m [38;5;3m[48;5;0m│[38;5;7m[48;5;0m[K - [38;5;10m[48;5;0m.[38;5;7m[48;5;0m [38;5;10m[48;5;0m.[38;5;7m[48;5;0m [38;5;10m[48;5;0m.[38;5;7m[48;5;0m [38;5;10m[48;5;0m.[38;5;7m[48;5;0m [38;5;10m[48;5;0m.[38;5;7m[48;5;0m [38;5;10m[48;5;0m.[38;5;7m[48;5;0m [38;5;10m[48;5;0m.[38;5;7m[48;5;0m [38;5;10m[48;5;0m.[38;5;7m[48;5;0m|[38;5;15m[48;5;0mto far-away lands [38;5;7m[48;5;0m|[38;5;15m[48;5;0m [38;5;7m[48;5;0m [38;5;10m[48;5;0m [38;5;4m[48;5;0ma[38;5;5m[48;5;0mj[38;5;4m[48;5;0moo[38;5;15m[48;5;0m [38;5;6m[48;5;0m [38;5;5m[48;5;0m |[38;5;7m[48;5;0m [38;5;5m[48;5;0my | [38;5;3m[48;5;0m│[38;5;5m[48;5;0m [38;5;7m[48;5;0m- [38;5;12m[48;5;0meternale[38;5;7m[48;5;0my[38;5;12m[48;5;0me[38;5;7m[48;5;0m [38;5;0m[48;5;7m(ipv6)[38;5;7m[48;5;0m [38;5;3m[48;5;0m│[38;5;7m[48;5;0m[K -[38;5;12m[48;5;0m [38;5;10m[48;5;0m [38;5;2m[48;5;0m.. . . . . .[38;5;10m[48;5;0m .[38;5;7m[48;5;0m '------------------' [38;5;5m[48;5;0mj [38;5;7m[48;5;0mtest[38;5;5m[48;5;0m |[38;5;7m[48;5;0m [38;5;5m[48;5;0my[38;5;7m[48;5;0m [38;5;5m[48;5;0m|[38;5;7m[48;5;0m [38;5;3m[48;5;0m│[38;5;7m[48;5;0m - meena [38;5;3m[48;5;0m [38;5;7m[48;5;0m[2P - sad[38;5;2m[48;5;0m [38;5;7m[48;5;0m hi friends [38;5;3m[48;5;0mhello[38;5;7m[48;5;0m [38;5;8m[48;5;0m [38;5;7m[48;5;0mcybre[38;5;7m[48;5;6m![38;5;7m[48;5;0m [38;5;7m[48;5;6m^Yes?[38;5;7m[48;5;0m [38;5;5m[48;5;0m j [38;5;7m[48;5;0mni [38;5;5m[48;5;0m| y[38;5;7m[48;5;0m [38;5;5m[48;5;0m|[38;5;7m[48;5;0m [38;5;3m[48;5;0m│[38;5;7m[48;5;0m [38;5;6m[48;5;0m- b0rk[38;5;7m[48;5;0m [38;5;5m[48;5;0m [38;5;7m[48;5;0m boy [38;5;15m[48;5;0m__ [38;5;7m[48;5;0m [38;5;3m[48;5;0m│[38;5;7m[48;5;0m[K - nethack [38;5;3m[48;5;0myo how do i select black???[38;5;7m[48;5;0m [38;5;1m[48;5;0ma[38;5;5m[48;5;0mj[38;5;14m[48;5;0m [38;5;7m[48;5;0msxD [38;5;5m[48;5;0m |[38;5;7m[48;5;0m [38;5;5m[48;5;0my | [38;5;3m[48;5;0m│[38;5;5m[48;5;0m [38;5;7m[48;5;0m- fbernier[38;5;5m[48;5;0m [38;5;15m[48;5;0m / '[38;5;3m[48;5;0m [38;5;7m[48;5;0m [38;5;3m[48;5;0m│[38;5;7m[48;5;0m[K -[38;5;12m[48;5;0m [38;5;7m[48;5;0mboi[38;5;12m[48;5;0m [38;5;7m[48;5;0m [38;5;9m[48;5;0mc[38;5;10m[48;5;0ml[38;5;11m[48;5;0mo[38;5;12m[48;5;0mw[38;5;13m[48;5;0mn[38;5;3m[48;5;0m [38;5;14m[48;5;0mt[38;5;9m[48;5;0mo[38;5;10m[48;5;0mw[38;5;11m[48;5;0mn[38;5;7m[48;5;0mjj [38;5;1m[48;5;0mthis is as wired [38;5;8m[48;5;0m0[38;5;5m[48;5;0mj[38;5;1m[48;5;0m [38;5;7m[48;5;0mdasdksajklj[38;5;3m[48;5;0m│[38;5;7m[48;5;0m -[38;5;5m[48;5;0m mguaypaq[38;5;2m[48;5;0m [38;5;3m[48;5;0m [38;5;15m[48;5;0m [38;5;3m[48;5;0m [38;5;15m[48;5;0m| [38;5;2m[48;5;0m [38;5;3m[48;5;0m│[38;5;7m[48;5;0m[K -[38;5;1m[48;5;0m [38;5;9m[48;5;0m [38;5;12m[48;5;0m* [38;5;5m[48;5;0m [38;5;8m[48;5;1mhot tip:[38;5;7m[48;5;1m [38;5;0m[48;5;1mdon't[38;5;7m[48;5;1m [38;5;8m[48;5;1mruin sh[38;5;7m[48;5;0mit [38;5;12m[48;5;0m [38;5;7m[48;5;0m [38;5;12m[48;5;0m* [38;5;5m[48;5;0m [38;5;3m[48;5;0m [38;5;5m[48;5;0m [38;5;12m[48;5;0m*[38;5;7m[48;5;0m [38;5;5m[48;5;0mj [38;5;12m[48;5;0m* [38;5;5m[48;5;0m /[38;5;7m[48;5;0m [38;5;5m[48;5;0my[38;5;7m[48;5;0mq[38;5;5m[48;5;0m/ [38;5;12m[48;5;0m*[38;5;5m[48;5;0m [38;5;3m[48;5;0m│[38;5;5m[48;5;0m [38;5;7m[48;5;0m- [38;5;2m[48;5;0mrkallos[38;5;7m[48;5;0m [38;5;15m[48;5;0m [38;5;3m[48;5;0m [38;5;15m[48;5;0mV [38;5;3m[48;5;0m │[38;5;7m[48;5;0m[K[H[m[39;49m[38;5;0m[48;5;0m[13;41H - - - - - - - - - - - -[1;41H [38;5;6m[48;5;0m(The client tries to check if you'll[38;5;7m[48;5;0m [38;5;5m[48;5;0mj[38;5;7m[48;5;0m [38;5;5m[48;5;0m|[38;5;7m[48;5;0m [38;5;5m[48;5;0my[38;5;7m[48;5;0m [38;5;5m[48;5;0m|[38;5;2m[48;5;0m///[38;5;3m[48;5;0m│[38;5;7m[48;5;0m [38;5;15m[48;5;0m-[38;5;7m[48;5;0m [38;5;15m[48;5;0mfsj[38;5;7m[48;5;0m [38;5;14m[48;5;0m [38;5;3m[48;5;0m│[7C[38;5;7m[48;5;0m1 -[38;5;6m[48;5;0mbe able to see all the colours now.)[38;5;7m[48;5;0m [38;5;5m[48;5;0mj[38;5;7m[48;5;0m [38;5;5m[48;5;0m|[38;5;7m[48;5;0m [38;5;5m[48;5;0my[38;5;7m[48;5;0m [38;5;5m[48;5;0m|[38;5;2m[48;5;0m\\\[38;5;3m[48;5;0m│[38;5;7m[48;5;0m [38;5;6m[48;5;0m-[38;5;7m[48;5;0m [38;5;6m[48;5;0mSylvhem[38;5;7m[48;5;0m [38;5;3m[48;5;0m└──────┐[38;5;2m[48;5;0m//[3;1H[38;5;6m[48;5;0m [38;5;7m[48;5;0m [38;5;9m[48;5;0m [38;5;7m[48;5;0m [38;5;5m[48;5;0mj[38;5;7m[48;5;0m [38;5;1m[48;5;0m [38;5;7m[48;5;0m [38;5;5m[48;5;0m|[38;5;7m[48;5;0m [38;5;5m[48;5;0my[38;5;7m[48;5;0m [38;5;5m[48;5;0m|[38;5;2m[48;5;0m///[38;5;3m[48;5;0m│[38;5;7m[48;5;0m [38;5;1m[48;5;0m- iliana[38;5;3m[48;5;0m [38;5;1m[48;5;0m<3[38;5;7m[48;5;0m [38;5;5m[48;5;0m [38;5;7m[48;5;0m [38;5;3m[48;5;0m│[38;5;2m[48;5;0m\\[4;1H[38;5;6m[48;5;0m [38;5;15m[48;5;0m][m[39;49m[38;5;0m[48;5;0m [38;5;7m[48;5;0mgas pedal ┐ this is just [38;5;15m[48;5;0m\[38;5;7m[48;5;0m [38;5;11m[48;5;0m [38;5;5m[48;5;0mj[38;5;7m[48;5;0m [38;5;1m[48;5;0m [38;5;7m[48;5;0m [38;5;5m[48;5;0m|[38;5;7m[48;5;0m [38;5;5m[48;5;0my[38;5;7m[48;5;0m [38;5;5m[48;5;0m|[38;5;2m[48;5;0m\\\[38;5;3m[48;5;0m│[38;5;7m[48;5;0m [38;5;14m[48;5;0m- tjk[38;5;7m[48;5;0m [38;5;3m[48;5;0m│[38;5;2m[48;5;0m//[5;1H[38;5;7m[48;5;0m [38;5;15m[48;5;0m.__[38;5;7m[48;5;0m [38;5;14m[48;5;0m [38;5;15m[48;5;0m[[m[39;49m[38;5;0m[48;5;0m [38;5;7m[48;5;0mbrakes ┘ to toggle fast now[38;5;5m[48;5;0mj[38;5;7m[48;5;0m [38;5;5m[48;5;0m|[38;5;7m[48;5;0m [38;5;5m[48;5;0my[38;5;7m[48;5;0m [38;5;5m[48;5;0m|[38;5;2m[48;5;0m///[38;5;3m[48;5;0m│[38;5;7m[48;5;0m - duckinator [7C[38;5;2m[48;5;0m\\[6;1H[38;5;7m[48;5;0m [38;5;15m[48;5;0m|\[38;5;7m[48;5;0m } curly gas pedal [38;5;1m[48;5;0m:)[38;5;7m[48;5;0m [38;5;5m[48;5;0mj[38;5;7m[48;5;0m [38;5;1m[48;5;1m [m[39;49m[38;5;0m[48;5;0melo[38;5;7m[48;5;0m [38;5;5m[48;5;0my[38;5;7m[48;5;0m [38;5;5m[48;5;0m|[38;5;2m[48;5;0m\\\[38;5;3m[48;5;0m│[38;5;7m[48;5;0m (pup@mastodon.social)[38;5;3m[48;5;0m│[38;5;2m[48;5;0m//[7;1H[38;5;7m[48;5;0m [38;5;15m[48;5;0m\[38;5;7m[48;5;0m { curly brakes [38;5;6m[48;5;0m [38;5;7m[48;5;0m [38;5;5m[48;5;0mj[38;5;7m[48;5;0m [38;5;1m[48;5;1m [38;5;6m[48;5;0m [38;5;1m[48;5;1m [38;5;5m[48;5;0m|[38;5;7m[48;5;0m [38;5;5m[48;5;0my[38;5;7m[48;5;0m [38;5;5m[48;5;0m|[38;5;2m[48;5;0m///[38;5;3m[48;5;0m│[38;5;6m[48;5;0m [38;5;3m[48;5;0m- bug[38;5;0m[48;5;3m(@chitter.xyz)[38;5;7m[48;5;0m [38;5;3m[48;5;0m│[38;5;2m[48;5;0m\\[8;1H[38;5;7m[48;5;0m Looking for something [38;5;15m[48;5;0minteresting[38;5;11m[48;5;0m?[38;5;7m[48;5;0m [38;5;5m[48;5;0mj[38;5;7m[48;5;0m [38;5;1m[48;5;1m [38;5;7m[48;5;0m [38;5;1m[48;5;1m [38;5;5m[48;5;0m|[38;5;7m[48;5;0m [38;5;5m[48;5;0my[38;5;7m[48;5;0m [38;5;5m[48;5;0m|[38;5;2m[48;5;0m\\\[38;5;3m[48;5;0m│[38;5;7m[48;5;0m - peidran [9C[38;5;2m[48;5;0m//[9;1H[38;5;7m[48;5;0m Aside from scattered pages all over, [38;5;5m[48;5;0mj[38;5;7m[48;5;0m [38;5;1m[48;5;1m [38;5;7m[48;5;0m [38;5;5m[48;5;0m|[38;5;7m[48;5;0m [38;5;5m[48;5;0my[38;5;7m[48;5;0m [38;5;5m[48;5;0m|[38;5;2m[48;5;0m///[38;5;3m[48;5;0m│[38;5;7m[48;5;0m -[38;5;3m[48;5;0m [38;5;7m[48;5;0mKitRedgrave[9C[38;5;2m[48;5;0m\\[10;1H[38;5;7m[48;5;0m there's some development [38;5;12m[48;5;0mleft[38;5;7m[48;5;0m and [38;5;10m[48;5;0mup[38;5;7m[48;5;0m fro[38;5;5m[48;5;0mj[38;5;7m[48;5;0m [38;5;5m[48;5;0m|[38;5;7m[48;5;0m [38;5;5m[48;5;0my[38;5;7m[48;5;0m [38;5;5m[48;5;0m|[38;5;2m[48;5;0m\\\[38;5;3m[48;5;0m│[38;5;7m[48;5;0m - [38;5;4m[48;5;0mvimtingu[38;5;7m[48;5;0m [10C[38;5;2m[48;5;0m//[11;1H[38;5;7m[48;5;0m here. The bulletin is over to the [38;5;9m[48;5;0mright[38;5;5m[48;5;0mj[38;5;15m[48;5;0m->[38;5;7m[48;5;0m [38;5;5m[48;5;0m|[38;5;7m[48;5;0m [38;5;5m[48;5;0my[38;5;7m[48;5;0m [38;5;5m[48;5;0m|[38;5;2m[48;5;0m///[38;5;3m[48;5;0m│[38;5;7m[48;5;0m - thomas@touhey.org [38;5;3m[48;5;0m│[38;5;2m[48;5;0m\\[12;1H[38;5;7m[48;5;0m somewhere. And there's stuff all along [38;5;5m[48;5;0mj[38;5;7m[48;5;0m [38;5;5m[48;5;0m|[38;5;7m[48;5;0m [38;5;5m[48;5;0my[38;5;7m[48;5;0m [38;5;5m[48;5;0m|[38;5;2m[48;5;0m\\\[38;5;3m[48;5;0m│[38;5;7m[48;5;0m - frewsxcv \.fr [38;5;3m[48;5;0m│[38;5;2m[48;5;0m//[13;1H[38;5;7m[48;5;0m the [38;5;13m[48;5;0mtorus[38;5;7m[48;5;0m if you follow it around. [38;5;5m[48;5;0mj[38;5;7m[48;5;0m [38;5;5m[48;5;0m|[38;5;7m[48;5;0m [38;5;5m[48;5;0my[38;5;7m[48;5;0m [38;5;5m[48;5;0m|[38;5;2m[48;5;0m///[38;5;3m[48;5;0m│[38;5;7m[48;5;0m -[38;5;3m[48;5;0m NecroTechno <3[38;5;7m[48;5;0m [38;5;3m[48;5;0m│[38;5;2m[48;5;0m\\[14;1H[38;5;7m[48;5;0m [38;5;15m[48;5;0m\[38;5;7m[48;5;0m [38;5;5m[48;5;0mj[38;5;7m[48;5;0m [38;5;5m[48;5;0m|[38;5;7m[48;5;0m [38;5;5m[48;5;0my[38;5;7m[48;5;0m [38;5;5m[48;5;0m|[38;5;2m[48;5;0m\\\[38;5;3m[48;5;0m│ [38;5;7m[48;5;0m-[38;5;5m[48;5;0m er1n[38;5;7m[48;5;0m [14;72H [38;5;3m[48;5;0m│[38;5;2m[48;5;0m//[15;1H [38;5;11m[48;5;0mNEW: press [38;5;15m[48;5;0mm[38;5;11m[48;5;0m to open the mini-map[38;5;7m[48;5;0m [38;5;15m[48;5;0m_\|[38;5;7m[48;5;0m [38;5;5m[48;5;0m|[38;5;7m[48;5;0m [38;5;5m[48;5;0my[38;5;7m[48;5;0m [38;5;5m[48;5;0m|[38;5;2m[48;5;0m///[38;5;3m[48;5;0m│[38;5;7m[48;5;0m [38;5;5m[48;5;0m- quantified [38;5;7m[48;5;0m [38;5;3m[48;5;0m│[38;5;2m[48;5;0m\\[16;1H[38;5;7m[48;5;0m [38;5;11m[48;5;0mand see what's nearby[38;5;7m[48;5;0m [38;5;5m[48;5;0m|[38;5;7m[48;5;0m [38;5;5m[48;5;0my[38;5;7m[48;5;0m [38;5;5m[48;5;0m|[38;5;2m[48;5;0m\\\[38;5;3m[48;5;0m│[38;5;7m[48;5;0m [38;5;5m[48;5;0m@cybre.space[38;5;7m[48;5;0m [38;5;3m[48;5;0m│[38;5;2m[48;5;0m//[17;1H[38;5;7m[48;5;0m [38;5;15m[48;5;0m [38;5;10m[48;5;0m [38;5;15m[48;5;0m [38;5;7m[48;5;0m [38;5;10m[48;5;0m [38;5;7m[48;5;0myoooooo yw! [38;5;10m[48;5;0m [38;5;7m[48;5;0m [38;5;5m[48;5;0m|[38;5;7m[48;5;0m [38;5;5m[48;5;0my[38;5;7m[48;5;0m [38;5;5m[48;5;0m|[38;5;2m[48;5;0m///[38;5;3m[48;5;0m│[38;5;7m[48;5;0m [38;5;10m[48;5;0m- nightpool (cybre) [38;5;3m[48;5;0m│[38;5;10m[48;5;0m\[38;5;2m[48;5;0m\[18;1H[38;5;7m[48;5;0m [38;5;10m[48;5;0m [38;5;2m[48;5;0maaa\]\\[38;5;12m[48;5;0my wat[38;5;10m[48;5;0m [38;5;7m[48;5;0mhey vanta [38;5;10m[48;5;0m [38;5;7m[48;5;0m [38;5;5m[48;5;0m|[38;5;7m[48;5;0m [38;5;5m[48;5;0my |[38;5;2m[48;5;0m\\\[38;5;3m[48;5;0m│[38;5;7m[48;5;0m - ghosty[14C[38;5;2m[48;5;0m//[19;2H[38;5;7m[48;5;0m [38;5;15m[48;5;0m [38;5;7m[48;5;0mUrFU !d[38;5;10m[48;5;0m [38;5;7m[48;5;0mthis is dope[38;5;10m[48;5;0m [38;5;7m[48;5;0m [38;5;10m[48;5;0m [38;5;5m[48;5;0m| y[38;5;7m[48;5;0m [38;5;5m[48;5;0m|[38;5;2m[48;5;0m///[38;5;3m[48;5;0m│[38;5;7m[48;5;0m [38;5;10m[48;5;0m- lynn (@chordbug)[38;5;7m[48;5;0m [38;5;3m[48;5;0m│[38;5;2m[48;5;0m\\[20;1H[38;5;10m[48;5;0m [38;5;7m[48;5;0mRTF - chempion![38;5;10m[48;5;0m [38;5;7m[48;5;0mthx 4 sharing [38;5;10m[48;5;0m [38;5;5m[48;5;0m|[38;5;7m[48;5;0m [38;5;5m[48;5;0my[38;5;7m[48;5;0m [38;5;5m[48;5;0m|[38;5;2m[48;5;0m\\\[38;5;3m[48;5;0m│[38;5;5m[48;5;0m [38;5;7m[48;5;0m-[38;5;5m[48;5;0m [38;5;7m[48;5;0mvantablack [38;5;3m[48;5;0m│[38;5;2m[48;5;0m//[21;1H[38;5;7m[48;5;0m This is actually amazing. [38;5;5m[48;5;0m|[38;5;7m[48;5;0m [38;5;5m[48;5;0my[38;5;7m[48;5;0m [38;5;5m[48;5;0m|[38;5;2m[48;5;0m///[38;5;3m[48;5;0m│[38;5;7m[48;5;0m [38;5;5m[48;5;0m//wxyzzyrd [38;5;7m[48;5;0m [9C[38;5;2m[48;5;0m\\[22;2H[38;5;7m[48;5;0mDon't forget to grab the source: [38;5;14m[48;5;0m [38;5;7m[48;5;0m [38;5;5m[48;5;0m|[38;5;7m[48;5;0m [38;5;5m[48;5;0my[38;5;7m[48;5;0m [38;5;5m[48;5;0m|[38;5;2m[48;5;0m\\\[38;5;3m[48;5;0m│[38;5;7m[48;5;0m //international <3 [38;5;3m[48;5;0m│[38;5;2m[48;5;0m//[23;2H[38;5;7m[48;5;0m hi RC! [38;5;5m[48;5;0m|[38;5;7m[48;5;0m [38;5;5m[48;5;0my |[38;5;2m[48;5;0m///[38;5;3m[48;5;0m│[38;5;7m[48;5;0m - [38;5;13m[48;5;0mmaren[38;5;7m[48;5;0m [38;5;3m[48;5;0m│[38;5;2m[48;5;0m\\[24;1H[38;5;7m[48;5;0m $ git clone \ [38;5;5m[48;5;0m| y[38;5;7m[48;5;0m [38;5;5m[48;5;0m|[38;5;2m[48;5;0m\\\[38;5;3m[48;5;0m│[38;5;14m[48;5;0m [38;5;13m[48;5;0m- [38;5;0m[48;5;2mrose[38;5;14m[48;5;0m [38;5;2m[48;5;0m [38;5;3m[48;5;0m│[38;5;2m[48;5;0m//[25;1H[38;5;7m[48;5;0m https://code.causal.agency/june/torus.git [38;5;5m[48;5;0m|[38;5;7m[48;5;0m [38;5;5m[48;5;0my[38;5;7m[48;5;0m [38;5;5m[48;5;0m|[38;5;2m[48;5;0m///[38;5;3m[48;5;0m│[38;5;7m[48;5;0m [38;5;13m[48;5;0m(@BLASTPROCESSlNG)[38;5;7m[48;5;0m [38;5;3m[48;5;0m│[38;5;2m[48;5;0m/\[4h/[4l[1;41H[m[39;49m[38;5;0m[48;5;0m - - - - - - - - - - - - - - - - - - - - - - - -[1;41H [38;5;4m[48;5;0m~~[38;5;7m[48;5;0m~[38;5;4m[48;5;0m~[38;5;12m[48;5;0m~[38;5;4m[48;5;0m~~~~~~~~[38;5;12m[48;5;0m~[38;5;4m[48;5;0m~~~~[38;5;12m[48;5;0m~[38;5;4m[48;5;0m~~~~~~~[38;5;12m[48;5;0m~[38;5;4m[48;5;0m~~~~~~~[38;5;12m[48;5;0m~[38;5;4m[48;5;0m~~~~~~[38;5;12m[48;5;0m~[38;5;4m[48;5;0m~~~~[38;5;5m[48;5;0m|[38;5;7m[48;5;0m [38;5;5m[48;5;0my[38;5;7m[48;5;0m [38;5;5m[48;5;0m|[38;5;12m[48;5;0m~[38;5;4m[48;5;0m~~[38;5;3m[48;5;0m│[38;5;1m[48;5;0m [38;5;5m[48;5;0m- grainloom[38;5;7m[48;5;0m [8C2 -[38;5;4m[48;5;0m~[38;5;12m[48;5;0m~[38;5;4m[48;5;0m~~~~~[38;5;12m[48;5;0m~[38;5;4m[48;5;0m~~~~~~~~~~~~~~~~~~~~[38;5;12m[48;5;0m~[38;5;4m[48;5;0m~~~~~~[38;5;12m[48;5;0m~[38;5;4m[48;5;0m~~~~~~~~~[38;5;12m[48;5;0m~[38;5;5m[48;5;0m|[38;5;7m[48;5;0m [38;5;5m[48;5;0my[38;5;7m[48;5;0m [38;5;5m[48;5;0m|[38;5;4m[48;5;0m~[38;5;12m[48;5;0m~[38;5;4m[48;5;0m~[38;5;3m[48;5;0m│[38;5;7m[48;5;0m [38;5;5m[48;5;0m@cybre.space[8C[38;5;12m[48;5;0m~[38;5;4m[48;5;0m~[3;1H~~~~~~~[38;5;7m[48;5;0mhi[38;5;4m[48;5;0m~~[38;5;12m[48;5;0m~[38;5;4m[48;5;0m~~~~~~~~[38;5;12m[48;5;0m~[38;5;4m[48;5;0m~~~~~~~~~~~~~~~~~~~~[38;5;12m[48;5;0m~[38;5;4m[48;5;0m~~~~[38;5;5m[48;5;0m|[38;5;7m[48;5;0m [38;5;5m[48;5;0my[38;5;7m[48;5;0m [38;5;5m[48;5;0m|[38;5;4m[48;5;0m~~[38;5;12m[48;5;0m~[38;5;3m[48;5;0m│[38;5;7m[48;5;0m [38;5;1m[48;5;2m@slimelia[38;5;7m[48;5;0m [9C[38;5;4m[48;5;0m~~[4;1H[38;5;12m[48;5;0m~[38;5;4m[48;5;0m~~~~~~~~~~~~~~~~~~~~~~~~[38;5;12m[48;5;0m~[38;5;4m[48;5;0m~~~~~~~~[38;5;12m[48;5;0m~[38;5;4m[48;5;0m~~~[38;5;12m[48;5;0m~[38;5;4m[48;5;0m~~~~~[38;5;5m[48;5;5m~[38;5;4m[48;5;0m~[38;5;5m[48;5;0m|[38;5;7m[48;5;0m [38;5;5m[48;5;0my[38;5;7m[48;5;0m [38;5;5m[48;5;0m|[38;5;4m[48;5;0m~[38;5;12m[48;5;0m~[38;5;4m[48;5;0m~[38;5;3m[48;5;0m│[38;5;7m[48;5;0m - jfo[17C[38;5;4m[48;5;0m~[38;5;12m[48;5;0m~[5;1H[38;5;4m[48;5;0m~~~~~~~~[38;5;12m[48;5;0m~[38;5;4m[48;5;0m~~~~~~[38;5;12m[48;5;0m~[38;5;4m[48;5;0m~~~~~~~~~~~~~~~[38;5;12m[48;5;0m~[38;5;4m[48;5;0m~~~~~[38;5;5m[48;5;5m~~~jh[38;5;4m[48;5;0m~~~~[38;5;5m[48;5;5m|[38;5;7m[48;5;0m [38;5;5m[48;5;0my[38;5;7m[48;5;0m [38;5;5m[48;5;0m|[38;5;12m[48;5;0m~[38;5;4m[48;5;0m~~[38;5;3m[48;5;0m│[38;5;7m[48;5;0m [38;5;1m[48;5;0m@Phairupegiont[6C[38;5;4m[48;5;0m~~[6;1H~~~[38;5;12m[48;5;0m~[38;5;4m[48;5;0m~~~~~~~~~~~~~~[38;5;12m[48;5;0m~[38;5;4m[48;5;0m~~~[38;5;12m[48;5;0m~[38;5;4m[48;5;0m~~~~~~~~~~~~~~~~~[38;5;12m[48;5;0m~~[38;5;4m[48;5;0m~~~~[38;5;5m[48;5;0m|[38;5;7m[48;5;0m [38;5;5m[48;5;0my[38;5;7m[48;5;0m [38;5;5m[48;5;0m|[38;5;4m[48;5;0m~[38;5;12m[48;5;0m~[38;5;4m[48;5;0m~[38;5;3m[48;5;0m│[38;5;7m[48;5;0m [m[39;49m[38;5;0m[48;5;0m- [38;5;2m[48;5;0mchr@cybre.space[38;5;7m[48;5;0m [38;5;5m[48;5;0m<3[38;5;7m[48;5;0m [38;5;3m[48;5;0m│[38;5;12m[48;5;0m~[38;5;4m[48;5;0m~[7;1H[38;5;12m[48;5;0m~[38;5;4m[48;5;0m~~~~~~~~~[38;5;7m[48;5;0m i want to marry lynn [38;5;4m[48;5;0m~~~~~~~~~~~~~~[38;5;5m[48;5;0m|[38;5;7m[48;5;0m [38;5;5m[48;5;0my[38;5;7m[48;5;0m [38;5;5m[48;5;0m|[38;5;4m[48;5;0m~~[38;5;12m[48;5;0m~[38;5;3m[48;5;0m│[38;5;7m[48;5;0m - elomatreb :3 [38;5;3m[48;5;0m│[38;5;4m[48;5;0m~~[8;1H~~~~~~~~~[38;5;12m[48;5;0m~[38;5;4m[48;5;0m~~~~~~~[38;5;14m[48;5;0msame[38;5;4m[48;5;0m~~[38;5;12m[48;5;0m~[38;5;4m[48;5;0m~~[38;5;12m[48;5;0m~[38;5;4m[48;5;0m~~~~~~~~~[38;5;12m[48;5;0m~[38;5;4m[48;5;0m~~~~~~~~~[38;5;5m[48;5;0m|[38;5;7m[48;5;0m [38;5;5m[48;5;0my[38;5;7m[48;5;0m [38;5;5m[48;5;0m|[38;5;4m[48;5;0m~[38;5;12m[48;5;0m~[38;5;4m[48;5;0m~[38;5;3m[48;5;0m│[38;5;7m[48;5;0m - minerobber[10C[38;5;4m[48;5;0m~[38;5;12m[48;5;0m~[9;1H[38;5;4m[48;5;0m~~~[38;5;12m[48;5;0m~[38;5;4m[48;5;0m~~~~~~~~~[38;5;12m[48;5;0m~[38;5;4m[48;5;0m~~~[38;5;7m[48;5;0msame tbh [38;5;4m[48;5;0m~~[38;5;12m[48;5;0m~[38;5;4m[48;5;0m~~~[38;5;12m[48;5;0m~[38;5;4m[48;5;0m~~~~~~~~~[38;5;7m[48;5;0m [38;5;12m[48;5;0m~[38;5;5m[48;5;0m|[38;5;7m[48;5;0m [38;5;5m[48;5;0my[38;5;7m[48;5;0m [38;5;5m[48;5;0m|[38;5;12m[48;5;0m~[38;5;4m[48;5;0m~~[38;5;3m[48;5;0m│[38;5;7m[48;5;0m @tilde.town[9C[38;5;4m[48;5;0m~~[10;1H~~~~~~~~~~[38;5;12m[48;5;0m~[38;5;4m[48;5;0m~~~~~~~~~~~~[38;5;12m[48;5;0m~[38;5;4m[48;5;0m~~~[38;5;7m[48;5;0m I iiiiikhjk been [38;5;4m[48;5;0m~[38;5;5m[48;5;0m|[38;5;7m[48;5;0m [38;5;5m[48;5;0my[38;5;7m[48;5;0m [38;5;5m[48;5;0m|[38;5;4m[48;5;0m~[38;5;12m[48;5;0m~[38;5;4m[48;5;0m~[38;5;3m[48;5;0m│[38;5;7m[48;5;0m - [38;5;13m[48;5;3mselfsame[38;5;7m[48;5;0m(~town) [38;5;3m[48;5;0m│[38;5;12m[48;5;0m~[38;5;4m[48;5;0m~[11;1H[38;5;12m[48;5;0m~[38;5;4m[48;5;0m~~~~~~[38;5;12m[48;5;0m~[38;5;4m[48;5;0m~~~~[38;5;12m[48;5;0m~[38;5;4m[48;5;0m~~~~~~[38;5;12m[48;5;0m~[38;5;4m[48;5;0m~~~~~~~~~~[38;5;7m[48;5;0m moving around [38;5;4m[48;5;0m~[38;5;5m[48;5;0m|[38;5;7m[48;5;0m [38;5;5m[48;5;0my[38;5;7m[48;5;0m [38;5;5m[48;5;0m|[38;5;4m[48;5;0m~~[38;5;12m[48;5;0m~[38;5;3m[48;5;0m│[38;5;7m[48;5;0m - [38;5;6m[48;5;0mZhorken[38;5;7m[48;5;0m@awoo.space [38;5;3m[48;5;0m│[38;5;4m[48;5;0m~~[12;1H~[38;5;12m[48;5;0m~[38;5;4m[48;5;0m~~~~~~[38;5;7m[48;5;0m I am bad at VIM [38;5;4m[48;5;0m~[38;5;12m[48;5;0m~[38;5;4m[48;5;0m~~~~[38;5;7m[48;5;0m I didnt know [38;5;4m[48;5;0m~[38;5;5m[48;5;0m|[38;5;7m[48;5;0m [38;5;5m[48;5;0my[38;5;7m[48;5;0m [38;5;5m[48;5;0m|[38;5;4m[48;5;0m~[38;5;12m[48;5;0m~[38;5;4m[48;5;0m~[38;5;3m[48;5;0m│[38;5;7m[48;5;0m - [38;5;1m[48;5;0mnoiob[38;5;2m[48;5;0m@[38;5;3m[48;5;0mawoo[38;5;4m[48;5;0m.[38;5;5m[48;5;0mspace[38;5;7m[48;5;0m [38;5;3m[48;5;0m│[38;5;4m[48;5;0m~[38;5;12m[48;5;0m~[13;1H[38;5;4m[48;5;0m~~~~~~~~~[38;5;12m[48;5;0m~[38;5;4m[48;5;0m~~~~~[38;5;12m[48;5;0m~[38;5;4m[48;5;0m~~~~~~~~~~~~~~~~~[38;5;7m[48;5;0m this is[38;5;4m[48;5;0m~[38;5;7m[48;5;0mvim[38;5;12m[48;5;0m~[38;5;5m[48;5;0m|[38;5;7m[48;5;0m [38;5;5m[48;5;0my[38;5;7m[48;5;0m [38;5;5m[48;5;0m|[38;5;12m[48;5;0m~[38;5;4m[48;5;0m~~[38;5;3m[48;5;0m│[38;5;7m[48;5;0m -[38;5;2m[48;5;0m [38;5;4m[48;5;2m [38;5;2m[48;5;0m [38;5;3m[48;5;2m [38;5;7m[48;5;0m [6C[38;5;4m[48;5;0m~~[14;1H~~[38;5;12m[48;5;0m~[38;5;4m[48;5;0m~~~~~~~~~~~~~~~~~[38;5;12m[48;5;0m~[38;5;4m[48;5;0m~~~~[38;5;12m[48;5;0m~[38;5;4m[48;5;0m~~~~[38;5;12m[48;5;0m~[38;5;4m[48;5;0m~~~~~~[38;5;7m[48;5;3mit's vim[38;5;4m[48;5;0m~[38;5;5m[48;5;0m|[38;5;7m[48;5;0m [38;5;5m[48;5;0my[38;5;7m[48;5;0m [38;5;5m[48;5;0m|[38;5;4m[48;5;0m~[38;5;12m[48;5;0m~[38;5;4m[48;5;0m~[38;5;3m[48;5;0m│[38;5;7m[48;5;0m - aeon[16C[38;5;12m[48;5;0m~[38;5;4m[48;5;0m~[15;1H~~~[38;5;12m[48;5;0m~[38;5;4m[48;5;0m~~[38;5;12m[48;5;0m~~[38;5;7m[48;5;0mvim is [38;5;2m[48;5;0m bad[38;5;7m[48;5;0m hello lynn[38;5;4m[48;5;0m~~~~~~~~~[38;5;7m[48;5;0m [38;5;4m[48;5;0m~~~~[38;5;12m[48;5;0m~[38;5;4m[48;5;0m~[38;5;5m[48;5;0m|[38;5;7m[48;5;0m [38;5;5m[48;5;0my[38;5;7m[48;5;0m [38;5;5m[48;5;0m|[38;5;4m[48;5;0m~~[38;5;12m[48;5;0m~[38;5;3m[48;5;0m│[38;5;7m[48;5;0m [38;5;2m[48;5;0m- unascribed[38;5;7m[48;5;0m [38;5;3m[48;5;0m│[38;5;4m[48;5;0m~~[16;1H~~~~~~~~[38;5;7m[48;5;0m(lovely application, this)[38;5;4m[48;5;0m~~~~~~~~~~~~[38;5;5m[48;5;0m|[38;5;7m[48;5;0m [38;5;5m[48;5;0my[38;5;7m[48;5;0m [38;5;5m[48;5;0m|[38;5;4m[48;5;0m~[38;5;12m[48;5;0m~[38;5;4m[48;5;0m~[38;5;3m[48;5;0m│[38;5;7m[48;5;0m [38;5;12m[48;5;0m~ nee (hidamari.blue)[38;5;3m[48;5;0m│[38;5;4m[48;5;0m~[38;5;12m[48;5;0m~[17;1H~[38;5;4m[48;5;0m~~~~~[38;5;12m[48;5;0m~[38;5;4m[48;5;0m~~~~~~~~~~~[38;5;12m[48;5;0m~[38;5;4m[48;5;0m~~~~~~~~~~~~~~~~~[38;5;12m[48;5;0m~[38;5;4m[48;5;0m~~~~~~~~~[38;5;5m[48;5;0m|[38;5;7m[48;5;0m [38;5;5m[48;5;0my[38;5;7m[48;5;0m [38;5;5m[48;5;0m|[38;5;12m[48;5;0m~[38;5;4m[48;5;0m~~[38;5;3m[48;5;0m│[38;5;7m[48;5;0m ~ curiouser [38;5;3m[48;5;0m│[38;5;4m[48;5;0m~~[18;1H~~~~~~[38;5;7m[48;5;0mthis is as much nethack[38;5;5m[48;5;3m [38;5;4m[48;5;0m~~[38;5;5m[48;5;0m|[38;5;7m[48;5;0m [38;5;5m[48;5;0my[38;5;7m[48;5;0m [38;5;5m[48;5;0m|[38;5;4m[48;5;0m~[38;5;12m[48;5;0m~[38;5;4m[48;5;0m~[38;5;3m[48;5;0m│[38;5;7m[48;5;0m - clouded[38;5;8m[48;5;0m [11C[38;5;12m[48;5;0m~[38;5;4m[48;5;0m~[19;1H~[38;5;12m[48;5;0m~[38;5;4m[48;5;0m~~~~[38;5;7m[48;5;0mas it is vim [38;5;4m[48;5;0m~[38;5;12m[48;5;0m~[38;5;4m[48;5;0m~~~~~~~[38;5;5m[48;5;3m [38;5;0m[48;5;2msry i cnt drw[38;5;5m[48;5;3m [38;5;4m[48;5;0m~~[38;5;5m[48;5;0m|[38;5;7m[48;5;0m [38;5;5m[48;5;0my[38;5;7m[48;5;0m [38;5;5m[48;5;0m|[38;5;4m[48;5;0m~~[38;5;12m[48;5;0m~[38;5;3m[48;5;0m│[38;5;7m[48;5;0m - flacs (@f1ac5) [38;5;3m[48;5;0m│[38;5;4m[48;5;0m~~[20;1H~~~~[38;5;12m[48;5;0m~[38;5;4m[48;5;0m~~~~~[38;5;12m[48;5;0m~[38;5;4m[48;5;0m~~~~~~[38;5;7m[48;5;0m [38;5;4m[48;5;0m~~~~~~~[38;5;5m[48;5;3m [38;5;4m[48;5;0m~~[38;5;5m[48;5;0m|[38;5;7m[48;5;0m [38;5;5m[48;5;0my[38;5;7m[48;5;0m [38;5;5m[48;5;0m|[38;5;4m[48;5;0m~[38;5;12m[48;5;0m~[38;5;4m[48;5;0m~[38;5;3m[48;5;0m│[38;5;7m[48;5;0m [38;5;4m[48;5;0m- xenonnsmb (~town) [38;5;3m[48;5;0m│[38;5;4m[48;5;0m~[38;5;12m[48;5;0m~[21;1H[38;5;4m[48;5;0m~~~~~~~~~~~~~~~~~~[38;5;7m[48;5;0memacs keys pls[38;5;4m[48;5;0m~[38;5;7m[48;5;0m+[38;5;2m[48;5;0m2[38;5;4m[48;5;0m~~~~~~~~~~~[38;5;5m[48;5;0m|[38;5;7m[48;5;0m [38;5;5m[48;5;0my[38;5;7m[48;5;0m [38;5;5m[48;5;0m|[38;5;12m[48;5;0m~[38;5;4m[48;5;0m~~[38;5;3m[48;5;0m│[38;5;7m[48;5;0m - Jakob [38;5;3m[48;5;0m [38;5;7m[48;5;0m [38;5;3m[48;5;0m [38;5;2m[48;5;0m [38;5;1m[48;5;0m [38;5;7m[48;5;0m [38;5;3m[48;5;0m│[38;5;4m[48;5;0m~~[22;1H~~~[38;5;12m[48;5;0m~[38;5;4m[48;5;0m~~~~[38;5;12m[48;5;0m~[38;5;4m[48;5;0m~~~~~[38;5;12m[48;5;0m~[38;5;4m[48;5;0m~~~~~~~~~~~~~~[38;5;12m[48;5;0m~[38;5;4m[48;5;0m~~~~~~~~~~[38;5;12m[48;5;0m~[38;5;4m[48;5;0m~~~~~[38;5;5m[48;5;0m|[38;5;7m[48;5;0m [38;5;5m[48;5;0my[38;5;7m[48;5;0m [38;5;5m[48;5;0m|[38;5;4m[48;5;0m~[38;5;12m[48;5;0m~[38;5;4m[48;5;0m~[38;5;3m[48;5;0m│[38;5;7m[48;5;0m - [38;5;13m[48;5;0mrose! [38;5;7m[48;5;0m [38;5;3m[48;5;0m│[38;5;12m[48;5;0m~[38;5;4m[48;5;0m~[23;1H[38;5;12m[48;5;0m~[38;5;4m[48;5;0m~~~~~[38;5;7m[48;5;0moh no its vim[38;5;4m[48;5;0m~~~[38;5;12m[48;5;0m~[38;5;4m[48;5;0m~~~~~~[38;5;5m[48;5;3mwhoops[38;5;4m[48;5;0m~~~~~~~~~~[38;5;12m[48;5;0m~[38;5;5m[48;5;0m|[38;5;7m[48;5;0m [38;5;5m[48;5;0my[38;5;7m[48;5;0m [38;5;5m[48;5;0m|[38;5;4m[48;5;0m~~[38;5;12m[48;5;0m~[38;5;3m[48;5;0m│ [38;5;13m[48;5;0m(@mahoushoujorose)[38;5;3m[48;5;0m │[38;5;4m[48;5;0m~~[24;1H~~~~~~[38;5;7m[48;5;0mhelp im trapped in a vim factory[38;5;4m[48;5;0m~~~~~~~~[38;5;5m[48;5;0m|[38;5;7m[48;5;0m [38;5;5m[48;5;0my |[38;5;4m[48;5;0m~[38;5;12m[48;5;0m~[38;5;4m[48;5;0m~[38;5;3m[48;5;0m│[38;5;7m[48;5;0m - [38;5;5m[48;5;0mjess (@dogs ~town)[m[39;49m[38;5;0m[48;5;0m [38;5;3m[48;5;0m│[38;5;4m[48;5;0m~[38;5;12m[48;5;0m~[25;1H[38;5;4m[48;5;0m~~~~~~[38;5;12m[48;5;0m~[38;5;4m[48;5;0m~~~~~~~~~~~[38;5;12m[48;5;0m~[38;5;4m[48;5;0m~~~~~~~~~~~[38;5;12m[48;5;0m~[38;5;4m[48;5;0m~~~~~~~[38;5;7m[48;5;0mI messed[38;5;5m[48;5;0m| y[38;5;7m[48;5;0mq[38;5;5m[48;5;0m|[38;5;12m[48;5;0m~[38;5;4m[48;5;0m~~[38;5;3m[48;5;0m│[38;5;7m[48;5;0m -[38;5;5m[48;5;0m [38;5;13m[48;5;0mrachel (@arjache)[38;5;7m[48;5;0m [38;5;3m[48;5;0m│[38;5;4m[48;5;0m~~[4h~[4l[1;41H[m[39;49m[38;5;0m[48;5;0m - - - - - - - - - - - - - - - - - - - - - - - -[1;41H [38;5;6m[48;5;6m^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^ ^^^[38;5;7m[48;5;0m [38;5;5m[48;5;0m|[38;5;7m[48;5;0m [38;5;5m[48;5;0my[38;5;7m[48;5;0m [38;5;5m[48;5;0m|[38;5;7m[48;5;0m [38;5;3m[48;5;0m│[38;5;2m[48;5;0m - Falkreon[38;5;7m[48;5;0m [11C3 - Roses are [38;5;9m[48;5;0mred[38;5;7m[48;5;0m. [38;5;6m[48;5;6m^[38;5;7m[48;5;0m [38;5;5m[48;5;0m|[38;5;7m[48;5;0m [38;5;5m[48;5;0my[38;5;7m[48;5;0m [38;5;5m[48;5;0m|[38;5;7m[48;5;0m [38;5;3m[48;5;0m│[38;5;7m[48;5;0m [38;5;7m[48;5;6m- mitosis@manhater.io[38;5;3m[48;5;0m│[K -[38;5;7m[48;5;0m Violets are [38;5;12m[48;5;0mblue[38;5;7m[48;5;0m. [38;5;6m[48;5;6m^[38;5;7m[48;5;0m [38;5;5m[48;5;0m|[38;5;7m[48;5;0m [38;5;5m[48;5;0my[38;5;7m[48;5;0m [38;5;5m[48;5;0m|[38;5;7m[48;5;0m [38;5;3m[48;5;0m│[38;5;7m[48;5;0m [38;5;5m[48;5;0m- yrgfm[38;5;7m[48;5;0m [38;5;3m[48;5;0m [38;5;7m[48;5;0m [11C[K -Some people don't think [38;5;6m[48;5;6m^[38;5;7m[48;5;0m [38;5;5m[48;5;0m|[38;5;7m[48;5;0m [38;5;5m[48;5;0my |[38;5;7m[48;5;0m [38;5;3m[48;5;0m│[38;5;7m[48;5;0m [38;5;6m[48;5;0m- felix[38;5;7m[48;5;0m [38;5;3m[48;5;0m [12C[38;5;7m[48;5;0m[K - ascii.town be like it is. [38;5;7m[48;5;6m [38;5;7m[48;5;0m [38;5;5m[48;5;0m| y[38;5;7m[48;5;0m [38;5;5m[48;5;0m|[38;5;7m[48;5;0m [38;5;3m[48;5;0m│[38;5;7m[48;5;0m - ndiesslin [6C[K - But it [38;5;13m[48;5;0mdo[38;5;7m[48;5;0m! [38;5;6m[48;5;6m^[38;5;7m[48;5;0m [38;5;5m[48;5;0m|[38;5;7m[48;5;0m [38;5;5m[48;5;0my[38;5;7m[48;5;0m [38;5;5m[48;5;0m|[38;5;7m[48;5;0m [38;5;3m[48;5;0m│ [38;5;7m[48;5;0m- matth [38;5;3m[48;5;0m [38;5;7m[48;5;0m [2C[K - [38;5;6m[48;5;6m^[38;5;7m[48;5;0m [38;5;5m[48;5;0m|[38;5;7m[48;5;0m [38;5;5m[48;5;0my[38;5;7m[48;5;0m [38;5;5m[48;5;0m|[38;5;7m[48;5;0m [38;5;3m[48;5;0m│ [38;5;1m[48;5;0m- timi[38;5;3m[48;5;0m [38;5;7m[48;5;0m [8C[K - .-. .-. .-. .-. .-..-. .----. .-. .-. [38;5;6m[48;5;6m^[38;5;7m[48;5;0m [38;5;5m[48;5;0m|[38;5;7m[48;5;0m [38;5;5m[48;5;0my[38;5;7m[48;5;0m [38;5;5m[48;5;0m|[38;5;3m[48;5;0m │ [38;5;2m[48;5;0m- @andwhatnot2[38;5;3m[48;5;0m [7C[38;5;7m[48;5;0m[K - } \/ { \ \/ / | ' / } |__} \ \ / [38;5;6m[48;5;6m^[38;5;7m[48;5;0m [38;5;5m[48;5;0m|[38;5;7m[48;5;0m [38;5;5m[48;5;0my[38;5;7m[48;5;0m [38;5;5m[48;5;0m|[38;5;3m[48;5;0m │ [38;5;7m[48;5;0m- Spocky [9C[K - | { } | `-\ } | . \ } '__} `- } [38;5;7m[48;5;6m [38;5;7m[48;5;0m [38;5;5m[48;5;0m|[38;5;7m[48;5;0m [38;5;5m[48;5;0my[38;5;7m[48;5;0m [38;5;5m[48;5;0m|[38;5;3m[48;5;0m │ [38;5;2m[48;5;0m-[38;5;3m[48;5;0m [38;5;2m[48;5;0mKid Iccurus[38;5;3m[48;5;0m [38;5;7m[48;5;0m [5C[K - `-' `-' `-' `-'`-` `----' -' [38;5;7m[48;5;6m [38;5;7m[48;5;0m [38;5;5m[48;5;0m|[38;5;7m[48;5;0m [38;5;5m[48;5;0my[38;5;7m[48;5;0m [38;5;5m[48;5;0m|[38;5;3m[48;5;0m │ [38;5;7m[48;5;0m- tom@slime.global :3[C[K - [38;5;7m[48;5;6m [38;5;7m[48;5;0m [38;5;5m[48;5;0m|[38;5;7m[48;5;0m [38;5;5m[48;5;0my[38;5;7m[48;5;0m [38;5;5m[48;5;0m|[38;5;7m[48;5;0m [38;5;3m[48;5;0m [38;5;7m[48;5;0m [38;5;3m[48;5;0m│[38;5;7m[48;5;0m [38;5;4m[48;5;1m-[38;5;7m[48;5;0m [38;5;0m[48;5;1m [38;5;7m[48;5;0m [38;5;3m[48;5;0m [38;5;7m[48;5;0m [38;5;3m[48;5;0m│[38;5;7m[48;5;0m [38;5;3m[48;5;0m[K -[38;5;7m[48;5;6m [38;5;6m[48;5;6m [38;5;7m[48;5;6m [38;5;7m[48;5;0m [38;5;5m[48;5;0m|[38;5;7m[48;5;0m [38;5;5m[48;5;0my[38;5;7m[48;5;0m [38;5;5m[48;5;0m|[38;5;7m[48;5;0m [38;5;3m[48;5;0m│[38;5;0m[48;5;1m lr[38;5;7m[48;5;0m [38;5;3m[48;5;0m [8C[38;5;7m[48;5;0m [38;5;3m[48;5;0m[K -[38;5;7m[48;5;0m [38;5;5m[48;5;0m|[38;5;7m[48;5;0m [38;5;5m[48;5;0my[38;5;7m[48;5;0m [38;5;5m[48;5;0m|[38;5;7m[48;5;0m [38;5;3m[48;5;0m│[38;5;7m[48;5;0m - fennecs (helo)[6C[K - [m[39;49m[38;5;0m[48;5;0m [38;5;7m[48;5;0m this poem sd [38;5;4m[48;5;0m [38;5;7m[48;5;0m [38;5;5m[48;5;0m|[38;5;7m[48;5;0m [38;5;5m[48;5;0my[38;5;7m[48;5;0m [38;5;5m[48;5;0m|[38;5;7m[48;5;0m [38;5;3m[48;5;0m│ [38;5;7m[48;5;0m- @amsomniac (mastod[2C[K - [m[39;49m[38;5;0m[48;5;0m [38;5;7m[48;5;0m is factually [38;5;5m[48;5;0m|[38;5;7m[48;5;0m [38;5;5m[48;5;0my[38;5;7m[48;5;0m [38;5;5m[48;5;0m|[38;5;7m[48;5;0m [38;5;3m[48;5;0m│ [38;5;7m[48;5;0m on) [C[K - incorrect[38;5;8m[48;5;0m, but[38;5;15m[48;5;0m [38;5;7m[48;5;0m [38;5;2m[48;5;0m [38;5;7m[48;5;0m [38;5;5m[48;5;0m|[38;5;7m[48;5;0m [38;5;5m[48;5;0my |[38;5;7m[48;5;0m [38;5;3m[48;5;0m│ [38;5;7m[48;5;0m- maxj [11C[K - [38;5;8m[48;5;0mat least it rhymes[38;5;15m[48;5;0m [38;5;7m[48;5;0m [38;5;5m[48;5;0m| y |[38;5;7m[48;5;0m [38;5;3m[48;5;0m│[38;5;7m[48;5;1m [38;5;7m[48;5;0m AdamThePhantump was[C[K - [38;5;2m[48;5;0m [38;5;7m[48;5;0mi love this place [38;5;2m[48;5;0m [38;5;5m[48;5;0m | y[38;5;7m[48;5;0m [38;5;5m[48;5;0m| [38;5;3m[48;5;0m│ [38;5;7m[48;5;0mhere. Boo! :)[38;5;3m[48;5;0m [38;5;7m[48;5;0m [38;5;3m[48;5;0m└┐[38;5;7m[48;5;0m[K - [38;5;5m[48;5;0m|[38;5;7m[48;5;0m [38;5;5m[48;5;0my[38;5;7m[48;5;0m [38;5;5m[48;5;0m|[38;5;7m[48;5;0m [38;5;3m[48;5;0m│ [38;5;7m[48;5;0mTsuki "Hello guys !"[38;5;3m[48;5;0m│[38;5;7m[48;5;0m[K - now I can't sleep [38;5;5m[48;5;0m|[38;5;7m[48;5;0m [38;5;5m[48;5;0my |[38;5;7m[48;5;0m [38;5;3m[48;5;0m│ [38;5;7m[48;5;0m- @dejawu_ [38;5;3m[48;5;0m┌┘[38;5;7m[48;5;0m[K - [38;5;5m[48;5;0m| y[38;5;7m[48;5;0m [38;5;5m[48;5;0m|[38;5;7m[48;5;0m [38;5;3m[48;5;0m│ [38;5;7m[48;5;0m- @eal [14C[K - zzzz [38;5;5m[48;5;0m|[38;5;7m[48;5;0m [38;5;5m[48;5;0my[38;5;7m[48;5;0m [38;5;5m[48;5;0m|[38;5;7m[48;5;0m [38;5;3m[48;5;0m│ [38;5;7m[48;5;2m@social.sakamoto.gq[C[38;5;7m[48;5;0m[K -[38;5;1m[48;5;0m [38;5;7m[48;5;0m [38;5;5m[48;5;0m|[38;5;7m[48;5;0m [38;5;5m[48;5;0my[38;5;7m[48;5;0m [38;5;5m[48;5;0m|[38;5;7m[48;5;0m [38;5;3m[48;5;0m│ [38;5;7m[48;5;0m- frenata [C[K -[38;5;11m[48;5;0mwe are addicts. we need an intervention [38;5;7m[48;5;0m [38;5;5m[48;5;0m|[38;5;7m[48;5;0m [38;5;5m[48;5;0my[38;5;7m[48;5;0mq[38;5;5m[48;5;0m|[38;5;7m[48;5;0m [38;5;3m[48;5;0m│ [38;5;7m[48;5;0m- banjo [3C[K[1;41H[m[39;49m[38;5;0m[48;5;0m - - - - - - - - - - - - - - - - - - - - - - - -[1;41H [38;5;7m[48;5;0mWhat is this big fucking line of 'y'? [1;56H [38;5;1m[48;5;0m-Ethan[38;5;12m[48;5;0m [38;5;7m[48;5;0m [12C4 - [38;5;13m[48;5;0mWhat is this big fucking line of 'y', you [2;57H[38;5;3m[48;5;0m- [38;5;2m[48;5;0mProfpatsch[38;5;7m[48;5;0m [38;5;3m[48;5;0m└──────┐[38;5;7m[48;5;0m[K - [38;5;13m[48;5;0mmay ask yourself? It's the torus ouroboros,[3;59H[38;5;5m[48;5;0mviv@cybre.space -[38;5;7m[48;5;0m [38;5;13m[48;5;0mayying its own lmao. [38;5;9m[48;5;0m [38;5;7m[48;5;0m [38;5;13m[48;5;0m [38;5;7m[48;5;0m [38;5;5m[48;5;0m|[38;5;7m[48;5;0m [38;5;5m[48;5;0my[38;5;7m[48;5;0m [6C- dom96 ;)[5;18H [38;5;5m[48;5;0m|[38;5;7m[48;5;0m [5;59Hcloin[38;5;3m[48;5;0m [38;5;7m[48;5;0m [6;15H [6;44H [6;56H [38;5;5m[48;5;0m- dbucklin[38;5;7m[48;5;0m [11C[38;5;2m[48;5;0m[K[7;10Hi went all the way around the[38;5;7m[48;5;0m [7;56H[38;5;4m[48;5;0m - hiljusti[38;5;7m[48;5;0m - [38;5;7m[48;5;3m [38;5;2m[48;5;0mros[38;5;7m[48;5;0m [7C [38;5;3m[48;5;0m│[38;5;7m[48;5;0m [38;5;1m[48;5;0m- @ercts_mxms [38;5;7m[48;5;0m - [38;5;2m[48;5;0m leave some notes on the[38;5;7m[48;5;0m [7C [38;5;3m[48;5;0m│[38;5;7m[48;5;0m -f@r4ch0 - [38;5;2m[48;5;0mway for your fellow travellersr[38;5;7m[48;5;0m [7C [38;5;3m[48;5;0m│[38;5;7m[48;5;0m ffffff[38;5;3m[48;5;0m -[C[38;5;7m[48;5;0m [38;5;2m[48;5;0m~chr[38;5;7m[48;5;0m [7C [38;5;3m[48;5;0m│[38;5;7m[48;5;0m -Harper -[73D[38;5;8m[48;5;0m [38;5;9m[48;5;0mthis is pretty sweet [12;44H[38;5;7m[48;5;0m [12;53H [38;5;3m[48;5;0m│[38;5;7m[48;5;0m -@discordalert[8C[K - [38;5;9m[48;5;0m -meena[38;5;7m[48;5;0m [38;5;5m[48;5;0m|[38;5;7m[48;5;0m [38;5;5m[48;5;0my |[38;5;7m[48;5;0m [38;5;3m[48;5;0m│[38;5;7m[48;5;0m - [38;5;2m[48;5;0mvon [7C[38;5;7m[48;5;0m [8C[K[14;52H[38;5;5m[48;5;0m [6C[38;5;7m[48;5;0mShadowRZ [15;11Hworld wide web! [15;44H [15;56H (@ShadowRZ@mastodon[16;13Hinternet [16;56H [11C.xyz - [38;5;2m[48;5;0mYour journey begins now. [38;5;7m[48;5;0m [17;50H [38;5;5m[48;5;0m|[38;5;7m[48;5;0m [38;5;3m[48;5;0m│[38;5;7m[48;5;0m - [38;5;8m[48;5;0mQB[38;5;6m[48;5;0mFr[38;5;15m[48;5;0meak -[38;5;2m[48;5;0m [38;5;7m[48;5;0m [18;48H [38;5;5m[48;5;0my[38;5;7m[48;5;0m [38;5;5m[48;5;0m|[38;5;7m[48;5;0m [38;5;3m[48;5;0m│[38;5;7m[48;5;0m - [38;5;6m[48;5;0m@scanlime[38;5;7m[48;5;0m +Tuco [38;5;1m[48;5;0m<3[19;15H[38;5;7m[48;5;0mwow this is very exciting [38;5;5m[48;5;0m|[38;5;7m[48;5;0m [38;5;5m[48;5;0my[38;5;7m[48;5;0m [38;5;5m[48;5;0m|[38;5;7m[48;5;0m [38;5;3m[48;5;0m│[38;5;7m[48;5;0m [38;5;6m[48;5;0m@diode.zone[38;5;7m[48;5;0m [38;5;3m[48;5;0m│[38;5;7m[48;5;0m[K[20;29H-b0rk[20;56H [38;5;10m[48;5;0m- zer00[38;5;7m[48;5;0m [38;5;3m[48;5;0m│[38;5;7m[48;5;0m[K[21;14H O [21;50H [38;5;5m[48;5;0m|[38;5;7m[48;5;0m [38;5;3m[48;5;0m│[38;5;7m[48;5;0m [38;5;5m[48;5;0m- kokakoda[11C[38;5;3m[48;5;0m│[38;5;7m[48;5;0m[K - ifdfd[22;21H\|/[22;37H[38;5;9m[48;5;0m([38;5;15m[48;5;0m![38;5;9m[48;5;0m)[22;48H[38;5;7m[48;5;0m [7C[38;5;2m[48;5;0m - m3tax -[70D[38;5;7m[48;5;0mo_O[23;22H|[7C [38;5;9m[48;5;0m([38;5;15m[48;5;0m!!!!![38;5;9m[48;5;0m)[23;56H[38;5;7m[48;5;0m ~~~zgebiit~~~ - [24;21H/ \[24;32H[38;5;12m[48;5;0mhey b0rk!![24;56H[38;5;7m[48;5;0m - gauntlet - a - lastrik[K[1;41H[m[39;49m[38;5;0m[48;5;0m - - - - - - - - - - - - - - - - - - - - - - - -[1;41H [38;5;7m[48;5;0m [1;57H- CX [14C5 -[38;5;6m[48;5;0m [38;5;4m[48;5;0m######################################[38;5;7m[48;5;0m [2;57H- tomjschwanke [7C[38;5;3m[48;5;0m[K -[C[38;5;4m[48;5;0m# [38;5;7m[48;5;0m [38;5;4m[48;5;0m#[38;5;7m[48;5;0m [3;57H- @aliasless -[38;5;4m[48;5;0m #[38;5;7m[48;5;0m [38;5;4m[48;5;0mMastodon #[38;5;7m[48;5;0m [4;57H @awoo.wolfgirl. - [38;5;4m[48;5;0m#[5;12H[38;5;6m[48;5;0m [5;39H[38;5;4m[48;5;0m#[5;57H[38;5;7m[48;5;0m engineering - [38;5;4m[48;5;0m# Giving social networks back to you[38;5;6m[48;5;0m [38;5;4m[48;5;0m#[38;5;6m[48;5;0m [6;57H[38;5;7m[48;5;0m- cosine [12C[K - [38;5;4m[48;5;0m# Free, decentralized microblogging #[38;5;6m[48;5;0m [7;56H[38;5;7m[48;5;0m [38;5;0m[48;5;1m- stevenleeg -[C[38;5;4m[48;5;0m#[8;17H[38;5;7m[48;5;0m [8;39H[38;5;4m[48;5;0m#[8;57H[38;5;7m[48;5;0m- steampunc - [38;5;4m[48;5;0m# https://joinmastodon.org #[9;57H[38;5;2m[48;5;0m- @blinry -[C[38;5;4m[48;5;0m######################################[38;5;7m[48;5;0m [10;57H- ben@tilde.team [11;35H [11;56H[38;5;1m[48;5;0m [38;5;7m[48;5;0m- Alpatron#6158 -[67D [38;5;4m[48;5;0m [38;5;5m[48;5;0m####################################[12;58H[38;5;7m[48;5;0m Calamitous -[63D[38;5;5m[48;5;0m# [13;43H#[6C[38;5;7m[48;5;0m [6C [38;5;1m[48;5;0m [38;5;7m[48;5;0m -[55D[38;5;5m[48;5;0m#[14;19HWitches Town[14;43H#[14;52H[38;5;7m[48;5;0m [38;5;3m[48;5;0m│[38;5;7m[48;5;0m [38;5;1m[48;5;0m [38;5;7m[48;5;0m [38;5;3m[48;5;0m -[59D[38;5;5m[48;5;0m# #[15;59H[38;5;1m[48;5;0m [38;5;7m[48;5;0m -[70D[38;5;5m[48;5;0m# Mastodon insta[38;5;7m[48;5;0mn[38;5;5m[48;5;0mce for [38;5;7m[48;5;0m [38;5;5m[48;5;0m# [16;59H[38;5;1m[48;5;0m [14C[38;5;7m[48;5;0m - [38;5;5m[48;5;0m#[38;5;7m[48;5;0m [38;5;5m[48;5;0mqueer[38;5;2m[48;5;0m [38;5;5m[48;5;0m feminist[6Canarchists #[17;57H[38;5;7m[48;5;0m - [38;5;5m[48;5;0m# [38;5;7m[48;5;0m [18;43H[38;5;5m[48;5;0m#[18;57H[38;5;7m[48;5;0m -[70D[38;5;5m[48;5;0m# https://witches.town # [19;59H[38;5;7m[48;5;0m -[62D[38;5;5m[48;5;0m####################################[20;57H[38;5;7m[48;5;0m -<<<more advertising goes over there<<<[21;57H - [38;5;3m[48;5;7m ,-._.~~~^-v^v^v**=>[38;5;7m[48;5;0m [22;37H [22;56H - [38;5;3m[48;5;7m/[38;5;4m[48;5;7mlife is better on[38;5;3m[48;5;7m/ [7C[38;5;9m[48;5;0m<3[38;5;7m[48;5;0m [23;60H - [38;5;3m[48;5;7m*[38;5;4m[48;5;7m/a.weirder.earth/[38;5;3m[48;5;7m* [38;5;7m[48;5;0m [24;32H [24;57H - [38;5;3m[48;5;7m \______________/* [38;5;7m[48;5;0m love you[25;47H[38;5;5m[48;5;0m|[38;5;7m[48;5;0m [38;5;5m[48;5;0my[38;5;7m[48;5;0mq[38;5;5m[48;5;0m|[38;5;7m[48;5;0m [38;5;3m[48;5;0m│[38;5;7m[48;5;0m [12C[38;5;3m[48;5;0m│[1;41H[m[39;49m[38;5;0m[48;5;0m - - - - - - - - - - - - - - - - - - - - - - - -[1;41H[1;57H[38;5;7m[48;5;0m [18C6 - [38;5;9m[48;5;0msomeone.. feel free to reuse this space.[2;57H[38;5;7m[48;5;0m [38;5;3m[48;5;0m└[7C[38;5;7m[48;5;0m[K - [38;5;9m[48;5;0mit's uh... i wouldn't feel bad about [3;57H[38;5;7m[48;5;0m - [38;5;9m[48;5;0merasing[38;5;1m[48;5;0m [38;5;9m[48;5;0mwhatever this is [38;5;7m[48;5;0m [4;60H - [5;12H[38;5;2m[48;5;0m [38;5;7m[48;5;0m [38;5;11m[48;5;0m [5;39H[38;5;7m[48;5;0m [5;61H - [38;5;9m[48;5;0m [38;5;7m[48;5;0m [38;5;15m[48;5;0m [38;5;8m[48;5;0mTidied. The ASCII Janitor.[38;5;15m[48;5;0m [38;5;7m[48;5;0m [6;57H - [38;5;6m[48;5;0m [38;5;7m[48;5;0m [38;5;11m[48;5;0m [38;5;7m[48;5;0m [7;57H - [8;15H[38;5;6m[48;5;0m [38;5;11m[48;5;0m [38;5;6m[48;5;0m [m[39;49m[38;5;0m[48;5;0m [38;5;6m[48;5;0m [8;57H[38;5;7m[48;5;0m - WHATS UP MY GLIB GLOBS?[38;5;11m[48;5;0m [38;5;7m[48;5;0m [9;57H - W U B A L U B A D U B D U B[38;5;11m[48;5;0m [10;57H[38;5;7m[48;5;0m [11;12H*~~~~~~~~~~~~~~~~~~~[38;5;15m[48;5;0m~~~~[38;5;11m[48;5;0m* [11;56H[38;5;7m[48;5;0m -[65D < tilde.town <3s u > [12;57H -[61D *~~~~~~~~~~~~~~~~~~~~~~~*[6C [13;58H [38;5;3m[48;5;0m . -[59D[38;5;7m[48;5;0m [14;19H< shell in today >[6C [14;58H -[59D *[38;5;15m[48;5;0m~~~~~~~~~~~~~~~~*[38;5;7m[48;5;0m [15;59H -[52D [38;5;11m[48;5;0m [38;5;15m[48;5;0m < :3 >[38;5;7m[48;5;0m [16;57H[38;5;3m[48;5;0mi want to avoid -[64D[38;5;7m[48;5;0m *[38;5;15m[48;5;0m~~~~*[38;5;7m[48;5;0m [17;57H[38;5;3m[48;5;0mconfusion for new -[66D[38;5;7m[48;5;0m [18;43H [38;5;3m[48;5;0m│[38;5;7m[48;5;0m [38;5;3m[48;5;0mpeople though[9C[38;5;12m[48;5;0m[K -[71D[38;5;7m[48;5;0m [38;5;1m[48;5;0mthis thing is cool[38;5;7m[48;5;0m [19;57H[38;5;4m[48;5;0mor make the guestbook -[C[38;5;1m[48;5;0mtoo bad i[38;5;7m[48;5;0m [38;5;2m[48;5;0mssss[38;5;7m[48;5;0m [38;5;2m[48;5;0mu[38;5;7m[48;5;0m [38;5;2m[48;5;0mu[38;5;7m[48;5;0m [38;5;2m[48;5;0mk[38;5;7m[48;5;0m [38;5;2m[48;5;0mk[38;5;7m[48;5;0m [20;56H[38;5;4m[48;5;0m go AROUNDWAYS[38;5;7m[48;5;0m [38;5;11m[48;5;0m [38;5;3m[48;5;0m│[38;5;11m[48;5;0m -[38;5;7m[48;5;0m [38;5;2m[48;5;0ms[38;5;7m[48;5;0m [38;5;2m[48;5;0mu[38;5;7m[48;5;0m [38;5;2m[48;5;0mu[38;5;7m[48;5;0m [38;5;2m[48;5;0mkk [38;5;7m[48;5;0m [21;57H[38;5;3m[48;5;0mto be continued... -[72D[38;5;7m[48;5;0m [38;5;2m[48;5;0mssss[38;5;7m[48;5;0m [38;5;2m[48;5;0mu[38;5;7m[48;5;0m [38;5;2m[48;5;0mu[38;5;7m[48;5;0m [38;5;2m[48;5;0mkk [22;51H[38;5;5m[48;5;0m│[38;5;7m[48;5;0m [38;5;3m[48;5;0m│[38;5;7m[48;5;0m [38;5;3m[48;5;0mwe need to move the -[73D[38;5;7m[48;5;0m [38;5;2m[48;5;0ms u[38;5;7m[48;5;0m [38;5;2m[48;5;0mu[38;5;7m[48;5;0m [38;5;2m[48;5;0mk k[38;5;7m[48;5;0m [23;51H[38;5;3m[48;5;0m├───┘[38;5;7m[48;5;0m [38;5;3m[48;5;0mtext below elsewhere[38;5;7m[48;5;0m [38;5;3m[48;5;0m└─┐[24;3H[38;5;7m[48;5;0m [38;5;2m[48;5;0mssss[38;5;7m[48;5;0m [38;5;2m[48;5;0muuuu[38;5;7m[48;5;0m [38;5;2m[48;5;0mk[38;5;7m[48;5;0m [38;5;2m[48;5;0m k[38;5;7m[48;5;0m [38;5;1m[48;5;0mat ascii art[24;51H[38;5;5m[48;5;0m│[38;5;7m[48;5;0m (Snek petting dude moved to[38;5;3m[48;5;0m│[25;3H[38;5;7m[48;5;0m [38;5;1m[48;5;0m-xenonnsmb, from ~town[25;54H[38;5;7m[48;5;0m000,009.)[15C [38;5;3m[48;5;0m│[4h[38;5;7m[48;5;0m [4l[1;41H[m[39;49m[38;5;0m[48;5;0m - - - - - - - - - - - - - - - - - - - - - - - -[1;41H[1;24H [1;37H[38;5;3m[48;5;0m [41C[38;5;7m[48;5;0m7 - [m[39;49m[38;5;0m[48;5;0m [38;5;7m[48;5;0m [38;5;3m[48;5;0m [38;5;7m[48;5;0m - [m[39;49m[38;5;0m[48;5;0m [38;5;7m[48;5;0m [38;5;3m[48;5;0m [38;5;7m[48;5;0m [3;57H[38;5;3m[48;5;0mShrine of the church -[75D[38;5;7m[48;5;0m [m[39;49m[38;5;0m[48;5;0m [38;5;7m[48;5;0m [4;37H[38;5;3m[48;5;0m [4;60H [5;10H[38;5;7m[48;5;0mempty lot [m[39;49m[38;5;0m[48;5;0m [38;5;7m[48;5;0m [6C[38;5;3m[48;5;0m [5;61H[38;5;12m[48;5;4mo o o o -[66D[38;5;7m[48;5;0m COME ON DOWN [38;5;3m[48;5;0m [38;5;7m[48;5;0m [6;60H[38;5;12m[48;5;4mo[38;5;12m[48;5;5m [38;5;12m[48;5;4mo[7;15H[38;5;7m[48;5;0mTO ASCII TOWN~~~[6C[38;5;3m[48;5;0m [7;59H[38;5;12m[48;5;4mo[38;5;12m[48;5;5m [38;5;15m[48;5;5m..[38;5;12m[48;5;5m [38;5;12m[48;5;4mo[8;15H[38;5;7m[48;5;0m [m[39;49m[38;5;0m[48;5;0m [38;5;7m[48;5;0m [38;5;3m[48;5;0m [38;5;7m[48;5;0m [8;58H[38;5;12m[48;5;4mo[38;5;15m[48;5;5m |----[38;5;12m[48;5;5m [38;5;12m[48;5;4mo -[65D[38;5;7m[48;5;0m [m[39;49m[38;5;0m[48;5;0m [38;5;7m[48;5;0m [6C[38;5;3m[48;5;0m [9;58H[38;5;12m[48;5;4mo[38;5;15m[48;5;5m ||[38;5;12m[48;5;5m [38;5;15m[48;5;5m [38;5;12m[48;5;4mo -[64D[38;5;7m[48;5;0m uiwiidr [38;5;3m[48;5;0m [38;5;7m[48;5;0m [10;58H[38;5;12m[48;5;4mo[38;5;15m[48;5;5m --- [38;5;12m[48;5;4mo[38;5;7m[48;5;0m [38;5;3m[48;5;0mof[11;12H[38;5;7m[48;5;0m [m[39;49m[38;5;0m[48;5;0m [38;5;7m[48;5;0m [38;5;3m[48;5;0m [38;5;7m[48;5;0m [11;58H[38;5;12m[48;5;4mo[38;5;15m[48;5;5m |. [38;5;12m[48;5;4mo[12;12H[38;5;7m[48;5;0m [m[39;49m[38;5;0m[48;5;0m [38;5;7m[48;5;0m [6C [38;5;3m[48;5;0m [12;58H[38;5;12m[48;5;4mo[38;5;15m[48;5;5m .. [38;5;12m[48;5;4mo[13;12H[38;5;7m[48;5;0m [38;5;6m[48;5;0m [m[39;49m[38;5;0m[48;5;0m [38;5;7m[48;5;0m [m[39;49m[38;5;0m[48;5;0m [38;5;7m[48;5;0m [38;5;3m[48;5;0m [13;58H[38;5;12m[48;5;4mo[38;5;15m[48;5;5m \--- [38;5;12m[48;5;4mo[14;13H[38;5;7m[48;5;0mI walked the [38;5;3m[48;5;0m [14;50H[38;5;5m[48;5;0m [7C[38;5;12m[48;5;4mo[38;5;15m[48;5;5m ,/ [38;5;12m[48;5;4mo[15;16H[38;5;5m[48;5;0mourobouros[38;5;7m[48;5;0m [38;5;3m[48;5;0m [15;48H[38;5;5m[48;5;0m [15;59H[38;5;12m[48;5;4mo[38;5;15m[48;5;5m ' [38;5;12m[48;5;4mo[16;18H[38;5;7m[48;5;0mand all I got was this[16;57H [38;5;12m[48;5;4mo o[38;5;15m[48;5;5m [38;5;12m[48;5;4mo o[38;5;7m[48;5;0m [17;23Hlousy t-shirt [38;5;3m[48;5;0m [17;57H[38;5;7m[48;5;0m [38;5;12m[48;5;4m o [38;5;7m[48;5;0m -[68D_---.___,---_ [m[39;49m[38;5;0m[48;5;0m [18;37H[38;5;3m[48;5;0m [18;47H[38;5;5m[48;5;0m|[38;5;7m[48;5;0m [38;5;5m[48;5;0my[38;5;7m[48;5;0m [38;5;5m[48;5;0m|[38;5;7m[48;5;0m [38;5;12m[48;5;0m┌[38;5;7m[48;5;0m┘[38;5;3m[48;5;0m GNU Emacs [6C[38;5;7m[48;5;0m└[38;5;12m[48;5;0m─┐[19;5H[38;5;7m[48;5;0m/ \ [m[39;49m[38;5;0m[48;5;0m [38;5;7m[48;5;0m [19;37H[38;5;3m[48;5;0m [19;54H[38;5;12m[48;5;0m│[38;5;12m[48;5;5m=========================[38;5;12m[48;5;0m│[20;2H[38;5;7m[48;5;0m /| [38;5;5m[48;5;0m|y|[38;5;7m[48;5;0m |\ [m[39;49m[38;5;0m[48;5;0m [38;5;7m[48;5;0m [20;37H[38;5;3m[48;5;0m [20;54H[38;5;12m[48;5;0m│[38;5;12m[48;5;4m https://gnu.org/s/emacs [38;5;12m[48;5;0m│[21;8H[38;5;7m[48;5;0m| | [m[39;49m[38;5;0m[48;5;0m [38;5;7m[48;5;0m [21;37H[38;5;3m[48;5;0m [21;54H[38;5;12m[48;5;0m│[38;5;12m[48;5;5m=========================[38;5;12m[48;5;0m│[22;8H[38;5;7m[48;5;0m| | <- amazing shirt[22;51H[38;5;5m[48;5;0m|[38;5;7m[48;5;0m [38;5;12m[48;5;0m└[38;5;7m[48;5;0m┐ ┌[38;5;12m[48;5;0m─┘[23;8H[38;5;7m[48;5;0m|_______| would i buy it?[23;51H[38;5;5m[48;5;0m|[38;5;7m[48;5;0m [38;5;3m[48;5;0m│[38;5;7m[48;5;0m [38;5;3m[48;5;0mEmacs faithfuls [38;5;7m[48;5;0m [38;5;6m[48;5;0m| [38;5;7m[48;5;0m [38;5;3m[48;5;0m│[38;5;7m[48;5;0m[K[24;14H [m[39;49m[38;5;0m[48;5;0m [38;5;7m[48;5;0m [38;5;3m[48;5;0m [38;5;7m[48;5;0m [24;51H[38;5;5m[48;5;0m|[38;5;7m[48;5;0m [38;5;3m[48;5;0m│[38;5;7m[48;5;0m [38;5;3m[48;5;0m [38;5;7m[48;5;0m [38;5;6m[48;5;0m\|/[38;5;7m[48;5;0m [38;5;3m[48;5;0m│[38;5;7m[48;5;0m[K[25;16H maybe [38;5;3m[48;5;0m [25;54H[38;5;7m[48;5;0m [38;5;3m[48;5;0m│[38;5;7m[48;5;0m [38;5;3m[48;5;0msign[m[39;49m[38;5;0m[48;5;0mq[38;5;3m[48;5;0mbelow:[6C[38;5;6m[48;5;0mv[38;5;7m[48;5;0m [38;5;3m[48;5;0m│[38;5;7m[48;5;0m[K[1;41H[m[39;49m[38;5;0m[48;5;0m - - - - - - - - - - - - - - - - - - - - - - - -[1;41H[1;24H[38;5;7m[48;5;0m [1;38H[38;5;3m[48;5;0m [1;53H[38;5;7m[48;5;5m [38;5;3m[48;5;0m│[38;5;7m[48;5;0m [38;5;3m[48;5;0m- [X] [38;5;6m[48;5;0mnee [8C[38;5;7m[48;5;0m8 - [38;5;1m[48;5;0mi may prefer vim, but emacs[38;5;7m[48;5;0m [38;5;1m[48;5;0mhas tetris[38;5;3m[48;5;0m [2;53H[38;5;7m[48;5;5m [38;5;3m[48;5;0m│[38;5;7m[48;5;0m [38;5;3m[48;5;0m- [X] [38;5;2m[48;5;0mbyxor[11C[38;5;5m[48;5;5m[K -[C[38;5;1m[48;5;0mwhich is a stellar feature[3;38H[38;5;3m[48;5;0m [3;53H[38;5;7m[48;5;5m [38;5;3m[48;5;0m│[38;5;7m[48;5;0m - [38;5;3m[48;5;0m[X[38;5;7m[48;5;0m [38;5;3m[48;5;0m @amsomniac ([38;5;7m[48;5;0m [C[38;5;5m[48;5;5m[K -[38;5;1m[48;5;0mhonestly makes me like emacs[4;53H[38;5;7m[48;5;5m [38;5;3m[48;5;0m│[38;5;7m[48;5;0m ][38;5;3m[48;5;0mmastodon[38;5;4m[48;5;0m [38;5;3m[48;5;0m) [38;5;7m[48;5;0m [38;5;3m[48;5;0m│[38;5;7m[48;5;5m [38;5;7m[48;5;3m[K[5;10H[38;5;7m[48;5;0m [m[39;49m[38;5;0m[48;5;0m [38;5;7m[48;5;0m [m[39;49m[38;5;0m[48;5;0m [5;53H[38;5;7m[48;5;5m [38;5;3m[48;5;0m│[38;5;7m[48;5;0m - [X[38;5;2m[48;5;0m][38;5;7m[48;5;0m tokenrove[7C[38;5;7m[48;5;5m [38;5;7m[48;5;3m[K -[76D[38;5;1m[48;5;0ml[38;5;7m[48;5;0m [38;5;5m[48;5;0mshame it doesn't have[6;53H[38;5;7m[48;5;5m [38;5;3m[48;5;0m│[38;5;7m[48;5;0m [38;5;2m[48;5;0m- [X[38;5;7m[48;5;0m][38;5;2m[48;5;0m rkallos[9C[38;5;7m[48;5;5m [38;5;7m[48;5;4mG[7;4H[38;5;1m[48;5;0mj[38;5;7m[48;5;0m [38;5;5m[48;5;0ma text editor[38;5;7m[48;5;0m [7;53H[38;5;7m[48;5;5m [38;5;3m[48;5;0m│[38;5;7m[48;5;0m - [X[m[39;49m[38;5;0m[48;5;0m [38;5;7m[48;5;0m nephariuz[7C[38;5;7m[48;5;5m [38;5;7m[48;5;4m[K -[38;5;5m[48;5;0m fucking heretics[38;5;7m[48;5;0m SHAME!!! [38;5;3m[48;5;0m [38;5;7m[48;5;0m [8;53H[38;5;7m[48;5;5m [38;5;3m[48;5;0m│[38;5;7m[48;5;0m -[m[39;49m[38;5;0m[48;5;0m [38;5;7m[48;5;0m [m[39;49m[38;5;0m[48;5;0m [38;5;7m[48;5;0mevoxel [7C[38;5;7m[48;5;5m [38;5;7m[48;5;4m[K -[C[38;5;7m[48;5;0memacs doesn't have :smile though :)[9;53H[38;5;7m[48;5;5m [38;5;3m[48;5;0m│[38;5;7m[48;5;0m [38;5;6m[48;5;0m- :wq!<CR> [38;5;7m[48;5;0m [38;5;3m[48;5;0m│[38;5;7m[48;5;5mM[38;5;7m[48;5;4m[K[10;18H[38;5;7m[48;5;0m [10;53H[38;5;7m[48;5;5m [38;5;3m[48;5;0m│[38;5;7m[48;5;0m [38;5;3m[48;5;0m│[38;5;7m[48;5;5m [38;5;7m[48;5;4m[K[11;24H[38;5;7m[48;5;0m l[11;42Hi[11;53H[38;5;7m[48;5;5m [38;5;3m[48;5;0m│[38;5;7m[48;5;0m [7C[38;5;7m[48;5;5m [38;5;7m[48;5;4m[K[12;24H[38;5;7m[48;5;0m [12;53H[38;5;7m[48;5;5m [38;5;3m[48;5;0m│[38;5;1m[48;5;0m - [M-x] zge[38;5;7m[48;5;0m [7C[38;5;7m[48;5;5m [38;5;7m[48;5;4mN[13;15H[38;5;7m[48;5;0m [13;53H[38;5;7m[48;5;5m [38;5;3m[48;5;0m│[38;5;1m[48;5;0m [6C[38;5;7m[48;5;5m [38;5;7m[48;5;4m[K[14;13H[38;5;7m[48;5;0m [14;38H [14;50H [38;5;5m[48;5;0m|[38;5;7m[48;5;0m [38;5;7m[48;5;5m [38;5;3m[48;5;0m│[38;5;7m[48;5;0m [8C[38;5;7m[48;5;5m [38;5;7m[48;5;4m[K -[38;5;7m[48;5;0mo---------o o----o [15;48H [38;5;5m[48;5;0my[38;5;7m[48;5;0m [38;5;5m[48;5;0m|[38;5;7m[48;5;0m [38;5;7m[48;5;5m [38;5;3m[48;5;0m│[38;5;7m[48;5;0m [9C[38;5;7m[48;5;5mA[38;5;7m[48;5;4m[K -[38;5;7m[48;5;0m|[16;11H| | [38;5;8m[48;5;4m [38;5;7m[48;5;0m | [38;5;3m[48;5;0m [38;5;7m[48;5;0m [16;53H[38;5;7m[48;5;5m [38;5;3m[48;5;0m│[38;5;7m[48;5;0m [10C[38;5;7m[48;5;5m [38;5;7m[48;5;4m[K -[38;5;7m[48;5;0m|[17;11H| |[38;5;8m[48;5;0m [38;5;8m[48;5;4m [38;5;7m[48;5;0m | [17;53H[38;5;7m[48;5;5m [17;63H[38;5;7m[48;5;0m [13C[38;5;7m[48;5;5m [38;5;7m[48;5;4mU[18;1H[38;5;7m[48;5;0m| [38;5;7m[48;5;2m [38;5;7m[48;5;0m [38;5;7m[48;5;3m [38;5;7m[48;5;0m | | | [18;53H[38;5;7m[48;5;5m [38;5;3m[48;5;0m│[38;5;7m[48;5;0m [6C[38;5;3m[48;5;0m│[38;5;7m[48;5;5m [38;5;7m[48;5;3m[K -[38;5;7m[48;5;0m| [38;5;8m[48;5;3m [38;5;7m[48;5;0m [38;5;7m[48;5;2m [38;5;7m[48;5;0m [38;5;7m[48;5;3m [38;5;7m[48;5;0m | o----o [19;38Hstop here[6C[38;5;7m[48;5;5m [38;5;3m[48;5;0m│[38;5;7m[48;5;0m [38;5;3m[48;5;0m│[38;5;7m[48;5;5m [38;5;7m[48;5;3m[K -[38;5;7m[48;5;0m| [38;5;8m[48;5;3m [38;5;7m[48;5;0m [38;5;7m[48;5;2m [38;5;7m[48;5;0m [38;5;7m[48;5;5m [38;5;7m[48;5;3m [38;5;7m[48;5;0m| [6C [20;53H[38;5;7m[48;5;5m [38;5;3m[48;5;0m│[38;5;7m[48;5;0m [38;5;3m[48;5;0m│[38;5;7m[48;5;5mC[38;5;7m[48;5;3m[K -[38;5;7m[48;5;0m|[38;5;8m[48;5;0m [38;5;8m[48;5;3m [38;5;7m[48;5;4m [38;5;7m[48;5;5m [38;5;7m[48;5;0m [38;5;7m[48;5;5m [38;5;7m[48;5;0m| 000129 go down until you[7C[38;5;7m[48;5;5m [38;5;3m[48;5;0m│[38;5;7m[48;5;0m [38;5;3m[48;5;0m│[38;5;7m[48;5;5m [38;5;7m[48;5;3m[K -[38;5;7m[48;5;0m| [38;5;7m[48;5;3m [38;5;7m[48;5;4m [38;5;7m[48;5;5m [38;5;7m[48;5;6m [38;5;7m[48;5;5m [38;5;7m[48;5;0m| reach ok[22;53H[38;5;7m[48;5;5m [38;5;3m[48;5;0m│[22C│[38;5;7m[48;5;5m [38;5;7m[48;5;3m[K -[38;5;7m[48;5;0m| [38;5;7m[48;5;1m [38;5;7m[48;5;6m [38;5;7m[48;5;5m [38;5;7m[48;5;0m| [23;26H100 [23;53H[38;5;7m[48;5;5m [38;5;3m[48;5;0m│[38;5;7m[48;5;0m [38;5;3m[48;5;0m│[38;5;7m[48;5;5m [38;5;7m[48;5;3m[K -[38;5;7m[48;5;0mo---------o[24;24H [24;50H[38;5;0m[48;5;7me[38;5;5m[48;5;0m|[38;5;7m[48;5;0m [38;5;7m[48;5;5m [38;5;3m[48;5;0m│ [m[39;49m[38;5;0m[48;5;0mq[38;5;7m[48;5;0m [38;5;3m[48;5;0m│[38;5;7m[48;5;5mS[38;5;7m[48;5;3m[K -[38;5;0m[48;5;7m U:%*- *Tetris* Top (1,0) (Tetris Proj[38;5;7m[48;5;0mq[38;5;0m[48;5;7mctile[rms])[K[1;41H[m[39;49m[38;5;0m[48;5;0m - - - - - - - - - - - - - - - - - - - - - - - -[1;41H[38;5;7m[48;5;0m [1;53H [38;5;3m[48;5;0m│[38;5;7m[48;5;0m [8C9 -[38;5;2m[48;5;0m +/////////////////+[38;5;7m[48;5;0m [2;53H [38;5;3m[48;5;0m│[38;5;7m[48;5;0m [11C[K - [38;5;2m[48;5;0m //you@cybre.space//[38;5;7m[48;5;0m [3;37H [3;53H [38;5;3m[48;5;0m│[38;5;7m[48;5;0m [4C[K - [38;5;2m[48;5;0m +/////////////////+[38;5;7m[48;5;0m [4;37H [4;53H [6C [5C[K -[74D[38;5;3m[48;5;0m/\/\/\/\/[38;5;2m[48;5;0m\\\[38;5;3m[48;5;0m/\/\/\/\/\[38;5;7m[48;5;0m [5;53H [38;5;3m[48;5;0m│[38;5;7m[48;5;0m [7C[K - [38;5;3m[48;5;0m/ / [6;37H[38;5;7m[48;5;0m [6;53H [38;5;3m[48;5;0m│[38;5;7m[48;5;0m [9C[K - [38;5;3m[48;5;0m \ pleroma.soykaf.com \[7;37H[38;5;7m[48;5;0m [7;53H [38;5;3m[48;5;0m│[38;5;7m[48;5;0m [7C[K - [38;5;3m[48;5;0m/[38;5;7m[48;5;0m [38;5;3m[48;5;0msee the[38;5;7m[48;5;0m [38;5;3m[48;5;0m /[38;5;7m[48;5;0m [8;53H [38;5;3m[48;5;0m│[38;5;7m[48;5;0m [9C[K - [38;5;3m[48;5;0m\[38;5;7m[48;5;0m [38;5;2m[48;5;0m- entire -[38;5;7m[48;5;0m [38;5;3m[48;5;0m \[38;5;7m[48;5;0m I miss Karl...[9;53H [38;5;3m[48;5;0m│[38;5;7m[48;5;0m [4C[K - [38;5;3m[48;5;0m/[38;5;7m[48;5;0m [38;5;3m[48;5;0mfediverse[6C /[10;37H[38;5;7m[48;5;0m [10;53H [24C[K - [38;5;3m[48;5;0m\[11;25H \[38;5;7m[48;5;0m [6C [11;53H [24C[K - [38;5;3m[48;5;0m \/\/\/\/\[38;5;2m[48;5;0m///[38;5;3m[48;5;0m\/\/\/\/\/[12;37H[38;5;7m[48;5;0m [12;53H [38;5;3m[48;5;0m│[38;5;7m[48;5;0m [11C[K[13;37H [13;53H [38;5;3m[48;5;0m│[38;5;7m[48;5;0m [38;5;3m[48;5;0m.[38;5;7m[48;5;0m [6C[K[14;21H[38;5;12m[48;5;0m/---------------------\[14;53H[38;5;7m[48;5;0m [24C[K - [38;5;12m[48;5;0m|I'm petting the snek.| [15;53H[38;5;7m[48;5;0m [24C[K - [16;11H [38;5;12m[48;5;0m| |[16;53H[38;5;7m[48;5;0m [24C[K - [17;11H [38;5;12m[48;5;0m| ^U^ |[17;53H[38;5;7m[48;5;0m [24C[K - [38;5;12m[48;5;0m\---------------------/[18;53H[38;5;7m[48;5;0m [24C[K - [X] TODO: move this too[38;5;12m[48;5;0m \[38;5;7m[48;5;0m [6C [24C[K - [m[39;49m[38;5;0m[48;5;0m[ ] TODO: write todo list[38;5;7m[48;5;0m [38;5;12m[48;5;0m [38;5;7m[48;5;0m [38;5;4m[48;5;0m@/[6C[38;5;7m[48;5;0m [21C[38;5;6m[48;5;0m [2C[38;5;7m[48;5;0m[K - [X] TODO: hey, me too [38;5;4m[48;5;0m/| [6C[38;5;7m[48;5;0m [24C[K - [22;28H [22;41H [38;5;4m[48;5;0m/ \[6C[38;5;7m[48;5;0m [24C[K - ##########################[23;53H [24C[K - # TODO: advertise things # [24;50H [38;5;5m[48;5;0m|[38;5;7m[48;5;0m [38;5;3m[48;5;0m│[38;5;7m[48;5;0m [17C[K - ########################## [38;5;5m[48;5;0m|[38;5;7m[48;5;0m [38;5;5m[48;5;0my[38;5;7m[48;5;0mq[38;5;5m[48;5;0m|[38;5;7m[48;5;0m [38;5;3m[48;5;0m│[38;5;7m[48;5;0m [m[39;49m[38;5;0m[48;5;0mq[38;5;7m[48;5;0m [38;5;3m[48;5;0m│[38;5;7m[48;5;0m[K[1;41H[m[39;49m[38;5;0m[48;5;0m - - - - - - - - - - - - - - - - - - - - - - - -[1;41H[1;55H[38;5;0m[48;5;3m│[1;71H│[6C[38;5;7m[48;5;0m10 - [2;55H[38;5;0m[48;5;3m│[2;71H└──────┐ -[C[38;5;7m[48;5;0m [3;55H[38;5;0m[48;5;3m│[22C│ -[38;5;1m[48;5;0m [38;5;7m[48;5;0m # [4;55H[38;5;0m[48;5;3m│[22C│ -[74D[38;5;7m[48;5;0m ## # ## [5;55H[38;5;0m[48;5;3m│[22C│ -[75D[38;5;7m[48;5;0m ## # ## [6;55H[38;5;0m[48;5;3m│[22C│ -[76D[38;5;7m[48;5;0m # [7;55H[38;5;0m[48;5;3m│[22C│ -[75D[38;5;7m[48;5;0m #### [6C [8;55H[38;5;0m[48;5;3m│[22C│ -[75D[38;5;7m[48;5;0m ## [9;55H[38;5;0m[48;5;3m│[22C│ -[75D[38;5;7m[48;5;0m # ### ## [10;55H[38;5;0m[48;5;3m│[38;5;7m[48;5;0m [38;5;3m[48;5;0ma[16C[38;5;0m[48;5;3m│ -[75D[38;5;7m[48;5;0m ## ## ## ## [11;55H[38;5;0m[48;5;3m│[38;5;3m[48;5;0m(hells [7C[38;5;0m[48;5;3m│ -[75D[38;5;7m[48;5;0m ### ### Capouet[12;55H[38;5;0m[48;5;3m│[38;5;3m[48;5;0m guettbook [6C[38;5;0m[48;5;3m│ -[76D[38;5;7m[48;5;0mlol this is awesome[13;55H[38;5;0m[48;5;3m│[38;5;7m[48;5;0m [38;5;3m[48;5;0m s retch[11C[38;5;0m[48;5;3m│[14;21H[38;5;7m[48;5;0m [14;55H[38;5;0m[48;5;3m│[38;5;7m[48;5;0m [38;5;3m[48;5;0m [38;5;7m[48;5;0m [38;5;3m[48;5;0mgoals)[10C[38;5;0m[48;5;3m│[15;21H[38;5;7m[48;5;0m [15;55H[38;5;0m[48;5;3m│[22C│[16;21H[38;5;7m[48;5;0m [16;55H[38;5;0m[48;5;3m│[22C│[17;21H[38;5;7m[48;5;0m [17;55H[38;5;0m[48;5;3m│[22C│[18;21H[38;5;7m[48;5;0m [18;55H[38;5;0m[48;5;3m│[22C│ -[71D[38;5;7m[48;5;0m [19;55H[38;5;0m[48;5;3m│[22C│ -[71D[38;5;7m[48;5;0m [20;43H [20;55H[38;5;0m[48;5;3m│[20C[38;5;7m[48;5;0m [38;5;0m[48;5;3m│ -[72D[38;5;7m[48;5;0mtodo: write todo list [21;44H [21;55H[38;5;0m[48;5;3m│[22C│[22;44H[38;5;7m[48;5;0m [22;55H[38;5;3m[48;5;0m▓[22C▓ -[71D[38;5;7m[48;5;0m [23;55H[38;5;3m[48;5;0m▒[22C▒ -[71D[38;5;7m[48;5;0m [24;55H[38;5;3m[48;5;0m░[22C░ -[71D[38;5;7m[48;5;0m [25;55H [6C[K[1;41H[m[39;49m[38;5;0m[48;5;0m - - - - - - - - - - - - - - - - - - - - - - - -[1;41H [1;55H[38;5;3m[48;5;0m [1;71H[38;5;7m[48;5;0m [m[39;49m[38;5;0m[48;5;0m(000,011)[2;37H [2;55H[38;5;3m[48;5;0m [38;5;7m[48;5;0m[K[3;37H[m[39;49m[38;5;0m[48;5;0m [3;46H[38;5;7m[48;5;0mW[3;55H[38;5;3m[48;5;0m [38;5;7m[48;5;0m[K - [4;13H [4;37H[m[39;49m[38;5;0m[48;5;0m [4;46H[38;5;7m[48;5;0mE[4;55H[38;5;3m[48;5;0m [38;5;7m[48;5;0m[K -[48D [7C [5;37H[m[39;49m[38;5;0m[48;5;0m [5;46H[38;5;7m[48;5;0mE[5;55H[38;5;3m[48;5;0m [38;5;7m[48;5;0m[K -[48D [38;5;6m[48;5;0m3[38;5;5m[48;5;0m333333[38;5;3m[48;5;0m3[38;5;6m[48;5;0m33333333[6;37H[m[39;49m[38;5;0m[48;5;0m [6;46H[38;5;7m[48;5;0mE[6;55H[38;5;3m[48;5;0m [38;5;7m[48;5;0m[K[7;9H[38;5;6m[48;5;0m3[38;5;9m[48;5;0m33333333333[38;5;7m[48;5;0m [38;5;6m[48;5;0m3[7;37H[m[39;49m[38;5;0m[48;5;0m [7;46H[38;5;7m[48;5;0mE[7;55H[38;5;3m[48;5;0m [38;5;7m[48;5;0m[K[8;9H[38;5;6m[48;5;0m3[38;5;9m[48;5;0m33[38;5;7m[48;5;0m [38;5;13m[48;5;0m3[38;5;15m[48;5;0m3[38;5;7m[48;5;0m33 [38;5;6m[48;5;0m3[38;5;7m[48;5;0m [38;5;6m[48;5;0m3[8;37H[m[39;49m[38;5;0m[48;5;0m [8;46H[38;5;7m[48;5;0mE[8;55H[38;5;3m[48;5;0m [38;5;7m[48;5;0m[K[9;9H[38;5;6m[48;5;0m333333333333[38;5;3m[48;5;0m3333[9;37H[m[39;49m[38;5;0m[48;5;0m [9;46H[38;5;7m[48;5;0mE[9;55H[38;5;3m[48;5;0m [38;5;7m[48;5;0m[K[10;10H [10;37H[m[39;49m[38;5;0m[48;5;0m [10;46H[38;5;7m[48;5;0mE[10;55H[38;5;3m[48;5;0m [38;5;7m[48;5;0m[K[11;10H [11;37H[m[39;49m[38;5;0m[48;5;0m [11;46H[38;5;7m[48;5;0mH[11;55H[38;5;3m[48;5;0m [38;5;7m[48;5;0m[K[12;11H [12;37H[m[39;49m[38;5;0m[48;5;0m [12;46H[38;5;7m[48;5;0mE[12;55H[38;5;3m[48;5;0m [38;5;7m[48;5;0m[K - [13;37H[m[39;49m[38;5;0m[48;5;0m [13;46H[38;5;7m[48;5;0mE[13;55H[38;5;3m[48;5;0m [38;5;7m[48;5;0m [38;5;3m[48;5;0m [38;5;4m[48;5;0m.[38;5;7m[48;5;0m[K[14;37H[m[39;49m[38;5;0m[48;5;0m [14;46H[38;5;7m[48;5;0mH[14;55H[38;5;3m[48;5;0m [38;5;7m[48;5;0m[K[15;37H[m[39;49m[38;5;0m[48;5;0m [15;46H[38;5;7m[48;5;0mE[15;55H[38;5;3m[48;5;0m [38;5;7m[48;5;0m[K - [38;5;6m[48;5;0mvi[38;5;7m[48;5;0m for the [38;5;6m[48;5;0mvi[38;5;7m[48;5;0mn![16;37H[m[39;49m[38;5;0m[48;5;0m [16;46H[38;5;7m[48;5;0mE[16;55H[38;5;3m[48;5;0m [38;5;7m[48;5;0m[K[17;15H[38;5;6m[48;5;0m [17;37H[m[39;49m[38;5;0m[48;5;0m [17;46H[38;5;7m[48;5;0mE[17;55H[38;5;3m[48;5;0m [38;5;7m[48;5;0m[K[18;37H[m[39;49m[38;5;0m[48;5;0m [7C[38;5;7m[48;5;0mE[18;55H[38;5;3m[48;5;0m [38;5;7m[48;5;0m[K[19;37H[m[39;49m[38;5;0m[48;5;0m [19;46H[38;5;7m[48;5;0mE[19;55H[38;5;3m[48;5;0m [38;5;7m[48;5;0m[K[20;37H[m[39;49m[38;5;0m[48;5;0m [20;46H[38;5;7m[48;5;0mE[20;55H[38;5;3m[48;5;0m [38;5;7m[48;5;0m[K -[49D [38;5;0m[48;5;1m [38;5;7m[48;5;0m [21;37H[m[39;49m[38;5;0m[48;5;0m [21;46H[38;5;7m[48;5;0mE[21;55H[38;5;3m[48;5;0m [38;5;7m[48;5;0m[K[22;13H[38;5;0m[48;5;1m [38;5;0m[48;5;2m [38;5;0m[48;5;1m [38;5;0m[48;5;2m [38;5;0m[48;5;1m [22;37H[m[39;49m[38;5;0m[48;5;0m [22;46H[38;5;7m[48;5;0mE[22;55H[38;5;3m[48;5;0m [38;5;7m[48;5;0m[K[23;13H[38;5;0m[48;5;1m [23;37H[m[39;49m[38;5;0m[48;5;0m [23;46H[38;5;7m[48;5;0mE[23;55H[38;5;3m[48;5;0m [38;5;7m[48;5;0m[K[24;13H[38;5;0m[48;5;1m [38;5;0m[48;5;2m [38;5;0m[48;5;1m [24;37H[m[39;49m[38;5;0m[48;5;0m [24;55H[38;5;3m[48;5;0m [38;5;7m[48;5;0m[K[25;13H[38;5;0m[48;5;1m [25;37H[m[39;49m[38;5;0m[48;5;0m [25;55H[38;5;3m[48;5;0m [38;5;7m[48;5;0m[K[1;41H[m[39;49m[38;5;0m[48;5;0m - - - - - - - - - - - - - - - - - - - - - - - -[1;41H[1;14H[38;5;0m[48;5;1m [1;55H[38;5;7m[48;5;0m [23C[m[39;49m[38;5;0m[48;5;0m2[2;55H[38;5;7m[48;5;0m [3;46H [5C[K[4;17Hiiit[4;38H[m[39;49m[38;5;0m[48;5;0m [7C[38;5;7m[48;5;0m [5C[K[5;19Hllgwfth[5;46H [5C[K[6;9H [6;38H[m[39;49m[38;5;0m[48;5;0m [7C[38;5;7m[48;5;0m [5C[K[7;9H [7;46H [5C[K[8;9H [8;46H [5C[K[9;9H [38;5;5m[48;5;0mAcme is best editor :P[9;46H[38;5;7m[48;5;0m [5C[K -[6D [5C[K[11;18His that a plan9 reference [5C[K -[6D [5C[K[13;22His that a Jojo's referenc[13;55H [13;65H [38;5;3m[48;5;0m.[14;37H[38;5;7m[48;5;0m [14;46H [5C[K[15;25His that a let's encryp[5C [38;5;3m[48;5;0m -[58D[38;5;7m[48;5;0m [16;46H [5C[K[17;15H [17;46H [5C[K[18;38H [7C [18;55H[38;5;2m[48;5;0md[19;46H[38;5;7m[48;5;0m [19;55H[38;5;2m[48;5;0ms[20;46H[38;5;7m[48;5;0m [20;55H[38;5;2m[48;5;0mf[21;13H[38;5;7m[48;5;0m [21;46H [21;55H[38;5;2m[48;5;0ms[22;13H[38;5;7m[48;5;0m [22;46H [22;55H[38;5;2m[48;5;0mffd[38;5;7m[48;5;0m [38;5;2m[48;5;0mhello[38;5;7m[48;5;0m [38;5;2m[48;5;0mthere[23;13H[38;5;7m[48;5;0m [23;46H [23;55H[38;5;2m[48;5;0mo[38;5;7m[48;5;0m [38;5;2m[48;5;0mf[38;5;7m[48;5;0m [38;5;2m[48;5;0ml [24;13H[38;5;7m[48;5;0m eGenre l?[24;38H [24;55H[38;5;2m[48;5;0md[25;13H[38;5;7m[48;5;0m [25;55H[38;5;2m[48;5;0mj[38;5;3m[48;5;0m[1P[1;41H[m[39;49m[38;5;0m[48;5;0m - - - - - - - - - - - - - - - - - - - - - - - -[1;41H[1;14H[38;5;7m[48;5;0m [1;37H [1;55H[38;5;2m[48;5;0mp[23C[m[39;49m[38;5;0m[48;5;0m3[2;37H[38;5;7m[48;5;0m [2;52H[38;5;3m[48;5;0m[1P[3;37H[38;5;7m[48;5;0m [3;59H[38;5;2m[48;5;0mx[38;5;3m[48;5;0m[1P[4;17H[38;5;7m[48;5;0m [4;37H [4;59H[38;5;2m[48;5;0mm[38;5;3m[48;5;0m[1P[5;19H[38;5;7m[48;5;0m [5;37H [5;59H[38;5;2m[48;5;0mp[6;37H[38;5;7m[48;5;0m [6;59H[38;5;2m[48;5;0mp[7;37H[38;5;7m[48;5;0m [7;59H[38;5;2m[48;5;0m -[53D[38;5;7m[48;5;0mi want to pet a soft girl [8;59H[38;5;2m[48;5;0mp -[52D[38;5;7m[48;5;0mand call her by her first name[9;59H[38;5;2m[48;5;0mu -[52D[38;5;7m[48;5;0mgod, i'm so lonely.[10;37H [10;59H[38;5;2m[48;5;0mb[11;18H[38;5;7m[48;5;0m [11;59H[38;5;2m[48;5;0ml -[54D[38;5;10m[48;5;0mYou can do it[12;37H[38;5;7m[48;5;0m [12;59H[38;5;2m[48;5;0mi[13;22H[38;5;7m[48;5;0m [13;59H[38;5;2m[48;5;0mc -[54D[38;5;10m[48;5;0mGo out there and talk to people[14;59H[38;5;2m[48;5;0mg[15;25H[38;5;7m[48;5;0m [15;59H[38;5;2m[48;5;0m@[38;5;7m[48;5;0m[K -[54D[38;5;10m[48;5;0mEven if it doesnt go anywhere, don't[16;59H[38;5;2m[48;5;0mc -[54D[38;5;10m[48;5;0msee it as a loss, see it as practice[17;59H[38;5;2m[48;5;0mo[18;37H[38;5;7m[48;5;0m [18;55H [38;5;2m[48;5;0mn -[54D[38;5;10m[48;5;0mI believe in you[19;37H[38;5;7m[48;5;0m [19;55H [38;5;2m[48;5;0mf[20;37H[38;5;7m[48;5;0m [20;55H [38;5;2m[48;5;0me -[54D[38;5;10m[48;5;0mYou will be succesful[21;37H[38;5;7m[48;5;0m [21;55H [38;5;2m[48;5;0mr[22;37H[38;5;7m[48;5;0m [22;55H [38;5;2m[48;5;0me[38;5;7m[48;5;0m[K -[54D[38;5;10m[48;5;0mYou just have to try...[23;37H[38;5;7m[48;5;0m [23;55H [38;5;2m[48;5;0mn[38;5;7m[48;5;0m[K[24;15H [24;37H [24;55H [38;5;2m[48;5;0mc -[54D[38;5;7m[48;5;0mUwU[25;37H [25;55H [38;5;2m[48;5;0me[38;5;7m[48;5;0m[K[1;41H[m[39;49m[38;5;0m[48;5;0m - - - - - - - - - - - - - - - - - - - - - - - -[1;41H[1;55H[38;5;7m[48;5;0m [38;5;2m[48;5;0m.[19C[m[39;49m[38;5;0m[48;5;0m4[2;59H[38;5;2m[48;5;0my[38;5;7m[48;5;0m[K -[38;5;2m[48;5;0mo[38;5;7m[48;5;0m[K -[38;5;2m[48;5;0mu[38;5;7m[48;5;0m[K -[38;5;2m[48;5;0mr -d -a -[53D[38;5;7m[48;5;0m [8;59H[38;5;2m[48;5;0mt -[52D[38;5;7m[48;5;0m [9;59H[38;5;2m[48;5;0ma -[52D[38;5;7m[48;5;0m [10;59H[38;5;2m[48;5;0m. -f -[54D[38;5;7m[48;5;0m [12;59H[38;5;2m[48;5;0mo -r -[54D[38;5;7m[48;5;0m [38;5;10m[48;5;0mwhere[14;59H[38;5;2m[48;5;0ms[6C[38;5;3m[48;5;0m [15;36H[38;5;10m[48;5;0mare[15;59H[38;5;2m[48;5;0ma -[54D[38;5;7m[48;5;0m [38;5;10m[48;5;0myou[38;5;7m[48;5;0m [16;59H[38;5;2m[48;5;0ml -[54D[38;5;7m[48;5;0m [38;5;10m[48;5;0mgoing[38;5;7m[48;5;0m [17;59H[38;5;2m[48;5;0me[18;36H[38;5;10m[48;5;0mthere[18;52H[38;5;7m[48;5;0m[K -[46D [19;36H[38;5;10m[48;5;0mis[19;52H[38;5;7m[48;5;0m[K[20;36H[38;5;10m[48;5;0mnothing[20;52H[38;5;7m[48;5;0m[K -[46D [21;36H[38;5;10m[48;5;0mdown[21;52H[38;5;7m[48;5;0m[K[22;36H[38;5;10m[48;5;0mhere[22;52H[38;5;7m[48;5;0m[K -[46D [7C[38;5;10m[48;5;0mi [23;52H[38;5;7m[48;5;0m[K[24;36H[38;5;10m[48;5;0mpromise[24;52H[38;5;7m[48;5;0m[K -[46D [25;36H(there is)[6C[K[1;41H[m[39;49m[38;5;0m[48;5;0m - - - - - - - - - - - - - - - - - - - - - - - -[1;41H[1;59H[38;5;7m[48;5;0m [1;72H 015[K[2;59H - -[6D[38;5;1m[48;5;0mor is there?[5;59H[38;5;7m[48;5;0m -[5Dwow[K - -[5Dyou all just[9;59H -[5Dbb[K[11;19Hhello[11;52H[K[12;59H - [14;36H [38;5;3m[48;5;0m| |[5C[38;5;7m[48;5;0m[K[15;36H [15;52H[K[16;36H [16;52H[K[17;36H [17;52H[K -[46DRewrite this in Nim for better -[35Dperformance and easier maintenance. -[35Dhttps://nim-lang.org[20;36H -[37DSorry, couldn't resist :P [22;10HRewrite it in Idris to prove its[23;10Hcorrectness :P[23;36H -[32DRemove it :P[24;36H -[35Ddasdasdasdsa[25;36H [1;41H[m[39;49m[38;5;0m[48;5;0m - - - - - - - - - - - - - - - - - - - - - - - -[1;41H[38C[38;5;7m[48;5;0m6[4;54H[K[5;36Hwrite.[6;55H[K - -[K[9;39Hjjjjjjjjjjj -[5C[K[11;19H [13;35H[38;5;10m[48;5;0msee[38;5;7m[48;5;0m,[13;54HWhat's that creeping[14;35Hi told you [7Cwaaaaayyy over there?[15;54H-------------------->[18;6H -[30D -[35D -[20D [22;10H [23;10H -[18D -[10D[m[39;49m[38;5;0m[48;5;0mq[38;5;7m[48;5;0m [1;41H[m[39;49m[38;5;0m[48;5;0m - - - - - - - - - - - - - - - - - - - - - - - -[1;41H[38C[38;5;7m[48;5;0m7[4;27HWhat is this ?:wq[5;27Hq[5;36H [7;57H[38;5;12m[48;5;0mthere is[8;57Htrust me[9;39H[38;5;7m[48;5;0m [38;5;5m[48;5;0m|[38;5;7m[48;5;0m [38;5;5m[48;5;0my[7C[38;5;12m[48;5;0mi wrapped[13;35H[38;5;7m[48;5;0m [13;54H [38;5;3m[48;5;0m.[38;5;7m[48;5;0m[K[14;35H [7C[K - [K[25;8H [1;41H[m[39;49m[38;5;0m[48;5;0m - - - - - - - - - - - - - - - - - - - - - - - -[1;41H[38C[38;5;7m[48;5;0m8[4;27H -[38;5;11m[48;5;0mAncient legend tells of the treasure -of the legendary pirate, -Cap'n Jasmine Sharkbait![7;52H[38;5;7m[48;5;0m[K -[38;5;11m[48;5;0mNo one knows where its shiny and well shaded[7C[38;5;7m[48;5;0m[K -[38;5;11m[48;5;0mglory is hidden, and many have perished[9;52H[38;5;7m[48;5;0m[K -[38;5;11m[48;5;0mtrying to find it. - - [15;28H[38;5;1m[48;5;0mstuff is here[17;26H[38;5;6m[48;5;0m [38;5;5m[48;5;0m |[38;5;6m[48;5;0m [1;41H[m[39;49m[38;5;0m[48;5;0m - - - - - - - - - - - - - - - - - - - - - - - -[1;41H[1;72H[38;5;7m[48;5;0m(000,019)[3;29H[38;5;7m[48;5;1mMDG - boi - -[38;5;7m[48;5;0m [38;5;15m[48;5;0m [38;5;7m[48;5;0m - - - [8;62Hwhy though -======================================D - - - [15;28H [15;63H[38;5;3m[48;5;0m(i legit[16;63Hput tape[17;26H[38;5;7m[48;5;0m [38;5;5m[48;5;0m|[38;5;7m[48;5;0m [17;63H[38;5;3m[48;5;0mon my [18;63Hscreen -[6Dto do[38;5;7m[48;5;0m [38;5;3m[48;5;0mthis)[20;63H[38;5;1m[48;5;0myou are crazy[22;55H[38;5;4m[48;5;0myou will be seen as[23;55Ha visionary[24;24H[38;5;7m[48;5;0mhello tilde.town here[25;37H[m[39;49m[38;5;0m[48;5;0mq[25;58H[38;5;7m[48;5;0mweird flex but ok[1;41H[m[39;49m[38;5;0m[48;5;0m - - - - - - - - - - - - - - - - - - - - - - - -[1;41H[1;72H[38;5;7m[48;5;0m 020[K[3;29H -[38;5;10m[48;5;0mplease [5;15H[38;5;7m[48;5;0m [38;5;10m[48;5;0mstop -this -is -silly[8;52H[38;5;7m[48;5;0m[K - [9;59H[38;5;12m[48;5;0mit[6C[38;5;3m[48;5;0mllllllllllllll[10;27H[38;5;1m[48;5;0m [6C[38;5;7m[48;5;0mno[10;59H[38;5;12m[48;5;0mis[11;12H[38;5;1m[48;5;0m [11;59H[38;5;12m[48;5;0mlovely -[59D[38;5;7m[48;5;0m"Root? Where we're going we[12;54Ht -[48Ddon't need root!"[15;63H[K[16;34Hpeople have[7C[K[17;34Hdied trying[7C[K[18;34Hdon't try :([6C[K - [38;5;9m[48;5;0mdon't stop![38;5;7m[48;5;0m[K[20;55H[38;5;9m[48;5;0mthere's nice art[38;5;7m[48;5;0m[K[21;37Huwu[21;55H[38;5;9m[48;5;0mjust ahead[22;55H [38;5;7m[48;5;0m[K -[38;5;9m[48;5;0m|||[38;5;7m[48;5;0m[K[24;24H [24;55H[38;5;9m[48;5;0mvvv[25;37H[38;5;7m[48;5;0m [25;52H[K[1;41H[m[39;49m[38;5;0m[48;5;0m - - - - - - - - - - - - - - - - - - - - - - - -[1;41H [38;5;12m[48;5;6m [38;5;4m[48;5;6m [38;5;5m[48;5;0m|[38;5;7m[48;5;0m [38;5;5m[48;5;0m@[38;5;7m[48;5;0m [38;5;5m[48;5;0m|[38;5;10m[48;5;0m comment space!!! [38;5;9m[48;5;0m<3[38;5;7m[48;5;0m(000,021)[2;1H[38;5;4m[48;5;6m [38;5;0m[48;5;4m [38;5;4m[48;5;6m [38;5;0m[48;5;4m [38;5;4m[48;5;6m [38;5;0m[48;5;4m [38;5;4m[48;5;6m [38;5;0m[48;5;4m [38;5;4m[48;5;6m [38;5;0m[48;5;4m [38;5;4m[48;5;6m [38;5;0m[48;5;4m [38;5;4m[48;5;6m [38;5;0m[48;5;4m [38;5;4m[48;5;6m [38;5;0m[48;5;4m [38;5;4m[48;5;6m [38;5;0m[48;5;4m [38;5;4m[48;5;6m [38;5;0m[48;5;4m [38;5;4m[48;5;6m [38;5;0m[48;5;4m [38;5;4m[48;5;6m [38;5;0m[48;5;4m [38;5;4m[48;5;6m [38;5;0m[48;5;4m [38;5;4m[48;5;6m [38;5;0m[48;5;4m [38;5;4m[48;5;6m [38;5;0m[48;5;4m [38;5;4m[48;5;6m [38;5;0m[48;5;4m [38;5;4m[48;5;6m [38;5;0m[48;5;4m [38;5;4m[48;5;6m [38;5;0m[48;5;4m [38;5;12m[48;5;6m [38;5;0m[48;5;4m [38;5;4m[48;5;6m [38;5;0m[48;5;4m [38;5;4m[48;5;6m [38;5;0m[48;5;4m [38;5;4m[48;5;6m [38;5;0m[48;5;4m [38;5;4m[48;5;6m [38;5;0m[48;5;4m [38;5;5m[48;5;0m|[38;5;7m[48;5;0m [38;5;5m[48;5;0m@ -[38;5;0m[48;5;4m [38;5;12m[48;5;6m [38;5;0m[48;5;4m [38;5;12m[48;5;6m [38;5;0m[48;5;4m [38;5;12m[48;5;6m [38;5;0m[48;5;4m [38;5;12m[48;5;6m [38;5;0m[48;5;4m [38;5;12m[48;5;6m [38;5;0m[48;5;4m [38;5;12m[48;5;6m [38;5;0m[48;5;4m [38;5;12m[48;5;6m [38;5;0m[48;5;4m [38;5;12m[48;5;6m [38;5;0m[48;5;4m [38;5;12m[48;5;6m [38;5;0m[48;5;4m [38;5;12m[48;5;6m [38;5;0m[48;5;4m [38;5;12m[48;5;6m [38;5;0m[48;5;4m [38;5;12m[48;5;6m [38;5;0m[48;5;4m [38;5;12m[48;5;6m [38;5;0m[48;5;4m [38;5;12m[48;5;6m [38;5;0m[48;5;4m [38;5;12m[48;5;6m [38;5;0m[48;5;4m [38;5;12m[48;5;6m [38;5;0m[48;5;4m [38;5;12m[48;5;6m [38;5;0m[48;5;4m [38;5;12m[48;5;6m [38;5;0m[48;5;4m [38;5;12m[48;5;6m [38;5;0m[48;5;4m [38;5;12m[48;5;6m [38;5;0m[48;5;4m [38;5;12m[48;5;6m [38;5;0m[48;5;4m [38;5;12m[48;5;6m [38;5;0m[48;5;4m [38;5;12m[48;5;6m [38;5;5m[48;5;0m|[38;5;7m[48;5;0m [38;5;5m[48;5;0m@[38;5;7m[48;5;0m [38;5;5m[48;5;0m|[38;5;7m[48;5;0m [38;5;9m[48;5;0m__________________ -[38;5;0m[48;5;4m [38;5;5m[48;5;0m>[38;5;7m[48;5;0m [38;5;5m[48;5;0m@[38;5;7m[48;5;0m [38;5;5m[48;5;0m>[38;5;7m[48;5;0m [38;5;9m[48;5;0m|[38;5;2m[48;5;0m [38;5;9m[48;5;0m | -[38;5;0m[48;5;4m [38;5;12m[48;5;6m [38;5;0m[48;5;4m [38;5;12m[48;5;6m [38;5;0m[48;5;4m [38;5;12m[48;5;6m [38;5;0m[48;5;4m [38;5;12m[48;5;6m [38;5;0m[48;5;4m [38;5;12m[48;5;6m [38;5;0m[48;5;4m [38;5;12m[48;5;6m [38;5;0m[48;5;4m [38;5;12m[48;5;6m [38;5;0m[48;5;4m [38;5;12m[48;5;4m [38;5;12m[48;5;6m [38;5;0m[48;5;4m [38;5;12m[48;5;6m [38;5;0m[48;5;4m [38;5;12m[48;5;6m [38;5;0m[48;5;4m [38;5;12m[48;5;6m [38;5;0m[48;5;4m [38;5;5m[48;5;0m>[38;5;7m[48;5;0m [38;5;5m[48;5;0m@[38;5;7m[48;5;0m [38;5;5m[48;5;0m>[38;5;7m[48;5;0m [38;5;9m[48;5;0m|[38;5;2m[48;5;0m [38;5;9m[48;5;0m>[38;5;10m[48;5;0m>[38;5;14m[48;5;0m> [38;5;11m[48;5;0mM[38;5;3m[48;5;0mORE[38;5;14m[48;5;0m [38;5;11m[48;5;0mA[38;5;3m[48;5;0mRT[38;5;14m[48;5;0m >[38;5;10m[48;5;0m>[38;5;9m[48;5;0m>[38;5;2m[48;5;0m [38;5;9m[48;5;0m| -[38;5;0m[48;5;4m [38;5;2m[48;5;7m [38;5;0m[48;5;4m [38;5;5m[48;5;0m>[38;5;7m[48;5;0m [38;5;5m[48;5;0m@[38;5;7m[48;5;0m [38;5;5m[48;5;0m>[38;5;7m[48;5;0m [38;5;9m[48;5;0m| [38;5;3m[48;5;0m(on (001, 021)) [38;5;2m[48;5;0m [38;5;9m[48;5;0m|[38;5;2m[48;5;0m -[38;5;0m[48;5;4m [38;5;2m[48;5;7m [38;5;8m[48;5;7m#[38;5;2m[48;5;7m [38;5;0m[48;5;4m [38;5;2m[48;5;7m [38;5;0m[48;5;4m [38;5;2m[48;5;7m [38;5;0m[48;5;4m [38;5;5m[48;5;0m> @[38;5;7m[48;5;0m [38;5;5m[48;5;0m>[38;5;7m[48;5;0m [38;5;9m[48;5;0m|___________[38;5;7m[48;5;0m [38;5;9m[48;5;0m_____|[38;5;2m[48;5;0m -[38;5;0m[48;5;4m [38;5;8m[48;5;7m#############[38;5;0m[48;5;4m [38;5;8m[48;5;7m#[38;5;0m[48;5;4m [38;5;8m[48;5;7m##############[38;5;0m[48;5;4m [38;5;5m[48;5;0m|[38;5;7m[48;5;0m [38;5;5m[48;5;0m@[23C[38;5;2m[48;5;0m -[38;5;0m[48;5;4m [38;5;8m[48;5;4m [38;5;0m[48;5;4m [38;5;5m[48;5;0m|[38;5;7m[48;5;0m [38;5;5m[48;5;0m@[38;5;7m[48;5;0m [38;5;5m[48;5;0m|[38;5;7m[48;5;0m [38;5;9m[48;5;0m [38;5;2m[48;5;0m [38;5;1m[48;5;2mooh what you drawing[38;5;7m[48;5;0m[K -[38;5;0m[48;5;4m [38;5;8m[48;5;4m [38;5;6m[48;5;4m/[38;5;8m[48;5;4m [38;5;6m[48;5;4m [38;5;4m[48;5;4m [38;5;6m[48;5;4m /[38;5;8m[48;5;4m [38;5;6m[48;5;4m [38;5;8m[48;5;4m [38;5;14m[48;5;4m/[38;5;8m[48;5;4m [38;5;6m[48;5;4m/[38;5;8m[48;5;4m [38;5;6m[48;5;4m/[38;5;0m[48;5;4m [38;5;8m[48;5;4m [38;5;0m[48;5;4m [38;5;5m[48;5;0m|[38;5;7m[48;5;0m [38;5;5m[48;5;0m@[38;5;7m[48;5;0m [38;5;5m[48;5;0m|[38;5;7m[48;5;0m [38;5;0m[48;5;1mjust a little landscape -[38;5;0m[48;5;4m [38;5;6m[48;5;4m [38;5;0m[48;5;4m [38;5;6m[48;5;4m/[38;5;0m[48;5;4m [38;5;5m[48;5;0m|[38;5;7m[48;5;0m [38;5;5m[48;5;0m@[38;5;7m[48;5;0m [38;5;5m[48;5;0m|[38;5;7m[48;5;0m [38;5;1m[48;5;2mnice!! keep it up ^o^ -[38;5;0m[48;5;4m [38;5;6m[48;5;4m/[38;5;0m[48;5;4m [38;5;14m[48;5;4m/[38;5;0m[48;5;4m [38;5;5m[48;5;0m|[38;5;7m[48;5;0m [38;5;5m[48;5;0m@[38;5;7m[48;5;0m [38;5;5m[48;5;0m|[38;5;7m[48;5;0m [38;5;0m[48;5;1mthank you =v= -[38;5;0m[48;5;4m [38;5;6m[48;5;4m/[38;5;0m[48;5;4m [38;5;6m[48;5;4m/[38;5;0m[48;5;4m [38;5;5m[48;5;0m|[38;5;7m[48;5;0m [38;5;5m[48;5;0m@[13;67H[38;5;3m[48;5;0m -[38;5;0m[48;5;4m [38;5;14m[48;5;4m/[38;5;0m[48;5;4m [38;5;6m[48;5;4m/[38;5;0m[48;5;4m [38;5;5m[48;5;0m|[38;5;7m[48;5;0m [38;5;5m[48;5;0m@[14;60H[38;5;1m[48;5;2moh wait hi rose -[38;5;0m[48;5;4m [38;5;5m[48;5;0m|[38;5;7m[48;5;0m [38;5;5m[48;5;0m@[38;5;7m[48;5;0m [38;5;5m[48;5;0m|[38;5;7m[48;5;0m this is wonderful -[38;5;0m[48;5;4m [38;5;14m[48;5;4m/[38;5;0m[48;5;4m [38;5;5m[48;5;0m|[38;5;7m[48;5;0m [38;5;5m[48;5;0m@[7C[38;5;8m[48;5;7mhi alice!! -[38;5;0m[48;5;4m [38;5;10m[48;5;4m####[38;5;0m[48;5;4m [38;5;10m[48;5;4m####[38;5;0m[48;5;4m [38;5;5m[48;5;0m|[38;5;7m[48;5;0m [38;5;5m[48;5;0m@[38;5;7m[48;5;0m [38;5;5m[48;5;0m|[38;5;7m[48;5;0m [38;5;5m[48;5;0m -[38;5;0m[48;5;4m [38;5;10m[48;5;4m#[38;5;2m[48;5;4m#####[38;5;10m[48;5;4m#[38;5;0m[48;5;4m [38;5;5m[48;5;0m|[38;5;7m[48;5;0m [38;5;5m[48;5;0m@[38;5;7m[48;5;0m [38;5;5m[48;5;0m|[38;5;7m[48;5;0m [38;5;5m[48;5;0m [38;5;12m[48;5;0mart restored to its[38;5;5m[48;5;0m[K -[38;5;0m[48;5;4m [38;5;6m[48;5;4m/[38;5;0m[48;5;4m [38;5;10m[48;5;4m#[38;5;2m[48;5;4m#[38;5;8m[48;5;4m|[38;5;2m[48;5;4m#[38;5;10m[48;5;4m#[38;5;0m[48;5;4m [38;5;14m[48;5;4m/[38;5;0m[48;5;4m [38;5;4m[48;5;4m [38;5;0m[48;5;4m [38;5;4m[48;5;4m [38;5;0m[48;5;4m [38;5;5m[48;5;0m|[38;5;7m[48;5;0m [38;5;5m[48;5;0m@[38;5;7m[48;5;0m [38;5;5m[48;5;0m|[38;5;7m[48;5;0m [38;5;5m[48;5;0m [38;5;12m[48;5;0mformer glory[38;5;5m[48;5;0m [38;5;4m[48;5;0m -[38;5;0m[48;5;4m [38;5;10m[48;5;4m##[38;5;2m[48;5;4m##[38;5;8m[48;5;4m|[38;5;2m[48;5;4m##[38;5;10m[48;5;4m##[38;5;0m[48;5;4m [38;5;5m[48;5;0m|[38;5;7m[48;5;0m [38;5;5m[48;5;0m@[38;5;7m[48;5;0m [38;5;5m[48;5;0m|[38;5;7m[48;5;0m [38;5;5m[48;5;0m [38;5;12m[48;5;0mcmon, play nice yall -[38;5;0m[48;5;4m [38;5;10m[48;5;4m##[38;5;0m[48;5;4m |[38;5;10m[48;5;4m [38;5;0m[48;5;4m [38;5;10m[48;5;4m##[38;5;0m[48;5;4m [38;5;5m[48;5;0m|[38;5;7m[48;5;0m [38;5;5m[48;5;0m@[38;5;7m[48;5;0m [38;5;5m[48;5;0m|[38;5;7m[48;5;0m [7C[38;5;2m[48;5;0myeah! -[38;5;2m[48;5;4m||||||||||||||||||||[38;5;0m[48;5;4m\[38;5;2m[48;5;4m|||||||||||||||||||||||||[38;5;5m[48;5;0m|[38;5;7m[48;5;0m [38;5;5m[48;5;0m@[2C[38;5;7m[48;5;0m[K -[38;5;8m[48;5;2m#####################[38;5;0m[48;5;2m\[38;5;8m[48;5;2m########################[38;5;5m[48;5;0m|[38;5;7m[48;5;0m [38;5;5m[48;5;0m@[38;5;7m[48;5;0m [38;5;5m[48;5;0m| [38;5;2m[48;5;0mthanks for watching -[38;5;8m[48;5;2m######################[38;5;0m[48;5;2m\[38;5;8m[48;5;2m#######################[38;5;5m[48;5;0m|[38;5;7m[48;5;0m [38;5;5m[48;5;0m@[38;5;7m[48;5;0m [38;5;5m[48;5;0m|[38;5;7m[48;5;0m [38;5;2m[48;5;0m i guess it's done now -[38;5;8m[48;5;2m^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^[38;5;5m[48;5;0m|[38;5;7m[48;5;0m [38;5;5m[48;5;0m@[38;5;7m[48;5;0mq[38;5;5m[48;5;0m|[38;5;7m[48;5;0m [38;5;9m[48;5;0mwonderful :) [38;5;2m[48;5;0mmight do more[4hr[4l[1;41H[m[39;49m[38;5;0m[48;5;0m \ No newline at end of file diff --git a/www/git.causal.agency/.gitignore b/www/git.causal.agency/.gitignore index 8d20f25d..eaed8039 100644 --- a/www/git.causal.agency/.gitignore +++ b/www/git.causal.agency/.gitignore @@ -1,3 +1,13 @@ +*.html about-filter -hi +compress +ctags +email-filter +filter +gzip +hilex +htagml +mandoc +mtags +owner-filter source-filter diff --git a/www/git.causal.agency/Makefile b/www/git.causal.agency/Makefile index 28e08ba5..86b9f3eb 100644 --- a/www/git.causal.agency/Makefile +++ b/www/git.causal.agency/Makefile @@ -1,18 +1,53 @@ -ETC = /usr/local/etc -WWW = /usr/local/www/cgit -LIBEXEC = /usr/local/libexec +PREFIX = /var/www +CONFDIR = ${PREFIX}/conf +DATADIR = ${PREFIX}/cgit +BINDIR = ${PREFIX}/bin +WEBROOT = ${PREIFX}/git.causal.agency -BIN = ../../bin -BINS = about-filter source-filter hi +CFLAGS += -Wall -Wextra +LDFLAGS = -static -pie -install: cgitrc custom.css ${BINS} - install -m 644 cgitrc ${ETC} - install -m 644 custom.css ${WWW} - install ${BINS} ${LIBEXEC} +BINS += about-filter +BINS += ctags +BINS += email-filter +BINS += gzip +BINS += hilex +BINS += htagml +BINS += mandoc +BINS += mtags +BINS += owner-filter +BINS += source-filter + +HTMLS = index.html + +all: ${BINS} ${HTMLS} + +compress ctags mandoc: + ${MAKE} -C /usr/src/usr.bin/$@ LDFLAGS='${LDFLAGS}' + mv /usr/src/usr.bin/$@/$@ $@ + ${MAKE} -C /usr/src/usr.bin/$@ clean + +gzip: compress + ln -f compress $@ -hi: ${BIN}/hi.c - ${MAKE} -C ${BIN} $@ - cp ${BIN}/$@ $@ +hilex htagml mtags: + rm -f ../../bin/$@ + ${MAKE} -C ../../bin $@ LDFLAGS='${LDFLAGS}' + mv ../../bin/$@ $@ + +about-filter email-filter owner-filter source-filter: filter + ln -f filter $@ + +index.html: index.7 + mandoc -Thtml -Ostyle=https://causal.agency/style.css index.7 >index.html + +install: cgitrc custom.css ${BINS} + install -m 644 cgitrc ${CONFDIR} + install -m 644 custom.css ${DATADIR} + install -d -o www -g daemon ${PREFIX}/cache/cgit + install -d -m 1700 -o www -g daemon ${PREFIX}/tmp + install -s ${BINS} ${BINDIR} + install -m 644 ${HTMLS} ${WEBROOT} clean: - rm -f ${BINS} + rm -f compress filter ${BINS} ${HTMLS} diff --git a/www/git.causal.agency/about-filter.sh b/www/git.causal.agency/about-filter.sh deleted file mode 100644 index ea68fe05..00000000 --- a/www/git.causal.agency/about-filter.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/sh - -case "$1" in - (*.[1-9]) - exec /usr/bin/mandoc -T html -O fragment,man=%N.%S,includes=../tree/%I - ;; - (*) - exec /usr/local/libexec/hi -l text -f html - ;; -esac diff --git a/www/git.causal.agency/cgitrc b/www/git.causal.agency/cgitrc index c187e1ee..0666fd28 100644 --- a/www/git.causal.agency/cgitrc +++ b/www/git.causal.agency/cgitrc @@ -1,5 +1,6 @@ root-title=causal agency -root-desc=“then I'm sorry, no offence, but you write toy programs.” +root-desc=“I think some people from the Gentoo project are behind this.” +logo= clone-url=https://$HTTP_HOST/$CGIT_REPO_URL snapshots=tar.gz zip @@ -13,15 +14,17 @@ repository-sort=age branch-sort=age css=/custom.css -email-filter=/usr/local/libexec/cgit-email -about-filter=/usr/local/libexec/about-filter -source-filter=/usr/local/libexec/source-filter +about-filter=/bin/about-filter +source-filter=/bin/source-filter +#owner-filter=/bin/owner-filter +email-filter=/bin/email-filter readme=:README.7 readme=:README remove-suffix=1 enable-git-config=1 -scan-path=/home/june/pub +scan-path=/git.causal.agency +cache-root=/cache/cgit cache-size=1024 diff --git a/www/git.causal.agency/custom.css b/www/git.causal.agency/custom.css index 80892b36..b3f4f425 100644 --- a/www/git.causal.agency/custom.css +++ b/www/git.causal.agency/custom.css @@ -14,12 +14,12 @@ div#cgit { tab-size: 4; } -div#cgit table#header td.logo { - display: none; -} div#cgit table#header td.sub { border-top: none; } +div#cgit table#header td.sub.right { + padding-right: 1em; +} div#cgit table.tabs { border-bottom: none; } @@ -49,20 +49,19 @@ div#cgit div#summary { max-width: 80ch; } -/* from hi(1) */ -div#cgit .hi.Keyword { color: dimgray; } -div#cgit .hi.Macro { color: green; } -div#cgit .hi.Tag { color: inherit; text-decoration: underline; } -div#cgit .hi.String { color: teal; } -div#cgit .hi.Format { color: teal; font-weight: bold; } -div#cgit .hi.Interp { color: olive; } -div#cgit .hi.Comment { color: navy; } -div#cgit .hi.Todo { color: navy; font-weight: bold; } -div#cgit .hi.DiffOld { color: red; } -div#cgit .hi.DiffNew { color: green; } -div#cgit .hi.Tag:target { color: goldenrod; outline: none; } +/* for hilex(1) */ +div#cgit pre .Ke { color: dimgray; } +div#cgit pre .Ma { color: green; } +div#cgit pre .Co { color: navy; } +div#cgit pre .St { color: teal; } +div#cgit pre .Fo { color: teal; font-weight: bold; } +div#cgit pre .Su { color: olive; } + +/* for htagml(1) */ +div#cgit pre a.tag { color: inherit; text-decoration: underline; } +div#cgit pre a.tag:target { color: goldenrod; outline: none; } -/* from mandoc(1) */ +/* for mandoc(1) */ table.head, table.foot { width: 100%; } td.head-rtitle, td.foot-os { text-align: right; } td.head-vol { text-align: center; } @@ -74,11 +73,12 @@ dl.Bl-diag > dt { font-weight: bold; } code.Nm, code.Fl, code.Cm, code.Ic, code.In, code.Fd, code.Fn, code.Cd { font-weight: bold; font-family: inherit; } +h1.Sh { font-size: 1.5em; } table.Nm td:first-child { padding-right: 1ch; } code.Fl { white-space: nowrap; } span.RsT { font-style: italic; } -dl.Bl-tag:not(.Bl-compact) dt { margin-top: 1em; } -ul.Bl-bullet:not(.Bl-compact) li { margin-top: 1em; } +dl.Bl-tag:not(.Bl-compact) > dt { margin-top: 1em; } +ul.Bl-bullet:not(.Bl-compact) > li { margin-top: 1em; } div.Bd-indent { margin-left: 4ch; } table.Bl-column { width: 100%; } table.foot { margin-top: 1em; } diff --git a/www/git.causal.agency/filter.c b/www/git.causal.agency/filter.c new file mode 100644 index 00000000..7c7e9320 --- /dev/null +++ b/www/git.causal.agency/filter.c @@ -0,0 +1,158 @@ +#include <err.h> +#include <fcntl.h> +#include <fnmatch.h> +#include <limits.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <sys/wait.h> +#include <unistd.h> + +#define Q(...) #__VA_ARGS__ + +#define MANDOC_OPTIONS "fragment,man=%N.%S,includes=../tree/%I" + +static int about(int argc, char *argv[]) { + if (argc < 2) return 1; + if (!fnmatch("README.[1-9]", argv[1], 0)) { + execlp("mandoc", "mandoc", "-T", "html", "-O", MANDOC_OPTIONS, NULL); + err(127, "mandoc"); + } else if (!fnmatch("*.[1-9]", argv[1], 0)) { + execlp( + "mandoc", "mandoc", "-T", "html", "-O", "toc," MANDOC_OPTIONS, NULL + ); + err(127, "mandoc"); + } else { + execlp("hilex", "hilex", "-l", "text", "-f", "html", "-o", "pre", NULL); + err(127, "hilex"); + } +} + +static int email(void) { + size_t cap = 0; + char *buf = NULL; + if (getline(&buf, &cap, stdin) < 0) err(1, "getline"); + if (buf[0] == 'C' && !strncmp(&buf[strcspn(buf, " ")], " McEnroe", 8)) { + printf("June%s", &buf[strcspn(buf, " ")]); + } else { + printf("%s", buf); + } + return 0; +} + +static int owner(void) { + printf(Q(<a href="https://liberapay.com/june/donate"><img alt="Donate using Liberapay" src="https://liberapay.com/assets/widgets/donate.svg"></a>)); + return 0; +} + +#define CTAGS_PATTERN "*.[chlmy]" +#define TEMPLATE "/tmp/filter.XXXXXXXXXX" + +static char tmp[PATH_MAX]; +static char tags[] = TEMPLATE; +static void cleanup(void) { + unlink(tmp); + unlink(tags); +} + +static int source(int argc, char *argv[]) { + if (argc < 2) return 1; + if ( + strcmp("Makefile", argv[1]) && + strcmp(".profile", argv[1]) && + strcmp(".shrc", argv[1]) && + fnmatch(CTAGS_PATTERN, argv[1], 0) && + fnmatch("*.mk", argv[1], 0) && + fnmatch("*.[1-9]", argv[1], 0) && + fnmatch("*.sh", argv[1], 0) + ) { + execlp("hilex", "hilex", "-t", "-n", argv[1], "-f", "html", NULL); + err(127, "hilex"); + } + + const char *ext = strrchr(argv[1], '.'); + if (!strcmp(argv[1], ".profile") || !strcmp(argv[1], ".shrc")) { + ext = ".sh"; + } else if (!strcmp(argv[1], "Makefile")) { + ext = ".mk"; + } else if (!ext) { + ext = ""; + } + + snprintf(tmp, sizeof(tmp), TEMPLATE "%s", ext); + int fd = mkstemps(tmp, strlen(ext)); + if (fd < 0) err(1, "%s", tmp); + atexit(cleanup); + + char buf[4096]; + for (ssize_t len; 0 < (len = read(STDIN_FILENO, buf, sizeof(buf)));) { + if (write(fd, buf, len) < 0) err(1, "%s", tmp); + } + if (close(fd) < 0) err(1, "%s", tmp); + + fd = mkstemp(tags); + if (fd < 0) err(1, "%s", tags); + close(fd); + pid_t pid = fork(); + if (pid < 0) err(1, "fork"); + if (!pid) { + if (!fnmatch(CTAGS_PATTERN, argv[1], 0)) { + execlp("ctags", "ctags", "-w", "-f", tags, tmp, NULL); + warn("ctags"); + } else { + execlp("mtags", "mtags", "-f", tags, tmp, NULL); + warn("mtags"); + } + _exit(127); + } + int status; + if (wait(&status) < 0) err(1, "wait"); + + int rw[2]; + if (pipe(rw) < 0) err(1, "pipe"); + pid = fork(); + if (pid < 0) err(1, "fork"); + if (!pid) { + dup2(rw[1], STDOUT_FILENO); + close(rw[0]); + close(rw[1]); + execlp("hilex", "hilex", "-f", "html", tmp, NULL); + warn("hilex"); + _exit(127); + } + pid = fork(); + if (pid < 0) err(1, "fork"); + if (!pid) { + dup2(rw[0], STDIN_FILENO); + close(rw[0]); + close(rw[1]); + execlp("htagml", "htagml", "-im", "-f", tags, tmp, NULL); + warn("htagml"); + _exit(127); + } + close(rw[0]); + close(rw[1]); + + if (wait(&status) < 0) err(1, "wait"); + if (wait(&status) < 0) err(1, "wait"); + return status; +} + +int main(int argc, char *argv[]) { +#ifdef __OpenBSD__ + int error; + switch (getprogname()[0]) { + break; case 'a': error = pledge("stdio exec", NULL); + break; case 's': error = pledge("stdio tmppath proc exec", NULL); + break; default: error = pledge("stdio", NULL); + } + if (error) err(1, "pledge"); +#endif + switch (getprogname()[0]) { + case 'a': return about(argc, argv); + case 'e': return email(); + case 'o': return owner(); + case 's': return source(argc, argv); + default: return 1; + } +} diff --git a/www/git.causal.agency/index.7 b/www/git.causal.agency/index.7 new file mode 100644 index 00000000..58a40dfe --- /dev/null +++ b/www/git.causal.agency/index.7 @@ -0,0 +1,81 @@ +.Dd January 12, 2024 +.Dt GIT.CAUSAL.AGENCY 7 +.Os "Causal Agency" +. +.Sh NAME +.Nm causal agency +.Nd \(dqI think some people from the Gentoo project are behind this.\(dq +. +.Sh DESCRIPTION +basically cgit (awful software) +getting hammered by web crawlers +keeps making my machine crash. +this static page will be here +until I can find a better solution. +clone urls and tarball urls are still functional. +. +.Bl -tag +.It src \(em dontfiles +.Dl git clone https://git.causal.agency/src +.It ascii.town +.Bl -tag +.It torus \(em collaborative ASCII art +.Dl git clone https://git.causal.agency/torus +.It play \(em some games for SSH +.Dl git clone https://git.causal.agency/play +.El +.It email +.Bl -tag +.It imbox \(em IMAP to mbox +.Dl git clone https://git.causal.agency/imbox +.It bubger \(em IMAP archive generator +.Dl git clone https://git.causal.agency/bubger +.It notemap \(em notemap +.Dl git clone https://git.causal.agency/notemap +.El +.It forks +.Bl -tag +.It shulker \(em Discord to vanilla Minecraft bridge +.Dl git clone https://git.causal.agency/shulker +.It cgit-pink \(em web frontend for git +.Dl git clone https://git.causal.agency/cgit-pink +.It dash \(em patched shell with cmake build +.Dl git clone https://git.causal.agency/dash +.El +.It games +.Bl -tag +.It wep \(em Windows Entertainment Pack recreations +.Dl git clone https://git.causal.agency/wep +.It cards \(em CARDS.DLL loader for SDL +.Dl git clone https://git.causal.agency/cards +.El +.It irc +.Bl -tag +.It scooper \(em web interface for litterbox +.Dl git clone https://git.causal.agency/scooper +.It litterbox \(em IRC logger +.Dl git clone https://git.causal.agency/litterbox +.It pounce \(em IRC bouncer +.Dl git clone https://git.causal.agency/pounce +.It catgirl \(em IRC client +.Dl git clone https://git.causal.agency/catgirl +.El +.It ports +.Bl -tag +.It jorts \(em my own ports tree for macOS +.Dl git clone https://git.causal.agency/jorts +.It exman \(em manuals for other systems +.Dl git clone https://git.causal.agency/exman +.It libretls \(em libtls for OpenSSL +.Dl git clone https://git.causal.agency/libretls +.It ports \(em Fx and Ox ports for this software +.Dl git clone https://git.causal.agency/ports +.El +.It system +.Bl -tag +.It kitd \(em process supervisor for OpenBSD +.Dl git clone https://git.causal.agency/kitd +.It catsit \(em (deprecated) process supervisor +.Dl git clone https://git.causal.agency/catsit +.El +.El diff --git a/www/git.causal.agency/source-filter.sh b/www/git.causal.agency/source-filter.sh deleted file mode 100644 index 4febc2e0..00000000 --- a/www/git.causal.agency/source-filter.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh - -exec /usr/local/libexec/hi -t -n "$1" -f html -o anchor diff --git a/www/photo.causal.agency/.gitignore b/www/photo.causal.agency/.gitignore new file mode 100644 index 00000000..a5f66a9d --- /dev/null +++ b/www/photo.causal.agency/.gitignore @@ -0,0 +1,2 @@ +static/ +*.JPG diff --git a/www/photo.causal.agency/2024-04-10/IMG_0832.txt b/www/photo.causal.agency/2024-04-10/IMG_0832.txt new file mode 100644 index 00000000..65724024 --- /dev/null +++ b/www/photo.causal.agency/2024-04-10/IMG_0832.txt @@ -0,0 +1,6 @@ +a red brick wall with some faded black graffiti. +in the lower third, some bricks are missing +from the outer layer in an arc shape. +along the bottom is a ledge of conrete +lightly covered in brick dust and chunks +below the missing areas above. diff --git a/www/photo.causal.agency/2024-04-10/IMG_0850.txt b/www/photo.causal.agency/2024-04-10/IMG_0850.txt new file mode 100644 index 00000000..4cbb3def --- /dev/null +++ b/www/photo.causal.agency/2024-04-10/IMG_0850.txt @@ -0,0 +1,6 @@ +grey steel beams of a building in early construction +on a background of blue sky with some light clouds. +the beams are intersecting at odd points, +implying the final building will not be a simple box. +the sun casts dark shadows into the interiors +of the I-shaped metal. diff --git a/www/photo.causal.agency/2024-04-10/IMG_0852.txt b/www/photo.causal.agency/2024-04-10/IMG_0852.txt new file mode 100644 index 00000000..707d7cd6 --- /dev/null +++ b/www/photo.causal.agency/2024-04-10/IMG_0852.txt @@ -0,0 +1,4 @@ +in the foreground, a metal construction fence. +behind that, the bright red arm of a sort of small crane. +the arm is horizontal and crushing a perpendicular piece of fence, +which has deformed smoothly under it. diff --git a/www/photo.causal.agency/2024-04-10/IMG_0858.txt b/www/photo.causal.agency/2024-04-10/IMG_0858.txt new file mode 100644 index 00000000..42f243e4 --- /dev/null +++ b/www/photo.causal.agency/2024-04-10/IMG_0858.txt @@ -0,0 +1,6 @@ +an uneven grid of old wooden-framed windows in an alley. +the red paint on the frames is peeling badly, +completely stripped in some spots. +in the reflections of the lower windows +we see the roofs of the opposite buildings +and hints of clouds in the sky. diff --git a/www/photo.causal.agency/2024-04-10/IMG_0859.txt b/www/photo.causal.agency/2024-04-10/IMG_0859.txt new file mode 100644 index 00000000..ca33d7e0 --- /dev/null +++ b/www/photo.causal.agency/2024-04-10/IMG_0859.txt @@ -0,0 +1,6 @@ +an old backetball hoop mounted in an alley. +the backboard has been graffitied +and vines have invaded. +a few red strands of net are left hanging from the hoop. +the fence behind is painted with a design of yellow, purple, white and blue. +it's the kind of hoop airbud might be hanging around. diff --git a/www/photo.causal.agency/2024-04-10/IMG_0865.txt b/www/photo.causal.agency/2024-04-10/IMG_0865.txt new file mode 100644 index 00000000..7a955fc2 --- /dev/null +++ b/www/photo.causal.agency/2024-04-10/IMG_0865.txt @@ -0,0 +1,2 @@ +deep tire tread pressed into mud in the center of an alley. +a small branch of evergreen lies to one side. diff --git a/www/photo.causal.agency/2024-04-10/IMG_0890.txt b/www/photo.causal.agency/2024-04-10/IMG_0890.txt new file mode 100644 index 00000000..9d2cdc43 --- /dev/null +++ b/www/photo.causal.agency/2024-04-10/IMG_0890.txt @@ -0,0 +1,9 @@ +a pipe coming out of a light brown brick wall. +the pipe comes out of a metal square in the centre of the wall, +travels up and left for a bit, +before continuing straight up out of frame. +opposite, in the bottom right, +is the top of a red metal grate in front +of a ground-level window. +the brick below where the pipe enters the wall +is stained dark. diff --git a/www/photo.causal.agency/2024-04-14/IMG_1054.txt b/www/photo.causal.agency/2024-04-14/IMG_1054.txt new file mode 100644 index 00000000..f4803ee2 --- /dev/null +++ b/www/photo.causal.agency/2024-04-14/IMG_1054.txt @@ -0,0 +1,5 @@ +a short wall of natural rock, +all broken up somewhat neatly +along horizontal and vertical lines. +most of the rock is cool grey, +while some parts are warm brown. diff --git a/www/photo.causal.agency/2024-04-14/IMG_1058.txt b/www/photo.causal.agency/2024-04-14/IMG_1058.txt new file mode 100644 index 00000000..21aeb189 --- /dev/null +++ b/www/photo.causal.agency/2024-04-14/IMG_1058.txt @@ -0,0 +1,6 @@ +moss on a bit of exposed natural rock +surrounded by mostly brown grass. +there is shorter, darker green and brown moss, +as well as longer lighter green moss. +some small pieces of the rock are broken off +and lay in little piles. diff --git a/www/photo.causal.agency/2024-04-14/IMG_1066.txt b/www/photo.causal.agency/2024-04-14/IMG_1066.txt new file mode 100644 index 00000000..81747287 --- /dev/null +++ b/www/photo.causal.agency/2024-04-14/IMG_1066.txt @@ -0,0 +1,10 @@ +two green buds on the end of a thin branch +on a blurry brown backdrop. +the branch enters the frame +from the bottom left corner, +and there are three other pairs of buds +along it, +out of focus. +there is a hint of another bebudded branch +in the background, +but there is otherwise very little green. diff --git a/www/photo.causal.agency/generate.sh b/www/photo.causal.agency/generate.sh new file mode 100644 index 00000000..4b30db92 --- /dev/null +++ b/www/photo.causal.agency/generate.sh @@ -0,0 +1,211 @@ +#!/bin/sh +set -eu + +mkdir -p static/preview static/thumbnail + +resize() { + local photo=$1 size=$2 output=$3 + if ! test -f $output; then + # FIXME: convert complains about not understanding XML + echo $output >&2 + convert $photo -auto-orient -thumbnail $size $output 2>/dev/null ||: + fi +} + +preview() { + local photo=$1 + local preview=preview/${photo##*/} + resize $photo 25% static/$preview + echo $preview +} + +thumbnail() { + local photo=$1 + local thumbnail=thumbnail/${photo##*/} + resize $photo 5% static/$thumbnail + echo $thumbnail +} + +encode() { + sed ' + s/&/\&/g + s/</\</g + s/"/\"/g + ' "$@" +} + +page_title() { + date -j -f '%F' $1 '+%B %e, %Y' +} + +page_head() { + local date=$1 + local title=$(page_title $date) + cat <<-EOF + <!DOCTYPE html> + <meta charset="utf-8"> + <meta name="viewport" content="width=device-width, initial-scale=1.0"> + <link rel="alternate" type="application/atom+xml" href="../feed.atom"> + <title>${title}</title> + <style> + html { color: #bbb; background-color: black; font-family: sans-serif; } + figure { margin: 1em; padding-top: 0.5em; text-align: center; } + img { max-width: calc(100vw - 2.5em); max-height: calc(100vh - 2.5em); } + details { max-width: 78ch; margin: 0.5em auto; } + </style> + <h1>${title}</h1> + EOF +} + +photo_info() { + local photo=$1 + ExposureTime= + FNumber= + FocalLength= + PhotographicSensitivity= + eval $( + identify -format '%[EXIF:*]' $photo 2>/dev/null | + grep -E 'ExposureTime|FNumber|FocalLength|PhotographicSensitivity' | + sed 's/^exif://' + ) +} + +photo_id() { + local photo=$1 + photo=${photo##*/} + photo=${photo%%.*} + echo $photo +} + +page_photo() { + local photo=$1 preview=$2 description=$3 + if ! test -f $description; then + description=/dev/null + fi + photo_info $photo + cat <<-EOF + <figure id="$(photo_id $photo)"> + <a href="${photo##*/}"> + <img src="../${preview}" alt="$(encode $description)"> + </a> + <figcaption> + ${ExposureTime} · + ƒ/$(bc -S 1 -e ${FNumber}) · + $(bc -e ${FocalLength}) mm · + ${PhotographicSensitivity} ISO + <details> + <summary>description</summary> + $(encode $description) + </details> + </figcaption> + </figure> + EOF +} + +index_head() { + cat <<-EOF + <!DOCTYPE html> + <meta charset="utf-8"> + <meta name="viewport" content="width=device-width, initial-scale=1.0"> + <link rel="alternate" type="application/atom+xml" href="feed.atom"> + <title>Photos</title> + <style> + html { color: #bbb; background-color: black; font-family: sans-serif; } + a { text-decoration: none; color: inherit; } + </style> + EOF +} + +index_page() { + local date=$1 root=${2:-} + cat <<-EOF + <h1><a href="${root}${root:+/}${date}/">$(page_title $date)</a></h1> + EOF +} + +index_photo() { + local date=$1 photo=$2 thumbnail=$3 root=${4:-} + cat <<-EOF + <a href="${root}${root:+/}${date}/#$(photo_id $photo)"> + <img src="${root}${root:+/}${thumbnail}"> + </a> + EOF +} + +Root=https://photo.causal.agency + +atom_head() { + local updated=$(date -u '+%FT%TZ') + cat <<-EOF + <?xml version="1.0" encoding="utf-8"?> + <feed xmlns="http://www.w3.org/2005/Atom"> + <title>Photos</title> + <author><name>june</name><email>june@causal.agency</email></author> + <link href="${Root}"/> + <link rel="self" href="${Root}/feed.atom"/> + <id>${Root}/</id> + <updated>${updated}</updated> + EOF +} + +atom_entry_head() { + local date=$1 + local updated=$( + date -ju -f '%s' $(stat -f '%m' static/${date}/index.html) '+%FT%TZ' + ) + cat <<-EOF + <entry> + <title>$(page_title $date)</title> + <link href="${Root}/${date}/"/> + <id>${Root}/${date}/</id> + <updated>${updated}</updated> + <content type="html"> + EOF +} + +atom_entry_tail() { + cat <<-EOF + </content> + </entry> + EOF +} + +atom_tail() { + cat <<-EOF + </feed> + EOF +} + +set -- +for date in 20*; do + mkdir -p static/${date} + page=static/${date}/index.html + if ! test -f $page; then + echo $page >&2 + page_head $date >$page + for photo in ${date}/*.JPG; do + preview=$(preview $photo) + if ! test -f static/${photo}; then + ln $photo static/${photo} + fi + page_photo $photo $preview ${photo%.JPG}.txt >>$page + done + fi + set -- $date "$@" +done + +echo static/index.html >&2 +index_head >static/index.html +echo static/feed.atom >&2 +atom_head >static/feed.atom +for date; do + index_page $date >>static/index.html + atom_entry_head $date >>static/feed.atom + for photo in ${date}/*.JPG; do + thumbnail=$(thumbnail $photo) + index_photo $date $photo $thumbnail >>static/index.html + index_photo $date $photo $thumbnail $Root | encode >>static/feed.atom + done + atom_entry_tail >>static/feed.atom +done +atom_tail >>static/feed.atom diff --git a/www/photo.causal.agency/rsync.sh b/www/photo.causal.agency/rsync.sh new file mode 100644 index 00000000..957911d2 --- /dev/null +++ b/www/photo.causal.agency/rsync.sh @@ -0,0 +1,5 @@ +#!/bin/sh +set -eu + +sh generate.sh +rsync -av static/ scout:/var/www/photo.causal.agency diff --git a/www/temp.causal.agency/.gitignore b/www/temp.causal.agency/.gitignore new file mode 100644 index 00000000..e31ee94e --- /dev/null +++ b/www/temp.causal.agency/.gitignore @@ -0,0 +1 @@ +up diff --git a/www/temp.causal.agency/Makefile b/www/temp.causal.agency/Makefile new file mode 100644 index 00000000..a69a2b48 --- /dev/null +++ b/www/temp.causal.agency/Makefile @@ -0,0 +1,15 @@ +CGI_BIN = /var/www/cgi-bin + +CFLAGS += -std=c11 -Wall -Wextra -Wpedantic $$(pkg-config --cflags kcgi) +LDLIBS = -static $$(pkg-config --static --libs kcgi-html) + +up: + +clean: + rm -f up + +install: up + install up ${CGI_BIN}/up + +uninstall: + rm -f ${CGI_BIN}/up diff --git a/www/temp.causal.agency/up.c b/www/temp.causal.agency/up.c new file mode 100644 index 00000000..561a8901 --- /dev/null +++ b/www/temp.causal.agency/up.c @@ -0,0 +1,193 @@ +/* Copyright (C) 2020 June McEnroe <june@causal.agency> + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +#include <err.h> +#include <fcntl.h> +#include <stdarg.h> +#include <stdint.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <sys/types.h> +#include <sysexits.h> +#include <time.h> +#include <unistd.h> + +#include <kcgi.h> +#include <kcgihtml.h> + +static const char *Page = "up"; +static const struct kvalid Key = { NULL, "file" }; + +static enum kcgi_err head(struct kreq *req, enum khttp http, enum kmime mime) { + return khttp_head(req, kresps[KRESP_STATUS], "%s", khttps[http]) + || khttp_head(req, kresps[KRESP_CONTENT_TYPE], "%s", kmimetypes[mime]); +} + +static enum kcgi_err fail(struct kreq *req, enum khttp http) { + return head(req, http, KMIME_TEXT_PLAIN) + || khttp_body(req) + || khttp_printf(req, "%s\n", khttps[http]); +} + +static int dir = -1; +static const char *upload(const char *ext, void *ptr, size_t len) { + static char name[256]; + snprintf( + name, sizeof(name), "%jx%08x%s%s", + (intmax_t)time(NULL), arc4random(), + (ext && ext[0] != '.' ? "." : ""), (ext ? ext : "") + ); + int fd = openat(dir, name, O_CREAT | O_EXCL | O_WRONLY, 0644); + if (fd < 0) { + warn("%s", name); + return NULL; + } + ssize_t n = write(fd, ptr, len); + int error = close(fd); + if (n < 0 || error) { + warn("%s", name); + return NULL; + } + return name; +} + +static enum kcgi_err handle(struct kreq *req) { + if (req->page) return fail(req, KHTTP_404); + + if (req->method == KMETHOD_GET) { + struct khtmlreq html; + struct khtmlreq *h = &html; + return head(req, KHTTP_200, KMIME_TEXT_HTML) + || khttp_body(req) + || khtml_open(h, req, 0) + || khtml_elem(h, KELEM_DOCTYPE) + || khtml_elem(h, KELEM_TITLE) + || khtml_puts(h, "Upload") + || khtml_closeelem(h, 1) + || khtml_attr( + h, KELEM_FORM, + KATTR_METHOD, "post", + KATTR_ACTION, "", + KATTR_ENCTYPE, "multipart/form-data", + KATTR__MAX + ) + || khtml_attr( + h, KELEM_INPUT, + KATTR_TYPE, "file", + KATTR_NAME, Key.name, + KATTR__MAX + ) + || khtml_attr( + h, KELEM_INPUT, + KATTR_TYPE, "submit", + KATTR_VALUE, "Upload", + KATTR__MAX + ) + || khtml_close(h); + + } else if (req->method == KMETHOD_POST) { + struct kpair *field = req->fieldmap[0]; + if (!field || !field->valsz) return fail(req, KHTTP_400); + + const char *ext = strrchr(field->file, '.'); + const char *name = upload(ext, field->val, field->valsz); + if (!name) return fail(req, KHTTP_507); + + return head(req, KHTTP_303, KMIME_TEXT_PLAIN) + || khttp_head(req, kresps[KRESP_LOCATION], "/%s", name) + || khttp_body(req) + || khttp_puts(req, name); + + } else if (req->method == KMETHOD_PUT) { + struct kpair *field = req->fields; + if (!field || !field->valsz) return fail(req, KHTTP_400); + + const char *ext = req->suffix; + if (!ext[0]) ext = strrchr(field->file, '.'); + const char *name = upload(ext, field->val, field->valsz); + if (!name) return fail(req, KHTTP_507); + + return head(req, KHTTP_200, KMIME_TEXT_PLAIN) + || khttp_body(req) + || khttp_printf( + req, "%s://%s/%s\n", kschemes[req->scheme], req->host, name + ); + + } else { + return fail(req, KHTTP_405); + } +} + +int main(int argc, char *argv[]) { + int error; + const char *path = (argc > 1 ? argv[1] : "."); + dir = open(path, O_DIRECTORY); + if (dir < 0) err(EX_NOINPUT, "%s", path); + +#ifdef __OpenBSD__ + error = unveil(path, "wc"); + if (error) err(EX_OSERR, "unveil"); +#endif + + if (!khttp_fcgi_test()) { +#ifdef __OpenBSD__ + error = pledge("stdio wpath cpath proc", NULL); + if (error) err(EX_OSERR, "pledge"); +#endif + + struct kreq req; + error = khttp_parse(&req, &Key, 1, &Page, 1, 0); + if (error) errx(EX_PROTOCOL, "khttp_parse: %s", kcgi_strerror(error)); + +#ifdef __OpenBSD__ + error = pledge("stdio wpath cpath", NULL); + if (error) err(EX_OSERR, "pledge"); +#endif + + error = handle(&req); + if (error) errx(EX_PROTOCOL, "%s", kcgi_strerror(error)); + khttp_free(&req); + return EX_OK; + } + +#ifdef __OpenBSD__ + error = pledge("stdio wpath cpath unix sendfd recvfd proc", NULL); + if (error) err(EX_OSERR, "pledge"); +#endif + + struct kfcgi *fcgi; + error = khttp_fcgi_init(&fcgi, &Key, 1, &Page, 1, 0); + if (error) errx(EX_CONFIG, "khttp_fcgi_init: %s", kcgi_strerror(error)); + +#ifdef __OpenBSD__ + error = pledge("stdio wpath cpath recvfd", NULL); + if (error) err(EX_OSERR, "pledge"); +#endif + + for ( + struct kreq req; + !(error = khttp_fcgi_parse(fcgi, &req)); + khttp_free(&req) + ) { + error = handle(&req); + if (error && error != KCGI_HUP) break; + } + if (error != KCGI_EXIT) { + errx(EX_PROTOCOL, "khttp_fcgi_parse: %s", kcgi_strerror(error)); + } + khttp_fcgi_free(fcgi); +} diff --git a/www/text.causal.agency/.gitignore b/www/text.causal.agency/.gitignore index 37dd51ef..66b3e637 100644 --- a/www/text.causal.agency/.gitignore +++ b/www/text.causal.agency/.gitignore @@ -1,2 +1,4 @@ *.txt +colb feed.atom +igp diff --git a/www/text.causal.agency/010-irc-suite.7 b/www/text.causal.agency/010-irc-suite.7 index 5f799785..515a30ab 100644 --- a/www/text.causal.agency/010-irc-suite.7 +++ b/www/text.causal.agency/010-irc-suite.7 @@ -358,11 +358,37 @@ If you try any of this software and have feedback, let me know in .Li #ascii.town -on freenode +on tilde.chat or by email. And of course, patches are always welcome. . +.Ss Update: scooper +Somehow I had the motivation +to create a web interface for litterbox: +.Xr scooper 1 . +It can be used either as CGI +or as a FastCGI worker, +and I used the excellent +.Xr kcgi 3 +library for it. +. +.Pp +The main advantage of this interface +is that you can click on a search result +to be brought to its context in the log viewer. +I also added an option to +.Xr litterbox 1 +to provide a corresponding scooper link +in response to its query interface. +. +.Pp +A small demo of scooper is hosted at +.Aq Lk "https://causal.agency/scooper/" . +It publicly logs the +.Li #litterbox +channel on tilde.chat. +. .Sh SEE ALSO .Bl -item -compact .It @@ -373,6 +399,10 @@ patches are always welcome. .Lk "https://git.causal.agency/catgirl" catgirl .It .Lk "https://www.sqlite.org/fts5.html" "SQLite FTS5 Extension" +.It +.Lk "https://git.causal.agency/scooper" scooper +.It +.Lk "https://kristaps.bsd.lv/kcgi/" kcgi .El . .Sh AUTHORS diff --git a/www/text.causal.agency/011-libretls.7 b/www/text.causal.agency/011-libretls.7 new file mode 100644 index 00000000..c29c325e --- /dev/null +++ b/www/text.causal.agency/011-libretls.7 @@ -0,0 +1,220 @@ +.Dd August 9, 2020 +.Dt LIBRETLS 7 +.Os "Causal Agency" +. +.Sh NAME +.Nm LibreTLS +.Nd libtls for OpenSSL +. +.Sh DESCRIPTION +This is a sort of announcement post about LibreTLS, +my port of libtls from LibreSSL to OpenSSL. +If you've wanted to try any of my software +but have been unable to because of LibreSSL, +LibreTLS is an option that will likely work for you. +I'm including instructions +for building it and my IRC software +on Debian as an example, +since manually installing libraries +is less straightforward than it could be. +. +.Pp +libtls is +.Do +a new TLS library, +designed to make it easier to write foolproof applications +.Dc . +It was developed as part of LibreSSL, +.Ox Ap s +fork of OpenSSL, +and is implemented against their version of libssl. +It provides a nice high-level API +for TLS sockets, +with functions like +.Xr tls_connect 3 , +.Xr tls_read 3 +and +.Xr tls_write 3 . +This is a vast improvement over libssl's +confusing mess of an API! +Its relative obscurity is a real shame +for C programmers. +. +.Pp +An obvious cause of its obscurity +is that it is tied to LibreSSL. +Although LibreSSL is available +for platforms other than +.Ox , +it conflicts with OpenSSL +so is difficult to install alongside it +and is often not packaged at all. +Additionally, +even if a user manually installs LibreSSL, +libtls is likely not to work on some distros +due to its hardcoded CA bundle file path. +. +.Pp +Since libtls is implemented against libssl, +which originates in OpenSSL, +it should be possible to use libtls with it. +This is what I set out to do in LibreTLS. +I started by importing the sources +from a LibreSSL-portable release, +then worked on porting the portions +that were incompatible with OpenSSL. +. +.Pp +The simpler changes just involved +replacing internal struct field accesses +with public APIs. +libtls accesses libssl internals +using a hack to get the header files +to declare private struct fields, +and for basically no reason. +The bigger changes involved +reimplementing some functions +which only exist in LibreSSL, +but these were still quite small. +I also imported the necessary compatibility functions +from LibreSSL's libcrypto +and adapated the autotools build files +to produce only a libtls +which depends on OpenSSL. +. +.Pp +Along the way +I decided to make one small behavioural change +in order for LibreTLS to be more likely +to work for everyone. +I removed the hardcoded CA file path +and changed the default configuration +to use OpenSSL's default CA paths, +which include a CA directory. +This seems to be the preferred CA source +on systems such as Debian, +where the default CA file path doesn't exist. +. +.Pp +I think the reason LibreSSL +wants to avoid using a CA directory +is so that it can fully load the CA file +once before being sandboxed. +However, +using OpenSSL's default configuration, +the CA file will still be loaded immediately +if it exists. +If it doesn't exist, +sandboxed applications +will fail when trying to +load certificates from the directory, +but unsandboxed applications +will work just fine. +Since LibreSSL's libtls +would fail either way, +I think the new behaviour +is an improvement. +. +.Pp +Another advantage of separating libtls from LibreSSL +is that it is unencumbered by OpenSSL's +awkward double-license, +both of which are incompatible with the GPL. +libtls is all new ISC-licensed code, +and future versions of OpenSSL (3.0) +will be released under the Apache 2.0 license, +which is compatible with GPLv3. +In the future, +GPL software will be able to link with +libtls and OpenSSL without additional permissions. +. +.Pp +It's also worth noting that LibreSSL +likely will not be able to import any code +from future versions of OpenSSL, +since Apache 2.0 is on +.Ox Ap s +license shitlist. +LLVM is also slowly changing their license +to Apache 2.0, +so it'll be interesting to see what +.Ox +does. +. +.Ss Installing Manually +To install LibreTLS on Debian, +for example, +fetch a release tarball from +.Lk https://causal.agency/libretls/ +and install the build dependencies: +.Bd -literal -offset indent +sudo apt-get install build-essential libssl-dev pkgconf +.Ed +. +.Pp +.Xr pkgconf 1 +isn't a dependency of LibreTLS itself, +but it's how my software +configures its build +for a dependency on libtls. +The usual build steps +will install the library: +.Bd -literal -offset indent +\&./configure +make all +sudo make install +.Ed +. +.Pp +The library will be installed in +.Pa /usr/local/lib +by default, +and you need to make sure +the dynamic linker +will be able to find it there. +On Debian, +.Pa /usr/local/lib +already appears in +.Pa /etc/ld.so.conf.d/libc.conf , +but on other systems +you'll probably need to add it to either +.Pa /etc/ld.so.conf +or a new file such as +.Pa /etc/ld.so.conf.d/local.conf . +Once the library is installed +and the path is configured, +the linker cache needs to be refreshed: +.Bd -literal -offset indent +sudo ldconfig +.Ed +. +.Pp +You'll probably also need to set +.Ev PKG_CONFIG_PATH +for the configure scripts +of my software: +.Bd -literal -offset indent +PKG_CONFIG_PATH=/usr/local/lib/pkgconfig ./configure +.Ed +. +.Pp +On +.Fx , +LibreTLS and some of my IRC software +can be installed from my own +.Lk https://git.causal.agency/ports/ "ports tree" +. +.Sh SEE ALSO +.Bl -item -compact +.It +.Lk https://git.causal.agency/libretls/about LibreTLS +.It +.Lk https://man.openbsd.org/tls_init.3 "libtls API documentation" +.El +. +.Pp +Another alternative libtls implementation, +.Lk https://sr.ht/~mcf/libtls-bearssl/ "libtls-bearssl" +. +.Sh AUTHORS +.An June Bug Aq Mt june@causal.agency diff --git a/www/text.causal.agency/012-inability.7 b/www/text.causal.agency/012-inability.7 new file mode 100644 index 00000000..d352143b --- /dev/null +++ b/www/text.causal.agency/012-inability.7 @@ -0,0 +1,39 @@ +.Dd November 26, 2020 +.Dt INABILITY 7 +.Os "Causal Agency" +. +.Sh NAME +.Nm Inability +.Nd losing the ability to create +. +.Sh DESCRIPTION +For often weeks, sometimes months at a time, +I lose the ability to write new code. +I can still make fixes +and little cleanups +in my existing projects, +but if I try to work on something new, +nothing happens. +I can't get anything done. +. +.Pp +I think it's now been +over 3 months +since I've created anything. +I don't know what to do about it. +In the past I've eventually +regained the ability to code, +but it's unclear to me how or why. +I also don't know what +I should be doing instead. +Writing code is the only hobby +I've ever really developed, +so without it I basically +don't do anything. +. +.Pp +Does this happen to anyone else? +How do you cope? +. +.Sh AUTHORS +.Mt june@causal.agency diff --git a/www/text.causal.agency/013-hot-tips.7 b/www/text.causal.agency/013-hot-tips.7 new file mode 100644 index 00000000..63b6e353 --- /dev/null +++ b/www/text.causal.agency/013-hot-tips.7 @@ -0,0 +1,156 @@ +.Dd December 2, 2020 +.Dt HOT-TIPS 7 +.Os "Causal Agency" +. +.Sh NAME +.Nm hot tips +.Nd from my files +. +.Sh DESCRIPTION +This is a short list of tips +from my configuration files and code +that might be useful. +. +.Ss Shell +.Bl -tag -width Ds +.It CDPATH=:~ +This is useful if you sometimes type, +for example, +.Ql cd src/bin +wanting to go to +.Pa ~/src/bin +but you aren't in +.Pa ~ . +If the path doesn't exist +in the current directory, +.Ic cd +will try it in +.Pa ~ +as well. +. +.It alias ls='LC_COLLATE=C ls' +This makes it so that +.Xr ls 1 +lists files in ASCIIbetical order, +which puts capitalized names like +.Pa README +and +.Pa Makefile +first. +. +.It git config --global commit.verbose true +Not shell but close enough. +This makes it so the entire diff is shown +below the usual summary +in the editor for a +.Xr git-commit(1) +message. +Useful for doing a quick review +of what you're committing. +.El +. +.Ss (neo)vim +.Bl -tag -width Ds +.It set inccommand=nosplit +This is the only +.Xr nvim 1 +feature I really care about +aside from the improved defaults. +This provides a live preview of what a +.Ic :s +substitution command will do. +It makes it much easier to +write complex substitutions. +. +.It nmap <leader>s vip:sort<CR> +This mapping sorts the lines of a paragraph, +or block of text separated by blank lines. +I use this a lot to sort +#include directives. +. +.It nmap <leader>S $vi{:sort<CR> +Similar to the last mapping, +this one sorts lines inside braces. +I use this to sort +switch statement cases +or array initializers. +. +.It nmap <leader>a m':0/^#include <<CR>:nohlsearch<CR>O#include < +I use this mapping to add new +#include directives, +usually followed by +.Ic <leader>s +and +.Ic '' +to sort them +and return to where I was. +. +.It nmap <leader>d :0delete<CR>:0read !date +'.Dd \e%B \e%e, \e%Y'<CR> +I use this to replace the first line of +.Xr mdoc 7 +files with the current date. +.El +. +.Ss C +.Bl -tag -width Ds +.It #define Q(...) #__VA_ARGS__ +This is what I've started using +to quote things like SQL statements +or HTML fragments in C. +Anything that happens to be valid C tokens, +which is most code, +can be quoted this way. +Macros are not expanded +inside the quoted part. +You can embed (matched) quotes +without having to escape them. +Whitespace gets collapsed, +so you can write nicely formatted multi-line SQL +that doesn't mess up your debug logging, +for example. +.Bd -literal -offset indent +const char *sql = Q( + INSERT OR IGNORE INTO names (nick, user, host) + VALUES (:nick, :user, :host); +); +.Ed +. +.It #define BIT(x) x##Bit, x = 1 << x##Bit, x##Bit_ = x##Bit +I use this macro to declare bitflag enums. +It takes advantage of +auto-incrementing enum items +so you don't need to set the values manually. +You also get constants +for both the bit index +and the flag value +for each item. +.Bd -literal -offset indent +enum Attr { + BIT(Bold), + BIT(Reverse), + BIT(Italic), + BIT(Underline), +}; +.Ed +.Pp +For example, +defines +.Sy ItalicBit = 2 +and +.Sy Italic = 1 << 2 . +Ignore the extraneous constants. +. +.It typedef int FnType(const char *str, size_t len); +You can just typedef function types! +It annoys me more than it probably should +that everyone writes ugly +function pointer typedefs. +Just stick +.Sy typedef +on the front of a function declaration +and use +.Vt FnType * . +.El +. +.Sh AUTHORS +.Mt june@causal.agency diff --git a/www/text.causal.agency/014-using-vi.7 b/www/text.causal.agency/014-using-vi.7 new file mode 100644 index 00000000..e6a6a7a0 --- /dev/null +++ b/www/text.causal.agency/014-using-vi.7 @@ -0,0 +1,135 @@ +.Dd January 11, 2021 +.Dt USING-VI 7 +.Os "Causal Agency" +. +.Sh NAME +.Nm Using vi +.Nd simpler tools +. +.Sh DESCRIPTION +Happy new year +and hello from +.Xr vi 1 ! +I'm in the mood to post something +but not in the mood for +.Dq social +media. +This one will probably be short. +. +.Pp +Yesterday I was trying to work on sandboxing +.Xr catgirl 1 +(that's the IRC client I work on) +with +.Xr pledge 2 +and +.Xr unveil 2 +on +.Ox , +as suggested by the maintainer of its port. +I've done similar things before, +but only on server software +rather than user software. +. +.Pp +Anyway I was in +.Xr ssh 1 +to my +.Ox +VM +.Po +sadly I don't currently have any hardware to run +.Ox +on +.Pc +using my usual editor, +which is +.Xr nvim 1 . +I'm honestly not very thrilled +with what neovim is doing lately, +but the cleaned up defaults +make my configuration files happier. +. +.Pp +The real problem with +.Xr nvim 1 , +though, +is that it's laggy as hell on +.Ox . +There is significant delay +on every single keystroke, +as if I'm typing remotely to a server +on the other side of the world, +but this is on a local VM! +. +.Pp +So I did the only reasonable thing: +I typed +.Sy :qa +followed by +.Sy vi . +The difference was astonishing. +Typing and editing suddenly felt +.Em physical +again. +(I put that in italics even though I know it won't render.) +Not only was it a vast improvement over +.Xr nvim 1 +in +.Xr ssh 1 +in a VM, +it was a marked improvement over +.Xr nvim 1 +running locally and natively. +. +.Pp +Now obviously +.Xr vi 1 +doesn't have all the bells and whistles +of newer editors, +but of course the core editing model +that makes +.Xr vim 1 +and +.Xr nvim 1 +so good is there, +and in purer form, +I think. +The +.Xr vi 1 +manual page +is feasible to just sit down and read, +and learn everything there is to know about the editor. +I set up a basic configuration +and got coding. +.Bd -literal -offset indent +export EXINIT='set ai ic sm sw=4 ts=4' +.Ed +. +.Pp +After I finished my +.Xr pledge 2 +and +.Xr unveil 2 +patch, +I was so pleased with +.Xr vi 1 +that I kept on using it +yesterday and today +for other work, +and obviously to write this post. +Despite the lack of editor amenities, +its responsiveness and simplicity +are enough to make using it +.Em comfortable +and perhaps +.Em cosy . +I'm not sure I'll ever use +.Xr vi 1 +full-time, +but for now I am much less likely +to launch +.Xr nvim 1 . +. +.Sh AUTHORS +.An june Aq Mt june@causal.agency diff --git a/www/text.causal.agency/015-reusing-tags.7 b/www/text.causal.agency/015-reusing-tags.7 new file mode 100644 index 00000000..19546496 --- /dev/null +++ b/www/text.causal.agency/015-reusing-tags.7 @@ -0,0 +1,155 @@ +.Dd January 17, 2021 +.Dt REUSING-TAGS 7 +.Os "Causal Agency" +. +.Sh NAME +.Nm reusing tags +.Nd beyond ctags +. +.Sh DESCRIPTION +I've tried to start writing this post a couple times now +and I keep getting bogged down in explanations, +so I'm just going to tell you +about some cool things I did +and hope they make sense. +. +.Pp +When I wrote my first syntax highlighter, +I decided that function definitions +should have anchor links, +because line number anchor links +are entirely useless +if you expect the file to change at all. +Since the syntax highlighter +was somewhat deliberately just a big pile of regex, +I hacked in more regex to try +to identify function and type definitions. +It wasn't elegant and it didn't always work well. +It did work though, +and I found the links very useful. +. +.Pp +Recently I was thinking about +the lexer generator +.Xr lex 1 +and decided to +rewrite the syntax highlighter +using it. +Really syntax highlighting +is no different than lexical analysis. +I ran into a problem though, +trying to preserve my anchor link function, +because really that should involve +some amount of parsing. +Trying to port my regex hacks to +.Xr lex 1 +made the lexers way more complicated +and less reliable, +so I gave up on it for a while. +. +.Pp +And then, +probably in the shower, +I realized I was approaching it +completely from the wrong direction. +There's already a tool that does what I want, +and I already use it: +.Xr ctags 1 . +All I need to do is use its output +to insert anchor links +into my syntax highlighter output. +In an afternoon I wrote +.Xr htagml 1 , +which loads tag definitions for its input file, +then scans through the input for where they match. +It can either HTML-escape +the input as it goes, +or use already formatted HTML +being piped into it from a syntax highlighter. +. +.Pp +The result is three simple tools +working together to accomplish +what a more complex tool +couldn't reliably achieve. +I'm very pleased with it, +and I've updated my site and cgit +to use the new +.Xr lex 1 Ns -based +highlighter, +.Xr ctags 1 +and +.Xr htagml 1 . +I'm currently missing a lexer for +.Xr sh 1 , +but I plan to write it eventually. +I also want to write a tool +to generate tags for +.Xr make 1 , +.Xr mdoc 7 +and perhaps +.Xr sh 1 . +The cool thing about generating more kinds of tags +is that they'll not only improve +the HTML output, +they'll also be usable in my editor. +. +.Pp +Speaking of generating different kinds of tags, +I also wrote some scripts not too long ago +for reading IETF RFCs offline. +The plain text files are available to +.Xr rsync 1 , +but they're hard to navigate on their own. +By scanning the files for headings +and generating tags, +it allows jumping to sections using +.Ic :ta +or +.Ic ^] +in +.Xr vi 1 . +For +.Xr nvim 1 +I also added an +.Ic :RFC +command to open an RFC by number +and set up +.Ic ^] +to work optimally for them. +. +.Pp +I'm still using +.Xr vi 1 +for most of my editing, +by the way. +And of course +.Xr ctags 1 +was made to work with it! +Simple old tools +are really doing it for me lately. +. +.Sh SEE ALSO +.Bl -item -compact +.It +.Lk https://causal.agency/bin/htagml.html htagml +.It +.Lk https://causal.agency/bin/hilex.html hilex +.It +.Lk https://git.causal.agency/src/tree/doc/rfc rfctags +.El +. +.Sh AUTHORS +.An june Aq Mt june@causal.agency +. +.Sh ADDENDUM +.Xr catgirl 1 , +.Xr pounce 1 , +.Xr litterbox 1 +and +.Xr scooper 1 +all have new releases, +if you're using any of them. +Also, this space is now +available over gopher, +if that's your sort of thing. diff --git a/www/text.causal.agency/016-using-openbsd.7 b/www/text.causal.agency/016-using-openbsd.7 new file mode 100644 index 00000000..b843e3c3 --- /dev/null +++ b/www/text.causal.agency/016-using-openbsd.7 @@ -0,0 +1,505 @@ +.Dd February 14, 2021 +.Dt USING-OPENBSD 7 +.Os "Causal Agency" +. +.Sh NAME +.Nm Using OpenBSD +.Nd for real +. +.Sh DESCRIPTION +Hello from +.Ox ! +After wishing one too many times +that I had a real BSD +on a physical machine, +I finally got around to +just installing one on my +mid-2014 MacBook Pro. +I hadn't done it sooner +because I didn't realize +how easy it would be. +It helped that I already had a +.Dq Boot Camp +partition with a disused Windows 8 install +that I could replace. +. +.Pp +I roughly followed an old jcs gist +along with the +.Ox +Disk Setup guide. +I'm once again happy +that I bought a printer\(em +they're very useful for instructions +to install an operating system +on your only usable computer. +I set up encrypted softraid +and the operating system +installed smoothly. +. +.Pp +Next I had to install rEFInd, +since the default Mac boot manager +is really not keen on booting much. +Installing it requires using the +macOS recovery partition these days. +But there was a problem +with my new boot menu: +I was promised a picture of Puffy, +and instead I just got some abstract coloured circles! +Turns out a bunch of OS icons +got removed from rEFInd at some point, +and I had to rescue Puffy +from the git history. +. +.Pp +So I could happily boot +.Ox +by selecting Puffy, +but I had no networking. +I thought the wifi chip might be supported by +.Xr bwfm 4 , +but I got unlucky and it's a BCM4360, +which everything hates. +Based on the jcs gist, +I checked the list of hardware +supported by the +.Xr urtwn 4 +driver for a wifi dongle to order. +Just having a clear list +in the driver manual is wonderful. +I went with the Edimax EW-7811Un v2, +which I could get for around $20. +It's nice and tiny, +though it has a piercing blue LED +(destroy all blue LEDs) +which I had to cover with electrical tape. +. +.Pp +I had to do one other thing +before I could get it all working, though. +When I had checked the +.Xr urtwn 4 +hardware list, +I had been looking at +.Ox Ns -current , +but I had installed +.Ox 6.8 , +and support for the v2 hardware +I had bought was added after that release. +So I downloaded a snapshot +.Pa bsd.rd +along with the +.Xr urtwn 4 +firmware file +to a USB drive +and upgraded the system. +. +.Pp +Connecting to wifi with +.Xr ifconfig 8 +is a breeze, by the way, +and then you just write the same thing to a +.Xr hostname.if 5 +file to make it automatic. +I wanted to use +.Ox +for exactly this reason: +simple, consistent, cohesive, well-documented tools. +. +.Pp +Finally, I got to configuring. +The console is configured with +.Xr wsconsctl 8 , +and similarly you can put the commands in +.Xr wsconsctl.conf 5 +to have them run at boot. +I added +.Li display.brightness=50% +to tone down the brightness, +which is initially 100%, +and +.Li keyboard.backlight=0% +to turn off those annoying lights. +.Xr wsconsctl.conf 5 +is also where you can set +trackpad settings if you're not using +.Xr synaptics 4 . +I ended up using: +.Bd -literal -offset indent +mouse1.tp.tapping=1 +mouse1.tp.scaling=0.2 +mouse1.reverse_scrolling=1 +.Ed +.Pp +This enables tapping with several fingers +to simulate different mouse buttons, +makes the cursor move at a reasonable speed +and scrolling move in the right direction. +I also set up my usual modified QWERTY layout. +. +.Pp +For +.Xr X 7 +I had enabled +.Xr xenodm 1 , +which seems quite nice. +It automatically prompts you to add your +.Xr ssh 1 +keys to +.Xr ssh-agent 1 +when you log in. +One of the reasons I had not wanted +to set up another graphical system +is that I thought +I would have to make too many choices, +and that I would have to choose least bad options +rather than actually good options, +but +.Ox +already includes reasonable choices. +I wanted to use +.Xr cwm 1 , +so I started a basic +.Pa .xsession +file: +.Bd -literal -offset indent +\&. ~/.profile +export LC_CTYPE=en_US.UTF-8 +xset r rate 175 m 5/4 0 +xmodmap ~/.config/X/modmap +xrdb -load ~/.config/X/resources +exec cwm -c ~/.config/cwm/cwmrc +.Ed +. +.Pp +The +.Xr xset 1 +command sets keyboard repeat rate +and mouse acceleration. +I spent some time going through +.Xr cwm 1 Ap s +functions and writing up bindings +that would get me something close enough +to what I'm used to in macOS. +Most importantly, +putting everything on the 4 modifier (command key). +. +.Pp +I also added key bindings on F1 and F2 +to adjust the brightness with +.Xr xbacklight 1 , +and on F10, F11 and F12 +to adjust volume with +.Xr sndioctl 1 . +I'm not sure why the F keys +just send regular F1, F2, etc.\& +regardless of the Fn key. +I don't use F keys for anything else though, +so I'm not too concerned. +Once again, +.Xr sndioctl 1 +is such an easy straightforward tool: +.Bd -literal -offset indent +bind-key F10 "sndioctl output.mute=!" +bind-key F11 "sndioctl output.level=-0.05" +bind-key F12 "sndioctl output.level=+0.05" +.Ed +. +.Pp +For aesthetic configuration, +I added a new output to my +.Xr scheme 1 +colour scheme tool for +.Xr X 7 Ns -style +RGB and +.Xr xterm 1 +resources. +Normally I use the +.Em Go Mono +font, +but since +.Ox +already includes +.Em Luxi Mono , +which +.Em Go Mono +is based on, +I used that. +The most important configuration +to make anything readable on a high-DPI display is: +.Bd -literal -offset indent +Xft.dpi: 144 +Xft.antialias: true +Xft.hinting: false +.Ed +. +.Pp +I'm annoyed that I haven't found +where these resources are actually documented. +I would hope they'd be in +.Xr Xft 3 +or something, +but they're not. +Anyway, +turning off hinting +seems absolutely necessary +to prevent text from looking like garbage. +. +.Pp +It seems that to get a reasonably sized cursor +I need to install +.Sy xcursor-dmz . +I'd prefer if there wasn't this one +extra package that I needed +for a reasonable setup. +Tangentially, +I've never understood why +the black versions of dmz cursors +are called +.Dq aa +when it seems like that +would stand for antialiasing +or something. +.Bd -literal -offset indent +Xcursor.size: 64 +Xcursor.theme: dmz-aa +.Ed +. +.Pp +For a desktop background, +I found a cute bitmap (little picture) +of snowflakes already in the system +and used colours from my usual scheme: +.Bd -literal -offset indent +xsetroot -bitmap /usr/X11R6/include/X11/bitmaps/xsnow \e + -bg rgb:14/13/0E -fg rgb:7A/49/55 +.Ed +. +.Pp +Since I'd rather not install anything +I don't have to, +I went with the default +.Xr xterm 1 . +It seems more than adequate, honestly. +I read through its RESOURCES +section to configure it how I like. +The important settings are +.Sy XTerm*utf8 +and +.Sy XTerm*metaSendsEscape . +Since I'm used to copying and pasting on macOS, +I added equivalent +.Dq translations : +.Bd -literal -offset indent +XTerm*VT100*translations: #override \en\e + Super <Key>C: copy-selection(CLIPBOARD) \en\e + Super <Key>V: insert-selection(CLIPBOARD) +.Ed +. +.Pp +The next thing I needed +was a clock and battery indicator. +I actually had my battery die on me +while I was doing all this, +which reminded me. +.Xr xclock 1 +would be perfect, +but then I'd need something else +for battery. +There are a couple basic battery indicators +for X in ports, +but they're terribly ugly. +I wanted something as simple as +.Xr xclock 1 , +but that I could add some other text to. +Then I realized I could just use +.Xr xterm 1 +for that. +To my +.Pa xsession +I added: +.Bd -literal -offset indent +xterm -name clock -geometry 14x1-0+0 -sl 0 -e clock & +.Ed +.Pp +This places a little terminal +in the top-right corner of the screen +with no scrollback lines, +running a script called +.Pa clock . +To have +.Xr cwm 1 +treat it like a +.Dq panel +and show it on every desktop, +I added this to my +.Pa cwmrc : +.Bd -literal -offset indent +ignore clock +autogroup 0 clock,XTerm +.Ed +.Pp +The +.Pa clock +script simply uses +.Xr date 1 +and +.Xr apm 8 +to print the time and battery charge +every minute: +.Bd -literal -offset indent +tput civis +sleep=$(( 60 - $(date +'%S' | sed 's/^0//') )) +while :; do + if [ $(apm -a) -eq 1 ]; then + printf '%3s%%' "$(apm -l)" + else + test $(apm -b) -eq 2 && tput setaf 1 bold + printf '%3.3sm' "$(apm -m)" + tput sgr0 + fi + printf ' %s\r' "$(date +'%a %H:%M')" + sleep $sleep + sleep=60 +done +.Ed +.Pp +The initial setting of +.Va sleep +is to align the updates +with the minute ticking over. +I made the battery output +a bit fancier by showing +percentage while charging, +minutes left while discharging, +and highlighting in red +when the battery is +.Dq critical . +. +.Pp +Now is a good time to mention adding +.Ql apmd_flags=-A +to +.Pa /etc/rc.conf.local +to enable +.Dq automatic performance adjustment , +or not running your battery flat +as fast as possible mode. +It seems like I can get up to 3 hours +of battery life depending on the screen brightness, +but this is quite an old battery by now. +. +.Pp +The other thing I needed +was something to tone down +that awful, evil blue light from the screen. +I asked around and someone told me about +.Xr sct 1 , +originally written by tedu. +The package also includes a little +.Xr sctd 1 +script that you can add to your +.Pa .xsession +to have it automatically adjust +the colour temperature throughout the day. +My eyes are no longer being assaulted. +. +.Pp +While I was doing all this, +I of course needed to talk about it on IRC, +and it was very nice to be able to +install my own IRC client with: +.Bd -literal -offset indent +doas pkg_add catgirl +.Ed +.Pp +I don't plan to do +general Web Browsing on +.Ox , +and there is definitely +no good choice for browser, +so I just installed +.Xr imv 1 , +.Xr mpv 1 , +.Xr youtube-dl 1 +and +.Xr w3m 1 . +I wrote a script +to open images by piping +.Xr curl 1 +into +.Xr imv 1 , +videos with +.Xr mpv 1 , +and everything else with +.Xr w3m 1 +in a new +.Xr xterm 1 . +Annoyingly, +.Xr mpv 1 +seems incapable of exiting +without segfaulting. +That's quality. +. +.Pp +One thing I am still missing +is automatic brightness adjustment +based on ambient light +like macOS can do. +I can read the sensor with +.Xr sysctl 8 +.Cm hw.sensors.asmc0.illuminance0 , +which is measured in lux. +I tried doing something with it in a script, +but it seems tricky to map its value +to brightness adjustments +and to play nice with manual brightness changes, +so I'll just keep doing it manually for now. +. +.Pp +Update: +prx sent mail to let me know about +.Aq Lk https://github.com/jcs/xdimmer . +I should've guessed jcs had written something. +. +.Pp +And that's my current +.Ox +setup after a week of using it. +I'm quite enjoying it, +and still being pleasantly surprised +by the quality-of-life from +.Ox +tools and documentation. +For a small example, +I can jump to sections +or flag definitions in +.Xr man 1 +using +.Ic :t . +Systems without basic usability like that +should be ashamed. +. +.Pp +I would post a screenshot, +but this is +.Li text.causal.agency +;) +. +.Sh SEE ALSO +.Lk https://gist.github.com/jcs/5573685 +.Pp +My full configurations are in +.Aq Lk https://git.causal.agency/src . +. +.Sh AUTHORS +.An june Aq Mt june@causal.agency +. +.Sh BUGS +There's a red LED +inside the headphone jack +that is always on +and I have no idea how to turn off. +If anyone knows +please send me an email. diff --git a/www/text.causal.agency/017-unpasswords.7 b/www/text.causal.agency/017-unpasswords.7 new file mode 100644 index 00000000..f9643f2f --- /dev/null +++ b/www/text.causal.agency/017-unpasswords.7 @@ -0,0 +1,153 @@ +.Dd February 20, 2021 +.Dt UNPASSWORDS 7 +.Os "Causal Agency" +. +.Sh NAME +.Nm Unpasswords +.Nd password anti-management +. +.Sh DESCRIPTION +Right away I want to say +that I'm not trying to tell anyone +how to manage their online authentication. +This is just how I do it, +and I haven't seen anyone else write about it. +. +.Pp +I don't use a password manager. +It's not a type of software +I want to deal with. +For the small handful of sites +that I use regularly +and that actually matter, +I use strong passwords +(stored in my noggin) +and TOTP. +For everything else, +I simply do not know the password, +and neither does any software. +. +.Pp +I think I started doing this one time +when I had legitimately forgotten +the password to some old account. +I clicked on +.Dq forgot my password +and opened the email, +but I didn't want to +come up with a new password +I would just forget again. +Instead I set a random one +.Po +I usually use +.Ql openssl rand -base64 33 +for this +.Pc +and immediately used that to log in +while it was still in my clipboard. +Next time I wanted to log in, +I could use +.Dq forgot my password +again. +. +.Pp +Thinking about it, +I realized that any web authentication +with an email password reset flow +is only ever as strong as +the authentication for your email account. +So what is the point of having +all these passwords set on different sites? +They all answer to your email account, +and storing them in a password manager +seems to add another potential point of failure. +May as well have no other passwords at all, +or as close as possible. +.Po +Shout out to sites like Liberapay +and asciienema +which let me not set a password at all. +.Pc +. +.Pp +So I started doing that for any site +that I don't regularly log in to. +Going through the password reset flow +can be a bit slow, +but it doesn't need to be done often. +And I can do it from anywhere +I have access to my email, +which I feel is more easily reliable +than syncing password management databases. +It's quite stress-free. +. +.Pp +After doing this manually for years, +this week I finally got around to +writing some automation for it. +A while ago I had written +.Xr imbox 1 , +a tool to directly export mail +in mboxrd format from IMAP, +along with +.Xr git-fetch-email 1 , +a wrapper which offloads configuration to +.Xr git-config 1 . +It can match emails by +Subject, From, To and Cc. +This week I added a flag +to use IMAP IDLE +to wait for a matching message +if there isn't one already, +and a flag to move matching messages +(for example to Trash) +after exporting them. +. +.Pp +With those two new flags, +I started writing some shell scripts +to automate the password reset flow +using +.Xr curl 1 +to submit forms and +.Xr git-fetch-email 1 +with +.Xr sed 1 +to pull the reset tokens +from my inbox. +At the end of the script, +the random password it set +is copied to the clipboard +and the login page for the site is opened. +So now logging in is as simple +as running a command, +waiting for the login page to open, +and pasting. +. +.Pp +The script isn't sophisticated, +but I don't think it needs to be. +I've written functions +for a couple different sites already, +and they all work in mostly the same way. +Writing a new one is just a matter +of identifying the form URLs and fields +along with where the token is in the email. +I'm not going to turn this automation +into any kind of generally usable project, +because I don't want to have to +maintain functions for tonnes of different services. +If you're interested in this idea, +I encourage you to use my script as a template +and implement the functions for services you use. +. +.Sh SEE ALSO +.Bl -item -compact +.It +.Lk https://git.causal.agency/imbox +.It +.Lk https://causal.agency/bin/sup.html +.El +. +.Sh AUTHORS +.An june Aq Mt june@causal.agency diff --git a/www/text.causal.agency/018-operating-systems.7 b/www/text.causal.agency/018-operating-systems.7 new file mode 100644 index 00000000..691102e2 --- /dev/null +++ b/www/text.causal.agency/018-operating-systems.7 @@ -0,0 +1,86 @@ +.Dd February 22, 2021 +.Dt OPERATING-SYSTEMS 7 +.Os "Causal Agency" +. +.Sh NAME +.Nm Operating systems +.Nd criteria +. +.Sh DESCRIPTION +Sometimes in conversation +I use the term +.Dq real operating system +which people, +perhaps rightfully, +take as inflammatory. +But I have actually thought about +what I mean when I say +.Dq real operating system +and come up with +this list of criteria. +. +.Pp +An operating system should be... +.Bl -bullet +.It +Consistent and cohesive: +all parts of the system should have similar +usage, configuration, documentation and so on. +Parts of the system should naturally work together, +because they were designed to do so. +. +.It +Documented: +the system should include its own documentation. +A user should not have to +search some external wiki +to learn how the system works. +It should be obvious +where to find documentation +on a particular topic. +. +.It +Programmable: +the system should provide +a way to program the computer. +A computer which cannot be programmed +is not a computer at all. +Usually this takes the form +of a C compiler +and the tools that go with it. +In earlier times, +it might have been +a BASIC interpreter. +. +.It +Examinable and modifiable: +the full source tree +for the system should be included, +or easily obtainable +through official means. +A user should have no trouble +finding the corresponding source +for a part of the system. +Together with the previous point, +the source tree should be +compiled by the included toolchain, +allowing local modification. +.El +. +.Pp +Some things that may be parts +of real operating systems, +but are not themselves operating systems: +a kernel, +a package manager, +a collection of packages. +. +.Pp +I will leave it as an +.Dq exercise for the reader +to guess which operating systems +meet these criteria +and which don't. +. +.Sh AUTHORS +.An june Aq Mt june@causal.agency diff --git a/www/text.causal.agency/019-mailing-list.7 b/www/text.causal.agency/019-mailing-list.7 new file mode 100644 index 00000000..b3490a94 --- /dev/null +++ b/www/text.causal.agency/019-mailing-list.7 @@ -0,0 +1,286 @@ +.Dd March 4, 2021 +.Dt MAILING-LIST 7 +.Os "Causal Agency" +. +.Sh NAME +.Nm Mailing List +.Nd a small-scale approach +. +.Sh DESCRIPTION +When I initially published +some software I expected +other people to use, +I just asked that patches +be mailed directly to me, +but I figured that +if more people were interested, +it would be better +to have a mailing list. +Unfortunately +email software, +mailing list options in particular, +are quite daunting. +I wanted a light-weight option +that would require me to host +as little software as possible. +. +.Pp +My regular email is hosted by Fastmail, +and I poked around its settings +to see what I could do. +It turns out Fastmail lets you +configure address aliases to +.Dq also send to all contacts in +a contacts group. +That's a mailing list! +I created a group called +.Dq List +and an alias called +.Mt list@causal.agency +configured to deliver to that group. +So it's really just an alias +for my regular address +that happens to also +deliver to another group of people. +. +.Pp +It's easier to just configure +and manage one mailing list, +so what I do is ask patches and feedback +to be sent to +.Mt list+catgirl@causal.agency , +for example. +Fastmail treats any +.Ar +suffix +the same as the base address, +but the full address can be used +by subscribers to filter mail by topic +if they wish. +. +.Pp +To subscribe someone to the list, +I add their contact to the group. +For a long time I was planning +to write some software +to manage these subscriptions. +It should be possible +to process subscription requests from IMAP +and manipulate the contact group with CardDAV. +When I went to start implementing this, +however, +I found CardDAV (and WebDAV in general) +completely inscrutable. +It's the kind of protocol +that is split across like 20 +different RFCs +and you can't understand anything +by just reading +the one you actually care about. +So I've given up on that +and will keep manually subscribing people +on request. +. +.Pp +The only thing missing, then, +is a way for people to read +mail sent to the list +while they aren't subscribed. +All the existing +mailing list archive software +I know of +expects to have the mail locally, +but I'd rather keep all my mail in IMAP. +First, +in order to make sure +I keep a complete archive +of the mailing list in IMAP, +I added a small amount +of Sieve code +to my Fastmail filters configuration: +.Bd -literal -offset indent +if address :matches ["To", "Cc"] "list*@causal.agency" { + fileinto :copy :flags "\e\eSeen" "INBOX.List"; +} +.Ed +. +.Pp +Sieve is a small standard language +specifically for filtering mail. +This bit of code matches +anything sent to the list +and adds a copy of it +(the original is going into my inbox) +to the +.Dq List +folder +and marks the copy as read. +. +.Pp +With a pristine IMAP mailbox +to export from, +I wrote a new archive generator. +It's called +.Xr bubger 1 +kirg (have it in a way). +My goal was to render directly from IMAP +and produce only static files as output, +making it not only easy to serve, +but also to run in one place +and copy the files elsewhere. +That's important to me +because it has access to my email, +so I'd rather run it +on my local network and +.Xr rsync 1 +its output into The Cloud. +The static files are in +HTML, Atom and mboxrd formats. +. +.Pp +The architecture of +.Xr bubger 1 +is that for each piece of mail, +identified by its UID in the mailbox, +HTML and Atom fragments +are exported along with the mboxrd. +Those fragments are then stitched together +using the IMAP SORT and THREAD extensions +to make full pages and feeds +for each thread. +The fragments act as a cache +for subsequent runs. +. +.Pp +I admit I did some +pretty questionable things +to achieve this. +Namely, +I wrote a small string templating engine in C. +I use it to produce the HTML +and XML for Atom, +as well as to generate URLs +and paths. +I'm really happy with how it works, actually. +This is also where +I really started using +one of my favourite C hacks: +.Bd -literal -offset indent +#define Q(...) #__VA_ARGS__ +.Ed +. +.Pp +I quote all my HTML/XML templates +with this and it's lovely. +. +.Pp +I've been working on +.Xr bubger 1 +on and off for almost a year now, +and it's been interesting. +I learned a lot about how email +works from having to deal with +all the ways a message can be. +Thankfully a lot of that dealing +is done by the IMAP server. +. +.Pp +As for running it, +I initially just ran it with +.Xr cron 8 , +and that's still a good way to go. +To hook it up to +.Xr rsync 1 , +pipe it like so: +.Bd -literal -offset indent +bubger -C list [...] | rsync -a --files-from=- list remote:list +.Ed +. +.Pp +Later, +I got a little annoyed +with having to wait +for the next run +if I wanted to link +to some mail I just received. +I added an option +to use IMAP IDLE +to wait for new mail continuously +and I started running it +under my process supervisor, +.Xr catsitd 8 . +. +.Pp +The setup is a little more complex +to feed the list of updated files to +.Xr rsync 1 . +I added the +.Xr catsit-watch 1 +utility to run a command +when a file changes, +and in my +.Xr catsit.conf 5 +I have the following: +.Bd -literal -offset indent +bubger ~/.local/libexec/bubger +rsync catsit-watch -i -f ~/list/UIDNEXT ~/.local/libexec/rsync +.Ed +. +.Pp +The +.Pa ~/.local/libexec/bubger +script runs +.Xr bubger 1 , +writing the list of updated paths to +.Pa ~/list/FILES : +.Bd -literal -offset indent +exec bubger -i -C ~/list [...] >~/list/FILES +.Ed +. +.Pp +And the +.Pa ~/.local/libexec/rsync +script gets run each time a +.Xr bubger 1 +update completes +.Po +.Pa UIDNEXT +is always the last file written +.Pc +and copies the listed files +to the remote host: +.Bd -literal -offset indent +exec rsync -a --files-from=$HOME/list/FILES ~/list remote:list +.Ed +. +.Pp +I haven't tagged any +.Xr bubger 1 +releases yet +because it hasn't gotten +a huge amount of testing, +and I'm not sure anyone but me +would even want to use it. +But I'm happy +with how it's working right now, +so I might tag 1.0 soon +just for fun. +. +.Sh SEE ALSO +.Bl -item -compact +.It +.Lk https://causal.agency/list/ +.It +.Lk https://git.causal.agency/bubger/about +.It +.Lk https://git.causal.agency/catsit/about +.El +. +.Sh AUTHORS +.An june Aq Mt june@causal.agency +. +.Sh BUGS +Almost every time +I try to type +.Dq mailing list +I instead type +.Dq mailist list . diff --git a/www/text.causal.agency/020-c-style.7 b/www/text.causal.agency/020-c-style.7 new file mode 100644 index 00000000..9816dbc3 --- /dev/null +++ b/www/text.causal.agency/020-c-style.7 @@ -0,0 +1,172 @@ +.Dd March 16, 2021 +.Dt C-STYLE 7 +.Os "Causal Agency" +. +.Sh NAME +.Nm C Style +.Nd a rough description +. +.Sh DESCRIPTION +This is a rough description +of the style in which I write C, +since it's uncommon +but some people seem to like it. +I don't have any hard rules, +it just needs to look right. +. +.Ss Superficialities +I use tabs +and they're set to 4 characters wide +in my editor. +I keep my lines shorter than 80 columns, +which I enforce by +not resizing my terminal's width. +I use block indentation only, +meaning I write long function calls +like this: +.Bd -literal -offset indent +fprintf( + imap.w, "%s UID THREAD %s UTF-8 %s\er\en", + Atoms[thread], algo, search +); +.Ed +.Pp +Anything that can be sorted +should be sorted, +with trailing commas where possible. +This and block indentation +make for simpler diffs. +.Pp +I either write single-line ifs +or always use braces. +I put parentheses +around ternary expressions. +I use camelCase +for functions and variables, +and PascalCase for types and constants. +When an acronym appears +in an identifier, +it's in either all lower case +or all upper case. +The despicable SCREAMING_SNAKE_CASE +is reserved for macros. +I don't set globals or statics to zero +since that is already the default. +I don't compare against zero or NULL +unnecessarily. +. +.Ss \&No side-effects in control flow +I never write a function call +with side-effects +inside the condition of an if statement. +I find this makes following the +.Dq happy path +through functions +much easier. +I write things like this: +.Bd -literal -offset indent +pidFile = open(pidPath, O_WRONLY | O_CREAT | O_CLOEXEC, 0600); +if (pidFile < 0) err(EX_CANTCREAT, "%s", pidPath); + +error = flock(pidFile, LOCK_EX | LOCK_NB); +if (error && errno != EWOULDBLOCK) err(EX_IOERR, "%s", pidPath); +if (error) errx(EX_CANTCREAT, "%s: file is locked", pidPath); +.Ed +.Pp +I do write side-effects +inside for and while statement heads, +since that's generally expected. +For some reason +I like to write the constant first +if I'm comparing the result of an assignment +with a side-effect. +.Bd -literal -offset indent +for (ssize_t len; 0 <= (len = getline(&buf, &cap, file)); ++line) +.Ed +. +.Ss Paragraphs +I leave blank lines +between logical chunks of +.Dq things happening . +This is usually between side-effects +with their related error handling, +or between groups of closely related side-effects. +I try to keep variable declarations +glued to the top of the bit of code +they're used in. +. +.Ss Leading break +I've mentioned this previously. +I write my switch statement breaks +before each case label. +Doing this aligns nicely, +and being in the habit +means I always avoid +accidental fallthrough. +.Bd -literal -offset indent +switch (opt) { + break; case 'a': append = 1; + break; case 'd': delay = strtol(optarg, NULL, 10); + break; case 'f': watch(kq, optarg); + break; case 'i': init = 1; + break; default: return EX_USAGE; +} +.Ed +. +.Ss Function type definitions +Function types are always typedef'd, +and it's the function type itself +that is defined, +not a function pointer type! +I put the typedef above any functions +that are supposed to be of that type +so it's clear what the pattern is. +.Bd -literal -offset indent +typedef void Action(struct Service *service); +Action *fn = NULL; +.Ed +. +.Ss Constants +I prefer enums over #defines +for integer constants, +and static const strings over #defines +unless I want to do concatenation. +.Bd -literal -offset indent +enum { Cap = 1024 }; +.Ed +.Pp +I avoid the preprocessor +wherever possible, +with the notable exception of X macros, +which I've talked about previously. +Doing things in the actual language +makes for easier debugging. +. +.Ss Organization +I usually use only one header file +in each project. +The dependency is easy to declare +and the complete rebuild +when the header changes +isn't a problem for small projects. +Unless it's a single-file program, +I name the file which contains main +something generic, +since the name of the project +isn't relevant to its function. +I name functions like +.Ar nounVerb , +and all the functions for a +.Ar noun +are defined in +.Pa noun.c . +Not really to do with C, +but I always put a FILES section +in my README pages +to briefly describe +the layout of the code +for anyone looking to +read or make changes to it. +. +.Sh AUTHORS +.An june Aq Mt june@causal.agency diff --git a/www/text.causal.agency/021-time-machine.7 b/www/text.causal.agency/021-time-machine.7 new file mode 100644 index 00000000..93d35c1e --- /dev/null +++ b/www/text.causal.agency/021-time-machine.7 @@ -0,0 +1,144 @@ +.Dd April 25, 2021 +.Dt TIME-MACHINE 7 +.Os "Causal Agency" +. +.Sh NAME +.Nm Time Machine +.Nd an awful one +. +.Sh DESCRIPTION +If, like me, +you have a Raspberry Pi 3 at home +that you've just upgraded to +.Fx 13.0 +which has a hard drive +from an old laptop +attached to it by USB adapter +with ZFS on it +and you want to +use that as a Time Machine +backup destination +over SMB using +.Xr samba 8 , +despite +.Xr samba 8 +being awful software +and using ZFS on a system +with only 1 GB of RAM +being a terrible idea, +this is how to do it. +. +.Pp +In +.Pa /usr/local/etc/smb4.conf : +.Bd -literal -offset indent +[global] +vfs objects = zfsacl catia fruit streams_xattr +fruit:metadata = stream +fruit:model = Macmini + +[TimeMachine] +read only = no +path = /media/zhdd/backup/TimeMachine +fruit:time machine = yes +fruit:time machine max size = 250G +.Ed +. +.Pp +The important thing here is +.Sy zfsacl +in the vfs objects list. +Most pages will tell you about the others, +but without +.Sy zfsacl +Time Machine will just fail to +create the backup +and not provide any useful error. +I'm not actually sure if the +.Sy fruit:metadata +setting is required, +but a bunch of pages recommend it. +The +.Sy fruit:model +just makes it look nice in Finder. +The rest creates an SMB share called +.Dq TimeMachine +that macOS will be willing to use. +You can limit the size of the share that +.Xr samba 8 +reports so that Time Machine +doesn't fill up the whole drive. +. +.Pp +The other important thing to do +is to create some swap space. +When I first tried backing up +to this share, +it stopped after a while +because +.Xr smbd 8 +got killed +when there was nowhere to swap pages to. +A wiki page told me to +create swap on ZFS like this: +.Bd -literal -offset indent +zfs create -V 2G \e + -o org.freebsd:swap=on \e + -o checksum=off \e + -o compression=off \e + -o dedup=off \e + -o sync=disabled \e + -o primarycache=none \e + zhdd/swap +swapon /dev/zvol/zhdd/swap +.Ed +. +.Pp +To be fair to +.Xr samba 8 , +most of the memory +is being used by the ZFS ARC +.Po +which you can see in +.Xr top 1 +.Pc , +but +.Xr smbd 8 +still seems to be using +far more memory than is reasonable. +It's interesting seeing processes +with 0 RES in +.Xr htop 1 +because they're all being swapped out +while the ARC takes half the available RAM. +And having to wait for my shell +to be paged back in when I quit +.Xr htop 1 . +. +.Pp +Anyway, +as expected this whole thing +is terribly slow. +On my initial backup, +I'm currently at 26.49 GB +of 104.22 GB +with an estimate of 8 hours remaining. +Normally transfer time estimates +are wildly inaccurate, +but I think in this case it's right. +. +.Sh AUTHORS +.An june Aq Mt june@causal.agency +. +.Sh BUGS +.Fx +doesn't seem to want to mount +the ZFS volumes on the hard-drive-over-USB +automatically at boot. +I have to +.Xr zpool-import 8 +the drive manually each time. +I don't know if there's a workaround for this, +but I don't have anything essential +to the system on the drive, +and it doesn't need to reboot often. diff --git a/www/text.causal.agency/022-swans-are-dead.7 b/www/text.causal.agency/022-swans-are-dead.7 new file mode 100644 index 00000000..8664e886 --- /dev/null +++ b/www/text.causal.agency/022-swans-are-dead.7 @@ -0,0 +1,164 @@ +.Dd May 5, 2021 +.Dt SWANS-ARE-DEAD 7 +.Os "Causal Agency" +. +.Sh NAME +.Nm Swans Are Dead +.Nd album by Swans +. +.Sh DESCRIPTION +Swans Are Dead +is the best Swans album. +Among my favourites are +Soundtracks for the Blind, +To Be Kind +and Love of Life, +but Swans Are Dead +is the one I come back to +most consistently. +I'm always in the mood +to listen to these tunes. +. +.Pp +It's interesting to me +that I enjoy it so much, +I think because I had the expectation +that live albums +are not of the same quality +as studio albums, +but that's just completely untrue +in the case of Swans. +The performances are excellent +and the recording is +for the most part perfect. +The album feels live, +without any distracting deficiencies +of live recording +that would take you out +of just enjoying the music. +. +.Bl -ohang +.It Dq Feel Happiness +This track feels kind of special +since it's the only song on the album +that was never released +as part of another project. +I absolutely love this format of song. +It's like 10 minutes of build +before any lyrics happen, +which you only get after +the wave of the first part +of the song collapses. +It bookends the first disc nicely with +.Dq Blood Promise, +I think, +which is sort of the reverse. +. +.It Dq Blood On Yr Hands +This is such a great start +to the Jarboe-focused +section of the black disc. +A cappella apart from the hum +of the equipment on stage, +I love this vocal performance. +I sing this song, +terribly, +in the shower. +The lack of instrumental +seems to make it stick in my mind even more. +. +.It Dq I Crawled +This is another great vocal performance +by Jarboe. +It's so much more dynamic and intense +than the version of this song +released much earlier on Young God +with Gira's vocals. +I remember seeing a bad comment +somewhere online +from someone who couldn't stand +any Swans song Jarboe sang on. +They must have never heard +this version of +.Dq I Crawled. +Incredible. +. +.It Dq Blood Promise +My favourite track on +Swans Are Dead, +by far. +I had actually never heard of +.Dq The Whiffenpoof Song +until I looked up +the recording they use +to introduce this song +and indicate it's the last of the show. +Anyway, +this track highlights +what makes Swans live albums +so interesting. +This performance of the song +has evolved so much +from the studio recording on +The Great Annihilator. +They share the same lyrics, +but the earlier version is only 4:15, +to the live version's fifteen and a half minutes! +And it sucks me in the whole time. +As the song winds down +you can hear an audience member yell, +.Dq Don't stop! +and I agree. +. +.It Dq The Sound +One of my all-time favourite songs. +It's the one that got me to listen to +Soundtracks for the Blind, +and might've gotten me into Swans altogether. +I don't quite remember +what order I started listening to things in. +This version of it is great. +I don't think I could choose +between this and the studio recording. +There are just +two ways to enjoy it. +I love how frantic the guitars get +at the height of this track. +. +.It Dq I See Them All Lined Up +This version of the song +is way more harsh +than the version on Soundtracks. +It loses some contrast +between the verses +and the explosions of sound +punctuating them, +it just hits hard +the whole time. +. +.It Dq Yum Yab +An absolute banger. +The drums sound so good on this +and they really get me moving. +The whole thing is delightfully nasty and fun. +.El +. +.Pp +Everything else on the album +is good too, +of course, +I just don't have as much to say. +There's almost two and a half hours of music +on this thing! +. +.Sh AUTHORS +.An june Aq Mt june@causal.agency +.Pp +I want to try writing +about different kinds of things here, +and this is my first attempt +at doing so. +There's more music +I want to write about, +and maybe some other +non-computer topics. diff --git a/www/text.causal.agency/023-sparse-checkout.7 b/www/text.causal.agency/023-sparse-checkout.7 new file mode 100644 index 00000000..925bc043 --- /dev/null +++ b/www/text.causal.agency/023-sparse-checkout.7 @@ -0,0 +1,144 @@ +.Dd June 9, 2021 +.Dt SPARSE-CHECKOUT 7 +.Os "Causal Agency" +. +.Sh NAME +.Nm Sparse Checkout +.Nd a cool git feature +. +.Sh DESCRIPTION +I was going to write a post about +.Xr git-subtree 1 +(and I still plan to!) +but while talking about it +with a friend +I came across another command: +.Xr git-sparse-checkout 1 . +I got pretty excited because +I already had a use case for it. +. +.Pp +.Xr git-sparse-checkout 1 +does pretty much what it sounds like. +It lets you only have +a subset of files in the repository actually +.Dq checked out . +This is really useful +for huge respositories +where you are only interested in +some part of it. +Any operation touching the working tree +is much faster because +it can skip all the files you don't care about. +. +.Pp +My use case is with the +.Fx +.Xr ports 7 +tree, +which recently moved to git +and contains almost 14 thousand files. +Working with the whole repository +was super painful. +.Xr git-status 1 , +which I run as a habit +when my shell is idle, +would take dozens of seconds +to check the whole working tree +and report back. +(I didn't get any real time measurements +before enabling +.Xr git-sparse-checkout 1 , +and I'm not about to disable it now, +since it'd have to check out +all those files again.) +I'm only actually working on +a small handful of ports, +so all that work is wasted. +Time to turn on sparse checkout: +.Bd -literal -offset indent +git sparse-checkout init --cone +.Ed +. +.Pp +The +.Fl \-cone +option here +(which I keep reading as +.Dq clone +because it's git) +restricts the kinds of patterns +you can use to select files to check out, +but makes the calculation more efficient. +Basically it means you can only select +paths along with everything below them, +which I think is pretty much +always what you want anyway. +Enabling sparse checkout +can take quite a while +because it has to do a lot of un-checking-out. +I should mention +that you can pass +.Fl \-sparse +to +.Xr git-clone 1 +to avoid ever checking out +the whole tree. +. +.Pp +The default selection when you run +.Cm init +is to check out all the files +at the root of the repository, +but none of the subdirectories. +For +.Xr ports 7 , +I also want to check out +the shared scripts and Makefiles: +.Bd -literal -offset indent +git sparse-checkout add Keywords Mk Templates Tools +.Ed +. +.Pp +And then I can selectively check out +just the ports I'm working on: +.Bd -literal -offset indent +git sparse-checkout add irc/catgirl irc/pounce +.Ed +. +.Pp +After enabling sparse checkout, +.Xr git-status 1 +takes what I'd call +a normal amount of time. +I also did this on +a couple-weeks-out-of-date copy of the +.Xr ports 7 +tree, +and when I ran +.Xr git-pull 1 +it was also really quick, +because it didn't have to bother +updating all those files +I'm not interested in. +It still downloads all the git objects, +of course, +and you can just add any new paths you need +to the sparse checkout list. +My disk usage also went down +by about a gigabyte. +. +.Pp +I'm super pleased to discover this part of git, +because it makes working with huge +and/or monorepo-style repositories +so much more feasible! +You can see how I came across it, +since +.Xr git-subtree 1 +is also a useful tool for monorepos. +Stay tuned for that post, +I guess :) +. +.Sh AUTHORS +.An june Aq Mt june@causal.agency diff --git a/www/text.causal.agency/024-seprintf.7 b/www/text.causal.agency/024-seprintf.7 new file mode 100644 index 00000000..d1af2e1a --- /dev/null +++ b/www/text.causal.agency/024-seprintf.7 @@ -0,0 +1,137 @@ +.Dd June 12, 2021 +.Dt SEPRINTF 7 +.Os "Causal Agency" +. +.Sh NAME +.Nm seprintf +.Nd an snprintf alternative +. +.Sh SYNOPSIS +.Ft "char *" +.Fn seprintf "char *ptr" "char *end" "const char *fmt" "..." +. +.Sh DESCRIPTION +While discussing string building in C recently, +mcf pointed out +.Xr seprint 2 +from Plan 9, +and it kind of blew my mind. +I had implemented my own function in +.Xr catgirl 1 +for building up strings using +.Xr snprintf 3 +and a struct containing +pointer, length and capacity, +but it felt out of place. +.Fn seprintf +(I add the +.Dq f , +Plan 9 doesn't) +is a much simpler +and more +.Dq C-like +interface with really nice usage patterns. +. +.Pp +The obvious difference from +.Xr snprintf 3 +is that +.Fn seprintf +takes an +.Fa end +pointer +rather than a size. +This means you need only calculate it +once for each buffer, +rather than subtracting +the running length from the buffer size. +.Fn seprintf Ap s +return value is a pointer +to the terminating null +of the string it wrote, +so you can pass that back in +to continue appending +to the same buffer. +. +.Pp +I'm not sure of the exact behaviour on Plan 9, +but my implementation indicates truncation occurred +by returning the +.Fa end +pointer. +That makes it both easy to check, +and perfectly fine to keep calling +.Fn seprintf +anyway. +It just won't write anything if +.Fa ptr +== +.Fa end . +. +.Pp +In the case of formatting failure +(which should be prevented by +compile-time format string checking, +but should still be considered), +.Fn seprintf +returns +.Dv NULL . +I'm again not sure if this matches Plan 9. +I like this a lot better than +.Xr snprintf 3 +returning -1, +because an unchecked +.Dv NULL +is likely to quickly cause a crash, +while blindly adding +.Xr snprintf 3 Ap s +return value +to your running length +is a non-obvious logic error. +. +.Sh EXAMPLES +Here's an example of what some code using +.Fn seprintf +might look like: +.Bd -literal -offset indent +char buf[4096]; +char *ptr = buf, *end = &buf[sizeof(buf)]; +ptr = seprintf(ptr, end, "argv: "); +for (int i = 1; i < argc; ++i) { + ptr = seprintf( + ptr, end, "%s%s", + (i > 1 ? ", " : ""), argv[i] + ); +} +if (ptr == end) errx(1, "truncation occurred :("); +.Ed +. +.Pp +And here is the very short implementation of it against +.Xr vsnprintf 3 +which I copy into my project header files: +.Bd -literal -offset indent +#include <stdarg.h> +#include <stdio.h> +static inline char * +seprintf(char *ptr, char *end, const char *fmt, ...) + __attribute__((format(printf, 3, 4))); +static inline char * +seprintf(char *ptr, char *end, const char *fmt, ...) { + va_list ap; + va_start(ap, fmt); + int n = vsnprintf(ptr, end - ptr, fmt, ap); + va_end(ap); + if (n < 0) return NULL; + if (n > end - ptr) return end; + return ptr + n; +} +.Ed +. +.Sh AUTHORS +.An june Aq Mt june@causal.agency +.Pp +Another short one before +.Xr git-subtree 1 . +I just think this function +is really neat. diff --git a/www/text.causal.agency/025-v6-pwd.7 b/www/text.causal.agency/025-v6-pwd.7 new file mode 100644 index 00000000..90bfd6ac --- /dev/null +++ b/www/text.causal.agency/025-v6-pwd.7 @@ -0,0 +1,330 @@ +.Dd September 1, 2021 +.Dt V6-PWD 7 +.Os "Causal Agency" +. +.Sh NAME +.Nm V6 pwd +.Nd deciphering old code +. +.Sh DESCRIPTION +We were talking about +.Xr wall 1 +on IRC +and how long it had been annoying users. +My manual page says +.Xr wall 1 +appeared in +.At v6 , +which means that +.Xr wall 1 +has been annoying users for 46 years! +. +.Pp +The Wikipedia page links to the source for +.At v6 , +so I was curious to see how the very first +.Xr wall 1 +was implemented. +It's not that surprising, +except that it is hardcoded +to handle only 50 logins, +and it forks to write to each tty, +waiting one second between each. +I think the forking must be to avoid +any of the terminals being opened +from becoming the controlling terminal +of the original +.Xr wall 1 +process. +. +.Pp +Then I started looking +at some of the other source files +and found the implementation of +.Xr pwd 1 , +which was surprising. +There's no +.Xr getcwd 3 +function +(the earlier form of which, +.Xr getwd 3 , +appeared in +.Bx 4.0 ) , +so +.Xr pwd 1 +has to figure out +the path to the working directory itself. +It took me a while to figure out how it works. +. +.Pp +To make it easy to talk about, +I'm just going to include the whole thing here: +.Bd -literal +char dot[] "."; +char dotdot[] ".."; +char root[] "/"; +char name[512]; +int file, off -1; +struct statb {int devn, inum, i[18];}x; +struct entry { int jnum; char name[16];}y; + +main() { + int n; + +loop0: + stat(dot, &x); + if((file = open(dotdot,0)) < 0) prname(); +loop1: + if((n = read(file,&y,16)) < 16) prname(); + if(y.jnum != x.inum)goto loop1; + close(file); + if(y.jnum == 1) ckroot(); + cat(); + chdir(dotdot); + goto loop0; +} +ckroot() { + int i, n; + + if((n = stat(y.name,&x)) < 0) prname(); + i = x.devn; + if((n = chdir(root)) < 0) prname(); + if((file = open(root,0)) < 0) prname(); +loop: + if((n = read(file,&y,16)) < 16) prname(); + if(y.jnum == 0) goto loop; + if((n = stat(y.name,&x)) < 0) prname(); + if(x.devn != i) goto loop; + x.i[0] =& 060000; + if(x.i[0] != 040000) goto loop; + if(y.name[0]=='.')if(((y.name[1]=='.') && (y.name[2]==0)) || + (y.name[1] == 0)) goto pr; + cat(); +pr: + write(1,root,1); + prname(); +} +prname() { + if(off<0)off=0; + name[off] = '\en'; + write(1,name,off+1); + exit(); +} +cat() { + int i, j; + + i = -1; + while(y.name[++i] != 0); + if((off+i+2) > 511) prname(); + for(j=off+1; j>=0; --j) name[j+i+1] = name[j]; + off=i+off+1; + name[i] = root[0]; + for(--i; i>=0; --i) name[i] = y.name[i]; +} +.Ed +. +.Pp +First, some syntax trivia: +it seems you don't need +.Sy = +to give globals values. +I guess that makes sense. +I also noticed that +it avoids giving +.Va inum +and +.Va jnum +the same name. +I think that's because in old C, +struct field names all shared the same namespace. +The last difference I noticed +is the operator +.Sy =& +rather than +.Sy &= . +Honestly I think the former makes more sense, +but I can see that the one we have now +is less ambiguous. +. +.Pp +To get +.Fn prname +and +.Fn cat +out of the way, +it's building up a path from the bottom. +At first I thought it must be +starting at the end of its buffer +and moving back as it adds components, +but no, +it moves the entire path-so-far over +every time it adds a new component +onto the front. +.Fn cat +is just a bunch of manual string copying. +It also gives up +if the new component +would make the path longer than 511 characters. +Fair enough. +. +.Pp +So how does it build up the path? +The loop in +.Fn main +first calls +.Xr stat 2 +on the current directory +.Pa \&. +in order to get its inode number. +I love that +.Vt struct statb +is just declared at the top of this file. +Clearly this code predates the C preprocessor. +. +.Pp +It then opens the parent directory +.Pa .. +and reads directory entries from it. +The inner loop is looking for +a directory entry with the same inode number +as the current directory, +to figure out what the current directory is called. +Curiously, +it reads 16-byte directory entries, +despite declaring a larger struct. +The preprocessor can't be invented soon enough. +. +.Pp +Once it finds the matching directory entry, +it adds the name of the entry +onto the front of the path, +changes directory to +.Pa .. +and starts over. +It stops when the current directory +has an inode number of 1, +which must be the root of a file system, +but then it does something else. +It took me a while to decipher what +.Fn ckroot +is doing. +. +.Pp +The loop in +.Fn main +stops when it gets to the root +of a file system, +but that's not necessarily +.Pa / . +I think what +.Fn ckroot +is doing is trying to figure out +where that file system is mounted. +It starts by checking the device number +that the current directory is on. +Or really it calls +.Xr stat 2 +on the name of the directory entry that +.Fn main +just found, +which I think must be +.Pa \&. +at this point anyway since it's at a root. +. +.Pp +Anyway, +it then changes directory to and opens +.Pa / +and starts reading directory entries from that, +calling +.Xr stat 2 +on each of them +and checking for a matching device number. +I think this implies that file systems +can only be mounted in +.Pa / +and not at any lower level, +at least not if you want +.Xr pwd 1 +to understand it. +I'm not sure what the check for +an inode number of 0 is skipping over +in this loop. +Some kind of special entry in +.Pa / +perhaps. +. +.Pp +Once it finds an entry +with a matching device number, +it checks the flags +to make sure the entry is a directory. +It does so with hardcoded constants, +but it seems they haven't changed +in all these years. +According to +.Xr stat 2 , +040000 is +.Dv S_IFDIR . +The number of file types +clearly has grown since then though, +since +.Dv S_IFMT +is now 0170000 rather than 060000. +. +.Pp +I think the reason it checks +that the entry is a directory +is because if it actually is +on the root file system already, +then any regular file +would have a matching device number. +If the entry is indeed a directory, +it then checks if the entry is +.Pa \&. +or +.Pa \&.. , +which indicates that it really is already at +.Pa / . +If it's not, +it adds the mount point that it found +to the front of the path. +. +.Pp +Finally, +it prints +.Pa / +followed by the path it built up. +If it failed at any point before that, +it would print the path it had built so far +with no leading +.Pa / . +Better than nothing! +. +.Pp +So that's how I think +.Xr pwd 1 +works in +.At v6 . +It was a fun puzzle to work through, +and it was interesting to see +the assumptions it makes. +How simple things were back then... +Actually I find it really cool +that code from 1975 +can still be read and understood +using knowledge of modern C and UNIX-likes. +. +.Sh SEE ALSO +.Lk https://minnie.tuhs.org/cgi-bin/utree.pl?file=V6 +.Pp +.Pa pwd.c +appears in +.Pa V6/usr/source/s2 . +. +.Sh AUTHORS +.An june Aq Mt june@causal.agency +.Pp +I regret saying in two previous posts +what I planned to write next, +because this is still not that. diff --git a/www/text.causal.agency/026-git-comment.7 b/www/text.causal.agency/026-git-comment.7 new file mode 100644 index 00000000..fefb497e --- /dev/null +++ b/www/text.causal.agency/026-git-comment.7 @@ -0,0 +1,190 @@ +.Dd September 10, 2021 +.Dt GIT-COMMENT 7 +.Os "Causal Agency" +. +.Sh NAME +.Nm git-comment +.Nd add comments from commit messages +. +.Sh SYNOPSIS +.Nm git comment +.Op Fl \-all +.Op Fl \-comment-start Ar string +.Op Fl \-comment-lead Ar string +.Op Fl \-comment-end Ar string +.Op Fl \-min-group Ar lines +.Op Fl \-min-repeat Ar lines +.Op Fl \-no-repeat +.Op Fl \-pretty Ar format +.Op Ar options ... +.Op Fl \- +.Ar file +. +.Sh DESCRIPTION +The +.Nm +command +adds comments to a file +showing the commit messages +which last modified +each group of lines. +By default only commit messages with bodies +and which modified groups of at least 2 lines +are added. +Each comment contains +the abbreviated commit hash +and the commit summary, +followed by the commit body. +. +.Pp +.Nm +accepts all the options of +.Xr git-blame 1 +in addition to the following: +.Bl -tag -width Ds +.It Fl \-all +Include all commit messages. +The default is to include +only commit messages with bodies +(lines after the summary). +. +.It Fl \-comment-start Ar string +Start comments with +.Ar string . +The default is the value of +.Cm comment.start +or +.Ql /* . +. +.It Fl \-comment-lead Ar string +Continue comments with the leading +.Ar string . +The default is the value of +.Cm comment.lead +or +.Ql " *" . +. +.It Fl \-comment-end Ar string +End comments with +.Ar string . +The default is the value of +.Cm comment.end +or +.Ql " */" . +. +.It Fl \-min-group Ar lines +Add comments only for groups of at least +.Ar lines . +The default is 2 lines. +. +.It Fl \-min-repeat Ar lines +Avoid repeating a comment +if it occurred in the last +.Ar lines . +The default is 30 lines. +. +.It Fl \-no-repeat +Avoid repeating comments entirely. +. +.It Fl \-pretty Ar format +Set the pretty-print format +to use for commit messages. +The default is the value of +.Cm comment.pretty +or +.Ql format:%h\ %s%n%n%-b . +See +.Xr git-show 1 . +.El +. +.Sh EXAMPLES +For files with +.Ql # +comments: +.Bd -literal -offset indent +git config comment.start '#' +git config comment.lead '#' +git config comment.end '' +.Ed +. +.Pp +Add as many comments as possible: +.Bd -literal -offset indent +git comment --all --min-group 1 --min-repeat 1 +.Ed +. +.Pp +Some examples of output from +.Xr catgirl 1 : +.Bd -literal +/* 347e2b4 Don't apply uiThreshold to Network and Debug + * + * Messages don't really need to be hidden from <network> and I think + * it could be confusing. Debug messages are all Cold so everything + * would be hidden, and I want to keep them that way so that <debug> + * doesn't clutter the status line needlessly. + */ +if (id == Network || id == Debug) { + window->thresh = Cold; +} else { + window->thresh = uiThreshold; +} + +/* b4c26a2 Measure timestamp width using ncurses + * + * This allows for non-ASCII characters in timestamps, and simplifies + * things by including the trailing space in the width. + */ +int y; +char buf[TimeCap]; +struct tm *time = localtime(&(time_t) { -22100400 }); +size_t len = strftime(buf, sizeof(buf), uiTime.format, time); +if (!len) errx(EX_CONFIG, "invalid timestamp format: %s", uiTime.format); +waddstr(main, buf); +waddch(main, ' '); +getyx(main, y, uiTime.width); +(void)y; + +/* 43b1dba Restore toggling ignore with M-- + * + * So that pressing M-- repeatedly maintains the previous behavior. + */ +if (n < 0 && window->thresh == Ice) { + window->thresh = Cold; +} else { + window->thresh += n; +} + +/* 1891c77 Preserve colon from previous tab-complete + * + * This fixes the case when pinging multiple nicks and one of them needs to + * be cycled through. + */ +bool colon = (tab.len >= 2 && buf[tab.pos + tab.len - 2] == L':'); +.Ed +. +.Sh SEE ALSO +.Lk https://git.causal.agency/src/tree/bin/git-comment.pl +. +.Sh AUTHORS +.An june Aq Mt june@causal.agency +. +.Pp +In case it's unclear, +this is a +.Xr git 1 +subcommand I wrote. +Did you know you can add new +.Xr git 1 +subcommands just by +adding executables named +.Pa git-* +to somewhere in +.Ev PATH ? +. +.Pp +This is also, +I think, +my third Perl script ever. +It's an interestingly shaped language. +Quite neat. diff --git a/www/text.causal.agency/027-openbsd-linode.7 b/www/text.causal.agency/027-openbsd-linode.7 new file mode 100644 index 00000000..9f40de42 --- /dev/null +++ b/www/text.causal.agency/027-openbsd-linode.7 @@ -0,0 +1,202 @@ +.Dd September 26, 2021 +.Dt OPENBSD-LINODE 7 +.Os "Causal Agency" +. +.Sh NAME +.Nm Installing OpenBSD on Linode +.Nd a guide +. +.Sh DESCRIPTION +I've been thinking for a while +about moving my servers to Linode, +and also about moving them to +.Ox . +I actually originally got into +.Fx +(and from there, +.Ox ) +only because DigitalOcean +started offering it as a +.Dq droplet +image. +I've been running those servers fine for years, +but now I prefer to run +.Ox , +and some recent DigitalOcean outages +had me thinking about it more, +so I'm giving it a shot. +. +.Pp +As an aside, +running +.Ox +on DigitalOcean +is not really a good option. +It seems more awkward to install your own OS there, +and if you do, +I've heard that IPv6 won't work +because they don't know how to run SLAAC. +Also, +now that I've used +the Linode control panel and LISH a bit, +DigitalOcean kind of feels like a toy +in comparison. +. +.Pp +Here's what I did to install +.Ox +on Linode: +.Bl -enum +.It +Create a Linode with the +.Dq Choose a Distribution +box blank. +. +.It +Under the Storage tab, +create a disk called +.Dq miniroot +of type raw +with size 8 MB. +This will hold the install image. +. +.It +Create another disk called +.Dq root +of type raw +using the remaining available storage. +. +.It +Boot the Linode in rescue mode +from the option in the three-dots menu +next to +.Dq Power On . +Attach +.Dq miniroot +to +.Pa /dev/sda . +. +.It +Log into the LISH console +and obtain the install image: +.Bd -literal +curl -O https://cdn.openbsd.org/pub/OpenBSD/6.9/amd64/miniroot69.img +dd if=miniroot69.img of=/dev/sda +.Ed +.Pp +Power off the Linode. +. +.It +Under the Configurations tab, +create a configuration called +.Dq install +in full virtualization mode. +Paravirtualization works fine once installed, +but for some reason the installer +can't see the root disk +without full virtualization. +Under boot settings, +select direct disk. +Attach +.Dq root +to +.Pa /dev/sda , +.Dq miniroot +to +.Pa /dev/sdb +and set the root device to +.Pa /dev/sdb . +. +.It +Create a similar configuration called +.Dq boot +but using paravirtualiztion +and without +.Dq miniroot +attached. +Set the root device to +.Pa /dev/sda . +. +.It +Boot the +.Dq install +configuration, +launch the LISH console +and switch to Glish. +It's possible +to have the installer use serial console, +but it requires entering commands +at the boot prompt +before the timeout, +and I never managed it. +If you do manage it, +run: +.Bd -literal +stty com0 9600 +set tty com0 +boot +.Ed +. +.It +Proceed through the +.Ox +installer. +When asked to +change the default console to com0, +answer yes +so that regular LISH will work. +Power off the Linode. +. +.It +Boot the +.Dq boot +configuration +and log in to LISH. +Since the installer configured networking +in full virtualization, +rename the file to the paravirtualized interface: +.Bd -literal +mv /etc/hostname.em0 /etc/hostname.vio0 +.Ed +.Pp +In order to get the right public IPv6 address, +disable privacy extensions +by changing the inet6 line of +.Pa hostname.vio0 +to: +.Bd -literal +inet6 autoconf -temporary -soii +.Ed +. +.It +Bring networking up +and run +.Xr syspatch 8 +since +.Pa rc.firsttime +couldn't do it: +.Bd -literal +sh /etc/netstart +syspatch +.Ed +. +.It +Reboot. +.El +. +.Pp +I guess I'll be slowly moving things over +to the new servers +for the next little while. +With any luck the next post here +will not say +.Fx +in its header! +. +.Sh SEE ALSO +I learned the basic idea +of how to do this from +.Lk https://www.subgeniuskitty.com/notes/openbsd_on_linode . +. +.Sh AUTHORS +.An june Aq Mt june@causal.agency diff --git a/www/text.causal.agency/028-names.7 b/www/text.causal.agency/028-names.7 new file mode 100644 index 00000000..de47c074 --- /dev/null +++ b/www/text.causal.agency/028-names.7 @@ -0,0 +1,81 @@ +.Dd October 30, 2021 +.Dt NAMES 7 +.Os "Causal Agency" +. +.Sh NAME +.Nm Names +.Nd three types +. +.Sh DESCRIPTION +There are (at least) three +different types of names +a person has. +. +.Pp +First, there are normie names. +These are names usually made up +of several words +each of which is capitalized. +Most people have one of these, +but it's possible to have more. +They're names that might appear on +various types of Documents. +A +.Dq legal name +(dubious) +is a normie name, +but normie names need not be +.Dq legal +(dubious). +I list this category first +not because it's more important, +but because it is by far the most boring. +. +.Pp +Next, there are Real Names. +Most people have at least a few +and will probably go through +different ones over time. +Your Real Names are anything people +use to refer to you. +On the internet these are often not capitalized. +Sometimes that is the only distinction +between a Real Name +and a normie name. +. +.Pp +There was a period of time +when I was playing a lot of TF2 +and not really leaving my apartment. +I had set my steam name to +.Dq gluten product +(yeah, from that dril tweet) +and I talked in the game's voice chat +quite a bit. +Naturally other Gamers in voice chat +called me +.Dq gluten +and at some point I realized +that over the span of months +I had been refered to as +.Dq gluten +more often than any other name. +So that was a Real Name of mine. +People used it and I responded to it. +. +.Pp +Last, there are the True Names. +The kind of name that knowledge of +gives one power over a person. +I don't think any humans +know their own True Names, +but I do believe they exist. +It's possible that other animals +know theirs. +It's probably best not to know though, right? +I think if I knew mine +I would always worry +about accidentally revealing it. +. +.Sh AUTHORS +.An june Aq Mt june@causal.agency diff --git a/www/text.causal.agency/029-topics.7 b/www/text.causal.agency/029-topics.7 new file mode 100644 index 00000000..d071eb67 --- /dev/null +++ b/www/text.causal.agency/029-topics.7 @@ -0,0 +1,116 @@ +.Dd January 8, 2022 +.Dt TOPICS 7 +.Os "Causal Agency" +. +.Sh NAME +.Nm Topics +.Nd a bit of a mess +. +.Sh DESCRIPTION +Shortly after my last post +I started writing another one +but I never finished it. +I don't think I had enough to say, +or if I did it meant going into +a whole extra thing. +I also had a list in my mind +of other things to write about, +but inspiration hasn't really struck +for any of them. +I'm currently in the mood +to write something anyway, +so I'm just going to write a bit +about the topics I have in mind. +I may or may not ever +write more about any of them. +. +.Pp +The post I had started writing +(twice, actually) +was about voices. +I like them a lot +and I'm fascinated by them. +The problem is +I don't actually have much +to say about it +without getting into Gender, +which as I say is a whole extra thing, +and not something I've written about here before. +. +.Pp +When I started writing here, +I didn't want to blog about +personal topics or LGBTQ stuff. +But more recently +I want to move away from +only writing about computers. +Or maybe away from +writing about computers entirely. +There are more interesting things, +but I don't have experience +writing about them. +Yet, +I should say. +. +.Pp +I'm honestly still not sure +if writing about gender here +is at all a good idea. +But it turns out to feel like +a bit of a prerequisite +for other things. +I find gender perception +in particular +to be fascinating. +It's interesting. +It's neat. +And I don't know if I can +write anything coherent about it. +. +.Pp +Related to that, +I've been thinking of writing +about how the pandemic +has had a strangely positive effect +on my life. +Or at least, +I've made a lot of positive changes +during it. +I'm in a better place emotionally now +than ever before, +and that obviously runs counter +to most people's experiences. +Additionally with that positive outlook +I want to write about the meaning +of my domain name. +I'm proud of it. +. +.Pp +This week the topic of fetish +has been on my mind. +That actually feels +a bit less risky +to write about than gender. +And it may honestly be more interesting. +I don't know. +There's not enough sex +on computer blogs, +or whatever this is. +Although my main ideas +are not about sex at all. +. +.Pp +Just this turned out to be +harder to write than I thought it would be. +I think I want to populate this space +with more short posts like the previous one. +I wrote that while very sleepy +after 3 AM though, +and I don't exactly +want to repeat that regularly. +We'll see. +. +.Sh AUTHORS +.An june Aq Mt june@causal.agency +.Pp +Listening to Kate Bush \(em Hounds of Love. diff --git a/www/text.causal.agency/030-discs.7 b/www/text.causal.agency/030-discs.7 new file mode 100644 index 00000000..df73a750 --- /dev/null +++ b/www/text.causal.agency/030-discs.7 @@ -0,0 +1,114 @@ +.Dd January 8, 2022 +.Dt DISCS 7 +.Os "Causal Agency" +. +.Sh NAME +.Nm Desert Island Discs +.Nd we're doing three in this one +. +.Sh DESCRIPTION +In typical fashion +I'm going to write about something +completely different instead. +Something short and simple. +I got thinking about this +after reading a little interview thing +this week. +The question is +which three albums would you want to have +if you were stranded on a desert island. +What could you listen to +for the rest of time? +It's surprisingly easy +to take this question very seriously. +. +.Pp +My immediate thought was +.Em Music for 18 Musicians. +I've literally said this about it +in conversation before. +That's an album +I'd want to have on a desert island. +I find it incredibly soothing, +almost hypnotic. +I really do feel like +I could listen to it forever. +And then maybe I could finally determine +which of its eleven sections +is the best. +. +.Pp +My next thought was +.Em Soundtracks for the Blind . +We already know I'm a huge SWANS fan. +Despite what I've written about +.Em Swans Are Dead , +I instead jumped to SFTB. +I still think that +.Em Dead +has better tunes, +but +.Em Soundtracks +is definitely the better cohesive album. +It has such atmosphere and mood on it. +Like +.Em 18 , +it's an album that sucks me in. +Also, +either SWANS album +is an economical choice +in this hypothetical +since they're each 2 hours and 20 minutes long. +. +.Pp +Choosing a third album is a lot harder. +There's so much other music I like +and only one slot left. +There's no other single album +that stands out above the rest +like the previous two, +for me. +.Em Wildlife , +maybe? +Or +.Em Jane Doe ? +Perhaps a classic like +.Em Aeroplane , +or a boomer classic like +.Em The Wall . +But would I really want to +listen to any of those +to the exclusion of everything else? +They're too mood-dependent. +. +.Pp +Then I realized the perfect choice +for third album. +.Em Mouth Moods . +A mashup album is the perfect wildcard, +and +.Em Moods +is just fun as hell to listen to. +I get songs from it stuck in my head +instead of the originals. +The final track, +.Em Shit , +always gets me moving. +It's a masterpiece. +. +.Bl -enum +.It +Steve Reich Ensemble \(em +.Em Music for 18 Musicians +.It +SWANS \(em +.Em Soundtracks for the Blind +.It +Neil Cicierega \(em +.Em Mouth Moods +.El +. +.Sh AUTHORS +.An june Aq Mt june@causal.agency +.Pp +Listening to Steve Reich Ensemble \(em Music for 18 Musicians. diff --git a/www/text.causal.agency/031-books-2021.7 b/www/text.causal.agency/031-books-2021.7 new file mode 100644 index 00000000..d7b46f17 --- /dev/null +++ b/www/text.causal.agency/031-books-2021.7 @@ -0,0 +1,127 @@ +.Dd January 12, 2022 +.Dt BOOKS-2021 7 +.Os "Causal Agency" +. +.Sh NAME +.Nm Books 2021 +.Nd a review, I guess +. +.Sh DESCRIPTION +In 2021 I read 26 books. +Finished the 26th right on December 31st. +It's not a lot but it's more than last year. +Here are the ones I loved +(in the order I read them). +I will avoid spoilers, +of course. +. +.Ss Network Effect by Martha Wells +I've been reading the +.Em Murderbot Diaries +series for a while. +They're fun stories. +I liked this full-length novel entry a lot. +I guess it felt like it had more room +for the characters to develop. +This is probably when I started +asking my friends if they'd read it +because I wanted to talk about +Murderbot gender vibes. +.Pp +You may like if: you're trans. +. +.Ss The Once and Future Witches by Alix E. Harrow +Um, +it's about witches! +One of them has the same name as me. +Kind of has some similar vibes to +.%T The Future of Another Timeline , +which was my favourite book I read in 2020. +.Pp +You may like if: you like women. +. +.Ss A Desolation Called Peace by Arkady Martine +I was so excited for this sequel to +.%T A Memory Called Empire , +another previous favourite +and something I've been wanting more of. +I kinda wish there was more fucking in it though honestly. +.Pp +You may like if: you like women. +. +.Ss Piranesi by Susanna Clarke +Really something different. +It turned out to be a different story +than I expected +from reading the first few pages. +.Pp +You may like if: you like statues, I guess? +. +.Ss A Psalm for the Wild-Built by Becky Chambers +Ok yes I do give 3/3 stars +to every Becky Chambers book. +They're so fucking good. +I'm looking forward to +more entries in this novella series. +(Also I'm currently reading +the fourth +.Em Wayfarers +book +and loving it too!) +.Pp +You may like if: your pronouns are they/them <3 +. +.Sh HONOURABLE MENTIONS +.Ss Her Body and Other Parties by Carmen Maria Machado +I really enjoyed the short story +.Dq Especially Heinous: 272 Views of Law & Order SVU +in this collection. +It goes on a bit too long +but the format is unique. +You can read that one online, +actually. +. +.Ss The Hobbit by J. R. R. Tolkien +Yeah I hadn't read this until last year. +I borrowed it after marathoning +the extended editions of the +.%T Lord of the Rings +trilogy during a heat wave. +As I said at the time, +pretty good for something +written by a man +like a hundred years ago. +Kind of hilarious that women +just don't exist +in the world of +.%T The Hobbit . +. +.Ss Earthlings by Sayaka Murata +Pretty fucking wild. +I'd recommend it, +but I have to say it +.Em extremely +needs a child sexual abuse content warning on it. +. +.Ss Six Months, Three Days, Five Others by Charlie Jane Anders +A surprising number of these short stories +are actual stories! +They have beginnings, +middles +and ends! +. +.Ss The City in the Middle of the Night by Charlie Jane Anders +It's got some +.Em Xenogenesis +series vibes. +Sophie is a goddamn lesbian idiot though +and she never even realizes it. +. +.Sh SEE ALSO +.Lk https://git.causal.agency/src/tree/txt/books.txt +. +.Sh AUTHORS +.An june Aq Mt june@causal.agency +.Pp +Listening to +.Em Ear Massage with Latex Gloves 100% Sensitivity 40 minute (No Talking) . diff --git a/www/text.causal.agency/032-albums-2021.7 b/www/text.causal.agency/032-albums-2021.7 new file mode 100644 index 00000000..72c1d0d2 --- /dev/null +++ b/www/text.causal.agency/032-albums-2021.7 @@ -0,0 +1,173 @@ +.Dd January 13, 2022 +.Dt ALBUMS-2021 7 +.Os "Causal Agency" +. +.Sh NAME +.Nm Albums 2021 +.Nd a review +. +.Sh DESCRIPTION +Every year I create a new playlist +in iTunes +(Music dot app, whatever) +for the albums I listen to that year. +It's usually embarrassingly short. +I don't listen to new music +as much as I'd like, +and usually only one or two +are actually from the current year. +Not that the playlist +is limited to new (to me) music. +If I get really into an album +I've heard before, +more than before, +I also add it to the list. +Anyway, +this is a review +of my 2021 albums playlist. +. +.Ss Black Country, New Road \(em For the First Time (2021) +I first heard the single +.Em Sunglasses +from someone sharing it on IRC, +and I loved it, +so I was looking forward to this album. +What a let down though. +The version of +.Em Sunglasses +on the album is just plain worse +than the single version. +I still got some decent listening +out of the album, +but that just sours it for me. +.Pp +Favourite track: +.Em Track X . +. +.Ss Black Dresses \(em Forever \&In Your Heart (2021) +I fucking love Black Dresses. +.Em Peaceful as Hell +is one of my all-time favourite albums. +I'm glad they put out another one +after it looked like they wouldn't. +The sounds are just so good. +Exactly what my ears crave. +The texture of it +tickles my brain clit. +.Pp +Favourite tracks: +.Em Waiting42moro , +.Em Mistake . +. +.Ss Low \(em Drums and Guns (2007) +I've long loved the song +.Em Breaker +and its music video, +but I only listened to the album +it's on last year. +Something I didn't realize, +I guess because I usually pulled up +the music video +without headphones on, +is how aggressively this album +uses stereo panning. +Vocals are generally +panned hard right throughout, +with much of the instrumentation +panned centre or hard left. +It's bold +and it really works for me. +I especially love the vocal harmony on +.Em Breaker +all the way on the opposite channel. +Bring back stereo separation! +.Pp +Favourite tracks: +.Em Breaker , +.Em Murderer , +.Em Violent Past . +. +.Ss The Armed \(em Ultrapop (2021) +I have to admit +I didn't actually listen to this one much. +I listened to the previous album, +.Em Only Love , +a lot in 2020. +I think this album is good, +but I'll probably only really get into it +in some future year. +. +.Ss Lingua Ignota \(em Caligula (2019) +Dear lord, +why did I wait so long +to listen to this one. +I had heard +.Em "Do You Doubt Me Traitor" +back when it came out, +but somehow I didn't realize +just how much this album +would be my shit. +Fucking incredible vocals. +Lovely sometimes minimal, +sometimes extreme +instrumentals +and exquisite percussion. +The sound of, +I believe, +a lightbulb rolling around on the floor on +.Em Fragrant +is such an interesting addition. +.Pp +Favourite tracks: +.Em "Do You Doubt Me Traitor" , +.Em "Fragrant Is My Many Flower'd Crown" , +.Em "If the Poison Won't Take You My Dogs Will" . +. +.Ss Black Dresses \(em LOVE AND AFFECTION FOR STUPID LITTLE BITCHES (2019) +I wanted even more Black Dresses +and fortunately there was still more +I hadn't yet listened to! +I've already gushed about Black Dresses +so I'll spare you. +They're so good though. +.Pp +Favourite tracks: +.Em STATIC , +.Em HERTZ , +.Em MY HEART BEATS OUT OF TIME . +. +.Ss Barenaked Ladies \(em All Their Greatest Hits: Disc One 1991-2001 +What? +Yeah, +late last year I decided to revisit BNL. +My parents listened to them a lot +when I was growing up, +and I liked them too. +The first show I ever went to was the +.Dq Barenaked for the Holidays +tour with my parents. +It turns out +I still think their '90s stuff +is pretty darn good! +Steven Page is really a great singer. +This is also the first time +I'm listening to these tunes +with fancy headphones +and it sounds great. +Honestly +.Em The Old Apartment +can totally compete +with the favourites +I've accumulated more recently. +\&'90s alt rock was good actually? +.Pp +Favourite tracks: +.Em The Old Apartment , +.Em Brian Wilson , +.Em What a Good Boy , +.Em Too Little Too Late . +. +.Sh AUTHORS +.An june Aq Mt june@causal.agency +.Pp +Listening to all my favourite tracks :) diff --git a/www/text.causal.agency/033-jorts.7 b/www/text.causal.agency/033-jorts.7 new file mode 100644 index 00000000..001f877c --- /dev/null +++ b/www/text.causal.agency/033-jorts.7 @@ -0,0 +1,485 @@ +.Dd February 2, 2022 +.Dt JORTS 7 +.Os "Causal Agency" +. +.Sh NAME +.Nm Introducing Jorts +.Nd june's ports +. +.Sh DESCRIPTION +Alright so I've gone off the deep end, +maybe. +After continual frustration with MacPorts +culminating in not being able to install +.Xr nvi 1 +on my work MacBook, +I have just gone ahead +and started my own personal ports tree +for macOS. +After a couple of weeks, +I have 32 ports in my tree +and only two remaining requested ports +installed from MacPorts. +. +.Pp +I set out with a couple ideas in mind: +.Bl -bullet +.It +This will be my own personal ports tree. +It only has to work for me. +Since I'm using it on both +my personal Intel MacBook Pro +still running Catalina +and my work M1 MacBook Pro +running Monterey, +it is at least that portable. +. +.It +It's ok to rely on +system libraries and tools +provided by macOS. +I'm not creating a distro, +so it doesn't need to be totally isolated. +This lets me skip really annoying things +like compiler toolchains. +. +.It +Sources get vendored, +either from release tarballs +or with +.Xr git-subtree 1 . +This allows totally pain-free +local patching, +and boy has this paid off. +I can just do what I need to do +to get the thing to build how I want +and commit it in git like anything else. +.Pp +It also means that the tree itself +is entirely self-contained +and doesn't rely on any external sources +or network access. +Honestly with some old and obscure software +it feels like upstream could disappear at any moment, +so this gives me peace of mind too. +.Pp +Another advantage of vendoring upstream sources +is that all of the code installed on my system +(in +.Pa /usr/local +anyway) +is easily inspected, +much like +.Pa /usr/src +on a BSD. +This can be super useful for debugging +or just for reference. +. +.It +Produce simple package tarballs. +They're just the contents of +.Ev DESTDIR +after a staged install. +They get installed for real +by untarring them in +.Pa / . +They can then be uninstalled +(or upgraded) +by removing the paths contained +in the tarball from the system. +. +.It +Track installed packages with symbolic links +to specific package tarballs. +Keep old tarballs around for rollbacks. +This means I can see what's installed +with plain old +.Xr ls 1 ! +.Bd -literal +$ ls */Installed +\&... +libretls/Installed toilet/Installed +mandoc/Installed tree/Installed + +$ ls -l toilet/Installed +lrwxr-xr-x 1 root staff 19 17 Jan 21:45 toilet/Installed -> toilet-0.3~1.tar.gz +.Ed +. +.It +Use +.Xr bmake 1 . +It's scrutable. +It also knows how to bootstrap itself +pretty well. +Since +.Xr bmake 1 +is itself a port in my tree +that would require +.Xr bmake 1 +to build and install, +I wrote a small +.Pa Bootstrap +shell script +to install +.Xr bmake 1 +.Dq manually +then use that +.Xr bmake 1 +to build and install its own port. +It also requires a bit of care +when upgrading the +.Xr bmake 1 +port since macOS +rather doesn't like a binary +deleting itself while it's running. +. +.It +No GNU software. +I simply refuse to do it. +To that end, +prefer configuring/building with +.Xr cmake 1 +where at all possible. +I fell into this early on +since I originally just wanted to install +.Xr nvi 1 +and +.Sy lichray/nvi2 +is a better upstream source these days +that uses +.Xr cmake 1 . +.Pp +With a port and support for +.Xr cmake 1 +in +.Pa Port.mk , +I can make changes to +.Pa CMakeLists.txt +files without issue. +I can also vendor upstreams +directly from git +rather than having to find +release tarballs with generated +.Pa configure +scripts and so on. +When I need to make changes +to the build systems of projects using autotools, +I either have to have autotools installed +(from outside my tree) +or painstakingly reflect my edits by hand +in the generated files, +both of which suck hard. +.El +. +.Pp +Ok so that's actually quite a number of ideas. +But they have come together +into something surprisingly usable +surprisingly quickly! +Like I said, +this is only intended to be +my own personal ports tree, +but I hope that some of these ideas +are interesting +and maybe inspire others +to explore similar approaches. +. +.Pp +But wait, +I'm not done yet! +There are some other interesting things +that I came up with along the way, +and also some complaints +about some upstreams, +but I'll try to keep those to a minimum. +. +.Pp +So it turns out that dependencies are hard. +Who knew? +It's easy enough to enforce +direct dependencies +at build time +by just checking for the required +.Pa Installed +symlinks. +It's less straightforward +to do this recursively, +which you need if +you want to be able to say, +.Do +Install +.Xr nvi +for me! +.Dc +and get +.Xr ncurses 3 , +.Xr cmake 1 +and +.Xr pkgconf 1 +installed first +if they aren't already. +. +.Pp +Rather than trying to do all that in +.Xr bmake 1 , +I wrote a shell script called +.Pa Plan , +which itself produces a shell script. +Given a list of ports +to install or upgrade, +it recursively gathers their dependencies +and feeds them to +.Xr tsort 1 , +which is a neat utility +which topologically sorts a graph. +In other words, +it determines the order +in which the graph of dependencies +should be installed. +The +.Pa Plan +script produces a list of +.Xr bmake 1 +commands to make that happen +on standard output, +which can be piped to +.Xr sh 1 . +So, +the way to say the above is: +.Bd -literal -offset ident +$ ./Plan -j4 nvi | sh -e +.Ed +. +.Pp +Now, +what's missing from this approach +is the ability to automatically +uninstall no-longer-needed dependencies. +It's something I've criticized Homebrew for lacking +and one of the reasons I started using MacPorts, +so it's somewhat ironic that +my own system lacks it as well. +However, +I don't think it's much of a problem, +since I'm only packaging +what I actually want installed +in the first place. +On my personal computer, +I have all 32 of my ports installed, +and I expect that to continue. +I can always keep using MacPorts +to install things I only intend +to use temporarily. +. +.Pp +Another thing I was slightly concerned about +from the beginning was disk usage. +I think the benefits of vendoring sources +far outweigh the cost in storage, +but it would be nice to at least minimize that cost. +Previously, +I wrote about +.Xr git-sparse-checkout 1 , +which allows you to only have certain paths +checked out in your git working tree. +Since port sources aren't always interesting +and only +.Em required +while actually building the port, +it makes sense to not have them always checked out. +. +.Pp +Rather than manipulate +.Xr git-sparse-checkout 1 +myself, +I added support for it +directly into +.Pa Port.mk . +If sparse checkout is enabled, +building a port will automatically +add its source tree to the checkout list, +and cleaning that port will +remove it from the list. +At rest, +only the port system itself +and the package tarballs +need to be present on the file system. +. +.Pp +It turns out that upstream +build system behaviour +is super inconsistent, +even among projects using +the same tools. +I started collecting a list of checks +to perform on the output of my port builds +to make sure they didn't do anything weird. +They live in +.Pa Check.sh , +which gets run +when a package tarball is created. +The current list of checks is: +.Bl -bullet +.It +Check for directories not included by +.Ev PACKAGE_DIRS . +In other words, +make sure the port isn't +trying to install anything +outside of +.Pa /usr/local . +Sometimes this makes sense, +though, +which is what +.Ev PACKAGE_DIRS +is for. +.It +Check for references to PWD, +i.e. the build directory. +This can mean the build +didn't understand +.Ev PREFIX +and +.Ev DESTDIR +correctly, +or that it built with debug info. +.It +Check for binaries without manuals. +If your software installs an executable in +.Pa bin +but not a manual page, +your software is incomplete! +Sometimes this just means +I missed an extra documentation install target. +.It +Check for dynamic linking to outside objects. +In other words, +if something ended up linking to +a library installed by MacPorts +rather than the one from +.Nm jorts +or macOS. +.It +Check for dynamic linking +to system libraries +.Nm jorts +provides instead. +Similar to the last one, +if both macOS and +.Nm jorts +provide a library, +check that ports link with the latter. +.It +Check for scripts with outside interpreters. +This is analogous to the linking checks +but for scripts, +checking that their shebang lines +refer to interpreters installed +by macOS or +.Nm jorts . +.El +. +.Pp +A number of my ports +still fail some of these checks, +but I have fixed a lot of problems +the script called out. +. +.Pp +Speaking of problem ports... +git's build system is truly awful. +I'm sorry, +it's just really disappointing. +On the upside though, +I did manage to patch it +to use +.Xr asciidoctor 1 +directly to generate manual pages +from asciidoc source, +rather than generating docbook or whatever +then converting that. +One less build dependency! +I also fixed up curl's +.Pa CMakeLists.txt +(which I guess are normally only used on Windows) +to build and install documentation properly. +And I got libcaca's Cocoa driver working again! +Very important to be able to run +.Xr cacafire 1 +in a Cocoa window. +. +.Pp +Shout out to SDL2, +which didn't require any patching +or extra options beyond +.Ev USE_CMAKE=yes . +Model upstream. +. +.Pp +Some other odds and ends: +I like being able to name ports how I want +(for example, +.Sy ag ) +and use my own port version convention, +using +.Ql + +to append VCS revisions +and +.Ql ~ +to append port revisions. +I don't think those are likely +to ever clash with upstream versioning schemes. +Not that I even need to follow upstream versioning. +There is no reason the version number of +.Xr dash 1 +should start with a zero. +. +.Pp +Speaking of versions, +a big downside of maintaining your own ports tree +is that you actually need to update it. +Thankfully, +once I packaged +.Xr curl 1 +and +.Xr jq 1 +(which needs a new release dammit, +it's been 4 years and the build is broken +on macOS), +I could use the Repology API +to check if I'm behind everyone else. +Far more reliable than +trying to automate checking upstreams +for new versions. +That lives in the +.Pa Outdated +shell script. +. +.Pp +Phew! +I wrote a lot about this. +It feels a little self-indulgent, +but I've had fun working on this +and want to share. +If anyone else tries anything similar, +or is weird enough to give +.Nm jorts +a try themselves, +I'd love to hear about it! +. +.Sh SEE ALSO +.Lk https://git.causal.agency/jorts/ +.Pp +.Lk https://youtu.be/Sx3ORAO1Y6s +. +.Sh AUTHORS +.An june Aq Mt june@causal.agency +.Pp +Listening to +.Em Arcade Fire \(em Arcade Fire (EP) , +.Em Arcade Fire \(em The Suburbs . +.Pp +Typed on a brand new +Leopold FC660M +with Cherry MX Red switches. +Lovely keyboard. diff --git a/www/text.causal.agency/034-voices.7 b/www/text.causal.agency/034-voices.7 new file mode 100644 index 00000000..4990295d --- /dev/null +++ b/www/text.causal.agency/034-voices.7 @@ -0,0 +1,56 @@ +.Dd March 5, 2022 +.Dt VOICES 7 +.Os "Causal Agency" +. +.Sh NAME +.Nm Voices +.Nd more kinds of them +. +.Sh DESCRIPTION +Welcome to the third time +I started writing this post! +I think the first time +was after watching a jan Misali video +that had clips of audio interviews in it. +It got me thinking about +how interesting it was +to hear someone's voice +without knowing anything else about them. +. +.Pp +That's pretty much all I managed to write +the first two times I started this. +If I get past this next sentence, +then I can probably finish the post. +What stopped me was that +all my thoughts and feelings about voices +are influenced by being trans +(and being a fan of other trans people), +and I thought, +.Dq I don't write about that here, +but why don't I? +I don't have to come out to my blog. +. +.Pp +So really what I have been wanting to say is this: +every trans woman's voice that I have heard +has sounded genuinely wonderful to me. +Especially if you're reading this +and we've been on a voice call before. +I know, +voices are the object of so much self-consciousness, +but I really wish they didn't have to be. +Most of us do not sound like cis women +and to me that is fine. +Good, actually. +Trans women sound like trans women. +As a voice appreciator, +I am so happy to hear more kinds. +. +.Sh AUTHORS +.An june Aq Mt june@causal.agency +.Pp +I've been watching some Vektroid streams lately, +and I love her voice. +It was another thing +reminding me to write this. diff --git a/www/text.causal.agency/035-addendum-2021.7 b/www/text.causal.agency/035-addendum-2021.7 new file mode 100644 index 00000000..262f2178 --- /dev/null +++ b/www/text.causal.agency/035-addendum-2021.7 @@ -0,0 +1,111 @@ +.Dd March 18, 2022 +.Dt ADDENDUM-2021 7 +.Os "Causal Agency" +. +.Sh NAME +.Nm Addendum 2021 +.Nd missed music +. +.Sh DESCRIPTION +I just realized that I totally forgot +some important music for me from last year +in my Albums 2021 post, +because it wasn't in my playlist. +Last year I watched +the Berserk anime from 1997, +and its soundtrack is incredible. +. +.Pp +Actually the only reason +I started watching it at all +was because of the music. +I was watching the wayneradiotv stream, +.Do +Mon repas durant un temps de tristesse; +un pizza je n'oublierai jamais +.Dc +and I was mesmerized by the Guts theme. +I had to find out what it was from. +This was also around the time +that Kentaro Miura died +so people were really talking about it. +Anyway just hearing +that part of the soundtrack +got me to start watching the anime, +since you can find it all on youtube. +. +.Pp +The anime in general did not disappoint. +Actually it's really fucking good, +and so is the rest of the soundtrack. +The title sequence and credits tracks +are so good that I let them play +every episode even though +I watched the series over only like 2 days. +. +.Pp +I absolutely love whatever genre this stuff is. +Is '90s anime intros its own genre? +Something about combining +acoustic and electric guitars, +maybe. +I'm also fond of +the poorly written english lyrics. +They're poetic in a distinctive way. +I feel the same about +that Shinsei Kamattechan +song that was used for the credits of +Attack on Titan season 2. +Honestly awesome to write lyrics +in a second language you haven't mastered. +. +.Pp +So, +the intro track, +.Em Tell Me Why . +First off, +that sword sound effect +near the beginning rules. +Put that in more songs. +What I really can't get enough of +on this track are +the quiet shouty vocals +a bit off to the left +during the chorus. +It's such a cool idea +to have clean lead vocals +and shouting in the background. +. +.Pp +And the credits track, +.Em "Waiting So Long" . +That first low note is so good. +This is really a perfect credits song +for the atmosphere of the show. +It's creeping. +The dual vocals +the whole way through +are such an interesting texture. +Both of these tracks +have really cool vocal sounds. +And that dirty final guitar chord +is a great sound to end on. +. +.Sh SEE ALSO +These aren't great quality uploads +but this stuff is sadly hard to find. +.Bl -tag -width Ds +.It "Guts" +.Lk https://youtu.be/vZa0Yh6e7dw +.It "Earth" +.Lk https://youtu.be/5iAViNf9Z4Y +.It "Penpals \(em Tell Me Why" +.Lk https://youtu.be/I2rV8oKWSdM +.It "Silver Fins \(em Waiting So Long" +.Lk https://youtu.be/70GD2SBCq64 +.El +. +.Sh AUTHORS +.An june Aq Mt june@causal.agency +.Pp +.Dq I like swinging my sword in battle. diff --git a/www/text.causal.agency/036-compassion.7 b/www/text.causal.agency/036-compassion.7 new file mode 100644 index 00000000..9d0d887d --- /dev/null +++ b/www/text.causal.agency/036-compassion.7 @@ -0,0 +1,105 @@ +.Dd March 31, 2022 +.Dt COMPASSION 7 +.Os "Causal Agency" +. +.Sh NAME +.Nm Compassion +.Nd better world fiction +. +.Sh DESCRIPTION +Recently I watched the film +.Em Margarita With a Straw . +I'm not sure how to feel +about some aspects of it, +but it tries to do a lot, +and I was still thinking about it +a couple days later. +. +.Pp +What really sticks out about it, +to me, +is that it is +better world fiction, +for lack of a better term. +It's a film about two characters +with disabilities, +but it doesn't play into tropes. +There's no big dramatic scene +where a character gets treated unfairly. +It doesn't really happen. +In the world of the movie, +most people are accepting, +patient +and compassionate. +That's not to say +there is no conflict. +The film is just telling a different story. +. +.Pp +The story takes place +in a better world. +Or maybe it takes place +in a world that exists +within our own, +hidden between the worse parts. +It's wonderfully subversive. +Because I went into the film +expecting at least one deeply upsetting +scene of discrimination. +What else would you expect +of a story like this one, +right? +But instead of being upset, +I was warmed. +It was so nice to see +the characters work through +their own problems +surrounded by simple kindness. +And when it was over, +I was left wanting +to move our world +closer to that one. +. +.Pp +That's what I love about this kind of fiction. +It's why I love the books of Becky Chambers so much. +They give me hope, +and guidance. +I count the +.Em Murderbot Diaries +series in this as well, +which shows a sort of bad world, +and an alternative. +I think it's so important +to see the good that exists +and the good that could exist. +Rather than something to fight against, +these stories show something to fight for. +A more compassionate world. +. +.Pp +I know, +one person can't change the world. +But they can change their own world, +and the worlds of those around them. +And slowly, +good things can spread. +I'll strive to be +more patient, +more understanding, +more compassionate, +and I hope you will too. +. +.Sh AUTHORS +.An june Aq Mt june@causal.agency +. +.Pp +I can't help but worry, +when I write something like this, +that someone I know will read it +and think that I'm lying +because I've hurt them. +If that's the case, +I am sorry, +and I promise +I am trying to do better. diff --git a/www/text.causal.agency/037-care.7 b/www/text.causal.agency/037-care.7 new file mode 100644 index 00000000..052a4727 --- /dev/null +++ b/www/text.causal.agency/037-care.7 @@ -0,0 +1,167 @@ +.Dd April 3, 2022 +.Dt CARE 7 +.Os "Causal Agency" +. +.Sh NAME +.Nm Care +.Nd trans stuff in Montreal +. +.Sh DESCRIPTION +This kind of info +is frustratingly hard to find +even from support orgs +and the like. +I think it's unlikely +that anyone in my blog's audience +is also someone who needs this info, +and my blog isn't easy to find either, +but I want to at least +make it available somewhere. +Really this is just like +the posts where I figure out +how to do something with a computer +then I write it down. +. +.Pp +Prices obviously change, +by which I mean they inevitably go up, +but I'm gonna give the amounts I paid +in 2021\(en2022. +Also if you want more details +about any of this +please email me. +I will be happy to tell you all about it. +. +.Ss Medication +I get HRT through +Dr. Gabrielle Landry +at La Clinique A, +which is a private clinic. +I've done everything over the phone. +After the first consultation, +I signed an informed consent form +and had a prescription the next day, +which I could start +after I got an initial blood test. +The information I found +said to contact a specific person +at the clinic with a direct phone number, +which is what I did. +Email me if you want that number. +. +.Pp +I paid $300 for the first consult, +$195 for the first followup, +and $75 for further followups. +I think annual appointments +are more expensive +than the followups. +I've been getting blood tests done at a CLSC, +which is free. +On the public drug insurance plan, +I paid $30-$35 +for my prescriptions +as my dosage increased. +I have private insurance now +that entirely covers prescriptions, +so I'm not sure what I'd be paying +for my current prescription +on the public plan. +. +.Ss Hair removal +I tried laser hair removal, +for longer than I should have. +It was a waste of time and money. +Do not believe any arguments about +its convenience over electrolysis. +. +.Pp +I've started getting electrolysis done +with Dimi. +Again, +feel free to email me for contact info. +He is very good and can do long sessions. +I really don't find it very painful, +which I think is partly my own pain tolerance +and partly good equipment and skill. +I've also found that taking acetaminophen beforehand +and dressing warmly to keep my body relaxed help. +I've paid $85 for hour-long sessions +and $160 for two-hour sessions. +I'm still early in treatment, +but I'm really happy with the results so far! +. +.Ss Sex & name change +The form for this is +.Do +Application to Change the Sex Designation +of a Person 18 Years of Age and Over +.Dc +from the +.Em Directeur de l'\('etat civil . +It's self-ID, +but you have to get it signed by +someone you know +and a commissioner for oaths. +Julien at P10 is qualified for that +and was super nice. +We did it over Zoom. +It's a free service, +so I made a donation to P10. +. +.Pp +I paid $144 to file mine +but it's now FREE +the first time you do it. +Also $17 to mail it. +Surprisingly, +I got an acknowledgment letter +.Po +just saying they got it +and would start looking at it +.Dq shortly +.Pc +like a week and a half +after I mailed the application. +My cheque was cashed +39 days after the date +on the acknowledgment, +and I got a +.Dq favourable decision +a week later. +It takes another 30 days +to get the certificate of change, +after which you can +order a new birth certificate +and RAMQ will (slowly) send you a form +to get a new card. +In all it took about 4 months +from when I mailed the application +to having ID with my name on it. +. +.Ss Therapy +I'm not seeking therapy +for gender specifically, +but I would like to find a good therapist +that's aware of it. +I'll update this +if I find one. +. +.Ss Piercings +Ok I know this isn't trans-specific +but at least for me getting piercings +was gender-affirming. +Cuz I got nipple piercings lol. +Anyway, +I went to Mauve. +They're super nice, +really know what they're doing, +and their website has lots of info. +. +.Sh AUTHORS +.An june Aq Mt june@causal.agency +. +.Pp +If somehow you did find this useful, +I'd love for you to email me +and let me know how things went for you. diff --git a/www/text.causal.agency/038-agency.7 b/www/text.causal.agency/038-agency.7 new file mode 100644 index 00000000..f99a070b --- /dev/null +++ b/www/text.causal.agency/038-agency.7 @@ -0,0 +1,85 @@ +.Dd April 14, 2022 +.Dt AGENCY 7 +.Os "Causal Agency" +. +.Sh NAME +.Nm Agency +.Nd origin of a name +. +.Sh DESCRIPTION +When I registered this domain name, +it was aspirational. +Intentionally so. +I wanted a new domain +for a new identity, +and I was thinking about personhood. +That's what causal agency means. +. +.Pp +It really was aspirational +for me at the time. +I spent a lot of time +wishing I could be a person, +because I didn't feel like one. +I didn't feel real, +like everyone else was. +I didn't have any power +over my own life. +Things just happened to me, +and I watched. +There wasn't really a +.Dq me +there. +The world was something that happened +but that I couldn't interact with. +I felt like that +for most of my life. +. +.Pp +But at some point +I decided that, +even if I wasn't now, +one day I hoped to be an actual real life person. +Like most programmers +I am dreadful at naming things, +so I didn't come up +with this clever domain name +myself. +I typed +.Dq person +into some thesaurus, +and it gave back +.Dq causal agent , +and I realized +agency is a TLD now. +. +.Pp +Maybe it's a little dramatic +to label myself with the thing +I didn't think I had. +But who knows, +maybe it helped. +Because it took a few years, +but I did become a person. +I feel real now. +I can change my own life +and the world around me. +I have causal agency. +. +.Pp +I am really proud of this domain name. +I'm proud to put it on everything I make. +Every instance of it +is a reminder +that I did what I set out to do, +and that I'm still doing it. +. +.Sh AUTHORS +.An june Aq Mt june@causal.agency +. +.Pp +If anything in this post resonates with you, +I want you to know that, +whatever you think you can't do, +it is possible, +and you'll get there one day. diff --git a/www/text.causal.agency/039-apologies.7 b/www/text.causal.agency/039-apologies.7 new file mode 100644 index 00000000..1b15076a --- /dev/null +++ b/www/text.causal.agency/039-apologies.7 @@ -0,0 +1,81 @@ +.Dd September 19, 2022 +.Dt APOLOGIES 7 +.Os "Causal Agency" +. +.Sh NAME +.Nm Apologies +.Nd making them +. +.Sh DESCRIPTION +Apologies are very important to me. +Unfortunately +I've only recently realized +how valuable they are. +I've tried to think about +what makes a good apology, +since it's not something +I was ever taught. +This is the advice +I came up with for myself, +on how to apologize. +. +.Bl -enum +.It +Make the apology. +This is the most important part. +If you feel guilty +for something you've done, +or think you might have hurt someone, +apologize. +Even if they don't need an apology, +saying sorry won't hurt. +And start with that. +Literally say +.Dq I'm sorry . +Sometimes people forget that. +.Pp +On the other side, +if you've been hurt by someone, +and you trust them, +let them know. +Give them a chance to apologize. +People don't always realize +they've made a mistake. +. +.It +Explain what you did wrong. +I think it's important +for the other person +to know you understand +how you've messed up. +Really think about this! +It's what will help you learn. +If you know you've hurt someone +but you're not sure why, +you can try asking them. +Take their answer seriously. +. +.It +Don't make excuses. +Do not talk about yourself. +Don't even mention +how you were feeling stressed that day, +or whatever. +It's not relevant. +We all make mistakes, +we all have bad days. +. +.It +Commit to doing better. +Try to learn from your mistakes. +Say it won't happen again. +Literally say +.Dq I won't do that again . +And then try your hardest to make that true. +An apology is a commitment, +not something you're done with +once you've said it. +.El +. +.Sh AUTHORS +.An june Aq Mt june@causal.agency diff --git a/www/text.causal.agency/040-sound-memory.7 b/www/text.causal.agency/040-sound-memory.7 new file mode 100644 index 00000000..c995de08 --- /dev/null +++ b/www/text.causal.agency/040-sound-memory.7 @@ -0,0 +1,165 @@ +.Dd November 14, 2022 +.Dt SOUND-MEMORY 7 +.Os "Causal Agency" +. +.Sh NAME +.Nm Sound Memory +.Nd associations +. +.Sh DESCRIPTION +.Ss Talking Heads \(em "Remain In Light" +The first time I gave this album a serious listen +was when I was going for several-hour walks +at 4 in the morning in, +I think, +fall 2020. +I would stay up all night, +go out walking at 4am +for a couple hours, +come home, +eat +.Dq breakfast +and go to sleep. +I listened to this album +walking on completely empty +big city streets +in the dark. +. +.Ss Buffy Sainte-Marie \(em Up Where We Belong +I started listening to this album +after hearing it many mornings +walking into the cafe on my block +back in 2019. +I could tell Vincent was working +if I heard this when I opened the door. +. +.Ss Molasses \(em Trilogie: Toil & Peaceful Life +I listened to this when I had 8am classes +in CEGEP. +In particular my first semester philosophy course, +which was in the forum. +I usually got there even earlier +because of how the bus schedules worked out. +There was another girl in my class, +who I always sat next to, +who also got there early, +but we never spoke outside of class. +. +.Ss Arcade Fire \(em Funeral +This album just feels like walking outside +in fresh snow in early winter, +you know? +. +.Ss Molasses \(em Trouble at Jinx Hotel +I listened to this when I was looking for an apartment. +I specifically remember listening to it +walking down Clark toward my new place +to pick up my keys. +. +.Ss Arcade Fire \(em Neon Bible +The song +.Dq "No Cars Go" +is strongly associated for me +with my earliest gender feelings. +It's how I date when I first +started to feel like something was wrong. +The Suburbs was released in 2010, +so I was probably listening to Neon Bible +in 2011. +Ten years between that +and coming out. +. +.Ss "Do Make Say Think" \(em "You You're a History In Rust" +I remember hearing +.Dq "A Tender History In Rust" +for the first time +at the office of my first job. +Me and my coworkers stayed late, +probably on a Friday night, +drinking free tech startup booze. +. +.Ss mewithoutYou \(em It's All Crazy! It's All False! It's All a Dream! It's Alright +I exclusively listened to this album +on a high school trip to Europe. +Every morning when we got on the bus, +I heard +.Dq Every Thought a Thought of You +and every night before bed +I listened to +.Dq The King Beetle on a Coconut Estate . +. +.Ss Arcade Fire \(em The Suburbs +I listened to this album a tonne +when I was playing +Minecraft and Urban Terror +with my online friends +while I was in high school. +In particular I remember +a backyard shed World of Padman map +and the apartments Minecraft world. +. +.Ss Arcade Fire \(em Reflektor +I associate +.Dq Afterlife +with the walk between Laurier metro +and my first job, +in the winter. +Must've just been how the timing worked out +with my commute at the time. +. +.Ss Swans \(em To Be Kind +I listened to this on one of my playthroughs +of Half-Life 2. +In particular I associate +.Dq Bring the Sun / Toussaint L'Ouverture +with the Water Hazard chapter. +. +.Ss Wrekmeister Harmonies \(em Light Falls +For a while I put this on whenever I +left my apartment to go somewhere +and it was already dark, +so probably winter. +. +.Ss St. Vincent \(em MASSEDUCTION +This, +along with the next one, +I think were all I listened to +on a family vacation +to Quebec City and New Brunswick +some years ago. +. +.Ss SOPHIE \(em Oil of Every Pearl's Un-Insides +Many hours on the road +on that family vacation. +Two albums on repeat. +. +.Ss Julia Holter \(em Aviary +This is another album +I listened to when I was taking +walks at 4am. +I wasn't in a good place. +Yet. +. +.Ss Beep Test \(em Laugh Track +A tape from the first act +at one of my favourite shows +I've ever been to, +at La Sotterenea +in Suoni 2019. +I wish I had been out already. +. +.Ss The Armed \(em Only Love +The third of the albums I listened to +on those dark walks. +I listened to it loud, +this album's mixing needs it. +. +.Ss Eliza Kavtion \(em The Rez That Summer +A favourite local artist. +I remember vividly the first time +I heard her play, +opening for Wrekmeister Harmonies +at La Vitrola in 2018. +. +.Sh AUTHORS +.An june Aq Mt june@causal.agency diff --git a/www/text.causal.agency/041-albums-2022.7 b/www/text.causal.agency/041-albums-2022.7 new file mode 100644 index 00000000..48bd3c3d --- /dev/null +++ b/www/text.causal.agency/041-albums-2022.7 @@ -0,0 +1,185 @@ +.Dd December 21, 2022 +.Dt ALBUMS-2022 7 +.Os "Causal Agency" +. +.Sh NAME +.Nm albums 2022 +.Nd review +. +.Sh DESCRIPTION +it's the year-end review +of albums I listened to. +same as last year, +I added any albums I got into +this year to a playlist. +I've actually done that +every year since 2018. +maybe I'll review +those old playlists some time. +. +.Ss ZHAOZE \(em SUMMER INSECTS TALK ABOUT ICE (2021) +it's a five-and-a-half-minute album! +you can loop it however long you want. +it's really lovely. +.Pp +favourite track: +ON HORSEBACK, TO FARAWAY +. +.Ss KATE BUSH \(em HOUNDS OF LOVE (1985) +first of all I do not watch that one show. +I've known that track for a while actually. +I mean I probably first heard the CHROMATICS cover. +but anyway, +I think someone mentioned this album +on IRC at just the right time +and I put it on. +the second half really shines tbh. +love a concept album. +.Pp +favourite tracks: +RUNNING UP THAT HILL, +HOUNDS OF LOVE, +AND DREAM OF SHEEP, +WATCHING YOU WITHOUT ME, +THE MORNING FOG. +. +.Ss GODSPEED YOU! BLACK EMPEROR \(em ALL LIGHTS FUCKED ON THE HAIRY AMP DROOLING (1994) +didn't expect to hear this probably ever. +still wild that it finally got uploaded. +and to be honest I'm a little mad +that it's actually good. +like yeah it's not a godspeed album +but it holds up as a tape on its own. +it's the kind of shit I listen to. +also can't believe some people +still thought it was fake. +like have you not heard +any other efrim menuck projects? +.Pp +favourite tracks: +$13.13, +DIMINISHING SHINE, +DADMOMDADDY, +333 FRAMES PER SECOND, +ALL ANGELS GONE. +. +.Ss BLACK DRESSES \(em FORGET YOUR OWN FACE (2022) +woops I think I only listened to this like twice. +will need to revisit it later for sure. +I'll like it. +. +.Ss BACKXWASH \(em I LIE HERE BURIED WITH MY RINGS AND MY DRESSES (2021) +only got into this album +after hearing it live this summer. +was the first show I went to in years +and it was really fucking good. +gotta listen to this shit loud. +sampling godspeed for a beat fucks. +honestly back to back bangers. +.Pp +favourite tracks: +I LIE HERE BURIED WITH MY RINGS AND MY DRESSES, +TERROR PACKETS, +SONG OF SINNERS, +BURN TO ASHES. +. +.Ss PHILIP GLASS ENSEMBLE \(em EINSTEIN ON THE BEACH (1979) +actually just the knee plays +because I can't be bothered +listening to all of it. +and I'm embarrassed by how much +I enjoy this avant-garde bullshit. +like ok just sing repeating numbers at me +and my brain is happy. +what is this? +my kink? +anyway I also have kind of an obsession +with the +.Dq story of love +in knee 5. +I fucking hate it. +but it's delivered so well. +and that violin though! +.Pp +favourite tracks: +KNEE 1, +KNEE 5. +. +.Ss KANYE WEST \(em YEEZUS (2013) +ok look I listened to this +before recent events. +what the fuck. +it's a really good album though? +pretty sure I listened to it +because bound 2 kept getting in my head, +because of that minecraft parody parody +wayne did ages ago. +.Pp +favourite tracks: +BLACK SKINHEAD, +HOLD MY LIQUOR, +BLOOD ON THE LEAVES, +BOUND 2. +. +.Ss FLYING RACCOON SUIT \(em AFTERGLOW (2021) +I've listened to the whole album +a few times +but I'm mostly just here +for the title track. +this also happened to be +dropped in IRC at just the right time. +good ska-punk-type shit. +and I like lisps ok. +.Pp +favourite track: +AFTERGLOW. +. +.Ss RAMSHACKLE GLORY \(em LIVE THE DREAM (2011) +one of those albums +I don't know why I took so long +to get to. +I've been listening to johnny hobo +since I was like in high school. +ramshackle is a little more hopeful +and I love that. +your heart is a muscle the size of your fist. +keep on loving. +keep on fighting. +.Pp +favourite tracks: +WE ARE ALL COMPOST IN TRAINING, +NEVER COMING HOME, +YOUR HEART IS A MUSCLE THE SIZE OF YOUR FIST. +. +.Ss LES RALLIZES D\('ENUD\('ES \(em THE OZ TAPES (2022) +a pleasant surprise in someone's playlist. +lately I've been listening to this +in the metro to or from electrolysis. +it's good listening for that. +bold to have two versions +of the same 24-minute song +on the same release. +.Pp +favourite tracks: +A SHADOW ON OUR JOY, +THE LAST ONE_1970 (ver.2). +. +.Ss LINGUA IGNOTA \(em SINNER GET READY (2021) +another I'm only getting into +after hearing it live. +just last sunday actually. +was a good show. +people will go wild +to hear a cover live for real. +.Pp +favourite tracks: +I WHO BEND THE TALL GRASSES, +PENNSYLVANIA FURNACE, +PERPETUAL FLAME OF CENTRALIA. +. +.Sh AUTHORS +.An june Aq Mt june@causal.agency +.Pp +I started writing this +before I saw LINGUA IGNOTA. +good thing I waited. diff --git a/www/text.causal.agency/042-comfort-music.7 b/www/text.causal.agency/042-comfort-music.7 new file mode 100644 index 00000000..445e04c3 --- /dev/null +++ b/www/text.causal.agency/042-comfort-music.7 @@ -0,0 +1,62 @@ +.Dd February 23, 2024 +.Dt COMFORT-MUSIC 7 +.Os "Causal Agency" +. +.Sh NAME +.Nm comfort music +.Nd feel better +. +.Sh DESCRIPTION +it's been a while. +and I'm on almost no sleep +and haven't eaten a real meal +since noon. +which is a state I've written +at least a couple posts in before, +so what better time +to return to what has apparently +become this blog's format: +lists of some music I like. +. +.Pp +this is a list of music that comforts me. +. +.Bl -bullet +.It +knee play 5, from einstein on the beach. +I like the organ and the counting and the cadence of the story. +.It +low \(em words. +and I'm tired. +.It +godspeed you! black emperor \(em storm. +this is like my original comfort music. +been listening to it since I was teenage. +the grooves are worn deep in my mind. +.It +set fire to flames \(em love song for 15 ontario (w/ singing police car). +I like how it ends. +.It +va, from the beginner's guide. +I think that's the whole point. +though maybe it's too sad +to be truly comforting. +.It +undertale, from undertale. +what can I say? +.It +wrekmeister harmonies \(em covered in blood from invisible wounds. +I find quite a bit of the album comforting really. +I'm picking this one because I like the cadence +of the lyrics. +.It +lingua ignota \(em pennsylvania furnace and perpetual flame of centralia. +these are really my go to in recent times. +I like waiting for the next line. +.El +. +.Sh AUTHORS +.An june Aq Mt june@causal.agency +.Pp +I don't think I've said anything +very interesting here. diff --git a/www/text.causal.agency/043-little-blessings.7 b/www/text.causal.agency/043-little-blessings.7 new file mode 100644 index 00000000..957c6289 --- /dev/null +++ b/www/text.causal.agency/043-little-blessings.7 @@ -0,0 +1,78 @@ +.Dd March 24, 2024 +.Dt LITTLE-BLESSINGS 7 +.Os "Causal Agency" +. +.Sh NAME +.Nm little blessings +.Nd life's +. +.Sh DESCRIPTION +today I went out to go around. +run some errands and do some shopping. +along the way I was given +several of life's little blessings. +. +.Pp +while walking on ste-cath +between berri and complexe desjardins, +there was a somewhat disheveled man +walking in the same direction and singing. +he had a beautiful voice. +he was singing a sad song in french, +and he sung it well and enunciated every word. +. +.Pp +in the mcdonald's at complexe desjardins, +while waiting for my order, +there were what appeared to be +a teenager and her younger brother, +who must have been +looking at the display of +current happy meal toys. +the teenager was playing smash or pass, +to the amusement of the younger one. +they got ice cream +and ate it across the room from me downstairs. +. +.Pp +later, +taking the 24 home from atwater +carrying my new vacuum cleaner, +the bus got lost. +I think the driver missed the stop +and tried to compensate +by turning north onto peel +and stopping there. +but then he had to keep going up peel. +he turned right onto docteur-penfield, +which just brings you further up the mountain. +when it met des pins, +he turned left and pulled over, +asking for guidance over the radio. +we got moving again, +back towards peel. +that's how I ended up +on a 24 +.Dq sherbrooke +east, +facing west on des pins. +it was actually quite scenic. +and amusing. +I was in no rush. +. +.Pp +after getting back onto sherbrooke, +the bus had to take another detour, +this one planned. +so my ride on the 24, +which normally only drives on sherbrooke, +ended up going on peel, +docteur-penfield, +des pins, +de bleury, +ren\('e-l\('evesque +and saint-laurent. +it was a very exciting bus trip. +. +.Sh AUTHORS +.An june Aq Mt june@causal.agency diff --git a/www/text.causal.agency/Makefile b/www/text.causal.agency/Makefile index c1b79645..a8683a20 100644 --- a/www/text.causal.agency/Makefile +++ b/www/text.causal.agency/Makefile @@ -1,4 +1,4 @@ -WEBROOT = /usr/local/www/text.causal.agency +WEBROOT = /var/www/text.causal.agency TXTS += 001-make.txt TXTS += 002-writing-mdoc.txt @@ -10,19 +10,57 @@ TXTS += 007-cgit-setup.txt TXTS += 008-how-irc.txt TXTS += 009-casual-update.txt TXTS += 010-irc-suite.txt +TXTS += 011-libretls.txt +TXTS += 012-inability.txt +TXTS += 013-hot-tips.txt +TXTS += 014-using-vi.txt +TXTS += 015-reusing-tags.txt +TXTS += 016-using-openbsd.txt +TXTS += 017-unpasswords.txt +TXTS += 018-operating-systems.txt +TXTS += 019-mailing-list.txt +TXTS += 020-c-style.txt +TXTS += 021-time-machine.txt +TXTS += 022-swans-are-dead.txt +TXTS += 023-sparse-checkout.txt +TXTS += 024-seprintf.txt +TXTS += 025-v6-pwd.txt +TXTS += 026-git-comment.txt +TXTS += 027-openbsd-linode.txt +TXTS += 028-names.txt +TXTS += 029-topics.txt +TXTS += 030-discs.txt +TXTS += 031-books-2021.txt +TXTS += 032-albums-2021.txt +TXTS += 033-jorts.txt +TXTS += 034-voices.txt +TXTS += 035-addendum-2021.txt +TXTS += 036-compassion.txt +TXTS += 037-care.txt +TXTS += 038-agency.txt +TXTS += 039-apologies.txt +TXTS += 040-sound-memory.txt +TXTS += 041-albums-2022.txt +TXTS += 042-comfort-music.txt +TXTS += 043-little-blessings.txt -all: ${TXTS} +all: colb ${TXTS} -.SUFFIXES: .7 .txt +.SUFFIXES: .7 .fmt .txt .7.txt: - mandoc $< | col -bx > $@ + mandoc -T utf8 $< | ./colb > $@ + touch -m -r $< $@ -feed.atom: feed.sh ${TXTS} +.fmt.txt: + fmt $< | sed '1,/^$$/d' > $@ + touch -m -r $< $@ + +feed.atom: feed.sh colb ${TXTS} sh feed.sh > feed.atom clean: - rm -f ${TXTS} feed.atom + rm -f colb ${TXTS} feed.atom -install: ${TXTS} feed.atom +install: colb ${TXTS} feed.atom install -p -m 644 ${TXTS} feed.atom ${WEBROOT} diff --git a/www/text.causal.agency/colb.c b/www/text.causal.agency/colb.c new file mode 100644 index 00000000..5faabc3a --- /dev/null +++ b/www/text.causal.agency/colb.c @@ -0,0 +1,16 @@ +#include <locale.h> +#include <stdio.h> +#include <wchar.h> +int main(void) { + setlocale(LC_CTYPE, "en_US.UTF-8"); + wint_t next, prev = WEOF; + while (WEOF != (next = getwchar())) { + if (next == L'\b') { + prev = WEOF; + } else { + if (prev != WEOF) putwchar(prev); + prev = next; + } + } + if (prev != WEOF) putwchar(prev); +} diff --git a/www/text.causal.agency/feed.sh b/www/text.causal.agency/feed.sh index de9e7c54..71bbf662 100644 --- a/www/text.causal.agency/feed.sh +++ b/www/text.causal.agency/feed.sh @@ -4,33 +4,53 @@ set -eu readonly Root='https://text.causal.agency' updated=$(date -u '+%FT%TZ') -cat <<- EOF +cat <<-EOF <?xml version="1.0" encoding="utf-8"?> <feed xmlns="http://www.w3.org/2005/Atom"> <title>Causal Agency</title> <author><name>June</name><email>june@causal.agency</email></author> <link href="${Root}"/> - <id>${Root}</id> + <link rel="self" href="${Root}/feed.atom"/> + <id>${Root}/</id> <updated>${updated}</updated> EOF -for entry in *.7; do - url="${Root}/${entry%.7}.txt" +encode() { + sed ' + s/&/\&/g + s/</\</g + s/"/\"/g + ' "$@" +} + +set -- *.txt +shift $(( $# - 20 )) +for txt; do + entry="${txt%.txt}.7" + test -f "$entry" || entry="${txt%.txt}.fmt" date=$(grep '^[.]Dd' "$entry" | cut -c 5-) - title=$(grep '^[.]Nm' "$entry" | cut -c 5-) - summary=$(grep '^[.]Nd' "$entry" | cut -c 5-) + title=$(grep -m 1 '^[.]Nm' "$entry" | cut -c 5- | encode) + summary=$(grep '^[.]Nd' "$entry" | cut -c 5- | encode) published=$(date -ju -f '%B %d, %Y %T' "${date} 00:00:00" '+%FT%TZ') mtime=$(stat -f '%m' "$entry") updated=$(date -ju -f '%s' "$mtime" '+%FT%TZ') - cat <<- EOF + cat <<-EOF <entry> <title>${title}</title> <summary>${summary}</summary> - <link href="${url}"/> - <id>${url}</id> + <link href="${Root}/${txt}"/> + <id>${Root}/${txt}</id> <published>${published}</published> <updated>${updated}</updated> - <content type="text/plain" src="${url}"/> + <content type="xhtml"> + <div xmlns="http://www.w3.org/1999/xhtml"> + EOF + printf '<pre>' + encode "$txt" + cat <<-EOF + </pre> + </div> + </content> </entry> EOF done |