Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F154608497
D38280.id116053.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D38280.id116053.diff
View Options
diff --git a/usr.bin/cmp/cmp.c b/usr.bin/cmp/cmp.c
--- a/usr.bin/cmp/cmp.c
+++ b/usr.bin/cmp/cmp.c
@@ -75,6 +75,17 @@
{NULL, no_argument, NULL, 0}
};
+#ifdef SIGINFO
+volatile sig_atomic_t info;
+
+static void
+siginfo(int signo)
+{
+
+ info = signo;
+}
+#endif
+
static void usage(void);
static bool
@@ -240,6 +251,9 @@
}
}
+#ifdef SIGINFO
+ signal(SIGINFO, siginfo);
+#endif
if (special)
c_special(fd1, file1, skip1, fd2, file2, skip2, limit);
else {
@@ -252,6 +266,9 @@
c_regular(fd1, file1, skip1, sb1.st_size,
fd2, file2, skip2, sb2.st_size, limit);
}
+#ifdef SIGINFO
+ signal(SIGINFO, SIG_DFL);
+#endif
exit(0);
}
diff --git a/usr.bin/cmp/extern.h b/usr.bin/cmp/extern.h
--- a/usr.bin/cmp/extern.h
+++ b/usr.bin/cmp/extern.h
@@ -46,3 +46,7 @@
void eofmsg(const char *);
extern bool bflag, lflag, sflag, xflag, zflag;
+
+#ifdef SIGINFO
+extern volatile sig_atomic_t info;
+#endif
diff --git a/usr.bin/cmp/regular.c b/usr.bin/cmp/regular.c
--- a/usr.bin/cmp/regular.c
+++ b/usr.bin/cmp/regular.c
@@ -120,6 +120,13 @@
p2 = m2 + (skip2 - off2);
for (byte = line = 1; length--; ++byte) {
+#ifdef SIGINFO
+ if (info) {
+ (void)printf("%s %s char %zu line %zu\n",
+ file1, file2, (size_t)byte, (size_t)line);
+ info = 0;
+ }
+#endif
if ((ch = *p1) != *p2) {
if (xflag) {
dfound = 1;
diff --git a/usr.bin/cmp/special.c b/usr.bin/cmp/special.c
--- a/usr.bin/cmp/special.c
+++ b/usr.bin/cmp/special.c
@@ -77,6 +77,13 @@
goto eof;
for (byte = line = 1; limit == 0 || byte <= limit; ++byte) {
+#ifdef SIGINFO
+ if (info) {
+ (void)printf("%s %s char %zu line %zu\n",
+ file1, file2, (size_t)byte, (size_t)line);
+ info = 0;
+ }
+#endif
ch1 = getc(fp1);
ch2 = getc(fp2);
if (ch1 == EOF || ch2 == EOF)
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, Apr 30, 1:06 AM (9 h, 40 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
32424064
Default Alt Text
D38280.id116053.diff (1 KB)
Attached To
Mode
D38280: cmp: Print a summary on SIGINFO.
Attached
Detach File
Event Timeline
Log In to Comment