draft-ietf-netmod-artwork-folding-06.txt | draft-ietf-netmod-artwork-folding-07.txt | |||
---|---|---|---|---|
NETMOD Working Group K. Watsen | NETMOD Working Group K. Watsen | |||
Internet-Draft Watsen Networks | Internet-Draft Watsen Networks | |||
Intended status: Best Current Practice A. Farrel | Intended status: Best Current Practice A. Farrel | |||
Expires: December 29, 2019 Old Dog Consulting | Expires: January 24, 2020 Old Dog Consulting | |||
Q. Wu | Q. Wu | |||
Huawei Technologies | Huawei Technologies | |||
June 27, 2019 | July 23, 2019 | |||
Handling Long Lines in Inclusions in Internet-Drafts and RFCs | Handling Long Lines in Inclusions in Internet-Drafts and RFCs | |||
draft-ietf-netmod-artwork-folding-06 | draft-ietf-netmod-artwork-folding-07 | |||
Abstract | Abstract | |||
This document defines two strategies for handling long lines in | This document defines two strategies for handling long lines in | |||
width-bounded text content. One strategy is based on the historic | width-bounded text content. One strategy is based on the historic | |||
use of a single backslash ('\') character to indicate where line- | use of a single backslash ('\') character to indicate where line- | |||
folding has occurred, with the continuation occurring with the first | folding has occurred, with the continuation occurring with the first | |||
non-space (' ') character on the next line. The second strategy | non-space (' ') character on the next line. The second strategy | |||
extends the first strategy by adding a second backslash character to | extends the first strategy by adding a second backslash character to | |||
identify where the continuation begins and thereby able to handle | identify where the continuation begins and thereby able to handle | |||
skipping to change at page 1, line 42 ¶ | skipping to change at page 1, line 42 ¶ | |||
Internet-Drafts are working documents of the Internet Engineering | Internet-Drafts are working documents of the Internet Engineering | |||
Task Force (IETF). Note that other groups may also distribute | Task Force (IETF). Note that other groups may also distribute | |||
working documents as Internet-Drafts. The list of current Internet- | working documents as Internet-Drafts. The list of current Internet- | |||
Drafts is at https://datatracker.ietf.org/drafts/current/. | Drafts is at https://datatracker.ietf.org/drafts/current/. | |||
Internet-Drafts are draft documents valid for a maximum of six months | Internet-Drafts are draft documents valid for a maximum of six months | |||
and may be updated, replaced, or obsoleted by other documents at any | and may be updated, replaced, or obsoleted by other documents at any | |||
time. It is inappropriate to use Internet-Drafts as reference | time. It is inappropriate to use Internet-Drafts as reference | |||
material or to cite them other than as "work in progress." | material or to cite them other than as "work in progress." | |||
This Internet-Draft will expire on December 29, 2019. | This Internet-Draft will expire on January 24, 2020. | |||
Copyright Notice | Copyright Notice | |||
Copyright (c) 2019 IETF Trust and the persons identified as the | Copyright (c) 2019 IETF Trust and the persons identified as the | |||
document authors. All rights reserved. | document authors. All rights reserved. | |||
This document is subject to BCP 78 and the IETF Trust's Legal | This document is subject to BCP 78 and the IETF Trust's Legal | |||
Provisions Relating to IETF Documents | Provisions Relating to IETF Documents | |||
(https://trustee.ietf.org/license-info) in effect on the date of | (https://trustee.ietf.org/license-info) in effect on the date of | |||
publication of this document. Please review these documents | publication of this document. Please review these documents | |||
skipping to change at page 3, line 12 ¶ | skipping to change at page 3, line 12 ¶ | |||
9.3.1. Using '\' . . . . . . . . . . . . . . . . . . . . . . 14 | 9.3.1. Using '\' . . . . . . . . . . . . . . . . . . . . . . 14 | |||
9.3.2. Using '\\' . . . . . . . . . . . . . . . . . . . . . 15 | 9.3.2. Using '\\' . . . . . . . . . . . . . . . . . . . . . 15 | |||
10. Security Considerations . . . . . . . . . . . . . . . . . . . 16 | 10. Security Considerations . . . . . . . . . . . . . . . . . . . 16 | |||
11. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 16 | 11. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 16 | |||
12. References . . . . . . . . . . . . . . . . . . . . . . . . . 16 | 12. References . . . . . . . . . . . . . . . . . . . . . . . . . 16 | |||
12.1. Normative References . . . . . . . . . . . . . . . . . . 16 | 12.1. Normative References . . . . . . . . . . . . . . . . . . 16 | |||
12.2. Informative References . . . . . . . . . . . . . . . . . 16 | 12.2. Informative References . . . . . . . . . . . . . . . . . 16 | |||
Appendix A. POSIX Shell Script: rfcfold . . . . . . . . . . . . 18 | Appendix A. POSIX Shell Script: rfcfold . . . . . . . . . . . . 18 | |||
Acknowledgements . . . . . . . . . . . . . . . . . . . . . . . . 26 | Acknowledgements . . . . . . . . . . . . . . . . . . . . . . . . 26 | |||
Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 26 | Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 27 | |||
1. Introduction | 1. Introduction | |||
[RFC7994] sets out the requirements for plain-text RFCs and states | [RFC7994] sets out the requirements for plain-text RFCs and states | |||
that each line of an RFC (and hence of an Internet-Draft) must be | that each line of an RFC (and hence of an Internet-Draft) must be | |||
limited to 72 characters followed by the character sequence that | limited to 72 characters followed by the character sequence that | |||
denotes an end-of-line (EOL). | denotes an end-of-line (EOL). | |||
Internet-Drafts and RFCs often include example text or code | Internet-Drafts and RFCs often include example text or code | |||
fragments. Many times the example text or code exceeds the 72 | fragments. Many times the example text or code exceeds the 72 | |||
skipping to change at page 18, line 47 ¶ | skipping to change at page 18, line 47 ¶ | |||
purposely added to the script so as to ensure that the script is | purposely added to the script so as to ensure that the script is | |||
itself not folded in this document, thus simplify the ability to | itself not folded in this document, thus simplify the ability to | |||
copy/paste the script for local use. As should be evident by the | copy/paste the script for local use. As should be evident by the | |||
lack of the mandatory header described in Section 7.1.1, these | lack of the mandatory header described in Section 7.1.1, these | |||
backslashes do not designate a folded line, such as described in | backslashes do not designate a folded line, such as described in | |||
Section 7. | Section 7. | |||
<CODE BEGINS> | <CODE BEGINS> | |||
#!/bin/bash --posix | #!/bin/bash --posix | |||
# must use `bash` (not `sh`) | ||||
# This script may need some adjustments to work on a given system. | # This script may need some adjustments to work on a given system. | |||
# For instance, the utilities `pcregrep` and `gsed` may need to | # For instance, the utilities `pcregrep` and `gsed` may need to | |||
# be installed. | # be installed. Also, please be advised that `bash` (not `sh`) | |||
# must be used. | ||||
# Copyright (c) 2019 IETF Trust, Kent Watsen, and Erik Auerswald. | ||||
# All rights reserved. | ||||
# | ||||
# Redistribution and use in source and binary forms, with or without | ||||
# modification, are permitted provided that the following conditions | ||||
# are met: | ||||
# | ||||
# * Redistributions of source code must retain the above copyright | ||||
# notice, this list of conditions and the following disclaimer. | ||||
# | ||||
# * 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. | ||||
# | ||||
# * Neither the name of Internet Society, IETF or IETF Trust, nor | ||||
# the names of specific contributors, may be used to endorse or | ||||
# promote products derived from this software without specific | ||||
# prior written permission. | ||||
# | ||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 | ||||
# COPYRIGHT OWNER 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. | ||||
print_usage() { | print_usage() { | |||
echo | printf "\n" | |||
echo "Folds the text file, only if needed, at the specified" | printf "Folds or unfolds the input text file according to BCP XX" | |||
echo "column, according to BCP XX." | printf " (RFC XXXX).\n" | |||
echo | printf "\n" | |||
echo "Usage: $0 [-s <strategy>] [-c <col>] [-r] -i <infile>" | printf "Usage: rfcfold [-s <strategy>] [-c <col>] [-r] -i <infile>" | |||
echo " -o <outfile>" | printf " -o <outfile>\n" | |||
echo | printf "\n" | |||
echo " -s: strategy to use, '1' or '2' (default: try 1, else 2)" | printf " -s: strategy to use, '1' or '2' (default: try 1," | |||
echo " -c: column to fold on (default: 69)" | printf " else 2)\n" | |||
echo " -r: reverses the operation" | printf " -c: column to fold on (default: 69)\n" | |||
echo " -i: the input filename" | printf " -r: reverses the operation\n" | |||
echo " -o: the output filename" | printf " -i: the input filename\n" | |||
echo " -d: show debug messages" | printf " -o: the output filename\n" | |||
echo " -q: quiet (suppress error messages)" | printf " -d: show debug messages\n" | |||
echo " -h: show this message" | printf " -q: quiet (suppress error messages)\n" | |||
echo | printf " -h: show this message\n" | |||
echo "Exit status code: zero on success, non-zero otherwise." | printf "\n" | |||
echo | printf "Exit status code: 1 on error, 0 on success, -1 on no-op.\n" | |||
printf "\n" | ||||
} | } | |||
# global vars, do not edit | # global vars, do not edit | |||
strategy=0 # auto | strategy=0 # auto | |||
debug=0 | debug=0 | |||
quiet=0 | quiet=0 | |||
reversed=0 | reversed=0 | |||
infile="" | infile="" | |||
outfile="" | outfile="" | |||
maxcol=69 # default, may be overridden by param | maxcol=69 # default, may be overridden by param | |||
hdr_txt_1="NOTE: '\\' line wrapping per BCP XX (RFC XXXX)" | hdr_txt_1="NOTE: '\\' line wrapping per BCP XX (RFC XXXX)" | |||
hdr_txt_2="NOTE: '\\\\' line wrapping per BCP XX (RFC XXXX)" | hdr_txt_2="NOTE: '\\\\' line wrapping per BCP XX (RFC XXXX)" | |||
equal_chars="==============================================" | equal_chars="=======================================================" | |||
space_chars=" " | space_chars=" " | |||
temp_dir="" | temp_dir="" | |||
# determine name of [g]sed binary | # determine name of [g]sed binary | |||
type gsed > /dev/null 2>&1 && SED=gsed || SED=sed | type gsed > /dev/null 2>&1 && SED=gsed || SED=sed | |||
# warn if a non-GNU sed utility is used | # warn if a non-GNU sed utility is used | |||
"$SED" --version < /dev/null 2> /dev/null \ | "$SED" --version < /dev/null 2> /dev/null \ | |||
| grep GNU >/dev/null 2>&1 || echo 'Warning: not using GNU sed' | | grep GNU >/dev/null 2>&1 || echo 'Warning: not using GNU `sed`.' | |||
# verify the availability of pcregrep | # verify the availability of pcregrep | |||
type pcregrep > /dev/null 2>&1 || { | type pcregrep > /dev/null 2>&1 || { | |||
echo 'Error: missing utility `pcregrep`' | echo 'Error: missing utility `pcregrep`' | |||
exit 1 | exit 1 | |||
} | } | |||
cleanup() { | cleanup() { | |||
rm -rf "$temp_dir" | rm -rf "$temp_dir" | |||
} | } | |||
trap 'cleanup' EXIT | trap 'cleanup' EXIT | |||
fold_it_1() { | fold_it_1() { | |||
# ensure input file doesn't contain the fold-sequence already | # ensure input file doesn't contain the fold-sequence already | |||
pcregrep -M "\\\\\n" $infile >> /dev/null 2>&1 | pcregrep -M "\\\\\n" $infile >> /dev/null 2>&1 | |||
if [[ $? -eq 0 ]]; then | if [[ $? -eq 0 ]]; then | |||
if [[ $quiet -eq 0 ]]; then | if [[ $quiet -eq 0 ]]; then | |||
End of changes. 11 change blocks. | ||||
28 lines changed or deleted | 63 lines changed or added | |||
This html diff was produced by rfcdiff 1.47. The latest version is available from http://tools.ietf.org/tools/rfcdiff/ |