gdiffmk(1)

πŸ’… gdiffmk(1) β€” General Commands Manual πŸŽ€

okay so bestie, welcome to gdiffmk, straight out of the General Commands Manual section (section 1, the "just a normal command, nothing spooky" section πŸ’–). this whole page is literally gonna teach you how to mark up the diff between groff/nroff/troff files, and it's giving main character energy fr fr ✨


✨ Name ✨

gdiffmk β€” mark differences between groff/nroff/troff files πŸ¦‹


🌸 Synopsis 🌸

gdiffmk [-a add-mark] [-c change-mark] [-d delete-mark] [-x diff-
        command] [-D [-B] [-M mark1 mark2]] [--] file1 file2 [output-
        file]

gdiffmk --help

gdiffmk --version

so yeah, that's the shape of it πŸ’… two files in, optionally an output file, and a whole pile of flags to make it yours 🫢 (the diff-command thing is wrapped across lines up there, don't panic, it's still just -x diff-command).


πŸ¦‹ Description πŸ¦‹

okay so here's the whole vibe: gdiffmk compares two roff(7) documents, file1 and file2, and writes another document derived from both of them β€” either to the standard output stream or to output-file πŸ“ β€” and it sprinkles margin character (mc) requests into the output at exactly the spots where the input documents differ ✨

and here's the important bit, bestie, so listen up: gdiffmk does not interpret the source documents πŸ™ˆ it treats roff comments and nilpotent changes to formatting as meaningful. like, it genuinely does not know that \h'3m', \h'(1 * 3m)', and \h'3m+0' all mean the same thing. no cap, it's just not that kind of girl πŸ’€

other deets:

  • if file1 or file2 is -, gdiffmk reads the standard input stream for that input πŸ“
  • if the output operand is present, it writes output to a file of that name πŸ“
  • if output is - or absent, it writes to the standard output stream 🌈
  • - cannot be both an input and an output operand ⚠️ like, pick a lane, babe

πŸ’… OPTIONS πŸ’…

first up, the two ride-or-die info flags:

  • --help β€” displays a usage message, then exits 🫢
  • --version β€” shows version information, then exits ⭐

(both of them dip out right afterward, very "my work here is done" πŸ’…)

now the actual diff-flavouring ones:

  • -a add-mark β€” annotate material that's absent from file1 but present in file2 with add-mark (default: +) 🌸
  • -B β€” suppress br requests that are normally inserted by the -D option. use with caution 😭 because those requests are literally the only way to guarantee that deletions and small changes get marked ⚠️
  • -c change-mark β€” annotate material that differs between file1 and file2 with change-mark (default: |) πŸ¦‹
  • -d delete-mark β€” annotate material that's present in file1 but absent from file2 with delete-mark (default: *) πŸ“
  • -D β€” mark changed and deleted material with surrounding delimiters πŸ‘‘
  • -M mark1 mark2 β€” use mark1 (default: [[) and mark2 (default: ]]) as the delimiters when you're using the -D option πŸŽ€
  • -x diff-command β€” use the diff-command program to do the comparison of file1 and file2. diff-command (default: diff) must accept GNU diff(1)'s -D extension option πŸ”₯
  • -- β€” treat all the arguments after it as file names, even if they start with - 🫢 (yes, even the chaotic ones)

⭐ Exit status ⭐

gdiffmk exits with these, iykyk:

  • 0 β€” the input files are the same 😌
  • 1 β€” the input files differ πŸ‘€
  • 2 β€” usage error πŸ™ˆ
  • 3 β€” your system's diff(1) or sh(1) commands don't support features gdiffmk requires πŸ’€
  • 4 β€” the output argument is a duplicate of file1 or file2 😭

⚠️ Caveats ⚠️

bestie, the output is not necessarily compatible with all macro packages or preprocessors πŸ’€ a reliable workaround? run gdiffmk on the output of the final preprocessor instead of on the input source ✨ (yes, that's the move, trust)

also: gdiffmk relies on the -D option of GNU diff to make a merged #ifdef output format 🧚 Busybox diff is known to not support it πŸ™ˆ also see the -x diff-command option above πŸ‘‘


πŸ‘‘ Authors πŸ‘‘

gdiffmk was written by Mike Bianchi, now retired 🌸 it is maintained by the groff developers 🫢


🌈 See also 🌈

groff(1), nroff(1), troff(1), roff(7), diff(1)


and that's the whole page, bestie πŸ’– this iconic little number is groff 1.24.2, dated 2026-10-01, and it's literally the gdiffmk(1) page β€” go mark some differences, slay πŸŽ€πŸ¦‹βœ¨

πŸ“¦ where this page comes from