Annotation of src/usr.bin/sdiff/sdiff.1, Revision 1.18
1.18 ! bentley 1: .\" $OpenBSD: sdiff.1,v 1.17 2013/07/16 00:07:52 schwarze Exp $
1.1 tedu 2: .\"
3: .\" Written by Raymond Lai <ray@cyth.net>.
4: .\" Public domain.
5: .\"
1.18 ! bentley 6: .Dd $Mdocdate: July 16 2013 $
1.1 tedu 7: .Dt SDIFF 1
8: .Os
9: .Sh NAME
10: .Nm sdiff
11: .Nd side-by-side diff
12: .Sh SYNOPSIS
13: .Nm
1.3 tedu 14: .Op Fl abdilstW
1.1 tedu 15: .Op Fl I Ar regexp
16: .Op Fl o Ar outfile
17: .Op Fl w Ar width
18: .Ar file1
19: .Ar file2
20: .Sh DESCRIPTION
1.11 ray 21: .Nm
22: displays two files side by side,
23: with any differences between the two highlighted as follows:
24: new lines are marked with
1.18 ! bentley 25: .Sq > ;
1.11 ray 26: deleted lines are marked with
1.18 ! bentley 27: .Sq < ;
1.11 ray 28: and changed lines are marked with
1.18 ! bentley 29: .Sq | .
1.11 ray 30: .Pp
31: .Nm
32: can also be used to interactively merge two files,
33: prompting at each set of differences.
34: See the
35: .Fl o
36: option for an explanation.
1.1 tedu 37: .Pp
38: The options are:
39: .Bl -tag -width Ds
40: .It Fl l
1.4 jmc 41: Only print the left column for identical lines.
1.1 tedu 42: .It Fl o Ar outfile
1.4 jmc 43: Interactively merge
1.1 tedu 44: .Ar file1
45: and
46: .Ar file2
47: into
48: .Ar outfile .
49: In this mode, the user is prompted for each set of differences.
1.6 jmc 50: See
51: .Ev EDITOR
52: and
53: .Ev VISUAL ,
54: below,
55: for details of which editor, if any, is invoked.
1.1 tedu 56: .Pp
1.4 jmc 57: The commands are as follows:
1.1 tedu 58: .Bl -tag -width Ds
1.14 jmc 59: .It Cm l | 1
1.1 tedu 60: Choose left set of diffs.
1.14 jmc 61: .It Cm r | 2
1.1 tedu 62: Choose right set of diffs.
63: .It Cm s
64: Silent mode \(en identical lines are not printed.
65: .It Cm v
66: Verbose mode \(en identical lines are printed.
67: .It Cm e
68: Start editing an empty file, which will be merged into
69: .Ar outfile
70: upon exiting the editor.
71: .It Cm e Cm l
72: Start editing file with left set of diffs.
73: .It Cm e Cm r
74: Start editing file with right set of diffs.
75: .It Cm e Cm b
76: Start editing file with both sets of diffs.
77: .It Cm q
78: Quit
79: .Nm .
80: .El
81: .It Fl s
82: Skip identical lines.
83: .It Fl w Ar width
84: Print a maximum of
85: .Ar width
86: characters on each line.
87: The default is 130 characters.
88: .El
89: .Pp
90: Options passed to
91: .Xr diff 1
92: are:
93: .Bl -tag -width Ds
94: .It Fl a
95: Treat
96: .Ar file1
97: and
98: .Ar file2
99: as text files.
100: .It Fl b
101: Ignore trailing blank spaces.
102: .It Fl d
103: Minimize diff size.
104: .It Fl I Ar regexp
105: Ignore line changes matching
106: .Ar regexp .
1.7 jmc 107: All lines in the change must match
108: .Ar regexp
109: for the change to be ignored.
1.1 tedu 110: .It Fl i
111: Do a case-insensitive comparison.
112: .It Fl t
113: Expand tabs to spaces.
114: .It Fl W
1.4 jmc 115: Ignore all spaces
116: (the
1.1 tedu 117: .Fl w
118: flag is passed to
1.4 jmc 119: .Xr diff 1 ) .
1.1 tedu 120: .El
1.6 jmc 121: .Sh ENVIRONMENT
122: .Bl -tag -width Ds
123: .It Ev EDITOR , VISUAL
124: Specifies an editor to use with the
125: .Fl o
126: option.
127: If both
128: .Ev EDITOR
129: and
130: .Ev VISUAL
131: are set,
132: .Ev VISUAL
133: takes precedence.
134: If neither
135: .Ev EDITOR
136: nor
137: .Ev VISUAL
138: are set,
139: the default is
140: .Xr vi 1 .
1.8 jmc 141: .It Ev TMPDIR
142: Specifies a directory for temporary files to be created.
143: The default is
144: .Pa /tmp .
1.16 jmc 145: .El
146: .Sh EXIT STATUS
147: The
148: .Nm
149: utility exits with one of the following values:
150: .Pp
151: .Bl -tag -width Ds -offset indent -compact
152: .It 0
153: No differences were found.
154: .It 1
155: Differences were found.
156: .It \*(Gt1
157: An error occurred.
1.6 jmc 158: .El
1.5 jmc 159: .Sh SEE ALSO
1.10 jasper 160: .Xr cmp 1 ,
1.5 jmc 161: .Xr diff 1 ,
1.6 jmc 162: .Xr diff3 1 ,
1.7 jmc 163: .Xr vi 1 ,
164: .Xr re_format 7
1.4 jmc 165: .Sh AUTHORS
166: .Nm
167: was written from scratch for the public domain by
1.17 schwarze 168: .An Ray Lai Aq Mt ray@cyth.net .
1.1 tedu 169: .Sh CAVEATS
170: Although undocumented,
171: .Nm
1.15 jmc 172: supports most long options supported by GNU sdiff,
173: though some require GNU diff.
1.1 tedu 174: .Pp
175: Tabs are treated as anywhere from one to eight characters wide,
176: depending on the current column.
177: Terminals that treat tabs as eight characters wide will look best.
1.9 ray 178: .Sh BUGS
179: .Nm
180: may not work with binary data.