• GNU diff output defaults

    From Janis Papanagnou@21:1/5 to All on Sun Aug 7 11:59:49 2022
    When using a side-by-side diff output with GNU diff(1) it just
    occurred to me that the output didn't fit on the screen window
    and I saw that there's a somewhat strange or arbitrary default
    width of 130 columns defined

    -y, --side-by-side
    -W, --width=NUM
    output at most NUM (default 130) print columns

    Is there a reason for a number like that; I mean I'd have (if
    only for historical reasons) expected, say, a value of 80, or,
    since "any default value is wrong" considering diff to take the
    actual display width as default (if not specified by the user).

    It's no issue, but I was surprised about that default.

    Janis

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Christian Weisgerber@21:1/5 to Janis Papanagnou on Sun Aug 7 10:55:14 2022
    On 2022-08-07, Janis Papanagnou <janis_papanagnou@hotmail.com> wrote:

    When using a side-by-side diff output with GNU diff(1) it just
    occurred to me that the output didn't fit on the screen window
    and I saw that there's a somewhat strange or arbitrary default
    width of 130 columns defined

    Indeed, I would expect 132 columns. I guess they wanted a round
    number.

    Is there a reason for a number like that; I mean I'd have (if
    only for historical reasons) expected, say, a value of 80, or,

    The DEC VT100 family of video terminals could be switched from the
    default 80 columns into 132-column mode.

    I have a vague memory that 1980s dot matrix printers also supported
    such a condensed mode.

    --
    Christian "naddy" Weisgerber naddy@mips.inka.de

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Ben Bacarisse@21:1/5 to Janis Papanagnou on Sun Aug 7 14:55:46 2022
    Janis Papanagnou <janis_papanagnou@hotmail.com> writes:

    When using a side-by-side diff output with GNU diff(1) it just
    occurred to me that the output didn't fit on the screen window
    and I saw that there's a somewhat strange or arbitrary default
    width of 130 columns defined

    -y, --side-by-side
    -W, --width=NUM
    output at most NUM (default 130) print columns

    Is there a reason for a number like that; I mean I'd have (if
    only for historical reasons) expected, say, a value of 80, or,
    since "any default value is wrong" considering diff to take the
    actual display width as default (if not specified by the user).

    80 columns comes from punched cards and, in those days, the most common
    size of line printer paper accommodated 132 columns. (This predates
    line printers and comes from 14 inch stock and a 10 pitch font. The
    other 8 columns being lost to margins and the holes to move the paper
    through.)

    So 80 and 132 characters were often used widths. 130? Not sure but
    it's close enough to 132 that someone might be remembering an old line
    printer.

    --
    Ben.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Janis Papanagnou@21:1/5 to Ben Bacarisse on Sun Aug 7 16:49:45 2022
    On 07.08.2022 15:55, Ben Bacarisse wrote:
    Janis Papanagnou <janis_papanagnou@hotmail.com> writes:

    When using a side-by-side diff output with GNU diff(1) it just
    occurred to me that the output didn't fit on the screen window
    and I saw that there's a somewhat strange or arbitrary default
    width of 130 columns defined

    -y, --side-by-side
    -W, --width=NUM
    output at most NUM (default 130) print columns

    Is there a reason for a number like that; I mean I'd have (if
    only for historical reasons) expected, say, a value of 80, or,
    since "any default value is wrong" considering diff to take the
    actual display width as default (if not specified by the user).

    80 columns comes from punched cards and, in those days, the most common
    size of line printer paper accommodated 132 columns. (This predates
    line printers and comes from 14 inch stock and a 10 pitch font. The
    other 8 columns being lost to margins and the holes to move the paper through.)

    So 80 and 132 characters were often used widths. 130? Not sure but
    it's close enough to 132 that someone might be remembering an old line printer.

    I do recall the 80/132 devices quite well (actually I have still a
    set of punch-cards and chain-printer output somewhere buried).[*]

    But I don't see the point of such a default. In my code I now have
    a (IMO unnecessary complex) call of

    diff -W$(tput cols) -y ...

    This could have been the implicit default to make usage simpler for
    any terminal settings by only calling

    diff -y ...

    and anyone you wants a fixed number can just define that number as
    -W80, -W132, -W160, or whatever, anyway.

    But okay, it is what it is.

    Janis

    [*] Wikipedia, though, mentions for the most widespread IBM printer
    a width of 120 character positions. (This deviates from my own, but
    only faint, memories.)

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Dan Espen@21:1/5 to Janis Papanagnou on Sun Aug 7 11:38:33 2022
    Janis Papanagnou <janis_papanagnou@hotmail.com> writes:

    On 07.08.2022 15:55, Ben Bacarisse wrote:
    Janis Papanagnou <janis_papanagnou@hotmail.com> writes:

    When using a side-by-side diff output with GNU diff(1) it just
    occurred to me that the output didn't fit on the screen window
    and I saw that there's a somewhat strange or arbitrary default
    width of 130 columns defined

    -y, --side-by-side
    -W, --width=NUM
    output at most NUM (default 130) print columns

    Is there a reason for a number like that; I mean I'd have (if
    only for historical reasons) expected, say, a value of 80, or,
    since "any default value is wrong" considering diff to take the
    actual display width as default (if not specified by the user).

    80 columns comes from punched cards and, in those days, the most common
    size of line printer paper accommodated 132 columns. (This predates
    line printers and comes from 14 inch stock and a 10 pitch font. The
    other 8 columns being lost to margins and the holes to move the paper
    through.)

    So 80 and 132 characters were often used widths. 130? Not sure but
    it's close enough to 132 that someone might be remembering an old line
    printer.

    I do recall the 80/132 devices quite well (actually I have still a
    set of punch-cards and chain-printer output somewhere buried).[*]

    But I don't see the point of such a default. In my code I now have
    a (IMO unnecessary complex) call of

    diff -W$(tput cols) -y ...

    This could have been the implicit default to make usage simpler for
    any terminal settings by only calling

    diff -y ...

    and anyone you wants a fixed number can just define that number as
    -W80, -W132, -W160, or whatever, anyway.

    But okay, it is what it is.

    Janis

    [*] Wikipedia, though, mentions for the most widespread IBM printer
    a width of 120 character positions. (This deviates from my own, but
    only faint, memories.)

    My memories are pretty clear.
    I can't recall a shop with 120 character printers and I was in a LOT of
    shops.

    I spent 2 years in a 1440 shop. The 1443 printer was 144 or 120
    characters. Never saw one of those with 120 characters either.

    --
    Dan Espen

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Dan Espen@21:1/5 to David W. Hodgins on Sun Aug 7 13:08:26 2022
    "David W. Hodgins" <dwhodgins@nomail.afraid.org> writes:

    On Sun, 07 Aug 2022 05:59:49 -0400, Janis Papanagnou <janis_papanagnou@hotmail.com> wrote:

    When using a side-by-side diff output with GNU diff(1) it just
    occurred to me that the output didn't fit on the screen window
    and I saw that there's a somewhat strange or arbitrary default
    width of 130 columns defined

    -y, --side-by-side
    -W, --width=NUM
    output at most NUM (default 130) print columns

    Is there a reason for a number like that; I mean I'd have (if
    only for historical reasons) expected, say, a value of 80, or,
    since "any default value is wrong" considering diff to take the
    actual display width as default (if not specified by the user).

    It's no issue, but I was surprised about that default.

    The fanfold paper used on older printers had 133 characters per line with the first being used for carriage control. I guess they dropped a couple of characters
    to allow for paper being not quite centered.

    Never did the printer have 133 characters per line.
    One of the ways a program could indicate carriage control was thru
    putting a character in the first byte of the output stream.
    On S/360 that first character was converted to some bits in the write
    CCW. Only 132 characters were sent to the printer.


    --
    Dan Espen

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From David W. Hodgins@21:1/5 to Janis Papanagnou on Sun Aug 7 12:34:45 2022
    On Sun, 07 Aug 2022 05:59:49 -0400, Janis Papanagnou <janis_papanagnou@hotmail.com> wrote:

    When using a side-by-side diff output with GNU diff(1) it just
    occurred to me that the output didn't fit on the screen window
    and I saw that there's a somewhat strange or arbitrary default
    width of 130 columns defined

    -y, --side-by-side
    -W, --width=NUM
    output at most NUM (default 130) print columns

    Is there a reason for a number like that; I mean I'd have (if
    only for historical reasons) expected, say, a value of 80, or,
    since "any default value is wrong" considering diff to take the
    actual display width as default (if not specified by the user).

    It's no issue, but I was surprised about that default.

    The fanfold paper used on older printers had 133 characters per line with the first being used for carriage control. I guess they dropped a couple of characters
    to allow for paper being not quite centered.

    Regards, Dave Hodgins

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From David W. Hodgins@21:1/5 to Dan Espen on Sun Aug 7 13:48:57 2022
    On Sun, 07 Aug 2022 13:08:26 -0400, Dan Espen <dan1espen@gmail.com> wrote:
    Never did the printer have 133 characters per line.
    One of the ways a program could indicate carriage control was thru
    putting a character in the first byte of the output stream.
    On S/360 that first character was converted to some bits in the write
    CCW. Only 132 characters were sent to the printer.

    133 characters were sent to the printer. The first byte was not printed. A blank
    in that character was for single spacing, 0 for double spacing, 1 for page advance,
    and + for write without advancing for highlighting or underlining, using the standard page ribbon.

    The ribbon had to match the paper being used. The ribbon had columns, with one colums having a hole for every line on the page, and the others being used for vertical tabs and page advances.

    Regards, Dave Hodgins

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From David W. Hodgins@21:1/5 to Dan Espen on Sun Aug 7 20:57:51 2022
    On Sun, 07 Aug 2022 20:32:04 -0400, Dan Espen <dan1espen@gmail.com> wrote:

    "David W. Hodgins" <dwhodgins@nomail.afraid.org> writes:

    On Sun, 07 Aug 2022 13:08:26 -0400, Dan Espen <dan1espen@gmail.com> wrote: >>> Never did the printer have 133 characters per line.
    One of the ways a program could indicate carriage control was thru
    putting a character in the first byte of the output stream.
    On S/360 that first character was converted to some bits in the write
    CCW. Only 132 characters were sent to the printer.

    133 characters were sent to the printer. The first byte was not printed. A blank
    in that character was for single spacing, 0 for double spacing, 1 for page advance,
    and + for write without advancing for highlighting or underlining, using the >> standard page ribbon.

    Nope.

    That's how COBOL printing using RECFM FBA would look.
    That's not what got sent the printer.

    On the first computer/printer I used, it did. The computer was a DOS Honeywell model 100/5. This was in 1975. I spent time helping out in the computer room for
    bonus marks in my Fortran programming course, feeding the cards through the punch or optical card readers, changing the paper on the printer, and with forms, punching and changing the paper tape that controller the printer's advancing.

    IOCS took that first character and converted it to the opcode for a CCW. Check your green card.

    With COBOL you didn't have to use the first byte. Make the print file
    FB and WRITE using AFTER ADVANCING.

    Just because the programming language hid the first byte from the programmer, doesn't mean it wasn't generated for sending to the printer.

    Later, when I worked on an IBM 370, some times we'd print to a file instead of the printer. In a file browser the first byte was visible.

    The ribbon had to match the paper being used. The ribbon had columns, with one
    colums having a hole for every line on the page, and the others being used for
    vertical tabs and page advances.

    The ribbon is where the ink was.

    That's a carriage control tape.

    Ah. I'd forgotten the term. Thanks for the correction.

    Regards, Dave Hodgins

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Keith Thompson@21:1/5 to Janis Papanagnou on Sun Aug 7 18:08:37 2022
    Janis Papanagnou <janis_papanagnou@hotmail.com> writes:
    When using a side-by-side diff output with GNU diff(1) it just
    occurred to me that the output didn't fit on the screen window
    and I saw that there's a somewhat strange or arbitrary default
    width of 130 columns defined

    -y, --side-by-side
    -W, --width=NUM
    output at most NUM (default 130) print columns

    Is there a reason for a number like that; I mean I'd have (if
    only for historical reasons) expected, say, a value of 80, or,
    since "any default value is wrong" considering diff to take the
    actual display width as default (if not specified by the user).

    It's no issue, but I was surprised about that default.

    As discussed, VT100-based terminals and line printers commonly have a 132-column mode. 80 columns is likely to be too narrow for a
    side-by-side diff. When the option was first added, it's likely that 80
    and 132 columns were the only options on a lot of systems.

    I think there's a strong hesitancy to make a text-processing command's
    behavior depend on the current terminal characteristics. `ls` using
    columns when writing to a tty is a notable exception.

    It might be nice for diff to have an option to check the terminal width
    itself, but as you say downthread you can roll your own:

    diff -W$(tput cols) -y ...

    Another useful option might be to use the actual maximum widths of the
    input files (and again, you can roll your own).

    --
    Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com
    Working, but not speaking, for Philips
    void Void(void) { Void(); } /* The recursive call of the void */

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Dan Espen@21:1/5 to David W. Hodgins on Sun Aug 7 20:32:04 2022
    "David W. Hodgins" <dwhodgins@nomail.afraid.org> writes:

    On Sun, 07 Aug 2022 13:08:26 -0400, Dan Espen <dan1espen@gmail.com> wrote:
    Never did the printer have 133 characters per line.
    One of the ways a program could indicate carriage control was thru
    putting a character in the first byte of the output stream.
    On S/360 that first character was converted to some bits in the write
    CCW. Only 132 characters were sent to the printer.

    133 characters were sent to the printer. The first byte was not printed. A blank
    in that character was for single spacing, 0 for double spacing, 1 for page advance,
    and + for write without advancing for highlighting or underlining, using the standard page ribbon.

    Nope.

    That's how COBOL printing using RECFM FBA would look.
    That's not what got sent the printer.

    IOCS took that first character and converted it to the opcode for a CCW.
    Check your green card.

    With COBOL you didn't have to use the first byte. Make the print file
    FB and WRITE using AFTER ADVANCING.

    The ribbon had to match the paper being used. The ribbon had columns, with one
    colums having a hole for every line on the page, and the others being used for
    vertical tabs and page advances.

    The ribbon is where the ink was.

    That's a carriage control tape.

    --
    Dan Espen

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Janis Papanagnou@21:1/5 to Keith Thompson on Mon Aug 8 04:45:31 2022
    On 08.08.2022 03:08, Keith Thompson wrote:
    Janis Papanagnou <janis_papanagnou@hotmail.com> writes:
    When using a side-by-side diff output with GNU diff(1) it just
    occurred to me that the output didn't fit on the screen window
    and I saw that there's a somewhat strange or arbitrary default
    width of 130 columns defined

    -y, --side-by-side
    -W, --width=NUM
    output at most NUM (default 130) print columns

    Is there a reason for a number like that; I mean I'd have (if
    only for historical reasons) expected, say, a value of 80, or,
    since "any default value is wrong" considering diff to take the
    actual display width as default (if not specified by the user).

    It's no issue, but I was surprised about that default.

    As discussed, VT100-based terminals and line printers commonly have a 132-column mode. 80 columns is likely to be too narrow for a
    side-by-side diff. When the option was first added, it's likely that 80
    and 132 columns were the only options on a lot of systems.

    I'm aware of that, that's why I wrote elsethread "-W80, -W132, -W160",
    with 160 to mean two screen contents side by side, which might also
    be a [non-]"sensible" default.

    I still think that any fixed default number is arbitrary and can only
    be wrong (wrong = correct only by coincidence).
    (On Unix systems we have such defaults in other places as well.)


    I think there's a strong hesitancy to make a text-processing command's behavior depend on the current terminal characteristics. `ls` using
    columns when writing to a tty is a notable exception.

    There's yet more commands than that; pr(1) immediately comes to mind.


    It might be nice for diff to have an option to check the terminal width itself, but as you say downthread you can roll your own:

    diff -W$(tput cols) -y ...

    The point is that making that a default will be "correct" for any
    terminal size (as opposed to one hard coded value that can anyway
    be simply specified as all the other arbitrary constant values).
    (If one wants any fixed value it can be written in compact form.)


    Another useful option might be to use the actual maximum widths of the
    input files (and again, you can roll your own).

    I think taking the maximum width of data/file contents might not
    be a good choice. Think about the consequences!
    Usually it's the physical display that you see that should be the
    limiting factor. (Whether line-wraps or truncation is appropriate
    in that case could be defined by an option. See also "pr -<N>",
    vim: set nowrap, and other data displaying programs.)

    But as it is with design issues that are already implemented;
    changing that now would break code that relies on that. <sigh>

    Janis

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Keith Thompson@21:1/5 to Janis Papanagnou on Sun Aug 7 21:12:51 2022
    Janis Papanagnou <janis_papanagnou@hotmail.com> writes:
    On 08.08.2022 03:08, Keith Thompson wrote:
    [...]
    I think there's a strong hesitancy to make a text-processing command's
    behavior depend on the current terminal characteristics. `ls` using
    columns when writing to a tty is a notable exception.

    There's yet more commands than that; pr(1) immediately comes to mind.

    I'm not aware that pr's behavior depends on whether it's writing to a
    tty. As I recall, its defaults are optimized for line printers with 66
    lines per page.

    [...]

    --
    Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com
    Working, but not speaking, for Philips
    void Void(void) { Void(); } /* The recursive call of the void */

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Janis Papanagnou@21:1/5 to Keith Thompson on Mon Aug 8 12:11:20 2022
    On 08.08.2022 06:12, Keith Thompson wrote:
    Janis Papanagnou <janis_papanagnou@hotmail.com> writes:
    On 08.08.2022 03:08, Keith Thompson wrote:
    [...]
    I think there's a strong hesitancy to make a text-processing command's
    behavior depend on the current terminal characteristics. `ls` using
    columns when writing to a tty is a notable exception.

    There's yet more commands than that; pr(1) immediately comes to mind.

    I'm not aware that pr's behavior depends on whether it's writing to a
    tty. As I recall, its defaults are optimized for line printers with 66
    lines per page.

    ...and 72 columns widths (per default). - Yes you are right, I confused
    that.

    Janis

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Christian Weisgerber@21:1/5 to Keith Thompson on Mon Aug 8 12:02:33 2022
    On 2022-08-08, Keith Thompson <Keith.S.Thompson+u@gmail.com> wrote:

    As discussed, VT100-based terminals and line printers commonly have a 132-column mode. 80 columns is likely to be too narrow for a
    side-by-side diff. When the option was first added, it's likely that 80
    and 132 columns were the only options on a lot of systems.

    On BSD, adding the w flag will also expand the output of ps(1) from
    80 to 132 columns. (Well, 79 to 131 really, because once upon a
    time, not every terminal had the newline glitch.)

    I still carry these aliases:
    alias c132='printf "\033[?3h"; stty columns 132; kill -WINCH $$' # set DECCOLM alias c80='printf "\033[?3l"; stty columns 80; kill -WINCH $$' # reset DECCOLM

    I think there's a strong hesitancy to make a text-processing command's behavior depend on the current terminal characteristics. `ls` using
    columns when writing to a tty is a notable exception.

    column(1) also does this. Which is presumably where ls(1) got it
    from.

    --
    Christian "naddy" Weisgerber naddy@mips.inka.de

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)