Index: head/bin/ed/cbc.c =================================================================== --- head/bin/ed/cbc.c (revision 340131) +++ head/bin/ed/cbc.c (nonexistent) @@ -1,395 +0,0 @@ -/* cbc.c: This file contains the encryption routines for the ed line editor */ -/*- - * SPDX-License-Identifier: BSD-3-Clause - * - * Copyright (c) 1993 The Regents of the University of California. - * All rights reserved. - * - * Copyright (c) 1993 Andrew Moore, Talke Studio. - * 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. - */ - -#include -__FBSDID("$FreeBSD$"); - -#include -#include -#include -#ifdef DES -#include -#include -#define ED_DES_INCLUDES -#endif - -#include "ed.h" - - -/* - * BSD and System V systems offer special library calls that do - * block move_liness and fills, so if possible we take advantage of them - */ -#define MEMCPY(dest,src,len) memcpy((dest),(src),(len)) -#define MEMZERO(dest,len) memset((dest), 0, (len)) - -/* Hide the calls to the primitive encryption routines. */ -#define DES_XFORM(buf) \ - DES_ecb_encrypt(buf, buf, &schedule, \ - inverse ? DES_DECRYPT : DES_ENCRYPT); - -/* - * read/write - no error checking - */ -#define READ(buf, n, fp) fread(buf, sizeof(char), n, fp) -#define WRITE(buf, n, fp) fwrite(buf, sizeof(char), n, fp) - -/* - * global variables and related macros - */ - -#ifdef DES -static DES_cblock ivec; /* initialization vector */ -static DES_cblock pvec; /* padding vector */ - -static char bits[] = { /* used to extract bits from a char */ - '\200', '\100', '\040', '\020', '\010', '\004', '\002', '\001' -}; - -static int pflag; /* 1 to preserve parity bits */ - -static DES_key_schedule schedule; /* expanded DES key */ - -static unsigned char des_buf[8];/* shared buffer for get_des_char/put_des_char */ -static int des_ct = 0; /* count for get_des_char/put_des_char */ -static int des_n = 0; /* index for put_des_char/get_des_char */ -#endif - -/* init_des_cipher: initialize DES */ -void -init_des_cipher(void) -{ -#ifdef DES - des_ct = des_n = 0; - - /* initialize the initialization vector */ - MEMZERO(ivec, 8); - - /* initialize the padding vector */ - arc4random_buf(pvec, sizeof(pvec)); -#endif -} - - -/* get_des_char: return next char in an encrypted file */ -int -get_des_char(FILE *fp) -{ -#ifdef DES - if (des_n >= des_ct) { - des_n = 0; - des_ct = cbc_decode(des_buf, fp); - } - return (des_ct > 0) ? des_buf[des_n++] : EOF; -#else - return (getc(fp)); -#endif -} - - -/* put_des_char: write a char to an encrypted file; return char written */ -int -put_des_char(int c, FILE *fp) -{ -#ifdef DES - if (des_n == sizeof des_buf) { - des_ct = cbc_encode(des_buf, des_n, fp); - des_n = 0; - } - return (des_ct >= 0) ? (des_buf[des_n++] = c) : EOF; -#else - return (fputc(c, fp)); -#endif -} - - -/* flush_des_file: flush an encrypted file's output; return status */ -int -flush_des_file(FILE *fp) -{ -#ifdef DES - if (des_n == sizeof des_buf) { - des_ct = cbc_encode(des_buf, des_n, fp); - des_n = 0; - } - return (des_ct >= 0 && cbc_encode(des_buf, des_n, fp) >= 0) ? 0 : EOF; -#else - return (fflush(fp)); -#endif -} - -#ifdef DES -/* - * get keyword from tty or stdin - */ -int -get_keyword(void) -{ - char *p; /* used to obtain the key */ - DES_cblock msgbuf; /* I/O buffer */ - - /* - * get the key - */ - if ((p = getpass("Enter key: ")) != NULL && *p != '\0') { - - /* - * copy it, nul-padded, into the key area - */ - expand_des_key(msgbuf, p); - MEMZERO(p, _PASSWORD_LEN); - set_des_key(&msgbuf); - MEMZERO(msgbuf, sizeof msgbuf); - return 1; - } - return 0; -} - - -/* - * print a warning message and, possibly, terminate - */ -void -des_error(const char *s) -{ - errmsg = s ? s : strerror(errno); -} - -/* - * map a hex character to an integer - */ -int -hex_to_binary(int c, int radix) -{ - switch(c) { - case '0': return(0x0); - case '1': return(0x1); - case '2': return(radix > 2 ? 0x2 : -1); - case '3': return(radix > 3 ? 0x3 : -1); - case '4': return(radix > 4 ? 0x4 : -1); - case '5': return(radix > 5 ? 0x5 : -1); - case '6': return(radix > 6 ? 0x6 : -1); - case '7': return(radix > 7 ? 0x7 : -1); - case '8': return(radix > 8 ? 0x8 : -1); - case '9': return(radix > 9 ? 0x9 : -1); - case 'A': case 'a': return(radix > 10 ? 0xa : -1); - case 'B': case 'b': return(radix > 11 ? 0xb : -1); - case 'C': case 'c': return(radix > 12 ? 0xc : -1); - case 'D': case 'd': return(radix > 13 ? 0xd : -1); - case 'E': case 'e': return(radix > 14 ? 0xe : -1); - case 'F': case 'f': return(radix > 15 ? 0xf : -1); - } - /* - * invalid character - */ - return(-1); -} - -/* - * convert the key to a bit pattern - * obuf bit pattern - * kbuf the key itself - */ -void -expand_des_key(char *obuf, char *kbuf) -{ - int i, j; /* counter in a for loop */ - int nbuf[64]; /* used for hex/key translation */ - - /* - * leading '0x' or '0X' == hex key - */ - if (kbuf[0] == '0' && (kbuf[1] == 'x' || kbuf[1] == 'X')) { - kbuf = &kbuf[2]; - /* - * now translate it, bombing on any illegal hex digit - */ - for (i = 0; i < 16 && kbuf[i]; i++) - if ((nbuf[i] = hex_to_binary((int) kbuf[i], 16)) == -1) - des_error("bad hex digit in key"); - while (i < 16) - nbuf[i++] = 0; - for (i = 0; i < 8; i++) - obuf[i] = - ((nbuf[2*i]&0xf)<<4) | (nbuf[2*i+1]&0xf); - /* preserve parity bits */ - pflag = 1; - return; - } - /* - * leading '0b' or '0B' == binary key - */ - if (kbuf[0] == '0' && (kbuf[1] == 'b' || kbuf[1] == 'B')) { - kbuf = &kbuf[2]; - /* - * now translate it, bombing on any illegal binary digit - */ - for (i = 0; i < 16 && kbuf[i]; i++) - if ((nbuf[i] = hex_to_binary((int) kbuf[i], 2)) == -1) - des_error("bad binary digit in key"); - while (i < 64) - nbuf[i++] = 0; - for (i = 0; i < 8; i++) - for (j = 0; j < 8; j++) - obuf[i] = (obuf[i]<<1)|nbuf[8*i+j]; - /* preserve parity bits */ - pflag = 1; - return; - } - /* - * no special leader -- ASCII - */ - (void)strncpy(obuf, kbuf, 8); -} - -/***************** - * DES FUNCTIONS * - *****************/ -/* - * This sets the DES key and (if you're using the deszip version) - * the direction of the transformation. This uses the Sun - * to map the 64-bit key onto the 56 bits that the key schedule - * generation routines use: the old way, which just uses the user- - * supplied 64 bits as is, and the new way, which resets the parity - * bit to be the same as the low-order bit in each character. The - * new way generates a greater variety of key schedules, since many - * systems set the parity (high) bit of each character to 0, and the - * DES ignores the low order bit of each character. - */ -void -set_des_key(DES_cblock *buf) /* key block */ -{ - int i, j; /* counter in a for loop */ - int par; /* parity counter */ - - /* - * if the parity is not preserved, flip it - */ - if (!pflag) { - for (i = 0; i < 8; i++) { - par = 0; - for (j = 1; j < 8; j++) - if ((bits[j] & (*buf)[i]) != 0) - par++; - if ((par & 0x01) == 0x01) - (*buf)[i] &= 0x7f; - else - (*buf)[i] = ((*buf)[i] & 0x7f) | 0x80; - } - } - - DES_set_odd_parity(buf); - DES_set_key(buf, &schedule); -} - - -/* - * This encrypts using the Cipher Block Chaining mode of DES - */ -int -cbc_encode(unsigned char *msgbuf, int n, FILE *fp) -{ - int inverse = 0; /* 0 to encrypt, 1 to decrypt */ - - /* - * do the transformation - */ - if (n == 8) { - for (n = 0; n < 8; n++) - msgbuf[n] ^= ivec[n]; - DES_XFORM((DES_cblock *)msgbuf); - MEMCPY(ivec, msgbuf, 8); - return WRITE(msgbuf, 8, fp); - } - /* - * at EOF or last block -- in either case, the last byte contains - * the character representation of the number of bytes in it - */ -/* - MEMZERO(msgbuf + n, 8 - n); -*/ - /* - * Pad the last block randomly - */ - (void)MEMCPY(msgbuf + n, pvec, 8 - n); - msgbuf[7] = n; - for (n = 0; n < 8; n++) - msgbuf[n] ^= ivec[n]; - DES_XFORM((DES_cblock *)msgbuf); - return WRITE(msgbuf, 8, fp); -} - -/* - * This decrypts using the Cipher Block Chaining mode of DES - * msgbuf I/O buffer - * fp input file descriptor - */ -int -cbc_decode(unsigned char *msgbuf, FILE *fp) -{ - DES_cblock tbuf; /* temp buffer for initialization vector */ - int n; /* number of bytes actually read */ - int c; /* used to test for EOF */ - int inverse = 1; /* 0 to encrypt, 1 to decrypt */ - - if ((n = READ(msgbuf, 8, fp)) == 8) { - /* - * do the transformation - */ - MEMCPY(tbuf, msgbuf, 8); - DES_XFORM((DES_cblock *)msgbuf); - for (c = 0; c < 8; c++) - msgbuf[c] ^= ivec[c]; - MEMCPY(ivec, tbuf, 8); - /* - * if the last one, handle it specially - */ - if ((c = fgetc(fp)) == EOF) { - n = msgbuf[7]; - if (n < 0 || n > 7) { - des_error("decryption failed (block corrupted)"); - return EOF; - } - } else - (void)ungetc(c, fp); - return n; - } - if (n > 0) - des_error("decryption failed (incomplete block)"); - else if (n < 0) - des_error("cannot read file"); - return EOF; -} -#endif /* DES */ Property changes on: head/bin/ed/cbc.c ___________________________________________________________________ Deleted: svn:keywords ## -1 +0,0 ## -FreeBSD=%H \ No newline at end of property Index: head/bin/ed/Makefile =================================================================== --- head/bin/ed/Makefile (revision 340131) +++ head/bin/ed/Makefile (revision 340132) @@ -1,16 +1,11 @@ # $FreeBSD$ .include PACKAGE=runtime PROG= ed -SRCS= buf.c cbc.c glbl.c io.c main.c re.c sub.c undo.c +SRCS= buf.c glbl.c io.c main.c re.c sub.c undo.c LINKS= ${BINDIR}/ed ${BINDIR}/red MLINKS= ed.1 red.1 - -.if ${MK_OPENSSL} != "no" && ${MK_ED_CRYPTO} != "no" -CFLAGS+=-DDES -LIBADD= crypto -.endif .include Index: head/bin/ed/POSIX =================================================================== --- head/bin/ed/POSIX (revision 340131) +++ head/bin/ed/POSIX (revision 340132) @@ -1,101 +1,92 @@ $FreeBSD$ This version of ed(1) is not strictly POSIX compliant, as described in the POSIX 1003.2 document. The following is a summary of the omissions, extensions and possible deviations from POSIX 1003.2. OMISSIONS --------- 1) For backwards compatibility, the POSIX rule that says a range of addresses cannot be used where only a single address is expected has been relaxed. 2) To support the BSD `s' command (see extension [1] below), substitution patterns cannot be delimited by numbers or the characters `r', `g' and `p'. In contrast, POSIX specifies any character expect space or newline can used as a delimiter. EXTENSIONS ---------- 1) BSD commands have been implemented wherever they do not conflict with the POSIX standard. The BSD-ism's included are: i) `s' (i.e., s[n][rgp]*) to repeat a previous substitution, ii) `W' for appending text to an existing file, iii) `wq' for exiting after a write, iv) `z' for scrolling through the buffer, and v) BSD line addressing syntax (i.e., `^' and `%') is recognized. -2) If crypt(3) is available, files can be read and written using DES - encryption. The `x' command prompts the user to enter a key used for - encrypting/ decrypting subsequent reads and writes. If only a newline - is entered as the key, then encryption is disabled. Otherwise, a key - is read in the same manner as a password entry. The key remains in - effect until encryption is disabled. For more information on the - encryption algorithm, see the bdes(1) man page. Encryption/decryption - should be fully compatible with SunOS des(1). - -3) The POSIX interactive global commands `G' and `V' are extended to +2) The POSIX interactive global commands `G' and `V' are extended to support multiple commands, including `a', `i' and `c'. The command format is the same as for the global commands `g' and `v', i.e., one command per line with each line, except for the last, ending in a backslash (\). -4) An extension to the POSIX file commands `E', `e', `r', `W' and `w' is +3) An extension to the POSIX file commands `E', `e', `r', `W' and `w' is that arguments are processed for backslash escapes, i.e., any character preceded by a backslash is interpreted literally. If the first unescaped character of a argument is a bang (!), then the rest of the line is interpreted as a shell command, and no escape processing is performed by ed. -5) For SunOS ed(1) compatibility, ed runs in restricted mode if invoked +4) For SunOS ed(1) compatibility, ed runs in restricted mode if invoked as red. This limits editing of files in the local directory only and prohibits shell commands. DEVIATIONS ---------- 1) Though ed is not a stream editor, it can be used to edit binary files. To assist in binary editing, when a file containing at least one ASCII NUL character is written, a newline is not appended if it did not already contain one upon reading. In particular, reading /dev/null prior to writing prevents appending a newline to a binary file. For example, to create a file with ed containing a single NUL character: $ ed file a ^@ . r /dev/null wq Similarly, to remove a newline from the end of binary `file': $ ed file r /dev/null wq 2) Since the behavior of `u' (undo) within a `g' (global) command list is not specified by POSIX, it follows the behavior of the SunOS ed: undo forces a global command list to be executed only once, rather than for each line matching a global pattern. In addition, each instance of `u' within a global command undoes all previous commands (including undo's) in the command list. This seems the best way, since the alternatives are either too complicated to implement or too confusing to use. The global/undo combination is useful for masking errors that would otherwise cause a script to fail. For instance, an ed script to remove any occurrences of either `censor1' or `censor2' might be written as: ed - file <\ 2" , then the corresponding range is determined by the last two addresses in the .Em n Ns -tuple . If only one address is expected, then the last address is used. .Pp Each address in a comma-delimited range is interpreted relative to the current address. In a semi-colon-delimited range, the first address is used to set the current address, and the second address is interpreted relative to the first. .Pp The following address symbols are recognized: .Bl -tag -width indent .It . The current line (address) in the buffer. .It $ The last line in the buffer. .It n The .Em n Ns th line in the buffer where .Em n is a number in the range .Em [0,$] . .It - or ^ The previous line. This is equivalent to .Em -1 and may be repeated with cumulative effect. .It -n or ^n The .Em n Ns th previous line, where .Em n is a non-negative number. .It + The next line. This is equivalent to .Em +1 and may be repeated with cumulative effect. .It +n The .Em n Ns th next line, where .Em n is a non-negative number. .It , or % The first through last lines in the buffer. This is equivalent to the address range .Em 1,$ . .It ; The current through last lines in the buffer. This is equivalent to the address range .Em .,$ . .It /re/ The next line containing the regular expression .Em re . The search wraps to the beginning of the buffer and continues down to the current line, if necessary. // repeats the last search. .It ?re? The previous line containing the regular expression .Em re . The search wraps to the end of the buffer and continues up to the current line, if necessary. ?? repeats the last search. .It 'lc The line previously marked by a .Em k (mark) command, where .Em lc is a lower case letter. .El .Sh REGULAR EXPRESSIONS Regular expressions are patterns used in selecting text. For example, the command: .Pp .Sm off .Cm g No / Em string Xo .No / .Xc .Sm on .Pp prints all lines containing .Em string . Regular expressions are also used by the .Em s command for selecting old text to be replaced with new. .Pp In addition to a specifying string literals, regular expressions can represent classes of strings. Strings thus represented are said to be matched by the corresponding regular expression. If it is possible for a regular expression to match several strings in a line, then the left-most longest match is the one selected. .Pp The following symbols are used in constructing regular expressions: .Bl -tag -width indent .It c Any character .Em c not listed below, including .Ql \&{ , .Ql \&} , .Ql \&( , .Ql \&) , .Ql < and .Ql > , matches itself. .It Pf \e c Any backslash-escaped character .Em c , except for .Ql \&{ , .Ql \&} , .Ql \&( , .Ql \&) , .Ql < and .Ql > , matches itself. .It . Match any single character. .It Op char-class Match any single character in .Em char-class . To include a .Ql \&] in .Em char-class , it must be the first character. A range of characters may be specified by separating the end characters of the range with a .Ql - , e.g., .Ql a-z specifies the lower case characters. The following literal expressions can also be used in .Em char-class to specify sets of characters: .Pp .Bl -column "[:alnum:]" "[:cntrl:]" "[:lower:]" "[:xdigit:]" -compact .It [:alnum:] Ta [:cntrl:] Ta [:lower:] Ta [:space:] .It [:alpha:] Ta [:digit:] Ta [:print:] Ta [:upper:] .It [:blank:] Ta [:graph:] Ta [:punct:] Ta [:xdigit:] .El .Pp If .Ql - appears as the first or last character of .Em char-class , then it matches itself. All other characters in .Em char-class match themselves. .Pp Patterns in .Em char-class of the form: .Pp .Bl -item -compact -offset 2n .It .Op \&. Ns Ar col-elm Ns .\& or, .It .Op = Ns Ar col-elm Ns = .El .Pp where .Ar col-elm is a .Em collating element are interpreted according to the current locale settings (not currently supported). See .Xr regex 3 and .Xr re_format 7 for an explanation of these constructs. .It Op ^char-class Match any single character, other than newline, not in .Em char-class . .Em Char-class is defined as above. .It ^ If .Em ^ is the first character of a regular expression, then it anchors the regular expression to the beginning of a line. Otherwise, it matches itself. .It $ If .Em $ is the last character of a regular expression, it anchors the regular expression to the end of a line. Otherwise, it matches itself. .It Pf \e < Anchor the single character regular expression or subexpression immediately following it to the beginning of a word. (This may not be available) .It Pf \e > Anchor the single character regular expression or subexpression immediately following it to the end of a word. (This may not be available) .It Pf \e (re\e) Define a subexpression .Em re . Subexpressions may be nested. A subsequent backreference of the form .Pf \e Em n , where .Em n is a number in the range [1,9], expands to the text matched by the .Em n Ns th subexpression. For example, the regular expression .Ql \e(.*\e)\e1 matches any string consisting of identical adjacent substrings. Subexpressions are ordered relative to their left delimiter. .It * Match the single character regular expression or subexpression immediately preceding it zero or more times. If .Em * is the first character of a regular expression or subexpression, then it matches itself. The .Em * operator sometimes yields unexpected results. For example, the regular expression .Ql b* matches the beginning of the string .Ql abbb (as opposed to the substring .Ql bbb ) , since a null match is the only left-most match. .It \e{n,m\e} or \e{n,\e} or \e{n\e} Match the single character regular expression or subexpression immediately preceding it at least .Em n and at most .Em m times. If .Em m is omitted, then it matches at least .Em n times. If the comma is also omitted, then it matches exactly .Em n times. .El .Pp Additional regular expression operators may be defined depending on the particular .Xr regex 3 implementation. .Sh COMMANDS All .Nm commands are single characters, though some require additional parameters. If a command's parameters extend over several lines, then each line except for the last must be terminated with a backslash (\\). .Pp In general, at most one command is allowed per line. However, most commands accept a print suffix, which is any of .Em p (print), .Em l (list), or .Em n (enumerate), to print the last line affected by the command. .Pp An interrupt (typically ^C) has the effect of aborting the current command and returning the editor to command mode. .Pp The .Nm utility recognizes the following commands. The commands are shown together with the default address or address range supplied if none is specified (in parenthesis). .Bl -tag -width indent .It (.)a Append text to the buffer after the addressed line. Text is entered in input mode. The current address is set to last line entered. .It (.,.)c Change lines in the buffer. The addressed lines are deleted from the buffer, and text is appended in their place. Text is entered in input mode. The current address is set to last line entered. .It (.,.)d Delete the addressed lines from the buffer. If there is a line after the deleted range, then the current address is set to this line. Otherwise the current address is set to the line before the deleted range. .It e Ar file Edit .Ar file , and sets the default filename. If .Ar file is not specified, then the default filename is used. Any lines in the buffer are deleted before the new file is read. The current address is set to the last line read. .It e Ar !command Edit the standard output of .Ar !command , (see .Ar !command below). The default filename is unchanged. Any lines in the buffer are deleted before the output of .Ar command is read. The current address is set to the last line read. .It E Ar file Edit .Ar file unconditionally. This is similar to the .Em e command, except that unwritten changes are discarded without warning. The current address is set to the last line read. .It f Ar file Set the default filename to .Ar file . If .Ar file is not specified, then the default unescaped filename is printed. .It (1,$)g/re/command-list Apply .Ar command-list to each of the addressed lines matching a regular expression .Ar re . The current address is set to the line currently matched before .Ar command-list is executed. At the end of the .Em g command, the current address is set to the last line affected by .Ar command-list . .Pp Each command in .Ar command-list must be on a separate line, and every line except for the last must be terminated by a backslash (\\). Any commands are allowed, except for .Em g , .Em G , .Em v , and .Em V . A newline alone in .Ar command-list is equivalent to a .Em p command. .It (1,$)G/re/ Interactively edit the addressed lines matching a regular expression .Ar re . For each matching line, the line is printed, the current address is set, and the user is prompted to enter a .Ar command-list . At the end of the .Em G command, the current address is set to the last line affected by (the last) .Ar command-list . .Pp The format of .Ar command-list is the same as that of the .Em g command. A newline alone acts as a null command list. A single .Ql & repeats the last non-null command list. .It H Toggle the printing of error explanations. By default, explanations are not printed. It is recommended that ed scripts begin with this command to aid in debugging. .It h Print an explanation of the last error. .It (.)i Insert text in the buffer before the current line. Text is entered in input mode. The current address is set to the last line entered. .It (.,.+1)j Join the addressed lines. The addressed lines are deleted from the buffer and replaced by a single line containing their joined text. The current address is set to the resultant line. .It (.)klc Mark a line with a lower case letter .Em lc . The line can then be addressed as .Em 'lc (i.e., a single quote followed by .Em lc ) in subsequent commands. The mark is not cleared until the line is deleted or otherwise modified. .It (.,.)l Print the addressed lines unambiguously. If a single line fills more than one screen (as might be the case when viewing a binary file, for instance), a .Dq Li --More-- prompt is printed on the last line. The .Nm utility waits until the RETURN key is pressed before displaying the next screen. The current address is set to the last line printed. .It (.,.)m(.) Move lines in the buffer. The addressed lines are moved to after the right-hand destination address, which may be the address .Em 0 (zero). The current address is set to the last line moved. .It (.,.)n Print the addressed lines along with their line numbers. The current address is set to the last line printed. .It (.,.)p Print the addressed lines. The current address is set to the last line printed. .It P Toggle the command prompt on and off. Unless a prompt was specified by with command-line option .Fl p Ar string , the command prompt is by default turned off. .It q Quit .Nm . .It Q Quit .Nm unconditionally. This is similar to the .Em q command, except that unwritten changes are discarded without warning. .It ($)r Ar file Read .Ar file to after the addressed line. If .Ar file is not specified, then the default filename is used. If there was no default filename prior to the command, then the default filename is set to .Ar file . Otherwise, the default filename is unchanged. The current address is set to the last line read. .It ($)r Ar !command Read to after the addressed line the standard output of .Ar !command , (see the .Ar !command below). The default filename is unchanged. The current address is set to the last line read. .It (.,.)s/re/replacement/ .It (.,.)s/re/replacement/g .It (.,.)s/re/replacement/n Replace text in the addressed lines matching a regular expression .Ar re with .Ar replacement . By default, only the first match in each line is replaced. If the .Em g (global) suffix is given, then every match to be replaced. The .Em n suffix, where .Em n is a positive number, causes only the .Em n Ns th match to be replaced. It is an error if no substitutions are performed on any of the addressed lines. The current address is set the last line affected. .Pp .Ar \&Re and .Ar replacement may be delimited by any character other than space and newline (see the .Em s command below). If one or two of the last delimiters is omitted, then the last line affected is printed as though the print suffix .Em p were specified. .Pp An unescaped .Ql & in .Ar replacement is replaced by the currently matched text. The character sequence .Em \em , where .Em m is a number in the range [1,9], is replaced by the .Em m th backreference expression of the matched text. If .Ar replacement consists of a single .Ql % , then .Ar replacement from the last substitution is used. Newlines may be embedded in .Ar replacement if they are escaped with a backslash (\\). .It (.,.)s Repeat the last substitution. This form of the .Em s command accepts a count suffix .Em n , or any combination of the characters .Em r , .Em g , and .Em p . If a count suffix .Em n is given, then only the .Em n Ns th match is replaced. The .Em r suffix causes the regular expression of the last search to be used instead of the that of the last substitution. The .Em g suffix toggles the global suffix of the last substitution. The .Em p suffix toggles the print suffix of the last substitution The current address is set to the last line affected. .It (.,.)t(.) Copy (i.e., transfer) the addressed lines to after the right-hand destination address, which may be the address .Em 0 (zero). The current address is set to the last line copied. .It u Undo the last command and restores the current address to what it was before the command. The global commands .Em g , .Em G , .Em v , and .Em V . are treated as a single command by undo. .Em u is its own inverse. .It (1,$)v/re/command-list Apply .Ar command-list to each of the addressed lines not matching a regular expression .Ar re . This is similar to the .Em g command. .It (1,$)V/re/ Interactively edit the addressed lines not matching a regular expression .Ar re . This is similar to the .Em G command. .It (1,$)w Ar file Write the addressed lines to .Ar file . Any previous contents of .Ar file is lost without warning. If there is no default filename, then the default filename is set to .Ar file , otherwise it is unchanged. If no filename is specified, then the default filename is used. The current address is unchanged. .It (1,$)wq Ar file Write the addressed lines to .Ar file , and then executes a .Em q command. .It (1,$)w Ar !command Write the addressed lines to the standard input of .Ar !command , (see the .Em !command below). The default filename and current address are unchanged. .It (1,$)W Ar file Append the addressed lines to the end of .Ar file . This is similar to the .Em w command, expect that the previous contents of file is not clobbered. The current address is unchanged. -.It x -Prompt for an encryption key which is used in subsequent reads and -writes. -If a newline alone is entered as the key, then encryption is -turned off. -Otherwise, echoing is disabled while a key is read. .It Pf (.+1)z n Scroll .Ar n lines at a time starting at addressed line. If .Ar n is not specified, then the current window size is used. The current address is set to the last line printed. .It !command Execute .Ar command via .Xr sh 1 . If the first character of .Ar command is .Ql \&! , then it is replaced by text of the previous .Ar !command . The .Nm utility does not process .Ar command for backslash (\\) escapes. However, an unescaped .Em % is replaced by the default filename. When the shell returns from execution, a .Ql \&! is printed to the standard output. The current line is unchanged. .It ($)= Print the line number of the addressed line. .It (.+1)newline Print the addressed line, and sets the current address to that line. .El .Sh FILES .Bl -tag -width /tmp/ed.* -compact .It Pa /tmp/ed.* buffer file .It Pa ed.hup the file to which .Nm attempts to write the buffer if the terminal hangs up .El .Sh DIAGNOSTICS When an error occurs, .Nm prints a .Ql \&? and either returns to command mode or exits if its input is from a script. An explanation of the last error can be printed with the .Em h (help) command. .Pp Since the .Em g (global) command masks any errors from failed searches and substitutions, it can be used to perform conditional operations in scripts; e.g., .Pp .Sm off .Cm g No / Em old Xo .No / Cm s .No // Em new .No / .Xc .Sm on .Pp replaces any occurrences of .Em old with .Em new . If the .Em u (undo) command occurs in a global command list, then the command list is executed only once. .Pp If diagnostics are not disabled, attempting to quit .Nm or edit another file before writing a modified buffer results in an error. If the command is entered a second time, it succeeds, but any changes to the buffer are lost. .Sh SEE ALSO .Xr sed 1 , .Xr sh 1 , .Xr vi 1 , .Xr regex 3 .Pp USD:12-13 .Rs .%A B. W. Kernighan .%A P. J. Plauger .%B Software Tools in Pascal .%O Addison-Wesley .%D 1981 .Re .Sh LIMITATIONS The .Nm utility processes .Ar file arguments for backslash escapes, i.e., in a filename, any characters preceded by a backslash (\\) are interpreted literally. .Pp If a text (non-binary) file is not terminated by a newline character, then .Nm appends one on reading/writing it. In the case of a binary file, .Nm does not append a newline on reading/writing. .Pp per line overhead: 4 ints .Sh HISTORY An .Nm command appeared in .At v1 . .Sh BUGS The .Nm utility does not recognize multibyte characters. Index: head/bin/ed/ed.h =================================================================== --- head/bin/ed/ed.h (revision 340131) +++ head/bin/ed/ed.h (revision 340132) @@ -1,285 +1,273 @@ /* ed.h: type and constant definitions for the ed editor. */ /*- * Copyright (c) 1993 Andrew Moore * 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. * * 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. * * @(#)ed.h,v 1.5 1994/02/01 00:34:39 alm Exp * $FreeBSD$ */ #include #include #include #include #include #include #include #include #include #define ERR (-2) #define EMOD (-3) #define FATAL (-4) #define MINBUFSZ 512 /* minimum buffer size - must be > 0 */ #define SE_MAX 30 /* max subexpressions in a regular expression */ #ifdef INT_MAX # define LINECHARS INT_MAX /* max chars per line */ #else # define LINECHARS MAXINT /* max chars per line */ #endif /* gflags */ #define GLB 001 /* global command */ #define GPR 002 /* print after command */ #define GLS 004 /* list after command */ #define GNP 010 /* enumerate after command */ #define GSG 020 /* global substitute */ typedef regex_t pattern_t; /* Line node */ typedef struct line { struct line *q_forw; struct line *q_back; off_t seek; /* address of line in scratch buffer */ int len; /* length of line */ } line_t; typedef struct undo { /* type of undo nodes */ #define UADD 0 #define UDEL 1 #define UMOV 2 #define VMOV 3 int type; /* command type */ line_t *h; /* head of list */ line_t *t; /* tail of list */ } undo_t; #ifndef max # define max(a,b) ((a) > (b) ? (a) : (b)) #endif #ifndef min # define min(a,b) ((a) < (b) ? (a) : (b)) #endif #define INC_MOD(l, k) ((l) + 1 > (k) ? 0 : (l) + 1) #define DEC_MOD(l, k) ((l) - 1 < 0 ? (k) : (l) - 1) /* SPL1: disable some interrupts (requires reliable signals) */ #define SPL1() mutex++ /* SPL0: enable all interrupts; check sigflags (requires reliable signals) */ #define SPL0() \ if (--mutex == 0) { \ if (sigflags & (1 << (SIGHUP - 1))) handle_hup(SIGHUP); \ if (sigflags & (1 << (SIGINT - 1))) handle_int(SIGINT); \ } /* STRTOL: convert a string to long */ #define STRTOL(i, p) { \ if (((i = strtol(p, &p, 10)) == LONG_MIN || i == LONG_MAX) && \ errno == ERANGE) { \ errmsg = "number out of range"; \ i = 0; \ return ERR; \ } \ } #if defined(sun) || defined(NO_REALLOC_NULL) /* REALLOC: assure at least a minimum size for buffer b */ #define REALLOC(b,n,i,err) \ if ((i) > (n)) { \ size_t ti = (n); \ char *ts; \ SPL1(); \ if ((b) != NULL) { \ if ((ts = (char *) realloc((b), ti += max((i), MINBUFSZ))) == NULL) { \ fprintf(stderr, "%s\n", strerror(errno)); \ errmsg = "out of memory"; \ SPL0(); \ return err; \ } \ } else { \ if ((ts = (char *) malloc(ti += max((i), MINBUFSZ))) == NULL) { \ fprintf(stderr, "%s\n", strerror(errno)); \ errmsg = "out of memory"; \ SPL0(); \ return err; \ } \ } \ (n) = ti; \ (b) = ts; \ SPL0(); \ } #else /* NO_REALLOC_NULL */ /* REALLOC: assure at least a minimum size for buffer b */ #define REALLOC(b,n,i,err) \ if ((i) > (n)) { \ size_t ti = (n); \ char *ts; \ SPL1(); \ if ((ts = (char *) realloc((b), ti += max((i), MINBUFSZ))) == NULL) { \ fprintf(stderr, "%s\n", strerror(errno)); \ errmsg = "out of memory"; \ SPL0(); \ return err; \ } \ (n) = ti; \ (b) = ts; \ SPL0(); \ } #endif /* NO_REALLOC_NULL */ /* REQUE: link pred before succ */ #define REQUE(pred, succ) (pred)->q_forw = (succ), (succ)->q_back = (pred) /* INSQUE: insert elem in circular queue after pred */ #define INSQUE(elem, pred) \ { \ REQUE((elem), (pred)->q_forw); \ REQUE((pred), elem); \ } /* REMQUE: remove_lines elem from circular queue */ #define REMQUE(elem) REQUE((elem)->q_back, (elem)->q_forw); /* NUL_TO_NEWLINE: overwrite ASCII NULs with newlines */ #define NUL_TO_NEWLINE(s, l) translit_text(s, l, '\0', '\n') /* NEWLINE_TO_NUL: overwrite newlines with ASCII NULs */ #define NEWLINE_TO_NUL(s, l) translit_text(s, l, '\n', '\0') -#ifdef ED_DES_INCLUDES -void des_error(const char *); -void expand_des_key(char *, char *); -void set_des_key(DES_cblock *); -#endif -/* Other DES support stuff */ -void init_des_cipher(void); -int flush_des_file(FILE *); -int get_des_char(FILE *); -int put_des_char(int, FILE *); - /* Local Function Declarations */ void add_line_node(line_t *); int append_lines(long); int apply_subst_template(const char *, regmatch_t *, int, int); int build_active_list(int); int cbc_decode(unsigned char *, FILE *); int cbc_encode(unsigned char *, int, FILE *); int check_addr_range(long, long); void clear_active_list(void); void clear_undo_stack(void); int close_sbuf(void); int copy_lines(long); int delete_lines(long, long); int display_lines(long, long, int); line_t *dup_line_node(line_t *); int exec_command(void); long exec_global(int, int); int extract_addr_range(void); char *extract_pattern(int); int extract_subst_tail(int *, long *); char *extract_subst_template(void); int filter_lines(long, long, char *); line_t *get_addressed_line_node(long); pattern_t *get_compiled_pattern(void); char *get_extended_line(int *, int); char *get_filename(void); int get_keyword(void); long get_line_node_addr(line_t *); long get_matching_node_addr(pattern_t *, int); long get_marked_node_addr(int); char *get_sbuf_line(line_t *); int get_shell_command(void); int get_stream_line(FILE *); int get_tty_line(void); void handle_hup(int); void handle_int(int); void handle_winch(int); int has_trailing_escape(char *, char *); int hex_to_binary(int, int); void init_buffers(void); int is_legal_filename(char *); int join_lines(long, long); int mark_line_node(line_t *, int); int move_lines(long); line_t *next_active_node(void); long next_addr(void); int open_sbuf(void); char *parse_char_class(char *); int pop_undo_stack(void); undo_t *push_undo_stack(int, long, long); const char *put_sbuf_line(const char *); int put_stream_line(FILE *, const char *, int); int put_tty_line(const char *, int, long, int); void quit(int); long read_file(char *, long); long read_stream(FILE *, long); int search_and_replace(pattern_t *, int, int); int set_active_node(line_t *); void signal_hup(int); void signal_int(int); char *strip_escapes(char *); int substitute_matching_text(pattern_t *, line_t *, int, int); char *translit_text(char *, int, int, int); void unmark_line_node(line_t *); void unset_active_nodes(line_t *, line_t *); long write_file(char *, const char *, long, long); long write_stream(FILE *, long, long); /* global buffers */ extern char stdinbuf[]; extern char *ibuf; extern char *ibufp; extern int ibufsz; /* global flags */ extern int isbinary; extern int isglobal; extern int modified; extern int mutex; extern int sigflags; /* global vars */ extern long addr_last; extern long current_addr; extern const char *errmsg; extern long first_addr; extern int lineno; extern long second_addr; extern long u_addr_last; extern long u_current_addr; extern long rows; extern int cols; extern int newline_added; -extern int des; extern int scripted; extern int patlock; Index: head/bin/ed/io.c =================================================================== --- head/bin/ed/io.c (revision 340131) +++ head/bin/ed/io.c (revision 340132) @@ -1,355 +1,345 @@ /* io.c: This file contains the i/o routines for the ed line editor */ /*- * Copyright (c) 1993 Andrew Moore, Talke Studio. * 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. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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 __FBSDID("$FreeBSD$"); #include "ed.h" /* read_file: read a named file/pipe into the buffer; return line count */ long read_file(char *fn, long n) { FILE *fp; long size; int cs; fp = (*fn == '!') ? popen(fn + 1, "r") : fopen(strip_escapes(fn), "r"); if (fp == NULL) { fprintf(stderr, "%s: %s\n", fn, strerror(errno)); errmsg = "cannot open input file"; return ERR; } if ((size = read_stream(fp, n)) < 0) { fprintf(stderr, "%s: %s\n", fn, strerror(errno)); errmsg = "error reading input file"; } if ((cs = (*fn == '!') ? pclose(fp) : fclose(fp)) < 0) { fprintf(stderr, "%s: %s\n", fn, strerror(errno)); errmsg = "cannot close input file"; } if (size < 0 || cs < 0) return ERR; if (!scripted) fprintf(stdout, "%lu\n", size); return current_addr - n; } static char *sbuf; /* file i/o buffer */ static int sbufsz; /* file i/o buffer size */ int newline_added; /* if set, newline appended to input file */ /* read_stream: read a stream into the editor buffer; return status */ long read_stream(FILE *fp, long n) { line_t *lp = get_addressed_line_node(n); undo_t *up = NULL; unsigned long size = 0; int o_newline_added = newline_added; int o_isbinary = isbinary; int appended = (n == addr_last); int len; isbinary = newline_added = 0; - if (des) - init_des_cipher(); for (current_addr = n; (len = get_stream_line(fp)) > 0; size += len) { SPL1(); if (put_sbuf_line(sbuf) == NULL) { SPL0(); return ERR; } lp = lp->q_forw; if (up) up->t = lp; else if ((up = push_undo_stack(UADD, current_addr, current_addr)) == NULL) { SPL0(); return ERR; } SPL0(); } if (len < 0) return ERR; if (appended && size && o_isbinary && o_newline_added) fputs("newline inserted\n", stderr); else if (newline_added && (!appended || (!isbinary && !o_isbinary))) fputs("newline appended\n", stderr); if (isbinary && newline_added && !appended) size += 1; if (!size) newline_added = 1; newline_added = appended ? newline_added : o_newline_added; isbinary = isbinary | o_isbinary; - if (des) - size += 8 - size % 8; /* adjust DES size */ return size; } /* get_stream_line: read a line of text from a stream; return line length */ int get_stream_line(FILE *fp) { int c; int i = 0; - while (((c = des ? get_des_char(fp) : getc(fp)) != EOF || (!feof(fp) && - !ferror(fp))) && c != '\n') { + while (((c = getc(fp)) != EOF || (!feof(fp) && !ferror(fp))) && + c != '\n') { REALLOC(sbuf, sbufsz, i + 1, ERR); if (!(sbuf[i++] = c)) isbinary = 1; } REALLOC(sbuf, sbufsz, i + 2, ERR); if (c == '\n') sbuf[i++] = c; else if (ferror(fp)) { fprintf(stderr, "%s\n", strerror(errno)); errmsg = "cannot read input file"; return ERR; } else if (i) { sbuf[i++] = '\n'; newline_added = 1; } sbuf[i] = '\0'; return (isbinary && newline_added && i) ? --i : i; } /* write_file: write a range of lines to a named file/pipe; return line count */ long write_file(char *fn, const char *mode, long n, long m) { FILE *fp; long size; int cs; fp = (*fn == '!') ? popen(fn+1, "w") : fopen(strip_escapes(fn), mode); if (fp == NULL) { fprintf(stderr, "%s: %s\n", fn, strerror(errno)); errmsg = "cannot open output file"; return ERR; } if ((size = write_stream(fp, n, m)) < 0) { fprintf(stderr, "%s: %s\n", fn, strerror(errno)); errmsg = "error writing output file"; } if ((cs = (*fn == '!') ? pclose(fp) : fclose(fp)) < 0) { fprintf(stderr, "%s: %s\n", fn, strerror(errno)); errmsg = "cannot close output file"; } if (size < 0 || cs < 0) return ERR; if (!scripted) fprintf(stdout, "%lu\n", size); return n ? m - n + 1 : 0; } /* write_stream: write a range of lines to a stream; return status */ long write_stream(FILE *fp, long n, long m) { line_t *lp = get_addressed_line_node(n); unsigned long size = 0; char *s; int len; - if (des) - init_des_cipher(); for (; n && n <= m; n++, lp = lp->q_forw) { if ((s = get_sbuf_line(lp)) == NULL) return ERR; len = lp->len; if (n != addr_last || !isbinary || !newline_added) s[len++] = '\n'; if (put_stream_line(fp, s, len) < 0) return ERR; size += len; } - if (des) { - flush_des_file(fp); /* flush buffer */ - size += 8 - size % 8; /* adjust DES size */ - } return size; } /* put_stream_line: write a line of text to a stream; return status */ int put_stream_line(FILE *fp, const char *s, int len) { while (len--) - if ((des ? put_des_char(*s++, fp) : fputc(*s++, fp)) < 0) { + if (fputc(*s++, fp) < 0) { fprintf(stderr, "%s\n", strerror(errno)); errmsg = "cannot write file"; return ERR; } return 0; } /* get_extended_line: get an extended line from stdin */ char * get_extended_line(int *sizep, int nonl) { static char *cvbuf = NULL; /* buffer */ static int cvbufsz = 0; /* buffer size */ int l, n; char *t = ibufp; while (*t++ != '\n') ; if ((l = t - ibufp) < 2 || !has_trailing_escape(ibufp, ibufp + l - 1)) { *sizep = l; return ibufp; } *sizep = -1; REALLOC(cvbuf, cvbufsz, l, NULL); memcpy(cvbuf, ibufp, l); *(cvbuf + --l - 1) = '\n'; /* strip trailing esc */ if (nonl) l--; /* strip newline */ for (;;) { if ((n = get_tty_line()) < 0) return NULL; else if (n == 0 || ibuf[n - 1] != '\n') { errmsg = "unexpected end-of-file"; return NULL; } REALLOC(cvbuf, cvbufsz, l + n, NULL); memcpy(cvbuf + l, ibuf, n); l += n; if (n < 2 || !has_trailing_escape(cvbuf, cvbuf + l - 1)) break; *(cvbuf + --l - 1) = '\n'; /* strip trailing esc */ if (nonl) l--; /* strip newline */ } REALLOC(cvbuf, cvbufsz, l + 1, NULL); cvbuf[l] = '\0'; *sizep = l; return cvbuf; } /* get_tty_line: read a line of text from stdin; return line length */ int get_tty_line(void) { int oi = 0; int i = 0; int c; for (;;) switch (c = getchar()) { default: oi = 0; REALLOC(ibuf, ibufsz, i + 2, ERR); if (!(ibuf[i++] = c)) isbinary = 1; if (c != '\n') continue; lineno++; ibuf[i] = '\0'; ibufp = ibuf; return i; case EOF: if (ferror(stdin)) { fprintf(stderr, "stdin: %s\n", strerror(errno)); errmsg = "cannot read stdin"; clearerr(stdin); ibufp = NULL; return ERR; } else { clearerr(stdin); if (i != oi) { oi = i; continue; } else if (i) ibuf[i] = '\0'; ibufp = ibuf; return i; } } } #define ESCAPES "\a\b\f\n\r\t\v\\" #define ESCCHARS "abfnrtv\\" /* put_tty_line: print text to stdout */ int put_tty_line(const char *s, int l, long n, int gflag) { int col = 0; int lc = 0; char *cp; if (gflag & GNP) { printf("%ld\t", n); col = 8; } for (; l--; s++) { if ((gflag & GLS) && ++col > cols) { fputs("\\\n", stdout); col = 1; #ifndef BACKWARDS if (!scripted && !isglobal && ++lc > rows) { lc = 0; fputs("Press to continue... ", stdout); fflush(stdout); if (get_tty_line() < 0) return ERR; } #endif } if (gflag & GLS) { if (31 < *s && *s < 127 && *s != '\\') putchar(*s); else { putchar('\\'); col++; if (*s && (cp = strchr(ESCAPES, *s)) != NULL) putchar(ESCCHARS[cp - ESCAPES]); else { putchar((((unsigned char) *s & 0300) >> 6) + '0'); putchar((((unsigned char) *s & 070) >> 3) + '0'); putchar(((unsigned char) *s & 07) + '0'); col += 2; } } } else putchar(*s); } #ifndef BACKWARDS if (gflag & GLS) putchar('$'); #endif putchar('\n'); return 0; } Index: head/bin/ed/main.c =================================================================== --- head/bin/ed/main.c (revision 340131) +++ head/bin/ed/main.c (revision 340132) @@ -1,1420 +1,1406 @@ /* main.c: This file contains the main control and user-interface routines for the ed line editor. */ /*- * Copyright (c) 1993 Andrew Moore, Talke Studio. * 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. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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 const char copyright[] = "@(#) Copyright (c) 1993 Andrew Moore, Talke Studio. \n\ All rights reserved.\n"; #endif #endif /* not lint */ #include __FBSDID("$FreeBSD$"); /* * CREDITS * * This program is based on the editor algorithm described in * Brian W. Kernighan and P. J. Plauger's book "Software Tools * in Pascal," Addison-Wesley, 1981. * * The buffering algorithm is attributed to Rodney Ruddock of * the University of Guelph, Guelph, Ontario. * - * The cbc.c encryption code is adapted from - * the bdes program by Matt Bishop of Dartmouth College, - * Hanover, NH. - * */ #include #include #include #include #include #include #include #include "ed.h" #ifdef _POSIX_SOURCE static sigjmp_buf env; #else static jmp_buf env; #endif /* static buffers */ char stdinbuf[1]; /* stdin buffer */ static char *shcmd; /* shell command buffer */ static int shcmdsz; /* shell command buffer size */ static int shcmdi; /* shell command buffer index */ char *ibuf; /* ed command-line buffer */ int ibufsz; /* ed command-line buffer size */ char *ibufp; /* pointer to ed command-line buffer */ /* global flags */ -int des = 0; /* if set, use crypt(3) for i/o */ static int garrulous = 0; /* if set, print all error messages */ int isbinary; /* if set, buffer contains ASCII NULs */ int isglobal; /* if set, doing a global command */ int modified; /* if set, buffer modified since last write */ int mutex = 0; /* if set, signals set "sigflags" */ static int red = 0; /* if set, restrict shell/directory access */ int scripted = 0; /* if set, suppress diagnostics */ int sigflags = 0; /* if set, signals received while mutex set */ static int sigactive = 0; /* if set, signal handlers are enabled */ static char old_filename[PATH_MAX] = ""; /* default filename */ long current_addr; /* current address in editor buffer */ long addr_last; /* last address in editor buffer */ int lineno; /* script line number */ static const char *prompt; /* command-line prompt */ static const char *dps = "*"; /* default command-line prompt */ static const char *usage = "usage: %s [-] [-sx] [-p string] [file]\n"; /* ed: line editor */ int main(volatile int argc, char ** volatile argv) { int c, n; long status = 0; (void)setlocale(LC_ALL, ""); red = (n = strlen(argv[0])) > 2 && argv[0][n - 3] == 'r'; top: while ((c = getopt(argc, argv, "p:sx")) != -1) switch(c) { case 'p': /* set prompt */ prompt = optarg; break; case 's': /* run script */ scripted = 1; break; case 'x': /* use crypt */ -#ifdef DES - des = get_keyword(); -#else fprintf(stderr, "crypt unavailable\n?\n"); -#endif break; default: fprintf(stderr, usage, red ? "red" : "ed"); exit(1); } argv += optind; argc -= optind; if (argc && **argv == '-') { scripted = 1; if (argc > 1) { optind = 1; goto top; } argv++; argc--; } /* assert: reliable signals! */ #ifdef SIGWINCH handle_winch(SIGWINCH); if (isatty(0)) signal(SIGWINCH, handle_winch); #endif signal(SIGHUP, signal_hup); signal(SIGQUIT, SIG_IGN); signal(SIGINT, signal_int); #ifdef _POSIX_SOURCE if ((status = sigsetjmp(env, 1))) #else if ((status = setjmp(env))) #endif { fputs("\n?\n", stderr); errmsg = "interrupt"; } else { init_buffers(); sigactive = 1; /* enable signal handlers */ if (argc && **argv && is_legal_filename(*argv)) { if (read_file(*argv, 0) < 0 && !isatty(0)) quit(2); else if (**argv != '!') if (strlcpy(old_filename, *argv, sizeof(old_filename)) >= sizeof(old_filename)) quit(2); } else if (argc) { fputs("?\n", stderr); if (**argv == '\0') errmsg = "invalid filename"; if (!isatty(0)) quit(2); } } for (;;) { if (status < 0 && garrulous) fprintf(stderr, "%s\n", errmsg); if (prompt) { printf("%s", prompt); fflush(stdout); } if ((n = get_tty_line()) < 0) { status = ERR; continue; } else if (n == 0) { if (modified && !scripted) { fputs("?\n", stderr); errmsg = "warning: file modified"; if (!isatty(0)) { if (garrulous) fprintf(stderr, "script, line %d: %s\n", lineno, errmsg); quit(2); } clearerr(stdin); modified = 0; status = EMOD; continue; } else quit(0); } else if (ibuf[n - 1] != '\n') { /* discard line */ errmsg = "unexpected end-of-file"; clearerr(stdin); status = ERR; continue; } isglobal = 0; if ((status = extract_addr_range()) >= 0 && (status = exec_command()) >= 0) if (!status || (status = display_lines(current_addr, current_addr, status)) >= 0) continue; switch (status) { case EOF: quit(0); case EMOD: modified = 0; fputs("?\n", stderr); /* give warning */ errmsg = "warning: file modified"; if (!isatty(0)) { if (garrulous) fprintf(stderr, "script, line %d: %s\n", lineno, errmsg); quit(2); } break; case FATAL: if (!isatty(0)) { if (garrulous) fprintf(stderr, "script, line %d: %s\n", lineno, errmsg); } else if (garrulous) fprintf(stderr, "%s\n", errmsg); quit(3); default: fputs("?\n", stderr); if (!isatty(0)) { if (garrulous) fprintf(stderr, "script, line %d: %s\n", lineno, errmsg); quit(2); } break; } } /*NOTREACHED*/ } long first_addr, second_addr; static long addr_cnt; /* extract_addr_range: get line addresses from the command buffer until an illegal address is seen; return status */ int extract_addr_range(void) { long addr; addr_cnt = 0; first_addr = second_addr = current_addr; while ((addr = next_addr()) >= 0) { addr_cnt++; first_addr = second_addr; second_addr = addr; if (*ibufp != ',' && *ibufp != ';') break; else if (*ibufp++ == ';') current_addr = addr; } if ((addr_cnt = min(addr_cnt, 2)) == 1 || second_addr != addr) first_addr = second_addr; return (addr == ERR) ? ERR : 0; } #define SKIP_BLANKS() while (isspace((unsigned char)*ibufp) && *ibufp != '\n') ibufp++ #define MUST_BE_FIRST() do { \ if (!first) { \ errmsg = "invalid address"; \ return ERR; \ } \ } while (0) /* next_addr: return the next line address in the command buffer */ long next_addr(void) { const char *hd; long addr = current_addr; long n; int first = 1; int c; SKIP_BLANKS(); for (hd = ibufp;; first = 0) switch (c = *ibufp) { case '+': case '\t': case ' ': case '-': case '^': ibufp++; SKIP_BLANKS(); if (isdigit((unsigned char)*ibufp)) { STRTOL(n, ibufp); addr += (c == '-' || c == '^') ? -n : n; } else if (!isspace((unsigned char)c)) addr += (c == '-' || c == '^') ? -1 : 1; break; case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': MUST_BE_FIRST(); STRTOL(addr, ibufp); break; case '.': case '$': MUST_BE_FIRST(); ibufp++; addr = (c == '.') ? current_addr : addr_last; break; case '/': case '?': MUST_BE_FIRST(); if ((addr = get_matching_node_addr( get_compiled_pattern(), c == '/')) < 0) return ERR; else if (c == *ibufp) ibufp++; break; case '\'': MUST_BE_FIRST(); ibufp++; if ((addr = get_marked_node_addr(*ibufp++)) < 0) return ERR; break; case '%': case ',': case ';': if (first) { ibufp++; addr_cnt++; second_addr = (c == ';') ? current_addr : 1; if ((addr = next_addr()) < 0) addr = addr_last; break; } /* FALLTHROUGH */ default: if (ibufp == hd) return EOF; else if (addr < 0 || addr_last < addr) { errmsg = "invalid address"; return ERR; } else return addr; } /* NOTREACHED */ } #ifdef BACKWARDS /* GET_THIRD_ADDR: get a legal address from the command buffer */ #define GET_THIRD_ADDR(addr) \ { \ long ol1, ol2; \ \ ol1 = first_addr, ol2 = second_addr; \ if (extract_addr_range() < 0) \ return ERR; \ else if (addr_cnt == 0) { \ errmsg = "destination expected"; \ return ERR; \ } else if (second_addr < 0 || addr_last < second_addr) { \ errmsg = "invalid address"; \ return ERR; \ } \ addr = second_addr; \ first_addr = ol1, second_addr = ol2; \ } #else /* BACKWARDS */ /* GET_THIRD_ADDR: get a legal address from the command buffer */ #define GET_THIRD_ADDR(addr) \ { \ long ol1, ol2; \ \ ol1 = first_addr, ol2 = second_addr; \ if (extract_addr_range() < 0) \ return ERR; \ if (second_addr < 0 || addr_last < second_addr) { \ errmsg = "invalid address"; \ return ERR; \ } \ addr = second_addr; \ first_addr = ol1, second_addr = ol2; \ } #endif /* GET_COMMAND_SUFFIX: verify the command suffix in the command buffer */ #define GET_COMMAND_SUFFIX() { \ int done = 0; \ do { \ switch(*ibufp) { \ case 'p': \ gflag |= GPR, ibufp++; \ break; \ case 'l': \ gflag |= GLS, ibufp++; \ break; \ case 'n': \ gflag |= GNP, ibufp++; \ break; \ default: \ done++; \ } \ } while (!done); \ if (*ibufp++ != '\n') { \ errmsg = "invalid command suffix"; \ return ERR; \ } \ } /* sflags */ #define SGG 001 /* complement previous global substitute suffix */ #define SGP 002 /* complement previous print suffix */ #define SGR 004 /* use last regex instead of last pat */ #define SGF 010 /* repeat last substitution */ int patlock = 0; /* if set, pattern not freed by get_compiled_pattern() */ long rows = 22; /* scroll length: ws_row - 2 */ /* exec_command: execute the next command in command buffer; return print request, if any */ int exec_command(void) { static pattern_t *pat = NULL; static int sgflag = 0; static long sgnum = 0; pattern_t *tpat; char *fnp; int gflag = 0; int sflags = 0; long addr = 0; int n = 0; int c; SKIP_BLANKS(); switch(c = *ibufp++) { case 'a': GET_COMMAND_SUFFIX(); if (!isglobal) clear_undo_stack(); if (append_lines(second_addr) < 0) return ERR; break; case 'c': if (check_addr_range(current_addr, current_addr) < 0) return ERR; GET_COMMAND_SUFFIX(); if (!isglobal) clear_undo_stack(); if (delete_lines(first_addr, second_addr) < 0 || append_lines(current_addr) < 0) return ERR; break; case 'd': if (check_addr_range(current_addr, current_addr) < 0) return ERR; GET_COMMAND_SUFFIX(); if (!isglobal) clear_undo_stack(); if (delete_lines(first_addr, second_addr) < 0) return ERR; else if ((addr = INC_MOD(current_addr, addr_last)) != 0) current_addr = addr; break; case 'e': if (modified && !scripted) return EMOD; /* FALLTHROUGH */ case 'E': if (addr_cnt > 0) { errmsg = "unexpected address"; return ERR; } else if (!isspace((unsigned char)*ibufp)) { errmsg = "unexpected command suffix"; return ERR; } else if ((fnp = get_filename()) == NULL) return ERR; GET_COMMAND_SUFFIX(); if (delete_lines(1, addr_last) < 0) return ERR; clear_undo_stack(); if (close_sbuf() < 0) return ERR; else if (open_sbuf() < 0) return FATAL; if (*fnp && *fnp != '!') strlcpy(old_filename, fnp, PATH_MAX); #ifdef BACKWARDS if (*fnp == '\0' && *old_filename == '\0') { errmsg = "no current filename"; return ERR; } #endif if (read_file(*fnp ? fnp : old_filename, 0) < 0) return ERR; clear_undo_stack(); modified = 0; u_current_addr = u_addr_last = -1; break; case 'f': if (addr_cnt > 0) { errmsg = "unexpected address"; return ERR; } else if (!isspace((unsigned char)*ibufp)) { errmsg = "unexpected command suffix"; return ERR; } else if ((fnp = get_filename()) == NULL) return ERR; else if (*fnp == '!') { errmsg = "invalid redirection"; return ERR; } GET_COMMAND_SUFFIX(); if (*fnp) strlcpy(old_filename, fnp, PATH_MAX); printf("%s\n", strip_escapes(old_filename)); break; case 'g': case 'v': case 'G': case 'V': if (isglobal) { errmsg = "cannot nest global commands"; return ERR; } else if (check_addr_range(1, addr_last) < 0) return ERR; else if (build_active_list(c == 'g' || c == 'G') < 0) return ERR; else if ((n = (c == 'G' || c == 'V'))) GET_COMMAND_SUFFIX(); isglobal++; if (exec_global(n, gflag) < 0) return ERR; break; case 'h': if (addr_cnt > 0) { errmsg = "unexpected address"; return ERR; } GET_COMMAND_SUFFIX(); if (*errmsg) fprintf(stderr, "%s\n", errmsg); break; case 'H': if (addr_cnt > 0) { errmsg = "unexpected address"; return ERR; } GET_COMMAND_SUFFIX(); if ((garrulous = 1 - garrulous) && *errmsg) fprintf(stderr, "%s\n", errmsg); break; case 'i': if (second_addr == 0) { errmsg = "invalid address"; return ERR; } GET_COMMAND_SUFFIX(); if (!isglobal) clear_undo_stack(); if (append_lines(second_addr - 1) < 0) return ERR; break; case 'j': if (check_addr_range(current_addr, current_addr + 1) < 0) return ERR; GET_COMMAND_SUFFIX(); if (!isglobal) clear_undo_stack(); if (first_addr != second_addr && join_lines(first_addr, second_addr) < 0) return ERR; break; case 'k': c = *ibufp++; if (second_addr == 0) { errmsg = "invalid address"; return ERR; } GET_COMMAND_SUFFIX(); if (mark_line_node(get_addressed_line_node(second_addr), c) < 0) return ERR; break; case 'l': if (check_addr_range(current_addr, current_addr) < 0) return ERR; GET_COMMAND_SUFFIX(); if (display_lines(first_addr, second_addr, gflag | GLS) < 0) return ERR; gflag = 0; break; case 'm': if (check_addr_range(current_addr, current_addr) < 0) return ERR; GET_THIRD_ADDR(addr); if (first_addr <= addr && addr < second_addr) { errmsg = "invalid destination"; return ERR; } GET_COMMAND_SUFFIX(); if (!isglobal) clear_undo_stack(); if (move_lines(addr) < 0) return ERR; break; case 'n': if (check_addr_range(current_addr, current_addr) < 0) return ERR; GET_COMMAND_SUFFIX(); if (display_lines(first_addr, second_addr, gflag | GNP) < 0) return ERR; gflag = 0; break; case 'p': if (check_addr_range(current_addr, current_addr) < 0) return ERR; GET_COMMAND_SUFFIX(); if (display_lines(first_addr, second_addr, gflag | GPR) < 0) return ERR; gflag = 0; break; case 'P': if (addr_cnt > 0) { errmsg = "unexpected address"; return ERR; } GET_COMMAND_SUFFIX(); prompt = prompt ? NULL : optarg ? optarg : dps; break; case 'q': case 'Q': if (addr_cnt > 0) { errmsg = "unexpected address"; return ERR; } GET_COMMAND_SUFFIX(); gflag = (modified && !scripted && c == 'q') ? EMOD : EOF; break; case 'r': if (!isspace((unsigned char)*ibufp)) { errmsg = "unexpected command suffix"; return ERR; } else if (addr_cnt == 0) second_addr = addr_last; if ((fnp = get_filename()) == NULL) return ERR; GET_COMMAND_SUFFIX(); if (!isglobal) clear_undo_stack(); if (*old_filename == '\0' && *fnp != '!') strlcpy(old_filename, fnp, PATH_MAX); #ifdef BACKWARDS if (*fnp == '\0' && *old_filename == '\0') { errmsg = "no current filename"; return ERR; } #endif if ((addr = read_file(*fnp ? fnp : old_filename, second_addr)) < 0) return ERR; else if (addr && addr != addr_last) modified = 1; break; case 's': do { switch(*ibufp) { case '\n': sflags |=SGF; break; case 'g': sflags |= SGG; ibufp++; break; case 'p': sflags |= SGP; ibufp++; break; case 'r': sflags |= SGR; ibufp++; break; case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': STRTOL(sgnum, ibufp); sflags |= SGF; sgflag &= ~GSG; /* override GSG */ break; default: if (sflags) { errmsg = "invalid command suffix"; return ERR; } } } while (sflags && *ibufp != '\n'); if (sflags && !pat) { errmsg = "no previous substitution"; return ERR; } else if (sflags & SGG) sgnum = 0; /* override numeric arg */ if (*ibufp != '\n' && *(ibufp + 1) == '\n') { errmsg = "invalid pattern delimiter"; return ERR; } tpat = pat; SPL1(); if ((!sflags || (sflags & SGR)) && (tpat = get_compiled_pattern()) == NULL) { SPL0(); return ERR; } else if (tpat != pat) { if (pat) { regfree(pat); free(pat); } pat = tpat; patlock = 1; /* reserve pattern */ } SPL0(); if (!sflags && extract_subst_tail(&sgflag, &sgnum) < 0) return ERR; else if (isglobal) sgflag |= GLB; else sgflag &= ~GLB; if (sflags & SGG) sgflag ^= GSG; if (sflags & SGP) sgflag ^= GPR, sgflag &= ~(GLS | GNP); do { switch(*ibufp) { case 'p': sgflag |= GPR, ibufp++; break; case 'l': sgflag |= GLS, ibufp++; break; case 'n': sgflag |= GNP, ibufp++; break; default: n++; } } while (!n); if (check_addr_range(current_addr, current_addr) < 0) return ERR; GET_COMMAND_SUFFIX(); if (!isglobal) clear_undo_stack(); if (search_and_replace(pat, sgflag, sgnum) < 0) return ERR; break; case 't': if (check_addr_range(current_addr, current_addr) < 0) return ERR; GET_THIRD_ADDR(addr); GET_COMMAND_SUFFIX(); if (!isglobal) clear_undo_stack(); if (copy_lines(addr) < 0) return ERR; break; case 'u': if (addr_cnt > 0) { errmsg = "unexpected address"; return ERR; } GET_COMMAND_SUFFIX(); if (pop_undo_stack() < 0) return ERR; break; case 'w': case 'W': if ((n = *ibufp) == 'q' || n == 'Q') { gflag = EOF; ibufp++; } if (!isspace((unsigned char)*ibufp)) { errmsg = "unexpected command suffix"; return ERR; } else if ((fnp = get_filename()) == NULL) return ERR; if (addr_cnt == 0 && !addr_last) first_addr = second_addr = 0; else if (check_addr_range(1, addr_last) < 0) return ERR; GET_COMMAND_SUFFIX(); if (*old_filename == '\0' && *fnp != '!') strlcpy(old_filename, fnp, PATH_MAX); #ifdef BACKWARDS if (*fnp == '\0' && *old_filename == '\0') { errmsg = "no current filename"; return ERR; } #endif if ((addr = write_file(*fnp ? fnp : old_filename, (c == 'W') ? "a" : "w", first_addr, second_addr)) < 0) return ERR; else if (addr == addr_last && *fnp != '!') modified = 0; else if (modified && !scripted && n == 'q') gflag = EMOD; break; case 'x': if (addr_cnt > 0) { errmsg = "unexpected address"; return ERR; } GET_COMMAND_SUFFIX(); -#ifdef DES - des = get_keyword(); - break; -#else errmsg = "crypt unavailable"; return ERR; -#endif case 'z': #ifdef BACKWARDS if (check_addr_range(first_addr = 1, current_addr + 1) < 0) #else if (check_addr_range(first_addr = 1, current_addr + !isglobal) < 0) #endif return ERR; else if ('0' < *ibufp && *ibufp <= '9') STRTOL(rows, ibufp); GET_COMMAND_SUFFIX(); if (display_lines(second_addr, min(addr_last, second_addr + rows), gflag) < 0) return ERR; gflag = 0; break; case '=': GET_COMMAND_SUFFIX(); printf("%ld\n", addr_cnt ? second_addr : addr_last); break; case '!': if (addr_cnt > 0) { errmsg = "unexpected address"; return ERR; } else if ((sflags = get_shell_command()) < 0) return ERR; GET_COMMAND_SUFFIX(); if (sflags) printf("%s\n", shcmd + 1); system(shcmd + 1); if (!scripted) printf("!\n"); break; case '\n': #ifdef BACKWARDS if (check_addr_range(first_addr = 1, current_addr + 1) < 0 #else if (check_addr_range(first_addr = 1, current_addr + !isglobal) < 0 #endif || display_lines(second_addr, second_addr, 0) < 0) return ERR; break; default: errmsg = "unknown command"; return ERR; } return gflag; } /* check_addr_range: return status of address range check */ int check_addr_range(long n, long m) { if (addr_cnt == 0) { first_addr = n; second_addr = m; } if (first_addr > second_addr || 1 > first_addr || second_addr > addr_last) { errmsg = "invalid address"; return ERR; } return 0; } /* get_matching_node_addr: return the address of the next line matching a pattern in a given direction. wrap around begin/end of editor buffer if necessary */ long get_matching_node_addr(pattern_t *pat, int dir) { char *s; long n = current_addr; line_t *lp; if (!pat) return ERR; do { if ((n = dir ? INC_MOD(n, addr_last) : DEC_MOD(n, addr_last))) { lp = get_addressed_line_node(n); if ((s = get_sbuf_line(lp)) == NULL) return ERR; if (isbinary) NUL_TO_NEWLINE(s, lp->len); if (!regexec(pat, s, 0, NULL, 0)) return n; } } while (n != current_addr); errmsg = "no match"; return ERR; } /* get_filename: return pointer to copy of filename in the command buffer */ char * get_filename(void) { static char *file = NULL; static int filesz = 0; int n; if (*ibufp != '\n') { SKIP_BLANKS(); if (*ibufp == '\n') { errmsg = "invalid filename"; return NULL; } else if ((ibufp = get_extended_line(&n, 1)) == NULL) return NULL; else if (*ibufp == '!') { ibufp++; if ((n = get_shell_command()) < 0) return NULL; if (n) printf("%s\n", shcmd + 1); return shcmd; } else if (n > PATH_MAX - 1) { errmsg = "filename too long"; return NULL; } } #ifndef BACKWARDS else if (*old_filename == '\0') { errmsg = "no current filename"; return NULL; } #endif REALLOC(file, filesz, PATH_MAX, NULL); for (n = 0; *ibufp != '\n';) file[n++] = *ibufp++; file[n] = '\0'; return is_legal_filename(file) ? file : NULL; } /* get_shell_command: read a shell command from stdin; return substitution status */ int get_shell_command(void) { static char *buf = NULL; static int n = 0; char *s; /* substitution char pointer */ int i = 0; int j = 0; if (red) { errmsg = "shell access restricted"; return ERR; } else if ((s = ibufp = get_extended_line(&j, 1)) == NULL) return ERR; REALLOC(buf, n, j + 1, ERR); buf[i++] = '!'; /* prefix command w/ bang */ while (*ibufp != '\n') switch (*ibufp) { default: REALLOC(buf, n, i + 2, ERR); buf[i++] = *ibufp; if (*ibufp++ == '\\') buf[i++] = *ibufp++; break; case '!': if (s != ibufp) { REALLOC(buf, n, i + 1, ERR); buf[i++] = *ibufp++; } #ifdef BACKWARDS else if (shcmd == NULL || *(shcmd + 1) == '\0') #else else if (shcmd == NULL) #endif { errmsg = "no previous command"; return ERR; } else { REALLOC(buf, n, i + shcmdi, ERR); for (s = shcmd + 1; s < shcmd + shcmdi;) buf[i++] = *s++; s = ibufp++; } break; case '%': if (*old_filename == '\0') { errmsg = "no current filename"; return ERR; } j = strlen(s = strip_escapes(old_filename)); REALLOC(buf, n, i + j, ERR); while (j--) buf[i++] = *s++; s = ibufp++; break; } REALLOC(shcmd, shcmdsz, i + 1, ERR); memcpy(shcmd, buf, i); shcmd[shcmdi = i] = '\0'; return *s == '!' || *s == '%'; } /* append_lines: insert text from stdin to after line n; stop when either a single period is read or EOF; return status */ int append_lines(long n) { int l; const char *lp = ibuf; const char *eot; undo_t *up = NULL; for (current_addr = n;;) { if (!isglobal) { if ((l = get_tty_line()) < 0) return ERR; else if (l == 0 || ibuf[l - 1] != '\n') { clearerr(stdin); return l ? EOF : 0; } lp = ibuf; } else if (*(lp = ibufp) == '\0') return 0; else { while (*ibufp++ != '\n') ; l = ibufp - lp; } if (l == 2 && lp[0] == '.' && lp[1] == '\n') { return 0; } eot = lp + l; SPL1(); do { if ((lp = put_sbuf_line(lp)) == NULL) { SPL0(); return ERR; } else if (up) up->t = get_addressed_line_node(current_addr); else if ((up = push_undo_stack(UADD, current_addr, current_addr)) == NULL) { SPL0(); return ERR; } } while (lp != eot); modified = 1; SPL0(); } /* NOTREACHED */ } /* join_lines: replace a range of lines with the joined text of those lines */ int join_lines(long from, long to) { static char *buf = NULL; static int n; char *s; int size = 0; line_t *bp, *ep; ep = get_addressed_line_node(INC_MOD(to, addr_last)); bp = get_addressed_line_node(from); for (; bp != ep; bp = bp->q_forw) { if ((s = get_sbuf_line(bp)) == NULL) return ERR; REALLOC(buf, n, size + bp->len, ERR); memcpy(buf + size, s, bp->len); size += bp->len; } REALLOC(buf, n, size + 2, ERR); memcpy(buf + size, "\n", 2); if (delete_lines(from, to) < 0) return ERR; current_addr = from - 1; SPL1(); if (put_sbuf_line(buf) == NULL || push_undo_stack(UADD, current_addr, current_addr) == NULL) { SPL0(); return ERR; } modified = 1; SPL0(); return 0; } /* move_lines: move a range of lines */ int move_lines(long addr) { line_t *b1, *a1, *b2, *a2; long n = INC_MOD(second_addr, addr_last); long p = first_addr - 1; int done = (addr == first_addr - 1 || addr == second_addr); SPL1(); if (done) { a2 = get_addressed_line_node(n); b2 = get_addressed_line_node(p); current_addr = second_addr; } else if (push_undo_stack(UMOV, p, n) == NULL || push_undo_stack(UMOV, addr, INC_MOD(addr, addr_last)) == NULL) { SPL0(); return ERR; } else { a1 = get_addressed_line_node(n); if (addr < first_addr) { b1 = get_addressed_line_node(p); b2 = get_addressed_line_node(addr); /* this get_addressed_line_node last! */ } else { b2 = get_addressed_line_node(addr); b1 = get_addressed_line_node(p); /* this get_addressed_line_node last! */ } a2 = b2->q_forw; REQUE(b2, b1->q_forw); REQUE(a1->q_back, a2); REQUE(b1, a1); current_addr = addr + ((addr < first_addr) ? second_addr - first_addr + 1 : 0); } if (isglobal) unset_active_nodes(b2->q_forw, a2); modified = 1; SPL0(); return 0; } /* copy_lines: copy a range of lines; return status */ int copy_lines(long addr) { line_t *lp, *np = get_addressed_line_node(first_addr); undo_t *up = NULL; long n = second_addr - first_addr + 1; long m = 0; current_addr = addr; if (first_addr <= addr && addr < second_addr) { n = addr - first_addr + 1; m = second_addr - addr; } for (; n > 0; n=m, m=0, np = get_addressed_line_node(current_addr + 1)) for (; n-- > 0; np = np->q_forw) { SPL1(); if ((lp = dup_line_node(np)) == NULL) { SPL0(); return ERR; } add_line_node(lp); if (up) up->t = lp; else if ((up = push_undo_stack(UADD, current_addr, current_addr)) == NULL) { SPL0(); return ERR; } modified = 1; SPL0(); } return 0; } /* delete_lines: delete a range of lines */ int delete_lines(long from, long to) { line_t *n, *p; SPL1(); if (push_undo_stack(UDEL, from, to) == NULL) { SPL0(); return ERR; } n = get_addressed_line_node(INC_MOD(to, addr_last)); p = get_addressed_line_node(from - 1); /* this get_addressed_line_node last! */ if (isglobal) unset_active_nodes(p->q_forw, n); REQUE(p, n); addr_last -= to - from + 1; current_addr = from - 1; modified = 1; SPL0(); return 0; } /* display_lines: print a range of lines to stdout */ int display_lines(long from, long to, int gflag) { line_t *bp; line_t *ep; char *s; if (!from) { errmsg = "invalid address"; return ERR; } ep = get_addressed_line_node(INC_MOD(to, addr_last)); bp = get_addressed_line_node(from); for (; bp != ep; bp = bp->q_forw) { if ((s = get_sbuf_line(bp)) == NULL) return ERR; if (put_tty_line(s, bp->len, current_addr = from++, gflag) < 0) return ERR; } return 0; } #define MAXMARK 26 /* max number of marks */ static line_t *mark[MAXMARK]; /* line markers */ static int markno; /* line marker count */ /* mark_line_node: set a line node mark */ int mark_line_node(line_t *lp, int n) { if (!islower((unsigned char)n)) { errmsg = "invalid mark character"; return ERR; } else if (mark[n - 'a'] == NULL) markno++; mark[n - 'a'] = lp; return 0; } /* get_marked_node_addr: return address of a marked line */ long get_marked_node_addr(int n) { if (!islower((unsigned char)n)) { errmsg = "invalid mark character"; return ERR; } return get_line_node_addr(mark[n - 'a']); } /* unmark_line_node: clear line node mark */ void unmark_line_node(line_t *lp) { int i; for (i = 0; markno && i < MAXMARK; i++) if (mark[i] == lp) { mark[i] = NULL; markno--; } } /* dup_line_node: return a pointer to a copy of a line node */ line_t * dup_line_node(line_t *lp) { line_t *np; if ((np = (line_t *) malloc(sizeof(line_t))) == NULL) { fprintf(stderr, "%s\n", strerror(errno)); errmsg = "out of memory"; return NULL; } np->seek = lp->seek; np->len = lp->len; return np; } /* has_trailing_escape: return the parity of escapes preceding a character in a string */ int has_trailing_escape(char *s, char *t) { return (s == t || *(t - 1) != '\\') ? 0 : !has_trailing_escape(s, t - 1); } /* strip_escapes: return copy of escaped string of at most length PATH_MAX */ char * strip_escapes(char *s) { static char *file = NULL; static int filesz = 0; int i = 0; REALLOC(file, filesz, PATH_MAX, NULL); while (i < filesz - 1 /* Worry about a possible trailing escape */ && (file[i++] = (*s == '\\') ? *++s : *s)) s++; return file; } void signal_hup(int signo) { if (mutex) sigflags |= (1 << (signo - 1)); else handle_hup(signo); } void signal_int(int signo) { if (mutex) sigflags |= (1 << (signo - 1)); else handle_int(signo); } void handle_hup(int signo) { char *hup = NULL; /* hup filename */ char *s; char ed_hup[] = "ed.hup"; size_t n; if (!sigactive) quit(1); sigflags &= ~(1 << (signo - 1)); if (addr_last && write_file(ed_hup, "w", 1, addr_last) < 0 && (s = getenv("HOME")) != NULL && (n = strlen(s)) + 8 <= PATH_MAX && /* "ed.hup" + '/' */ (hup = (char *) malloc(n + 10)) != NULL) { strcpy(hup, s); if (hup[n - 1] != '/') hup[n] = '/', hup[n+1] = '\0'; strcat(hup, "ed.hup"); write_file(hup, "w", 1, addr_last); } quit(2); } void handle_int(int signo) { if (!sigactive) quit(1); sigflags &= ~(1 << (signo - 1)); #ifdef _POSIX_SOURCE siglongjmp(env, -1); #else longjmp(env, -1); #endif } int cols = 72; /* wrap column */ void handle_winch(int signo) { int save_errno = errno; struct winsize ws; /* window size structure */ sigflags &= ~(1 << (signo - 1)); if (ioctl(0, TIOCGWINSZ, (char *) &ws) >= 0) { if (ws.ws_row > 2) rows = ws.ws_row - 2; if (ws.ws_col > 8) cols = ws.ws_col - 8; } errno = save_errno; } /* is_legal_filename: return a legal filename */ int is_legal_filename(char *s) { if (red && (*s == '!' || !strcmp(s, "..") || strchr(s, '/'))) { errmsg = "shell access restricted"; return 0; } return 1; } Index: head/share/man/man5/src.conf.5 =================================================================== --- head/share/man/man5/src.conf.5 (revision 340131) +++ head/share/man/man5/src.conf.5 (revision 340132) @@ -1,1912 +1,1908 @@ .\" DO NOT EDIT-- this file is @generated by tools/build/options/makeman. .\" $FreeBSD$ -.Dd October 30, 2018 +.Dd November 3, 2018 .Dt SRC.CONF 5 .Os .Sh NAME .Nm src.conf .Nd "source build options" .Sh DESCRIPTION The .Nm file contains settings that will apply to every build involving the .Fx source tree; see .Xr build 7 . .Pp The .Nm file uses the standard makefile syntax. However, .Nm should not specify any dependencies to .Xr make 1 . Instead, .Nm is to set .Xr make 1 variables that control the aspects of how the system builds. .Pp The default location of .Nm is .Pa /etc/src.conf , though an alternative location can be specified in the .Xr make 1 variable .Va SRCCONF . Overriding the location of .Nm may be necessary if the system-wide settings are not suitable for a particular build. For instance, setting .Va SRCCONF to .Pa /dev/null effectively resets all build controls to their defaults. .Pp The only purpose of .Nm is to control the compilation of the .Fx source code, which is usually located in .Pa /usr/src . As a rule, the system administrator creates .Nm when the values of certain control variables need to be changed from their defaults. .Pp In addition, control variables can be specified for a particular build via the .Fl D option of .Xr make 1 or in its environment; see .Xr environ 7 . .Pp The environment of .Xr make 1 for the build can be controlled via the .Va SRC_ENV_CONF variable, which defaults to .Pa /etc/src-env.conf . Some examples that may only be set in this file are .Va WITH_DIRDEPS_BUILD , and .Va WITH_META_MODE , and .Va MAKEOBJDIRPREFIX as they are environment-only variables. .Pp The values of variables are ignored regardless of their setting; even if they would be set to .Dq Li FALSE or .Dq Li NO . The presence of an option causes it to be honored by .Xr make 1 . .Pp This list provides a name and short description for variables that can be used for source builds. .Bl -tag -width indent .It Va WITHOUT_ACCT Set to not build process accounting tools such as .Xr accton 8 and .Xr sa 8 . .It Va WITHOUT_ACPI Set to not build .Xr acpiconf 8 , .Xr acpidump 8 and related programs. .It Va WITHOUT_AMD Set to not build .Xr amd 8 , and related programs. .It Va WITHOUT_APM Set to not build .Xr apm 8 , .Xr apmd 8 and related programs. .It Va WITHOUT_ASSERT_DEBUG Set to compile programs and libraries without the .Xr assert 3 checks. .It Va WITHOUT_AT Set to not build .Xr at 1 and related utilities. .It Va WITHOUT_ATM Set to not build programs and libraries related to ATM networking. .It Va WITHOUT_AUDIT Set to not build audit support into system programs. .It Va WITHOUT_AUTHPF Set to not build .Xr authpf 8 . .It Va WITHOUT_AUTOFS Set to not build .Xr autofs 5 related programs, libraries, and kernel modules. .It Va WITHOUT_AUTO_OBJ Disable automatic creation of objdirs. This is enabled by default if the wanted OBJDIR is writable by the current user. .Pp This must be set in the environment, make command line, or .Pa /etc/src-env.conf , not .Pa /etc/src.conf . .It Va WITHOUT_BHYVE Set to not build or install .Xr bhyve 8 , associated utilities, and examples. .Pp This option only affects amd64/amd64. .It Va WITHOUT_BINUTILS Set to not build or install binutils (as, ld, and objdump) as part of the normal system build. The resulting system cannot build programs from source. .Pp This is a default setting on arm64/aarch64 and riscv/riscv64. When set, it enforces these options: .Pp .Bl -item -compact .It .Va WITHOUT_GDB .El .It Va WITH_BINUTILS Set to build and install binutils (as, ld, and objdump) as part of the normal system build. .Pp This is a default setting on amd64/amd64, arm/arm, arm/armv6, arm/armv7, i386/i386, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf, mips/mips64hf, powerpc/powerpc, powerpc/powerpc64, powerpc/powerpcspe and sparc64/sparc64. .It Va WITHOUT_BINUTILS_BOOTSTRAP Set to not build binutils (as, ld, and objdump) as part of the bootstrap process. .Bf -symbolic The option does not work for build targets unless some alternative toolchain is provided. .Ef .Pp This is a default setting on arm64/aarch64 and riscv/riscv64. .It Va WITH_BINUTILS_BOOTSTRAP Set build binutils (as, ld, and objdump) as part of the bootstrap process. .Pp This is a default setting on amd64/amd64, arm/arm, arm/armv6, arm/armv7, i386/i386, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf, mips/mips64hf, powerpc/powerpc, powerpc/powerpc64, powerpc/powerpcspe and sparc64/sparc64. .It Va WITHOUT_BLACKLIST Set this if you do not want to build .Xr blacklistd 8 and .Xr blacklistctl 8 . When set, these options are also in effect: .Pp .Bl -inset -compact .It Va WITHOUT_BLACKLIST_SUPPORT (unless .Va WITH_BLACKLIST_SUPPORT is set explicitly) .El .It Va WITHOUT_BLACKLIST_SUPPORT Set to build some programs without .Xr libblacklist 3 support, like .Xr fingerd 8 , .Xr ftpd 8 , .Xr rlogind 8 , .Xr rshd 8 , and .Xr sshd 8 . .It Va WITHOUT_BLUETOOTH Set to not build Bluetooth related kernel modules, programs and libraries. .It Va WITHOUT_BOOT Set to not build the boot blocks and loader. .It Va WITHOUT_BOOTPARAMD Set to not build or install .Xr bootparamd 8 . .It Va WITHOUT_BOOTPD Set to not build or install .Xr bootpd 8 . .It Va WITHOUT_BSDINSTALL Set to not build .Xr bsdinstall 8 , .Xr sade 8 , and related programs. .It Va WITHOUT_BSD_CPIO Set to not build the BSD licensed version of cpio based on .Xr libarchive 3 . .It Va WITH_BSD_CRTBEGIN Enable the BSD licensed .Pa crtbegin.o and .Pa crtend.o . .It Va WITH_BSD_GREP Install BSD-licensed grep as '[ef]grep' instead of GNU grep. .It Va WITHOUT_BSNMP Set to not build or install .Xr bsnmpd 1 and related libraries and data files. .It Va WITHOUT_BZIP2 Set to not build contributed bzip2 software as a part of the base system. .Bf -symbolic The option has no effect yet. .Ef When set, these options are also in effect: .Pp .Bl -inset -compact .It Va WITHOUT_BZIP2_SUPPORT (unless .Va WITH_BZIP2_SUPPORT is set explicitly) .El .It Va WITHOUT_BZIP2_SUPPORT Set to build some programs without optional bzip2 support. .It Va WITHOUT_CALENDAR Set to not build .Xr calendar 1 . .It Va WITHOUT_CAPSICUM Set to not build Capsicum support into system programs. When set, it enforces these options: .Pp .Bl -item -compact .It .Va WITHOUT_CASPER .El .It Va WITHOUT_CASPER Set to not build Casper program and related libraries. .It Va WITH_CCACHE_BUILD Set to use .Xr ccache 1 for the build. No configuration is required except to install the .Sy devel/ccache package. When using with .Xr distcc 1 , set .Sy CCACHE_PREFIX=/usr/local/bin/distcc . The default cache directory of .Pa $HOME/.ccache will be used, which can be overridden by setting .Sy CCACHE_DIR . The .Sy CCACHE_COMPILERCHECK option defaults to .Sy content when using the in-tree bootstrap compiler, and .Sy mtime when using an external compiler. The .Sy CCACHE_CPP2 option is used for Clang but not GCC. .Pp Sharing a cache between multiple work directories requires using a layout similar to .Pa /some/prefix/src .Pa /some/prefix/obj and an environment such as: .Bd -literal -offset indent CCACHE_BASEDIR='${SRCTOP:H}' MAKEOBJDIRPREFIX='${SRCTOP:H}/obj' .Ed .Pp See .Xr ccache 1 for more configuration options. .It Va WITHOUT_CCD Set to not build .Xr geom_ccd 4 and related utilities. .It Va WITHOUT_CDDL Set to not build code licensed under Sun's CDDL. When set, it enforces these options: .Pp .Bl -item -compact .It .Va WITHOUT_CTF .It .Va WITHOUT_ZFS .El .It Va WITHOUT_CLANG Set to not build the Clang C/C++ compiler during the regular phase of the build. .Pp This is a default setting on riscv/riscv64 and sparc64/sparc64. When set, it enforces these options: .Pp .Bl -item -compact .It .Va WITHOUT_CLANG_EXTRAS .It .Va WITHOUT_CLANG_FULL .It .Va WITHOUT_LLVM_COV .El .Pp When set, these options are also in effect: .Pp .Bl -inset -compact .It Va WITHOUT_LLVM_TARGET_AARCH64 (unless .Va WITH_LLVM_TARGET_AARCH64 is set explicitly) .It Va WITHOUT_LLVM_TARGET_ALL (unless .Va WITH_LLVM_TARGET_ALL is set explicitly) .It Va WITHOUT_LLVM_TARGET_ARM (unless .Va WITH_LLVM_TARGET_ARM is set explicitly) .It Va WITHOUT_LLVM_TARGET_MIPS (unless .Va WITH_LLVM_TARGET_MIPS is set explicitly) .It Va WITHOUT_LLVM_TARGET_POWERPC (unless .Va WITH_LLVM_TARGET_POWERPC is set explicitly) .It Va WITHOUT_LLVM_TARGET_SPARC (unless .Va WITH_LLVM_TARGET_SPARC is set explicitly) .It Va WITHOUT_LLVM_TARGET_X86 (unless .Va WITH_LLVM_TARGET_X86 is set explicitly) .El .It Va WITH_CLANG Set to build the Clang C/C++ compiler during the normal phase of the build. .Pp This is a default setting on amd64/amd64, arm/arm, arm/armv6, arm/armv7, arm64/aarch64, i386/i386, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf, mips/mips64hf, powerpc/powerpc, powerpc/powerpc64 and powerpc/powerpcspe. .It Va WITHOUT_CLANG_BOOTSTRAP Set to not build the Clang C/C++ compiler during the bootstrap phase of the build. To be able to build the system, either gcc or clang bootstrap must be enabled unless an alternate compiler is provided via XCC. .Pp This is a default setting on mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf, mips/mips64hf, powerpc/powerpc, powerpc/powerpc64, powerpc/powerpcspe, riscv/riscv64 and sparc64/sparc64. .It Va WITH_CLANG_BOOTSTRAP Set to build the Clang C/C++ compiler during the bootstrap phase of the build. .Pp This is a default setting on amd64/amd64, arm/arm, arm/armv6, arm/armv7, arm64/aarch64 and i386/i386. .It Va WITH_CLANG_EXTRAS Set to build additional clang and llvm tools, such as bugpoint. .It Va WITHOUT_CLANG_FULL Set to avoid building the ARCMigrate, Rewriter and StaticAnalyzer components of the Clang C/C++ compiler. .Pp This is a default setting on riscv/riscv64 and sparc64/sparc64. .It Va WITH_CLANG_FULL Set to build the ARCMigrate, Rewriter and StaticAnalyzer components of the Clang C/C++ compiler. .Pp This is a default setting on amd64/amd64, arm/arm, arm/armv6, arm/armv7, arm64/aarch64, i386/i386, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf, mips/mips64hf, powerpc/powerpc, powerpc/powerpc64 and powerpc/powerpcspe. .It Va WITHOUT_CLANG_IS_CC Set to install the GCC compiler as .Pa /usr/bin/cc , .Pa /usr/bin/c++ and .Pa /usr/bin/cpp . .Pp This is a default setting on mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf, mips/mips64hf, powerpc/powerpc, powerpc/powerpc64, powerpc/powerpcspe, riscv/riscv64 and sparc64/sparc64. .It Va WITH_CLANG_IS_CC Set to install the Clang C/C++ compiler as .Pa /usr/bin/cc , .Pa /usr/bin/c++ and .Pa /usr/bin/cpp . .Pp This is a default setting on amd64/amd64, arm/arm, arm/armv6, arm/armv7, arm64/aarch64 and i386/i386. .It Va WITHOUT_CPP Set to not build .Xr cpp 1 . .It Va WITHOUT_CROSS_COMPILER Set to not build any cross compiler in the cross-tools stage of buildworld. When compiling a different version of .Fx than what is installed on the system, provide an alternate compiler with XCC to ensure success. When compiling with an identical version of .Fx to the host, this option may be safely used. This option may also be safe when the host version of .Fx is close to the sources being built, but all bets are off if there have been any changes to the toolchain between the versions. When set, it enforces these options: .Pp .Bl -item -compact .It .Va WITHOUT_BINUTILS_BOOTSTRAP .It .Va WITHOUT_CLANG_BOOTSTRAP .It .Va WITHOUT_ELFTOOLCHAIN_BOOTSTRAP .It .Va WITHOUT_GCC_BOOTSTRAP .It .Va WITHOUT_LLD_BOOTSTRAP .El .It Va WITHOUT_CRYPT Set to not build any crypto code. When set, it enforces these options: .Pp .Bl -item -compact .It .Va WITHOUT_KERBEROS .It .Va WITHOUT_OPENSSH .It .Va WITHOUT_OPENSSL .El .Pp When set, these options are also in effect: .Pp .Bl -inset -compact .It Va WITHOUT_GSSAPI (unless .Va WITH_GSSAPI is set explicitly) .El .It Va WITH_CTF Set to compile with CTF (Compact C Type Format) data. CTF data encapsulates a reduced form of debugging information similar to DWARF and the venerable stabs and is required for DTrace. .It Va WITHOUT_CTM Set to not build .Xr ctm 1 and related utilities. .It Va WITHOUT_CUSE Set to not build CUSE-related programs and libraries. .It Va WITHOUT_CXGBETOOL Set to not build .Xr cxgbetool 8 .Pp This is a default setting on arm/arm, arm/armv6, arm/armv7, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf, mips/mips64hf, powerpc/powerpc, powerpc/powerpcspe and riscv/riscv64. .It Va WITH_CXGBETOOL Set to build .Xr cxgbetool 8 .Pp This is a default setting on amd64/amd64, arm64/aarch64, i386/i386, powerpc/powerpc64 and sparc64/sparc64. .It Va WITHOUT_CXX Set to not build .Xr c++ 1 and related libraries. It will also prevent building of .Xr gperf 1 and .Xr devd 8 . When set, it enforces these options: .Pp .Bl -item -compact .It .Va WITHOUT_CLANG .It .Va WITHOUT_CLANG_EXTRAS .It .Va WITHOUT_CLANG_FULL .It .Va WITHOUT_DTRACE_TESTS .It .Va WITHOUT_GNUCXX .It .Va WITHOUT_LLVM_COV .It .Va WITHOUT_TESTS .El .It Va WITHOUT_DEBUG_FILES Set to avoid building or installing standalone debug files for each executable binary and shared library. .It Va WITHOUT_DIALOG Set to not build .Xr dialog 1 , .Xr dialog 3 , .Xr dpv 1 , and .Xr dpv 3 . When set, it enforces these options: .Pp .Bl -item -compact .It .Va WITHOUT_BSDINSTALL .El .It Va WITHOUT_DICT Set to not build the Webster dictionary files. .It Va WITH_DIRDEPS_BUILD This is an experimental build system. For details see http://www.crufty.net/sjg/docs/freebsd-meta-mode.htm. Build commands can be seen from the top-level with: .Dl make show-valid-targets The build is driven by dirdeps.mk using .Va DIRDEPS stored in Makefile.depend files found in each directory. .Pp The build can be started from anywhere, and behaves the same. The initial instance of .Xr make 1 recursively reads .Va DIRDEPS from .Pa Makefile.depend , computing a graph of tree dependencies from the current origin. Setting .Va NO_DIRDEPS skips checking dirdep dependencies and will only build in the current and child directories. .Va NO_DIRDEPS_BELOW skips building any dirdeps and only build the current directory. .Pp This also utilizes the .Va WITH_META_MODE logic for incremental builds. .Pp The build hides commands executed unless .Va NO_SILENT is defined. .Pp Note that there is currently no mass install feature for this. .Pp When set, it enforces these options: .Pp .Bl -item -compact .It .Va WITH_INSTALL_AS_USER .El .Pp When set, these options are also in effect: .Pp .Bl -inset -compact .It Va WITH_META_MODE (unless .Va WITHOUT_META_MODE is set explicitly) .It Va WITH_STAGING (unless .Va WITHOUT_STAGING is set explicitly) .It Va WITH_STAGING_MAN (unless .Va WITHOUT_STAGING_MAN is set explicitly) .It Va WITH_STAGING_PROG (unless .Va WITHOUT_STAGING_PROG is set explicitly) .It Va WITH_SYSROOT (unless .Va WITHOUT_SYSROOT is set explicitly) .El .Pp This must be set in the environment, make command line, or .Pa /etc/src-env.conf , not .Pa /etc/src.conf . .It Va WITH_DIRDEPS_CACHE Cache result of dirdeps.mk which can save significant time for subsequent builds. Depends on .Va WITH_DIRDEPS_BUILD . .Pp This must be set in the environment, make command line, or .Pa /etc/src-env.conf , not .Pa /etc/src.conf . .It Va WITHOUT_DMAGENT Set to not build dma Mail Transport Agent. .It Va WITHOUT_DOCCOMPRESS Set to not install compressed system documentation. Only the uncompressed version will be installed. .It Va WITH_DTRACE_TESTS Set to build and install the DTrace test suite in .Pa /usr/tests/cddl/usr.sbin/dtrace . This test suite is considered experimental on architectures other than amd64/amd64 and running it may cause system instability. .It Va WITHOUT_DYNAMICROOT Set this if you do not want to link .Pa /bin and .Pa /sbin dynamically. -.It Va WITHOUT_ED_CRYPTO -Set to build -.Xr ed 1 -without support for encryption/decryption. .It Va WITHOUT_EE Set to not build and install .Xr edit 1 , .Xr ee 1 , and related programs. .It Va WITHOUT_EFI Set not to build .Xr efivar 3 and .Xr efivar 8 . .Pp This is a default setting on mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf, mips/mips64hf, powerpc/powerpc, powerpc/powerpc64, powerpc/powerpcspe, riscv/riscv64 and sparc64/sparc64. .It Va WITH_EFI Set to build .Xr efivar 3 and .Xr efivar 8 . .Pp This is a default setting on amd64/amd64, arm/arm, arm/armv6, arm/armv7, arm64/aarch64 and i386/i386. .It Va WITHOUT_ELFTOOLCHAIN_BOOTSTRAP Set to not build ELF Tool Chain tools (addr2line, nm, size, strings and strip) as part of the bootstrap process. .Bf -symbolic An alternate bootstrap tool chain must be provided. .Ef .It Va WITHOUT_EXAMPLES Set to avoid installing examples to .Pa /usr/share/examples/ . .It Va WITH_EXPERIMENTAL Set to include experimental features in the build. .It Va WITH_EXTRA_TCP_STACKS Set to build extra TCP stack modules. .It Va WITHOUT_FDT Set to not build Flattened Device Tree support as part of the base system. This includes the device tree compiler (dtc) and libfdt support library. .It Va WITHOUT_FILE Set to not build .Xr file 1 and related programs. .It Va WITHOUT_FINGER Set to not build or install .Xr finger 1 and .Xr fingerd 8 . .It Va WITHOUT_FLOPPY Set to not build or install programs for operating floppy disk driver. .It Va WITHOUT_FMTREE Set to not build and install .Pa /usr/sbin/fmtree . .It Va WITHOUT_FORMAT_EXTENSIONS Set to not enable .Fl fformat-extensions when compiling the kernel. Also disables all format checking. .It Va WITHOUT_FORTH Set to build bootloaders without Forth support. .It Va WITHOUT_FP_LIBC Set to build .Nm libc without floating-point support. .It Va WITHOUT_FREEBSD_UPDATE Set to not build .Xr freebsd-update 8 . .It Va WITHOUT_FTP Set to not build or install .Xr ftp 1 and .Xr ftpd 8 . .It Va WITHOUT_GAMES Set to not build games. .It Va WITHOUT_GCC Set to not build and install gcc and g++ as part of the normal build process. .Pp This is a default setting on amd64/amd64, arm/arm, arm/armv6, arm/armv7, arm64/aarch64, i386/i386 and riscv/riscv64. .It Va WITH_GCC Set to build and install gcc and g++. .Pp This is a default setting on mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf, mips/mips64hf, powerpc/powerpc, powerpc/powerpc64, powerpc/powerpcspe and sparc64/sparc64. .It Va WITHOUT_GCC_BOOTSTRAP Set to not build gcc and g++ as part of the bootstrap process. You must enable either gcc or clang bootstrap to be able to build the system, unless an alternative compiler is provided via XCC. .Pp This is a default setting on amd64/amd64, arm/arm, arm/armv6, arm/armv7, arm64/aarch64, i386/i386 and riscv/riscv64. .It Va WITH_GCC_BOOTSTRAP Set to build gcc and g++ as part of the bootstrap process. .Pp This is a default setting on mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf, mips/mips64hf, powerpc/powerpc, powerpc/powerpc64, powerpc/powerpcspe and sparc64/sparc64. .It Va WITHOUT_GCOV Set to not build the .Xr gcov 1 tool. .It Va WITHOUT_GDB Set to not build .Xr gdb 1 . .Pp This is a default setting on arm64/aarch64 and riscv/riscv64. .It Va WITH_GDB Set to build .Xr gdb 1 . .Pp This is a default setting on amd64/amd64, arm/arm, arm/armv6, arm/armv7, i386/i386, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf, mips/mips64hf, powerpc/powerpc, powerpc/powerpc64, powerpc/powerpcspe and sparc64/sparc64. .It Va WITHOUT_GDB_LIBEXEC Set to install .Xr gdb 1 into .Pa /usr/bin . .Pp This is a default setting on sparc64/sparc64. .It Va WITH_GDB_LIBEXEC Set to install .Xr gdb 1 into .Pa /usr/libexec . This permits .Xr gdb 1 to be used as a fallback for .Xr crashinfo 8 if a newer version is not installed. .Pp This is a default setting on amd64/amd64, arm/arm, arm/armv6, arm/armv7, arm64/aarch64, i386/i386, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf, mips/mips64hf, powerpc/powerpc, powerpc/powerpc64, powerpc/powerpcspe and riscv/riscv64. .It Va WITHOUT_GNUCXX Do not build the GNU C++ stack (g++, libstdc++). This is the default on platforms where clang is the system compiler. .Pp This is a default setting on amd64/amd64, arm/arm, arm/armv6, arm/armv7, arm64/aarch64 and i386/i386. .It Va WITH_GNUCXX Build the GNU C++ stack (g++, libstdc++). This is the default on platforms where gcc is the system compiler. .Pp This is a default setting on mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf, mips/mips64hf, powerpc/powerpc, powerpc/powerpc64, powerpc/powerpcspe, riscv/riscv64 and sparc64/sparc64. .It Va WITHOUT_GNU_DIFF Set to not build GNU .Xr diff 1 and .Xr diff3 1 . .It Va WITHOUT_GNU_GREP Set to not build GNU .Xr grep 1 . .It Va WITH_GNU_GREP_COMPAT Set this option to include GNU extensions in .Xr bsdgrep 1 by linking against libgnuregex. .It Va WITHOUT_GPIO Set to not build .Xr gpioctl 8 as part of the base system. .It Va WITHOUT_GPL_DTC Set to build the BSD licensed version of the device tree compiler rather than the GPLed one from elinux.org. .Pp This is a default setting on amd64/amd64, arm/arm, arm/armv6, arm/armv7, arm64/aarch64 and i386/i386. .It Va WITH_GPL_DTC Set to build the GPL'd version of the device tree compiler from elinux.org, instead of the BSD licensed one. .Pp This is a default setting on mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf, mips/mips64hf, powerpc/powerpc, powerpc/powerpc64, powerpc/powerpcspe, riscv/riscv64 and sparc64/sparc64. .It Va WITHOUT_GSSAPI Set to not build libgssapi. .It Va WITHOUT_HAST Set to not build .Xr hastd 8 and related utilities. .It Va WITH_HESIOD Set to build Hesiod support. .It Va WITHOUT_HTML Set to not build HTML docs. .It Va WITHOUT_HYPERV Set to not build or install HyperV utilities. .Pp This is a default setting on arm/arm, arm/armv6, arm/armv7, arm64/aarch64, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf, mips/mips64hf, powerpc/powerpc, powerpc/powerpc64, powerpc/powerpcspe, riscv/riscv64 and sparc64/sparc64. .It Va WITH_HYPERV Set to build or install HyperV utilities. .Pp This is a default setting on amd64/amd64 and i386/i386. .It Va WITHOUT_ICONV Set to not build iconv as part of libc. .It Va WITHOUT_INCLUDES Set to not install header files. This option used to be spelled .Va NO_INCS . .Bf -symbolic The option does not work for build targets. .Ef .It Va WITHOUT_INET Set to not build programs and libraries related to IPv4 networking. When set, it enforces these options: .Pp .Bl -item -compact .It .Va WITHOUT_INET_SUPPORT .El .It Va WITHOUT_INET6 Set to not build programs and libraries related to IPv6 networking. When set, it enforces these options: .Pp .Bl -item -compact .It .Va WITHOUT_INET6_SUPPORT .El .It Va WITHOUT_INET6_SUPPORT Set to build libraries, programs, and kernel modules without IPv6 support. .It Va WITHOUT_INETD Set to not build .Xr inetd 8 . .It Va WITHOUT_INET_SUPPORT Set to build libraries, programs, and kernel modules without IPv4 support. .It Va WITHOUT_INSTALLLIB Set this to not install optional libraries. For example, when creating a .Xr nanobsd 8 image. .Bf -symbolic The option does not work for build targets. .Ef .It Va WITH_INSTALL_AS_USER Set to make install targets succeed for non-root users by installing files with owner and group attributes set to that of the user running the .Xr make 1 command. The user still must set the .Va DESTDIR variable to point to a directory where the user has write permissions. .It Va WITHOUT_IPFILTER Set to not build IP Filter package. .It Va WITHOUT_IPFW Set to not build IPFW tools. .It Va WITHOUT_IPSEC_SUPPORT Set to not build the kernel with .Xr ipsec 4 support. This option is needed for .Xr ipsec 4 and .Xr tcpmd5 4 . .It Va WITHOUT_ISCSI Set to not build .Xr iscsid 8 and related utilities. .It Va WITHOUT_JAIL Set to not build tools for the support of jails; e.g., .Xr jail 8 . .It Va WITHOUT_KDUMP Set to not build .Xr kdump 1 and .Xr truss 1 . .It Va WITHOUT_KERBEROS Set this to not build Kerberos 5 (KTH Heimdal). When set, these options are also in effect: .Pp .Bl -inset -compact .It Va WITHOUT_GSSAPI (unless .Va WITH_GSSAPI is set explicitly) .It Va WITHOUT_KERBEROS_SUPPORT (unless .Va WITH_KERBEROS_SUPPORT is set explicitly) .El .It Va WITHOUT_KERBEROS_SUPPORT Set to build some programs without Kerberos support, like .Xr ssh 1 , .Xr telnet 1 , .Xr sshd 8 , and .Xr telnetd 8 . .It Va WITH_KERNEL_RETPOLINE Set to enable the "retpoline" mitigation for CVE-2017-5715 in the kernel build. .It Va WITHOUT_KERNEL_SYMBOLS Set to not install kernel symbol files. .Bf -symbolic This option is recommended for those people who have small root partitions. .Ef .It Va WITHOUT_KVM Set to not build the .Nm libkvm library as a part of the base system. .Bf -symbolic The option has no effect yet. .Ef When set, these options are also in effect: .Pp .Bl -inset -compact .It Va WITHOUT_KVM_SUPPORT (unless .Va WITH_KVM_SUPPORT is set explicitly) .El .It Va WITHOUT_KVM_SUPPORT Set to build some programs without optional .Nm libkvm support. .It Va WITHOUT_LDNS Setting this variable will prevent the LDNS library from being built. When set, it enforces these options: .Pp .Bl -item -compact .It .Va WITHOUT_LDNS_UTILS .It .Va WITHOUT_UNBOUND .El .It Va WITHOUT_LDNS_UTILS Setting this variable will prevent building the LDNS utilities .Xr drill 1 and .Xr host 1 . .It Va WITHOUT_LEGACY_CONSOLE Set to not build programs that support a legacy PC console; e.g., .Xr kbdcontrol 1 and .Xr vidcontrol 1 . .It Va WITHOUT_LIB32 On 64-bit platforms, set to not build 32-bit library set and a .Nm ld-elf32.so.1 runtime linker. .It Va WITHOUT_LIBCPLUSPLUS Set to avoid building libcxxrt and libc++. .It Va WITHOUT_LIBPTHREAD Set to not build the .Nm libpthread providing library, .Nm libthr . When set, it enforces these options: .Pp .Bl -item -compact .It .Va WITHOUT_LIBTHR .El .It Va WITH_LIBSOFT On armv6 only, set to enable soft float ABI compatibility libraries. This option is for transitioning to the new hard float ABI. .It Va WITHOUT_LIBTHR Set to not build the .Nm libthr (1:1 threading) library. .It Va WITHOUT_LLD Set to not build LLVM's lld linker. .Pp This is a default setting on riscv/riscv64 and sparc64/sparc64. .It Va WITH_LLD Set to build LLVM's lld linker. .Pp This is a default setting on amd64/amd64, arm/arm, arm/armv6, arm/armv7, arm64/aarch64, i386/i386, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf, mips/mips64hf, powerpc/powerpc, powerpc/powerpc64 and powerpc/powerpcspe. .It Va WITHOUT_LLDB Set to not build the LLDB debugger. .Pp This is a default setting on arm/arm, arm/armv6, arm/armv7, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf, mips/mips64hf, powerpc/powerpc, powerpc/powerpc64, powerpc/powerpcspe, riscv/riscv64 and sparc64/sparc64. .It Va WITH_LLDB Set to build the LLDB debugger. .Pp This is a default setting on amd64/amd64, arm64/aarch64 and i386/i386. .It Va WITHOUT_LLD_BOOTSTRAP Set to not build the LLD linker during the bootstrap phase of the build. To be able to build the system, either Binutils or LLD bootstrap must be enabled unless an alternate linker is provided via XLD. .Pp This is a default setting on arm/arm, arm/armv6, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf, mips/mips64hf, powerpc/powerpc, powerpc/powerpc64, powerpc/powerpcspe, riscv/riscv64 and sparc64/sparc64. .It Va WITH_LLD_BOOTSTRAP Set to build the LLD linker during the bootstrap phase of the build. .Pp This is a default setting on amd64/amd64, arm/armv7, arm64/aarch64 and i386/i386. .It Va WITHOUT_LLD_IS_LD Set to use GNU binutils ld as the system linker, instead of LLVM's LLD. .Pp This is a default setting on arm/arm, arm/armv6, i386/i386, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf, mips/mips64hf, powerpc/powerpc, powerpc/powerpc64, powerpc/powerpcspe, riscv/riscv64 and sparc64/sparc64. .It Va WITH_LLD_IS_LD Set to use LLVM's LLD as the system linker, instead of GNU binutils ld. .Pp This is a default setting on amd64/amd64, arm/armv7 and arm64/aarch64. .It Va WITHOUT_LLVM_COV Set to not build the .Xr llvm-cov 1 tool. .Pp This is a default setting on riscv/riscv64 and sparc64/sparc64. .It Va WITH_LLVM_COV Set to build the .Xr llvm-cov 1 tool. .Pp This is a default setting on amd64/amd64, arm/arm, arm/armv6, arm/armv7, arm64/aarch64, i386/i386, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf, mips/mips64hf, powerpc/powerpc, powerpc/powerpc64 and powerpc/powerpcspe. .It Va WITHOUT_LLVM_LIBUNWIND Set to use GCC's stack unwinder (instead of LLVM's libunwind). .Pp This is a default setting on arm/arm, arm/armv6, arm/armv7, powerpc/powerpc, powerpc/powerpc64, powerpc/powerpcspe and sparc64/sparc64. .It Va WITH_LLVM_LIBUNWIND Set to use LLVM's libunwind stack unwinder (instead of GCC's unwinder). .Pp This is a default setting on amd64/amd64, arm64/aarch64, i386/i386, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf, mips/mips64hf and riscv/riscv64. .It Va WITHOUT_LLVM_TARGET_AARCH64 Set to not build LLVM target support for AArch64. The .Va LLVM_TARGET_ALL option should be used rather than this in most cases. .Pp This is a default setting on riscv/riscv64 and sparc64/sparc64. .It Va WITH_LLVM_TARGET_AARCH64 Set to build LLVM target support for AArch64. The .Va LLVM_TARGET_ALL option should be used rather than this in most cases. .Pp This is a default setting on amd64/amd64, arm/arm, arm/armv6, arm/armv7, arm64/aarch64, i386/i386, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf, mips/mips64hf, powerpc/powerpc, powerpc/powerpc64 and powerpc/powerpcspe. .It Va WITHOUT_LLVM_TARGET_ALL Set to only build the required LLVM target support. This option is preferred to specific target support options. .Pp This is a default setting on riscv/riscv64 and sparc64/sparc64. When set, these options are also in effect: .Pp .Bl -inset -compact .It Va WITHOUT_LLVM_TARGET_AARCH64 (unless .Va WITH_LLVM_TARGET_AARCH64 is set explicitly) .It Va WITHOUT_LLVM_TARGET_ARM (unless .Va WITH_LLVM_TARGET_ARM is set explicitly) .It Va WITHOUT_LLVM_TARGET_MIPS (unless .Va WITH_LLVM_TARGET_MIPS is set explicitly) .It Va WITHOUT_LLVM_TARGET_POWERPC (unless .Va WITH_LLVM_TARGET_POWERPC is set explicitly) .It Va WITHOUT_LLVM_TARGET_SPARC (unless .Va WITH_LLVM_TARGET_SPARC is set explicitly) .El .It Va WITH_LLVM_TARGET_ALL Set to build support for all LLVM targets. This option is always applied to the bootstrap compiler for buildworld when LLVM is used. .Pp This is a default setting on amd64/amd64, arm/arm, arm/armv6, arm/armv7, arm64/aarch64, i386/i386, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf, mips/mips64hf, powerpc/powerpc, powerpc/powerpc64 and powerpc/powerpcspe. .It Va WITHOUT_LLVM_TARGET_ARM Set to not build LLVM target support for ARM. The .Va LLVM_TARGET_ALL option should be used rather than this in most cases. .Pp This is a default setting on riscv/riscv64 and sparc64/sparc64. .It Va WITH_LLVM_TARGET_ARM Set to build LLVM target support for ARM. The .Va LLVM_TARGET_ALL option should be used rather than this in most cases. .Pp This is a default setting on amd64/amd64, arm/arm, arm/armv6, arm/armv7, arm64/aarch64, i386/i386, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf, mips/mips64hf, powerpc/powerpc, powerpc/powerpc64 and powerpc/powerpcspe. .It Va WITH_LLVM_TARGET_BPF Set to build LLVM target support for BPF. The .Va LLVM_TARGET_ALL option should be used rather than this in most cases. .It Va WITHOUT_LLVM_TARGET_MIPS Set to not build LLVM target support for MIPS. The .Va LLVM_TARGET_ALL option should be used rather than this in most cases. .Pp This is a default setting on riscv/riscv64 and sparc64/sparc64. .It Va WITH_LLVM_TARGET_MIPS Set to build LLVM target support for MIPS. The .Va LLVM_TARGET_ALL option should be used rather than this in most cases. .Pp This is a default setting on amd64/amd64, arm/arm, arm/armv6, arm/armv7, arm64/aarch64, i386/i386, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf, mips/mips64hf, powerpc/powerpc, powerpc/powerpc64 and powerpc/powerpcspe. .It Va WITHOUT_LLVM_TARGET_POWERPC Set to not build LLVM target support for PowerPC. The .Va LLVM_TARGET_ALL option should be used rather than this in most cases. .Pp This is a default setting on riscv/riscv64 and sparc64/sparc64. .It Va WITH_LLVM_TARGET_POWERPC Set to build LLVM target support for PowerPC. The .Va LLVM_TARGET_ALL option should be used rather than this in most cases. .Pp This is a default setting on amd64/amd64, arm/arm, arm/armv6, arm/armv7, arm64/aarch64, i386/i386, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf, mips/mips64hf, powerpc/powerpc, powerpc/powerpc64 and powerpc/powerpcspe. .It Va WITHOUT_LLVM_TARGET_SPARC Set to not build LLVM target support for SPARC. The .Va LLVM_TARGET_ALL option should be used rather than this in most cases. .Pp This is a default setting on riscv/riscv64 and sparc64/sparc64. .It Va WITH_LLVM_TARGET_SPARC Set to build LLVM target support for SPARC. The .Va LLVM_TARGET_ALL option should be used rather than this in most cases. .Pp This is a default setting on amd64/amd64, arm/arm, arm/armv6, arm/armv7, arm64/aarch64, i386/i386, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf, mips/mips64hf, powerpc/powerpc, powerpc/powerpc64 and powerpc/powerpcspe. .It Va WITHOUT_LLVM_TARGET_X86 Set to not build LLVM target support for X86. The .Va LLVM_TARGET_ALL option should be used rather than this in most cases. .Pp This is a default setting on riscv/riscv64 and sparc64/sparc64. .It Va WITH_LLVM_TARGET_X86 Set to build LLVM target support for X86. The .Va LLVM_TARGET_ALL option should be used rather than this in most cases. .Pp This is a default setting on amd64/amd64, arm/arm, arm/armv6, arm/armv7, arm64/aarch64, i386/i386, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf, mips/mips64hf, powerpc/powerpc, powerpc/powerpc64 and powerpc/powerpcspe. .It Va WITH_LOADER_FIREWIRE Enable firewire support in /boot/loader on x86. This option is a nop on all other platforms. .It Va WITH_LOADER_FORCE_LE Set to force the powerpc boot loader to launch the kernel in little endian mode. .It Va WITHOUT_LOADER_GELI Disable inclusion of GELI crypto support in the boot chain binaries. .Pp This is a default setting on powerpc/powerpc, powerpc/powerpc64, powerpc/powerpcspe and sparc64/sparc64. .It Va WITH_LOADER_GELI Set to build GELI bootloader support. .Pp This is a default setting on amd64/amd64, arm/arm, arm/armv6, arm/armv7, arm64/aarch64, i386/i386, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf, mips/mips64hf and riscv/riscv64. .It Va WITHOUT_LOADER_LUA Set to not build LUA bindings for the boot loader. .Pp This is a default setting on powerpc/powerpc, powerpc/powerpc64, powerpc/powerpcspe and sparc64/sparc64. .It Va WITH_LOADER_LUA Set to build LUA bindings for the boot loader. .Pp This is a default setting on amd64/amd64, arm/arm, arm/armv6, arm/armv7, arm64/aarch64, i386/i386, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf, mips/mips64hf and riscv/riscv64. .It Va WITHOUT_LOADER_OFW Disable building of openfirmware bootloader components. .Pp This is a default setting on amd64/amd64, arm/arm, arm/armv6, arm/armv7, arm64/aarch64, i386/i386, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf, mips/mips64hf and riscv/riscv64. .It Va WITH_LOADER_OFW Set to build openfirmware bootloader components. .Pp This is a default setting on powerpc/powerpc, powerpc/powerpc64, powerpc/powerpcspe and sparc64/sparc64. .It Va WITHOUT_LOADER_UBOOT Disable building of ubldr. .Pp This is a default setting on amd64/amd64, arm64/aarch64, i386/i386, riscv/riscv64 and sparc64/sparc64. .It Va WITH_LOADER_UBOOT Set to build ubldr. .Pp This is a default setting on arm/arm, arm/armv6, arm/armv7, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf, mips/mips64hf, powerpc/powerpc, powerpc/powerpc64 and powerpc/powerpcspe. .It Va WITHOUT_LOCALES Set to not build localization files; see .Xr locale 1 . .It Va WITHOUT_LOCATE Set to not build .Xr locate 1 and related programs. .It Va WITHOUT_LPR Set to not build .Xr lpr 1 and related programs. .It Va WITHOUT_LS_COLORS Set to build .Xr ls 1 without support for colors to distinguish file types. .It Va WITHOUT_LZMA_SUPPORT Set to build some programs without optional lzma compression support. .It Va WITHOUT_MAIL Set to not build any mail support (MUA or MTA). When set, it enforces these options: .Pp .Bl -item -compact .It .Va WITHOUT_DMAGENT .It .Va WITHOUT_MAILWRAPPER .It .Va WITHOUT_SENDMAIL .El .It Va WITHOUT_MAILWRAPPER Set to not build the .Xr mailwrapper 8 MTA selector. .It Va WITHOUT_MAKE Set to not install .Xr make 1 and related support files. .It Va WITHOUT_MAKE_CHECK_USE_SANDBOX Set to not execute .Dq Li "make check" in limited sandbox mode. This option should be paired with .Va WITH_INSTALL_AS_USER if executed as an unprivileged user. See .Xr tests 7 for more details. .It Va WITHOUT_MAN Set to not build manual pages. When set, these options are also in effect: .Pp .Bl -inset -compact .It Va WITHOUT_MAN_UTILS (unless .Va WITH_MAN_UTILS is set explicitly) .El .It Va WITHOUT_MANCOMPRESS Set to not to install compressed man pages. Only the uncompressed versions will be installed. .It Va WITHOUT_MAN_UTILS Set to not build utilities for manual pages, .Xr apropos 1 , .Xr makewhatis 1 , .Xr man 1 , .Xr whatis 1 , .Xr manctl 8 , and related support files. .It Va WITH_META_MODE Create .Xr make 1 meta files when building, which can provide a reliable incremental build when using .Xr filemon 4 . The meta file is created in OBJDIR as .Pa target.meta . These meta files track the command that was executed, its output, and the current directory. The .Xr filemon 4 module is required unless .Va NO_FILEMON is defined. When the module is loaded, any files used by the commands executed are tracked as dependencies for the target in its meta file. The target is considered out-of-date and rebuilt if any of these conditions are true compared to the last build: .Bl -bullet -compact .It The command to execute changes. .It The current working directory changes. .It The target's meta file is missing. .It The target's meta file is missing filemon data when filemon is loaded and a previous run did not have it loaded. .It [requires .Xr filemon 4 ] Files read, executed or linked to are newer than the target. .It [requires .Xr filemon 4 ] Files read, written, executed or linked are missing. .El The meta files can also be useful for debugging. .Pp The build hides commands that are executed unless .Va NO_SILENT is defined. Errors cause .Xr make 1 to show some of its environment for further debugging. .Pp The build operates as it normally would otherwise. This option originally invoked a different build system but that was renamed to .Va WITH_DIRDEPS_BUILD . .Pp This must be set in the environment, make command line, or .Pa /etc/src-env.conf , not .Pa /etc/src.conf . .It Va WITHOUT_MLX5TOOL Set to not build .Xr mlx5tool 8 .Pp This is a default setting on arm/arm, arm/armv6, arm/armv7, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf, mips/mips64hf, powerpc/powerpc, powerpc/powerpcspe and riscv/riscv64. .It Va WITH_MLX5TOOL Set to build .Xr mlx5tool 8 .Pp This is a default setting on amd64/amd64, arm64/aarch64, i386/i386, powerpc/powerpc64 and sparc64/sparc64. .It Va WITH_MODULE_DRM Enable creation of old drm video modules. .It Va WITH_MODULE_DRM2 Enable creation of old drm2 video modules. .It Va WITH_NAND Set to build the NAND Flash components. .It Va WITHOUT_NDIS Set to not build programs and libraries related to NDIS emulation support. .It Va WITHOUT_NETCAT Set to not build .Xr nc 1 utility. .It Va WITHOUT_NETGRAPH Set to not build applications to support .Xr netgraph 4 . When set, it enforces these options: .Pp .Bl -item -compact .It .Va WITHOUT_ATM .It .Va WITHOUT_BLUETOOTH .El .Pp When set, these options are also in effect: .Pp .Bl -inset -compact .It Va WITHOUT_NETGRAPH_SUPPORT (unless .Va WITH_NETGRAPH_SUPPORT is set explicitly) .El .It Va WITHOUT_NETGRAPH_SUPPORT Set to build libraries, programs, and kernel modules without netgraph support. .It Va WITHOUT_NIS Set to not build .Xr NIS 8 support and related programs. If set, you might need to adopt your .Xr nsswitch.conf 5 and remove .Sq nis entries. .It Va WITHOUT_NLS Set to not build NLS catalogs. When set, it enforces these options: .Pp .Bl -item -compact .It .Va WITHOUT_NLS_CATALOGS .El .It Va WITHOUT_NLS_CATALOGS Set to not build NLS catalog support for .Xr csh 1 . .It Va WITHOUT_NS_CACHING Set to disable name caching in the .Pa nsswitch subsystem. The generic caching daemon, .Xr nscd 8 , will not be built either if this option is set. .It Va WITHOUT_NTP Set to not build .Xr ntpd 8 and related programs. .It Va WITHOUT_NVME Set to not build nvme related tools and kernel modules. .Pp This is a default setting on arm/arm, arm/armv6, arm/armv7, arm64/aarch64, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf, mips/mips64hf, powerpc/powerpc, powerpc/powerpcspe, riscv/riscv64 and sparc64/sparc64. .It Va WITH_NVME Set to build nvme related tools and kernel modules. .Pp This is a default setting on amd64/amd64, i386/i386 and powerpc/powerpc64. .It Va WITH_OFED Set to build the .Dq "OpenFabrics Enterprise Distribution" Infiniband software stack. .It Va WITH_OFED_EXTRA Set to build the non-essential components of the .Dq "OpenFabrics Enterprise Distribution" Infiniband software stack, mostly examples. .It Va WITH_OPENLDAP Enable building openldap support for kerberos. .It Va WITHOUT_OPENSSH Set to not build OpenSSH. .It Va WITHOUT_OPENSSL Set to not build OpenSSL. When set, it enforces these options: .Pp .Bl -item -compact .It .Va WITHOUT_KERBEROS .It .Va WITHOUT_OPENSSH .El .Pp When set, these options are also in effect: .Pp .Bl -inset -compact .It Va WITHOUT_GSSAPI (unless .Va WITH_GSSAPI is set explicitly) .El .It Va WITHOUT_PAM Set to not build PAM library and modules. .Bf -symbolic This option is deprecated and does nothing. .Ef When set, these options are also in effect: .Pp .Bl -inset -compact .It Va WITHOUT_PAM_SUPPORT (unless .Va WITH_PAM_SUPPORT is set explicitly) .El .It Va WITHOUT_PAM_SUPPORT Set to build some programs without PAM support, particularly .Xr ftpd 8 and .Xr ppp 8 . .It Va WITHOUT_PC_SYSINSTALL Set to not build .Xr pc-sysinstall 8 and related programs. .It Va WITHOUT_PF Set to not build PF firewall package. When set, it enforces these options: .Pp .Bl -item -compact .It .Va WITHOUT_AUTHPF .El .It Va WITHOUT_PKGBOOTSTRAP Set to not build .Xr pkg 7 bootstrap tool. .It Va WITHOUT_PMC Set to not build .Xr pmccontrol 8 and related programs. .It Va WITHOUT_PORTSNAP Set to not build or install .Xr portsnap 8 and related files. When set, it enforces these options: .Pp .Bl -item -compact .It .Va WITHOUT_FREEBSD_UPDATE .El .It Va WITHOUT_PPP Set to not build .Xr ppp 8 and related programs. .It Va WITHOUT_PROFILE Set to not build profiled libraries for use with .Xr gprof 8 . .Pp This is a default setting on mips/mips64el, mips/mips64, mips/mips64elhf and mips/mips64hf. .It Va WITH_PROFILE Set to build profiled libraries for use with .Xr gprof 8 . .Pp This is a default setting on amd64/amd64, arm/arm, arm/armv6, arm/armv7, arm64/aarch64, i386/i386, mips/mipsel, mips/mips, mips/mipsn32, mips/mipselhf, mips/mipshf, powerpc/powerpc, powerpc/powerpc64, powerpc/powerpcspe, riscv/riscv64 and sparc64/sparc64. .It Va WITHOUT_QUOTAS Set to not build .Xr quota 1 and related programs. .It Va WITHOUT_RADIUS_SUPPORT Set to not build radius support into various applications, like .Xr pam_radius 8 and .Xr ppp 8 . .It Va WITH_RATELIMIT Set to build the system with rate limit support. .Pp This makes .Dv SO_MAX_PACING_RATE effective in .Xr getsockopt 2 , and .Ar txrlimit support in .Xr ifconfig 8 , by proxy. .It Va WITHOUT_RBOOTD Set to not build or install .Xr rbootd 8 . .It Va WITHOUT_REPRODUCIBLE_BUILD Set to include build metadata (such as the build time, user, and host) in the kernel, boot loaders, and uname output. Successive builds will not be bit-for-bit identical. .It Va WITHOUT_RESCUE Set to not build .Xr rescue 8 . .It Va WITH_RETPOLINE Set to build the base system with the retpoline speculative execution vulnerability mitigation for CVE-2017-5715. .It Va WITHOUT_ROUTED Set to not build .Xr routed 8 utility. .It Va WITH_RPCBIND_WARMSTART_SUPPORT Set to build .Xr rpcbind 8 with warmstart support. .It Va WITHOUT_SENDMAIL Set to not build .Xr sendmail 8 and related programs. .It Va WITHOUT_SERVICESDB Set to not install .Pa /var/db/services.db . .It Va WITHOUT_SETUID_LOGIN Set this to disable the installation of .Xr login 1 as a set-user-ID root program. .It Va WITHOUT_SHAREDOCS Set to not build the .Bx 4.4 legacy docs. .It Va WITH_SHARED_TOOLCHAIN Set to build the toolchain binaries shared. The set includes .Xr cc 1 , .Xr make 1 and necessary utilities like assembler, linker and library archive manager. .It Va WITH_SORT_THREADS Set to enable threads in .Xr sort 1 . .It Va WITHOUT_SOURCELESS Set to not build kernel modules that include sourceless code (either microcode or native code for host CPU). When set, it enforces these options: .Pp .Bl -item -compact .It .Va WITHOUT_SOURCELESS_HOST .It .Va WITHOUT_SOURCELESS_UCODE .El .It Va WITHOUT_SOURCELESS_HOST Set to not build kernel modules that include sourceless native code for host CPU. .It Va WITHOUT_SOURCELESS_UCODE Set to not build kernel modules that include sourceless microcode. .It Va WITHOUT_SSP Set to not build world with propolice stack smashing protection. .Pp This is a default setting on mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf and mips/mips64hf. .It Va WITH_SSP Set to build world with propolice stack smashing protection. .Pp This is a default setting on amd64/amd64, arm/arm, arm/armv6, arm/armv7, arm64/aarch64, i386/i386, powerpc/powerpc, powerpc/powerpc64, powerpc/powerpcspe, riscv/riscv64 and sparc64/sparc64. .It Va WITH_STAGING Enable staging of files to a stage tree. This can be best thought of as auto-install to .Va DESTDIR with some extra meta data to ensure dependencies can be tracked. Depends on .Va WITH_DIRDEPS_BUILD . When set, these options are also in effect: .Pp .Bl -inset -compact .It Va WITH_STAGING_MAN (unless .Va WITHOUT_STAGING_MAN is set explicitly) .It Va WITH_STAGING_PROG (unless .Va WITHOUT_STAGING_PROG is set explicitly) .El .Pp This must be set in the environment, make command line, or .Pa /etc/src-env.conf , not .Pa /etc/src.conf . .It Va WITH_STAGING_MAN Enable staging of man pages to stage tree. .It Va WITH_STAGING_PROG Enable staging of PROGs to stage tree. .It Va WITH_STALE_STAGED Check staged files are not stale. .It Va WITH_SVN Set to install .Xr svnlite 1 as .Xr svn 1 . .It Va WITHOUT_SVNLITE Set to not build .Xr svnlite 1 and related programs. .It Va WITHOUT_SYMVER Set to disable symbol versioning when building shared libraries. .It Va WITHOUT_SYSCONS Set to not build .Xr syscons 4 support files such as keyboard maps, fonts, and screen output maps. .It Va WITH_SYSROOT Enable use of sysroot during build. Depends on .Va WITH_DIRDEPS_BUILD . .Pp This must be set in the environment, make command line, or .Pa /etc/src-env.conf , not .Pa /etc/src.conf . .It Va WITHOUT_SYSTEM_COMPILER Set to not opportunistically skip building a cross-compiler during the bootstrap phase of the build. Normally, if the currently installed compiler matches the planned bootstrap compiler type and revision, then it will not be built. This does not prevent a compiler from being built for installation though, only for building one for the build itself. The .Va WITHOUT_CLANG and .Va WITHOUT_GCC options control those. .It Va WITHOUT_SYSTEM_LINKER Set to not opportunistically skip building a cross-linker during the bootstrap phase of the build. Normally, if the currently installed linker matches the planned bootstrap linker type and revision, then it will not be built. This does not prevent a linker from being built for installation though, only for building one for the build itself. The .Va WITHOUT_LLD and .Va WITHOUT_BINUTILS options control those. .Pp This option is only relevant when .Va WITH_LLD_BOOTSTRAP is set. .It Va WITHOUT_TALK Set to not build or install .Xr talk 1 and .Xr talkd 8 . .It Va WITHOUT_TCP_WRAPPERS Set to not build or install .Xr tcpd 8 , and related utilities. .It Va WITHOUT_TCSH Set to not build and install .Pa /bin/csh (which is .Xr tcsh 1 ) . .It Va WITHOUT_TELNET Set to not build .Xr telnet 1 and related programs. .It Va WITHOUT_TESTS Set to not build nor install the .Fx Test Suite in .Pa /usr/tests/ . See .Xr tests 7 for more details. This also disables the build of all test-related dependencies, including ATF. When set, it enforces these options: .Pp .Bl -item -compact .It .Va WITHOUT_DTRACE_TESTS .El .Pp When set, these options are also in effect: .Pp .Bl -inset -compact .It Va WITHOUT_TESTS_SUPPORT (unless .Va WITH_TESTS_SUPPORT is set explicitly) .El .It Va WITHOUT_TESTS_SUPPORT Set to disables the build of all test-related dependencies, including ATF. .It Va WITHOUT_TEXTPROC Set to not build programs used for text processing. .It Va WITHOUT_TFTP Set to not build or install .Xr tftp 1 and .Xr tftpd 8 . .It Va WITHOUT_TIMED Set to not build or install .Xr timed 8 . .It Va WITHOUT_TOOLCHAIN Set to not install header or programs used for program development, compilers, debuggers etc. When set, it enforces these options: .Pp .Bl -item -compact .It .Va WITHOUT_BINUTILS .It .Va WITHOUT_CLANG .It .Va WITHOUT_CLANG_EXTRAS .It .Va WITHOUT_CLANG_FULL .It .Va WITHOUT_GCC .It .Va WITHOUT_GDB .It .Va WITHOUT_INCLUDES .It .Va WITHOUT_LLD .It .Va WITHOUT_LLDB .It .Va WITHOUT_LLVM_COV .El .It Va WITHOUT_UNBOUND Set to not build .Xr unbound 8 and related programs. .It Va WITHOUT_UNIFIED_OBJDIR Set to use the historical object directory format for .Xr build 7 targets. For native-builds and builds done directly in sub-directories the format of .Pa ${MAKEOBJDIRPREFIX}/${.CURDIR} is used, while for cross-builds .Pa ${MAKEOBJDIRPREFIX}/${TARGET}.${TARGET_ARCH}/${.CURDIR} is used. .Pp This option is transitional and will be removed before the 12.0 release, at which time .va WITH_UNIFIED_OBJDIR will be enabled permanently. .Pp This must be set in the environment, make command line, or .Pa /etc/src-env.conf , not .Pa /etc/src.conf . .It Va WITHOUT_USB Set to not build USB-related programs and libraries. .It Va WITHOUT_USB_GADGET_EXAMPLES Set to not build USB gadget kernel modules. .It Va WITHOUT_UTMPX Set to not build user accounting tools such as .Xr last 1 , .Xr users 1 , .Xr who 1 , .Xr ac 8 , .Xr lastlogin 8 and .Xr utx 8 . .It Va WITHOUT_VI Set to not build and install vi, view, ex and related programs. .It Va WITHOUT_VT Set to not build .Xr vt 4 support files (fonts and keymaps). .It Va WITHOUT_WARNS Set this to not add warning flags to the compiler invocations. Useful as a temporary workaround when code enters the tree which triggers warnings in environments that differ from the original developer. .It Va WITHOUT_WIRELESS Set to not build programs used for 802.11 wireless networks; especially .Xr wpa_supplicant 8 and .Xr hostapd 8 . When set, these options are also in effect: .Pp .Bl -inset -compact .It Va WITHOUT_WIRELESS_SUPPORT (unless .Va WITH_WIRELESS_SUPPORT is set explicitly) .El .It Va WITHOUT_WIRELESS_SUPPORT Set to build libraries, programs, and kernel modules without 802.11 wireless support. .It Va WITHOUT_WPA_SUPPLICANT_EAPOL Build .Xr wpa_supplicant 8 without support for the IEEE 802.1X protocol and without support for EAP-PEAP, EAP-TLS, EAP-LEAP, and EAP-TTLS protocols (usable only via 802.1X). .It Va WITHOUT_ZFS Set to not build ZFS file system. .It Va WITHOUT_ZONEINFO Set to not build the timezone database. When set, it enforces these options: .Pp .Bl -item -compact .It .Va WITHOUT_ZONEINFO_LEAPSECONDS_SUPPORT .It .Va WITHOUT_ZONEINFO_OLD_TIMEZONES_SUPPORT .El .It Va WITH_ZONEINFO_LEAPSECONDS_SUPPORT Set to build leapsecond information in to the timezone database. .It Va WITH_ZONEINFO_OLD_TIMEZONES_SUPPORT Set to build backward compatibility timezone aliases in to the timezone database. .El .Sh FILES .Bl -tag -compact -width Pa .It Pa /etc/src.conf .It Pa /etc/src-env.conf .It Pa /usr/share/mk/bsd.own.mk .El .Sh SEE ALSO .Xr make 1 , .Xr make.conf 5 , .Xr build 7 , .Xr ports 7 .Sh HISTORY The .Nm file appeared in .Fx 7.0 . .Sh AUTHORS This manual page was autogenerated by .An tools/build/options/makeman . Index: head/share/mk/src.opts.mk =================================================================== --- head/share/mk/src.opts.mk (revision 340131) +++ head/share/mk/src.opts.mk (revision 340132) @@ -1,571 +1,570 @@ # $FreeBSD$ # # Option file for FreeBSD /usr/src builds. # # Users define WITH_FOO and WITHOUT_FOO on the command line or in /etc/src.conf # and /etc/make.conf files. These translate in the build system to MK_FOO={yes,no} # with sensible (usually) defaults. # # Makefiles must include bsd.opts.mk after defining specific MK_FOO options that # are applicable for that Makefile (typically there are none, but sometimes there # are exceptions). Recursive makes usually add MK_FOO=no for options that they wish # to omit from that make. # # Makefiles must include bsd.mkopt.mk before they test the value of any MK_FOO # variable. # # Makefiles may also assume that this file is included by src.opts.mk should it # need variables defined there prior to the end of the Makefile where # bsd.{subdir,lib.bin}.mk is traditionally included. # # The old-style YES_FOO and NO_FOO are being phased out. No new instances of them # should be added. Old instances should be removed since they were just to # bridge the gap between FreeBSD 4 and FreeBSD 5. # # Makefiles should never test WITH_FOO or WITHOUT_FOO directly (although an # exception is made for _WITHOUT_SRCONF which turns off this mechanism # completely inside bsd.*.mk files). # .if !target(____) ____: .include # # Define MK_* variables (which are either "yes" or "no") for users # to set via WITH_*/WITHOUT_* in /etc/src.conf and override in the # make(1) environment. # These should be tested with `== "no"' or `!= "no"' in makefiles. # The NO_* variables should only be set by makefiles for variables # that haven't been converted over. # # These options are used by the src builds. Those listed in # __DEFAULT_YES_OPTIONS default to 'yes' and will build unless turned # off. __DEFAULT_NO_OPTIONS will default to 'no' and won't build # unless turned on. Any options listed in 'BROKEN_OPTIONS' will be # hard-wired to 'no'. "Broken" here means not working or # not-appropriate and/or not supported. It doesn't imply something is # wrong with the code. There's not a single good word for this, so # BROKEN was selected as the least imperfect one considered at the # time. Options are added to BROKEN_OPTIONS list on a per-arch basis. # At this time, there's no provision for mutually incompatible options. __DEFAULT_YES_OPTIONS = \ ACCT \ ACPI \ AMD \ APM \ AT \ ATM \ AUDIT \ AUTHPF \ AUTOFS \ BHYVE \ BINUTILS \ BINUTILS_BOOTSTRAP \ BLACKLIST \ BLUETOOTH \ BOOT \ BOOTPARAMD \ BOOTPD \ BSD_CPIO \ BSDINSTALL \ BSNMP \ BZIP2 \ CALENDAR \ CAPSICUM \ CASPER \ CCD \ CDDL \ CPP \ CROSS_COMPILER \ CRYPT \ CTM \ CUSE \ CXX \ CXGBETOOL \ DIALOG \ DICT \ DMAGENT \ DYNAMICROOT \ - ED_CRYPTO \ EE \ EFI \ ELFTOOLCHAIN_BOOTSTRAP \ EXAMPLES \ FDT \ FILE \ FINGER \ FLOPPY \ FMTREE \ FORTH \ FP_LIBC \ FREEBSD_UPDATE \ FTP \ GAMES \ GCOV \ GDB \ GNU_DIFF \ GNU_GREP \ GPIO \ HAST \ HTML \ HYPERV \ ICONV \ INET \ INET6 \ INETD \ IPFILTER \ IPFW \ ISCSI \ JAIL \ KDUMP \ KVM \ LDNS \ LDNS_UTILS \ LEGACY_CONSOLE \ LIB32 \ LIBPTHREAD \ LIBTHR \ LLVM_COV \ LOADER_GELI \ LOADER_LUA \ LOADER_OFW \ LOADER_UBOOT \ LOCALES \ LOCATE \ LPR \ LS_COLORS \ LZMA_SUPPORT \ MAIL \ MAILWRAPPER \ MAKE \ MLX5TOOL \ NDIS \ NETCAT \ NETGRAPH \ NLS_CATALOGS \ NS_CACHING \ NTP \ NVME \ OFED \ OPENSSL \ PAM \ PC_SYSINSTALL \ PF \ PKGBOOTSTRAP \ PMC \ PORTSNAP \ PPP \ QUOTAS \ RADIUS_SUPPORT \ RBOOTD \ REPRODUCIBLE_BUILD \ RESCUE \ ROUTED \ SENDMAIL \ SERVICESDB \ SETUID_LOGIN \ SHAREDOCS \ SOURCELESS \ SOURCELESS_HOST \ SOURCELESS_UCODE \ SVNLITE \ SYSCONS \ SYSTEM_COMPILER \ SYSTEM_LINKER \ TALK \ TCP_WRAPPERS \ TCSH \ TELNET \ TEXTPROC \ TFTP \ TIMED \ UNBOUND \ USB \ UTMPX \ VI \ VT \ WIRELESS \ WPA_SUPPLICANT_EAPOL \ ZFS \ ZONEINFO __DEFAULT_NO_OPTIONS = \ BSD_GREP \ CLANG_EXTRAS \ DTRACE_TESTS \ EXPERIMENTAL \ GNU_GREP_COMPAT \ HESIOD \ LIBSOFT \ LOADER_FIREWIRE \ LOADER_FORCE_LE \ NAND \ OFED_EXTRA \ OPENLDAP \ RPCBIND_WARMSTART_SUPPORT \ SHARED_TOOLCHAIN \ SORT_THREADS \ SVN \ ZONEINFO_LEAPSECONDS_SUPPORT \ ZONEINFO_OLD_TIMEZONES_SUPPORT \ # LEFT/RIGHT. Left options which default to "yes" unless their corresponding # RIGHT option is disabled. __DEFAULT_DEPENDENT_OPTIONS= \ CLANG_FULL/CLANG \ LLVM_TARGET_ALL/CLANG \ # MK_*_SUPPORT options which default to "yes" unless their corresponding # MK_* variable is set to "no". # .for var in \ BLACKLIST \ BZIP2 \ INET \ INET6 \ KERBEROS \ KVM \ NETGRAPH \ PAM \ TESTS \ WIRELESS __DEFAULT_DEPENDENT_OPTIONS+= ${var}_SUPPORT/${var} .endfor # # Default behaviour of some options depends on the architecture. Unfortunately # this means that we have to test TARGET_ARCH (the buildworld case) as well # as MACHINE_ARCH (the non-buildworld case). Normally TARGET_ARCH is not # used at all in bsd.*.mk, but we have to make an exception here if we want # to allow defaults for some things like clang to vary by target architecture. # Additional, per-target behavior should be rarely added only after much # gnashing of teeth and grinding of gears. # .if defined(TARGET_ARCH) __T=${TARGET_ARCH} .else __T=${MACHINE_ARCH} .endif .if defined(TARGET) __TT=${TARGET} .else __TT=${MACHINE} .endif # All supported backends for LLVM_TARGET_XXX __LLVM_TARGETS= \ aarch64 \ arm \ mips \ powerpc \ sparc \ x86 __LLVM_TARGET_FILT= C/(amd64|i386)/x86/:S/sparc64/sparc/:S/arm64/aarch64/ .for __llt in ${__LLVM_TARGETS} # Default the given TARGET's LLVM_TARGET support to the value of MK_CLANG. .if ${__TT:${__LLVM_TARGET_FILT}} == ${__llt} __DEFAULT_DEPENDENT_OPTIONS+= LLVM_TARGET_${__llt:${__LLVM_TARGET_FILT}:tu}/CLANG # aarch64 needs arm for -m32 support. .elif ${__TT} == "arm64" && ${__llt} == "arm" __DEFAULT_DEPENDENT_OPTIONS+= LLVM_TARGET_ARM/LLVM_TARGET_AARCH64 # Default the rest of the LLVM_TARGETs to the value of MK_LLVM_TARGET_ALL # which is based on MK_CLANG. .else __DEFAULT_DEPENDENT_OPTIONS+= LLVM_TARGET_${__llt:${__LLVM_TARGET_FILT}:tu}/LLVM_TARGET_ALL .endif .endfor __DEFAULT_NO_OPTIONS+=LLVM_TARGET_BPF .include # If the compiler is not C++11 capable, disable Clang and use GCC instead. # This means that architectures that have GCC 4.2 as default can not # build Clang without using an external compiler. .if ${COMPILER_FEATURES:Mc++11} && (${__T} == "aarch64" || \ ${__T} == "amd64" || ${__TT} == "arm" || ${__T} == "i386") # Clang is enabled, and will be installed as the default /usr/bin/cc. __DEFAULT_YES_OPTIONS+=CLANG CLANG_BOOTSTRAP CLANG_IS_CC LLD __DEFAULT_NO_OPTIONS+=GCC GCC_BOOTSTRAP GNUCXX GPL_DTC .elif ${COMPILER_FEATURES:Mc++11} && ${__T:Mriscv*} == "" && ${__T} != "sparc64" # If an external compiler that supports C++11 is used as ${CC} and Clang # supports the target, then Clang is enabled but GCC is installed as the # default /usr/bin/cc. __DEFAULT_YES_OPTIONS+=CLANG GCC GCC_BOOTSTRAP GNUCXX GPL_DTC LLD __DEFAULT_NO_OPTIONS+=CLANG_BOOTSTRAP CLANG_IS_CC .else # Everything else disables Clang, and uses GCC instead. __DEFAULT_YES_OPTIONS+=GCC GCC_BOOTSTRAP GNUCXX GPL_DTC __DEFAULT_NO_OPTIONS+=CLANG CLANG_BOOTSTRAP CLANG_IS_CC LLD .endif # In-tree binutils/gcc are older versions without modern architecture support. .if ${__T} == "aarch64" || ${__T:Mriscv*} != "" BROKEN_OPTIONS+=BINUTILS BINUTILS_BOOTSTRAP GCC GCC_BOOTSTRAP GDB .endif .if ${__T:Mriscv*} != "" BROKEN_OPTIONS+=OFED .endif .if ${__T} == "aarch64" || ${__T} == "amd64" || ${__T} == "i386" || \ ${__T:Mriscv*} != "" || ${__TT} == "mips" __DEFAULT_YES_OPTIONS+=LLVM_LIBUNWIND .else __DEFAULT_NO_OPTIONS+=LLVM_LIBUNWIND .endif .if ${__T} == "aarch64" || ${__T} == "amd64" || ${__T} == "armv7" __DEFAULT_YES_OPTIONS+=LLD_BOOTSTRAP LLD_IS_LD .elif ${__T} == "i386" __DEFAULT_YES_OPTIONS+=LLD_BOOTSTRAP __DEFAULT_NO_OPTIONS+=LLD_IS_LD .else __DEFAULT_NO_OPTIONS+=LLD_BOOTSTRAP LLD_IS_LD .endif .if ${__T} == "aarch64" || ${__T} == "amd64" || ${__T} == "i386" __DEFAULT_YES_OPTIONS+=LLDB .else __DEFAULT_NO_OPTIONS+=LLDB .endif # LLVM lacks support for FreeBSD 64-bit atomic operations for ARMv4/ARMv5 .if ${__T} == "arm" BROKEN_OPTIONS+=LLDB .endif # GDB in base is generally less functional than GDB in ports. Ports GDB # sparc64 kernel support has not been tested. .if ${__T} == "sparc64" __DEFAULT_NO_OPTIONS+=GDB_LIBEXEC .else __DEFAULT_YES_OPTIONS+=GDB_LIBEXEC .endif # Only doing soft float API stuff on armv6 and armv7 .if ${__T} != "armv6" && ${__T} != "armv7" BROKEN_OPTIONS+=LIBSOFT .endif .if ${__T:Mmips*} BROKEN_OPTIONS+=SSP .endif # EFI doesn't exist on mips, powerpc, sparc or riscv. .if ${__T:Mmips*} || ${__T:Mpowerpc*} || ${__T:Msparc64} || ${__T:Mriscv*} BROKEN_OPTIONS+=EFI .endif # OFW is only for powerpc and sparc64, exclude others .if ${__T:Mpowerpc*} == "" && ${__T:Msparc64} == "" BROKEN_OPTIONS+=LOADER_OFW .endif # UBOOT is only for arm, mips and powerpc, exclude others .if ${__T:Marm*} == "" && ${__T:Mmips*} == "" && ${__T:Mpowerpc*} == "" BROKEN_OPTIONS+=LOADER_UBOOT .endif # GELI and Lua in loader currently cause boot failures on sparc64 and powerpc. # Further debugging is required -- probably they are just broken on big # endian systems generically (they jump to null pointers or try to read # crazy high addresses, which is typical of endianness problems). .if ${__T} == "sparc64" || ${__T:Mpowerpc*} BROKEN_OPTIONS+=LOADER_GELI LOADER_LUA .endif .if ${__T:Mmips64*} # profiling won't work on MIPS64 because there is only assembly for o32 BROKEN_OPTIONS+=PROFILE .endif .if ${__T} != "aarch64" && ${__T} != "amd64" && ${__T} != "i386" && \ ${__T} != "powerpc64" && ${__T} != "sparc64" BROKEN_OPTIONS+=CXGBETOOL BROKEN_OPTIONS+=MLX5TOOL .endif # HyperV is currently x86-only .if ${__T} != "amd64" && ${__T} != "i386" BROKEN_OPTIONS+=HYPERV .endif # NVME is only x86 and powerpc64 .if ${__T} != "amd64" && ${__T} != "i386" && ${__T} != "powerpc64" BROKEN_OPTIONS+=NVME .endif .if ${__T} == "aarch64" || ${__T} == "amd64" || ${__T} == "i386" || \ ${__T} == "powerpc64" __DEFAULT_NO_OPTIONS+=BSD_CRTBEGIN .else BROKEN_OPTIONS+=BSD_CRTBEGIN .endif .include # # MK_* options that default to "yes" if the compiler is a C++11 compiler. # .for var in \ LIBCPLUSPLUS .if !defined(MK_${var}) .if ${COMPILER_FEATURES:Mc++11} .if defined(WITHOUT_${var}) MK_${var}:= no .else MK_${var}:= yes .endif .else .if defined(WITH_${var}) MK_${var}:= yes .else MK_${var}:= no .endif .endif .endif .endfor # # Force some options off if their dependencies are off. # Order is somewhat important. # .if !${COMPILER_FEATURES:Mc++11} MK_LLVM_LIBUNWIND:= no .endif .if ${MK_BINUTILS} == "no" MK_GDB:= no .endif .if ${MK_CAPSICUM} == "no" MK_CASPER:= no .endif .if ${MK_LIBPTHREAD} == "no" MK_LIBTHR:= no .endif .if ${MK_LDNS} == "no" MK_LDNS_UTILS:= no MK_UNBOUND:= no .endif .if ${MK_SOURCELESS} == "no" MK_SOURCELESS_HOST:= no MK_SOURCELESS_UCODE:= no .endif .if ${MK_CDDL} == "no" MK_ZFS:= no MK_CTF:= no .endif .if ${MK_CRYPT} == "no" MK_OPENSSL:= no MK_OPENSSH:= no MK_KERBEROS:= no .endif .if ${MK_CXX} == "no" MK_CLANG:= no MK_GNUCXX:= no MK_TESTS:= no .endif .if ${MK_DIALOG} == "no" MK_BSDINSTALL:= no .endif .if ${MK_MAIL} == "no" MK_MAILWRAPPER:= no MK_SENDMAIL:= no MK_DMAGENT:= no .endif .if ${MK_NETGRAPH} == "no" MK_ATM:= no MK_BLUETOOTH:= no .endif .if ${MK_NLS} == "no" MK_NLS_CATALOGS:= no .endif .if ${MK_OPENSSL} == "no" MK_OPENSSH:= no MK_KERBEROS:= no .endif .if ${MK_PF} == "no" MK_AUTHPF:= no .endif .if ${MK_OFED} == "no" MK_OFED_EXTRA:= no .endif .if ${MK_PORTSNAP} == "no" # freebsd-update depends on phttpget from portsnap MK_FREEBSD_UPDATE:= no .endif .if ${MK_TESTS} == "no" MK_DTRACE_TESTS:= no .endif .if ${MK_ZONEINFO} == "no" MK_ZONEINFO_LEAPSECONDS_SUPPORT:= no MK_ZONEINFO_OLD_TIMEZONES_SUPPORT:= no .endif .if ${MK_CROSS_COMPILER} == "no" MK_BINUTILS_BOOTSTRAP:= no MK_CLANG_BOOTSTRAP:= no MK_ELFTOOLCHAIN_BOOTSTRAP:= no MK_GCC_BOOTSTRAP:= no MK_LLD_BOOTSTRAP:= no .endif .if ${MK_TOOLCHAIN} == "no" MK_BINUTILS:= no MK_CLANG:= no MK_GCC:= no MK_GDB:= no MK_INCLUDES:= no MK_LLD:= no MK_LLDB:= no .endif .if ${MK_CLANG} == "no" MK_CLANG_EXTRAS:= no MK_CLANG_FULL:= no MK_LLVM_COV:= no .endif # # MK_* options whose default value depends on another option. # .for vv in \ GSSAPI/KERBEROS \ MAN_UTILS/MAN .if defined(WITH_${vv:H}) MK_${vv:H}:= yes .elif defined(WITHOUT_${vv:H}) MK_${vv:H}:= no .else MK_${vv:H}:= ${MK_${vv:T}} .endif .endfor # # Set defaults for the MK_*_SUPPORT variables. # .if !${COMPILER_FEATURES:Mc++11} MK_LLDB:= no .endif # gcc 4.8 and newer supports libc++, so suppress gnuc++ in that case. # while in theory we could build it with that, we don't want to do # that since it creates too much confusion for too little gain. # XXX: This is incomplete and needs X_COMPILER_TYPE/VERSION checks too # to prevent Makefile.inc1 from bootstrapping unneeded dependencies # and to support 'make delete-old' when supplying an external toolchain. .if ${COMPILER_TYPE} == "gcc" && ${COMPILER_VERSION} >= 40800 MK_GNUCXX:=no MK_GCC:=no .endif .endif # !target(____) Index: head/tools/build/options/WITHOUT_ED_CRYPTO =================================================================== --- head/tools/build/options/WITHOUT_ED_CRYPTO (revision 340131) +++ head/tools/build/options/WITHOUT_ED_CRYPTO (nonexistent) @@ -1,4 +0,0 @@ -.\" $FreeBSD$ -Set to build -.Xr ed 1 -without support for encryption/decryption. Property changes on: head/tools/build/options/WITHOUT_ED_CRYPTO ___________________________________________________________________ Deleted: svn:keywords ## -1 +0,0 ## -FreeBSD=%H \ No newline at end of property