Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F152851832
D55608.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
3 KB
Referenced Files
None
Subscribers
None
D55608.diff
View Options
diff --git a/usr.bin/diff3/diff3.1 b/usr.bin/diff3/diff3.1
--- a/usr.bin/diff3/diff3.1
+++ b/usr.bin/diff3/diff3.1
@@ -27,7 +27,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.Dd June 23, 2022
+.Dd March 1, 2026
.Dt DIFF3 1
.Os
.Sh NAME
@@ -196,6 +196,21 @@
different in file
.Va n .
.El
+.Sh EXIT STATUS
+The
+.Nm
+utility exits with a status of 0 on success
+and >1 if an error occurred.
+Additionally, if the
+.Fl A ,
+.Fl E ,
+.Fl L ,
+.Fl m ,
+or
+.Fl X
+flags were specified,
+it exits with a status of 1 if conflicts were found.
+.El
.Sh SEE ALSO
.Xr diff 1 ,
.Xr ed 1 ,
diff --git a/usr.bin/diff3/diff3.c b/usr.bin/diff3/diff3.c
--- a/usr.bin/diff3/diff3.c
+++ b/usr.bin/diff3/diff3.c
@@ -202,7 +202,7 @@
if ((end != NULL && *end == str) ||
num < 0 || num > INT_MAX ||
errno == EINVAL || errno == ERANGE)
- err(1, "error in diff output");
+ err(2, "error in diff output");
return (int)num;
}
@@ -267,7 +267,7 @@
if (*p == ',')
d = strtoi(p + 1, &p);
if (*p != '\n')
- errx(1, "error in diff output");
+ errx(2, "error in diff output");
if (kind == 'a')
a++;
else if (kind == 'c')
@@ -275,11 +275,11 @@
else if (kind == 'd')
c++;
else
- errx(1, "error in diff output");
+ errx(2, "error in diff output");
b++;
d++;
if (b < a || d < c)
- errx(1, "error in diff output");
+ errx(2, "error in diff output");
(*dd)[i].old.from = a;
(*dd)[i].old.to = b;
(*dd)[i].new.from = c;
@@ -287,7 +287,7 @@
if (i > 0) {
if ((*dd)[i].old.from < (*dd)[i - 1].old.to ||
(*dd)[i].new.from < (*dd)[i - 1].new.to)
- errx(1, "diff output out of order");
+ errx(2, "diff output out of order");
}
}
if (i > 0) {
@@ -564,7 +564,7 @@
for (n = 0; cline[i] < from - 1; n += j) {
if ((line = get_line(fp[i], &j)) == NULL)
- errx(1, "logic error");
+ errx(2, "logic error");
if (pr != NULL)
printf("%s%s", Tflag == 1 ? "\t" : pr, line);
cline[i]++;
@@ -595,7 +595,7 @@
if (c == -1 && d == -1)
break;
if (c == -1 || d == -1)
- errx(1, "logic error");
+ errx(2, "logic error");
nchar++;
if (c != d) {
repos(nchar);
@@ -652,7 +652,7 @@
return;
if (r->from > r->to)
- errx(1, "invalid print range");
+ errx(2, "invalid print range");
/*
* XXX-THJ: We read through all of the file for each range printed.
@@ -900,27 +900,27 @@
p = reallocarray(d13, newsz, sizeof(*p));
if (p == NULL)
- err(1, NULL);
+ err(2, NULL);
memset(p + szchanges, 0, incr * sizeof(*p));
d13 = p;
p = reallocarray(d23, newsz, sizeof(*p));
if (p == NULL)
- err(1, NULL);
+ err(2, NULL);
memset(p + szchanges, 0, incr * sizeof(*p));
d23 = p;
p = reallocarray(de, newsz, sizeof(*p));
if (p == NULL)
- err(1, NULL);
+ err(2, NULL);
memset(p + szchanges, 0, incr * sizeof(*p));
de = p;
q = reallocarray(overlap, newsz, 1);
if (q == NULL)
- err(1, NULL);
+ err(2, NULL);
memset(q + szchanges, 0, incr * 1);
overlap = q;
s = reallocarray(de_delta, newsz, sizeof(*s));
if (s == NULL)
- err(1, NULL);
+ err(2, NULL);
memset(s + szchanges, 0, incr * sizeof(*s));
de_delta = s;
szchanges = newsz;
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Apr 18, 12:33 PM (9 h, 20 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
31719550
Default Alt Text
D55608.diff (3 KB)
Attached To
Mode
D55608: diff3: Produce correct exit status
Attached
Detach File
Event Timeline
Log In to Comment