- Notifications
You must be signed in to change notification settings - Fork6
Handling long lines in content of internet-drafts and RFCs
License
ietf-tools/rfcfold
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
rfcfold is aBashscript that folds or unfolds a text file according toRFC 8792,Handling Long Lines in Content of Internet-Drafts and RFCs.The (un)folding operations are implemented withgrep andsed.
Invokingrfcfold with the-h option shows usage information:
Folds or unfolds the input text file according to RFC 8792.Usage: rfcfold [-h] [-V] [-d] [-q] [-s <strategy>] [-c <col>] [-r] -i <infile> -o <outfile> -s: strategy to use, '1' or '2' (default: try 1, else 2) -c: column to fold on (default: 69) -r: reverses the operation -i: the input filename -o: the output filename -d: show debug messages (unless -q is given) -q: quiet (suppress error and debug messages) -h: show this message -V: print version informationExit status code: 1 on error, 0 on success, 255 on no-op.Fold the file
original.txtand write the result tofolded.txt:rfcfold -i original.txt -o folded.txtUnfold the file
folded.txtand write the result tounfolded.txt:rfcfold -r -i folded.txt -o unfolded.txt
Noteworthy changes between versions ofrfcfold can be found in theNEWS.md file.
rfcfold has some limitations, because its primary intended use is fortext file inclusions in IETF RFC and Internet-Draft (I-D) documents, andbecause it is implemented as a Bash script relying ongrep andsed.
The primary application ofrfcfold lies in creating text files thatcan be included in IETF RFC and I-D documents by ensuring a maximum linelength (in characters). Thus the input file is not allowed to containTAB characters, because they are not allowed for text fragments in an RFC.
Most ASCII control characters and non-ASCII characters are problematicin the context of IETF RFC and I-D documents, andrfcfold emits awarning if it finds them in the input data. IETF RFC and I-D documentsallow limited use of UTF-8 encoded Unicode characters, butrfcfolddoes not take Unicode specifics into account.
Depending on the operating system respectively the availablegrep andsed implementations,rfcfold may be able to process Unicode textfiles, but with limitations. The display width of Unicode characters isnot taken into consideration when folding. Every character is assumedto have single width. Since printable Unicode characters can be widerthan single width, and some implementations even display some singlewidth characters with more than single width, the end result may notlook as expected. There are additional complications with Unicode, e.g.,combining characters, none of which are taken into account byrfcfold.As such Unicode is notsupported byrfcfold.
Usage of bothgrepandsedconforms to thePOSIXspecification.
On non-GNU systems, GNU tools are ofteninstalled to complement the system-provided ones. On such systems,GNU grepandGNU sedare used if they are available asggrep andgsed.
Use of both GNU grep and GNU sed may increase the maximum usable valuefor the folding column over using system-provided grep and sed.
About
Handling long lines in content of internet-drafts and RFCs
Resources
License
Code of conduct
Contributing
Security policy
Uh oh!
There was an error while loading.Please reload this page.