To: vim_dev@googlegroups.com Subject: Patch 8.0.1658 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.0.1658 Problem: Capitalize argument not available in long form. Solution: Recognize -capitalize. Update man page. Files: src/xxd/xxd.c, runtime/doc/xxd.1, runtime/doc/xxd.man *** ../vim-8.0.1657/src/xxd/xxd.c 2018-04-03 12:17:19.816196268 +0200 --- src/xxd/xxd.c 2018-04-03 14:11:10.468210864 +0200 *************** *** 510,515 **** --- 510,517 ---- { if (pp[2] && STRNCMP("ols", pp + 2, 3)) cols = (int)strtol(pp + 2, NULL, 0); + else if (pp[2] && STRNCMP("apitalize", pp + 2, 9)) + capitalize = 1; else { if (!argv[2]) *** ../vim-8.0.1657/runtime/doc/xxd.1 2015-03-05 17:45:27.000000000 +0100 --- runtime/doc/xxd.1 2018-04-03 14:20:26.065295605 +0200 *************** *** 57,63 **** .PP .TP .IR \-a " | " \-autoskip ! toggle autoskip: A single '*' replaces nul-lines. Default off. .TP .IR \-b " | " \-bits Switch to bits (binary digits) dump, rather than hexdump. --- 57,63 ---- .PP .TP .IR \-a " | " \-autoskip ! Toggle autoskip: A single '*' replaces nul-lines. Default off. .TP .IR \-b " | " \-bits Switch to bits (binary digits) dump, rather than hexdump. *************** *** 67,76 **** \-r, \-p, \-i do not work with this mode. .TP .IR "\-c cols " | " \-cols cols" ! format .RI < cols > octets per line. Default 16 (\-i: 12, \-ps: 30, \-b: 6). Max 256. .TP .IR \-E " | " \-EBCDIC Change the character encoding in the righthand column from ASCII to EBCDIC. This does not change the hexadecimal representation. The option is --- 67,79 ---- \-r, \-p, \-i do not work with this mode. .TP .IR "\-c cols " | " \-cols cols" ! Format .RI < cols > octets per line. Default 16 (\-i: 12, \-ps: 30, \-b: 6). Max 256. .TP + .IR \-C " | " \-capitalize + Capitalize variable names in C include file style, when using \-i. + .TP .IR \-E " | " \-EBCDIC Change the character encoding in the righthand column from ASCII to EBCDIC. This does not change the hexadecimal representation. The option is *************** *** 87,93 **** \-r, \-p, \-i do not work with this mode. .TP .IR "\-g bytes " | " \-groupsize bytes" ! separate the output of every .RI < bytes > bytes (two hex characters or eight bit-digits each) by a whitespace. Specify --- 90,96 ---- \-r, \-p, \-i do not work with this mode. .TP .IR "\-g bytes " | " \-groupsize bytes" ! Separate the output of every .RI < bytes > bytes (two hex characters or eight bit-digits each) by a whitespace. Specify *************** *** 98,125 **** Grouping does not apply to postscript or include style. .TP .IR \-h " | " \-help ! print a summary of available commands and exit. No hex dumping is performed. .TP .IR \-i " | " \-include ! output in C include file style. A complete static array definition is written (named after the input file), unless xxd reads from stdin. .TP .IR "\-l len " | " \-len len" ! stop after writing .RI < len > octets. .TP .I \-o offset ! add .RI < offset > to the displayed file position. .TP .IR \-p " | " \-ps " | " \-postscript " | " \-plain ! output in postscript continuous hexdump style. Also known as plain hexdump style. .TP .IR \-r " | " \-revert ! reverse operation: convert (or patch) hexdump into binary. If not writing to stdout, xxd writes into its output file without truncating it. Use the combination .I \-r \-p --- 101,128 ---- Grouping does not apply to postscript or include style. .TP .IR \-h " | " \-help ! Print a summary of available commands and exit. No hex dumping is performed. .TP .IR \-i " | " \-include ! Output in C include file style. A complete static array definition is written (named after the input file), unless xxd reads from stdin. .TP .IR "\-l len " | " \-len len" ! Stop after writing .RI < len > octets. .TP .I \-o offset ! Add .RI < offset > to the displayed file position. .TP .IR \-p " | " \-ps " | " \-postscript " | " \-plain ! Output in postscript continuous hexdump style. Also known as plain hexdump style. .TP .IR \-r " | " \-revert ! Reverse operation: convert (or patch) hexdump into binary. If not writing to stdout, xxd writes into its output file without truncating it. Use the combination .I \-r \-p *************** *** 135,141 **** added to file positions found in hexdump. .TP .I \-s [+][\-]seek ! start at .RI < seek > bytes abs. (or rel.) infile offset. \fI+ \fRindicates that the seek is relative to the current stdin file position --- 138,144 ---- added to file positions found in hexdump. .TP .I \-s [+][\-]seek ! Start at .RI < seek > bytes abs. (or rel.) infile offset. \fI+ \fRindicates that the seek is relative to the current stdin file position *************** *** 145,154 **** Without \-s option, xxd starts at the current file position. .TP .I \-u ! use upper case hex letters. Default is lower case. .TP .IR \-v " | " \-version ! show version string. .SH CAVEATS .PP .I xxd \-r --- 148,157 ---- Without \-s option, xxd starts at the current file position. .TP .I \-u ! Use upper case hex letters. Default is lower case. .TP .IR \-v " | " \-version ! Show version string. .SH CAVEATS .PP .I xxd \-r *** ../vim-8.0.1657/runtime/doc/xxd.man 2015-07-10 19:17:47.000000000 +0200 --- runtime/doc/xxd.man 2018-04-03 14:20:27.777288652 +0200 *************** *** 30,36 **** notation. Thus -c8, -c 8, -c 010 and -cols 8 are all equivalent. -a | -autoskip ! toggle autoskip: A single '*' replaces nul-lines. Default off. -b | -bits Switch to bits (binary digits) dump, rather than hexdump. This --- 30,36 ---- notation. Thus -c8, -c 8, -c 010 and -cols 8 are all equivalent. -a | -autoskip ! Toggle autoskip: A single '*' replaces nul-lines. Default off. -b | -bits Switch to bits (binary digits) dump, rather than hexdump. This *************** *** 41,49 **** mode. -c cols | -cols cols ! format octets per line. Default 16 (-i: 12, -ps: 30, -b: 6). Max 256. -E | -EBCDIC Change the character encoding in the righthand column from ASCII to EBCDIC. This does not change the hexadecimal representation. --- 41,53 ---- mode. -c cols | -cols cols ! Format octets per line. Default 16 (-i: 12, -ps: 30, -b: 6). Max 256. + -C | -capitalize + Capitalize variable names in C include file style, when using + -i. + -E | -EBCDIC Change the character encoding in the righthand column from ASCII to EBCDIC. This does not change the hexadecimal representation. *************** *** 52,92 **** -e Switch to little-endian hexdump. This option treats byte groups as words in little-endian byte order. The default grouping of 4 bytes may be changed using -g. This option only applies to hex‐ ! dump, leaving the ASCII (or EBCDIC) representation unchanged. The command line switches -r, -p, -i do not work with this mode. -g bytes | -groupsize bytes ! separate the output of every bytes (two hex characters or eight bit-digits each) by a whitespace. Specify -g 0 to sup‐ press grouping. defaults to 2 in normal mode, 4 in lit‐ ! tle-endian mode and 1 in bits mode. Grouping does not apply to postscript or include style. -h | -help ! print a summary of available commands and exit. No hex dumping is performed. -i | -include ! output in C include file style. A complete static array defini‐ ! tion is written (named after the input file), unless xxd reads from stdin. -l len | -len len ! stop after writing octets. -o offset ! add to the displayed file position. -p | -ps | -postscript | -plain ! output in postscript continuous hexdump style. Also known as plain hexdump style. -r | -revert ! reverse operation: convert (or patch) hexdump into binary. If ! not writing to stdout, xxd writes into its output file without truncating it. Use the combination -r -p to read plain hexadeci‐ mal dumps without line number information and without a particu‐ ! lar column layout. Additional Whitespace and line-breaks are allowed anywhere. -seek offset --- 56,96 ---- -e Switch to little-endian hexdump. This option treats byte groups as words in little-endian byte order. The default grouping of 4 bytes may be changed using -g. This option only applies to hex‐ ! dump, leaving the ASCII (or EBCDIC) representation unchanged. The command line switches -r, -p, -i do not work with this mode. -g bytes | -groupsize bytes ! Separate the output of every bytes (two hex characters or eight bit-digits each) by a whitespace. Specify -g 0 to sup‐ press grouping. defaults to 2 in normal mode, 4 in lit‐ ! tle-endian mode and 1 in bits mode. Grouping does not apply to postscript or include style. -h | -help ! Print a summary of available commands and exit. No hex dumping is performed. -i | -include ! Output in C include file style. A complete static array defini‐ ! tion is written (named after the input file), unless xxd reads from stdin. -l len | -len len ! Stop after writing octets. -o offset ! Add to the displayed file position. -p | -ps | -postscript | -plain ! Output in postscript continuous hexdump style. Also known as plain hexdump style. -r | -revert ! Reverse operation: convert (or patch) hexdump into binary. If ! not writing to stdout, xxd writes into its output file without truncating it. Use the combination -r -p to read plain hexadeci‐ mal dumps without line number information and without a particu‐ ! lar column layout. Additional Whitespace and line-breaks are allowed anywhere. -seek offset *************** *** 94,127 **** found in hexdump. -s [+][-]seek ! start at bytes abs. (or rel.) infile offset. + indicates ! that the seek is relative to the current stdin file position (meaningless when not reading from stdin). - indicates that the ! seek should be that many characters from the end of the input (or if combined with +: before the current stdin file position). Without -s option, xxd starts at the current file position. ! -u use upper case hex letters. Default is lower case. -v | -version ! show version string. CAVEATS xxd -r has some builtin magic while evaluating line number information. ! If the output file is seekable, then the linenumbers at the start of ! each hexdump line may be out of order, lines may be missing, or over‐ ! lapping. In these cases xxd will lseek(2) to the next position. If the ! output file is not seekable, only gaps are allowed, which will be filled by null-bytes. xxd -r never generates parse errors. Garbage is silently skipped. ! When editing hexdumps, please note that xxd -r skips everything on the input line after reading enough columns of hexadecimal data (see option ! -c). This also means, that changes to the printable ascii (or ebcdic) ! columns are always ignored. Reverting a plain (or postscript) style ! hexdump with xxd -r -p does not depend on the correct number of col‐ ! umns. Here anything that looks like a pair of hex-digits is inter‐ preted. Note the difference between --- 98,131 ---- found in hexdump. -s [+][-]seek ! Start at bytes abs. (or rel.) infile offset. + indicates ! that the seek is relative to the current stdin file position (meaningless when not reading from stdin). - indicates that the ! seek should be that many characters from the end of the input (or if combined with +: before the current stdin file position). Without -s option, xxd starts at the current file position. ! -u Use upper case hex letters. Default is lower case. -v | -version ! Show version string. CAVEATS xxd -r has some builtin magic while evaluating line number information. ! If the output file is seekable, then the linenumbers at the start of ! each hexdump line may be out of order, lines may be missing, or over‐ ! lapping. In these cases xxd will lseek(2) to the next position. If the ! output file is not seekable, only gaps are allowed, which will be filled by null-bytes. xxd -r never generates parse errors. Garbage is silently skipped. ! When editing hexdumps, please note that xxd -r skips everything on the input line after reading enough columns of hexadecimal data (see option ! -c). This also means, that changes to the printable ascii (or ebcdic) ! columns are always ignored. Reverting a plain (or postscript) style ! hexdump with xxd -r -p does not depend on the correct number of col‐ ! umns. Here anything that looks like a pair of hex-digits is inter‐ preted. Note the difference between *************** *** 129,156 **** and % xxd -i < file ! xxd -s +seek may be different from xxd -s seek, as lseek(2) is used to "rewind" input. A '+' makes a difference if the input source is stdin, ! and if stdin's file position is not at the start of the file by the ! time xxd is started and given its input. The following examples may help to clarify (or further confuse!)... ! Rewind stdin before reading; needed because the `cat' has already read to the end of stdin. % sh -c "cat > plain_copy; xxd -s 0 > hex_copy" < file ! Hexdump from file position 0x480 (=1024+128) onwards. The `+' sign means "relative to the current position", thus the `128' adds to the 1k where dd left off. ! % sh -c "dd of=plain_snippet bs=1k count=1; xxd -s +128 > hex_snippet" < file Hexdump from file position 0x100 ( = 1024-768) on. % sh -c "dd of=plain_snippet bs=1k count=1; xxd -s +-768 > hex_snippet" < file ! However, this is a rare situation and the use of `+' is rarely needed. ! The author prefers to monitor the effect of xxd with strace(1) or truss(1), whenever -s is used. EXAMPLES --- 133,160 ---- and % xxd -i < file ! xxd -s +seek may be different from xxd -s seek, as lseek(2) is used to "rewind" input. A '+' makes a difference if the input source is stdin, ! and if stdin's file position is not at the start of the file by the ! time xxd is started and given its input. The following examples may help to clarify (or further confuse!)... ! Rewind stdin before reading; needed because the `cat' has already read to the end of stdin. % sh -c "cat > plain_copy; xxd -s 0 > hex_copy" < file ! Hexdump from file position 0x480 (=1024+128) onwards. The `+' sign means "relative to the current position", thus the `128' adds to the 1k where dd left off. ! % sh -c "dd of=plain_snippet bs=1k count=1; xxd -s +128 > hex_snippet" < file Hexdump from file position 0x100 ( = 1024-768) on. % sh -c "dd of=plain_snippet bs=1k count=1; xxd -s +-768 > hex_snippet" < file ! However, this is a rare situation and the use of `+' is rarely needed. ! The author prefers to monitor the effect of xxd with strace(1) or truss(1), whenever -s is used. EXAMPLES *************** *** 194,200 **** % xxd -s 0x36 -l 13 -c 13 xxd.1 0000036: 3235 7468 204d 6179 2031 3939 36 25th May 1996 ! Create a 65537 byte file with all bytes 0x00, except for the last one which is 'A' (hex 0x41). % echo "010000: 41" | xxd -r > file --- 198,204 ---- % xxd -s 0x36 -l 13 -c 13 xxd.1 0000036: 3235 7468 204d 6179 2031 3939 36 25th May 1996 ! Create a 65537 byte file with all bytes 0x00, except for the last one which is 'A' (hex 0x41). % echo "010000: 41" | xxd -r > file *************** *** 204,210 **** * 000fffc: 0000 0000 40 ....A ! Create a 1 byte file containing a single 'A' character. The number after '-r -s' adds to the linenumbers found in the file; in effect, the leading bytes are suppressed. % echo "010000: 41" | xxd -r -s -0x10000 > file --- 208,214 ---- * 000fffc: 0000 0000 40 ....A ! Create a 1 byte file containing a single 'A' character. The number after '-r -s' adds to the linenumbers found in the file; in effect, the leading bytes are suppressed. % echo "010000: 41" | xxd -r -s -0x10000 > file *************** *** 245,251 **** uuencode(1), uudecode(1), patch(1) WARNINGS ! The tools weirdness matches its creators brain. Use entirely at your own risk. Copy files. Trace it. Become a wizard. VERSION --- 249,255 ---- uuencode(1), uudecode(1), patch(1) WARNINGS ! The tools weirdness matches its creators brain. Use entirely at your own risk. Copy files. Trace it. Become a wizard. VERSION *** ../vim-8.0.1657/src/version.c 2018-04-03 12:50:55.509298311 +0200 --- src/version.c 2018-04-03 14:14:03.383282606 +0200 *************** *** 764,765 **** --- 764,767 ---- { /* Add new patch number below this line */ + /**/ + 1658, /**/ -- I AM THANKFUL... ...for the clothes that fit a little too snug because it means I have more than enough to eat. /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///