Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F98910663
D28072.id82048.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
D28072.id82048.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
@@ -60,7 +60,7 @@
#include "extern.h"
-int lflag, sflag, xflag, zflag;
+bool lflag, sflag, xflag, zflag;
static const struct option long_opts[] =
{
@@ -77,7 +77,8 @@
{
struct stat sb1, sb2;
off_t skip1, skip2;
- int ch, fd1, fd2, oflag, special;
+ int ch, fd1, fd2, oflag;
+ bool special;
const char *file1, *file2;
oflag = O_RDONLY;
@@ -87,18 +88,18 @@
oflag |= O_NOFOLLOW;
break;
case 'l': /* print all differences */
- lflag = 1;
+ lflag = true;
break;
case 's': /* silent run */
- sflag = 1;
- zflag = 1;
+ sflag = true;
+ zflag = true;
break;
case 'x': /* hex output */
- lflag = 1;
- xflag = 1;
+ lflag = true;
+ xflag = true;
break;
case 'z': /* compare size first */
- zflag = 1;
+ zflag = true;
break;
case '?':
default:
@@ -120,9 +121,9 @@
err(ERR_EXIT, "unable to limit rights on stderr");
/* Backward compatibility -- handle "-" meaning stdin. */
- special = 0;
+ special = false;
if (strcmp(file1 = argv[0], "-") == 0) {
- special = 1;
+ special = true;
fd1 = STDIN_FILENO;
file1 = "stdin";
} else if ((fd1 = open(file1, oflag, 0)) < 0 && errno != EMLINK) {
@@ -135,7 +136,7 @@
if (special)
errx(ERR_EXIT,
"standard input may only be specified once");
- special = 1;
+ special = true;
fd2 = STDIN_FILENO;
file2 = "stdin";
} else if ((fd2 = open(file2, oflag, 0)) < 0 && errno != EMLINK) {
@@ -174,7 +175,7 @@
exit(ERR_EXIT);
}
if (!S_ISREG(sb1.st_mode))
- special = 1;
+ special = true;
else {
if (fstat(fd2, &sb2)) {
if (!sflag)
@@ -183,7 +184,7 @@
exit(ERR_EXIT);
}
if (!S_ISREG(sb2.st_mode))
- special = 1;
+ special = true;
}
}
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
@@ -44,4 +44,4 @@
void diffmsg(const char *, const char *, off_t, off_t);
void eofmsg(const char *);
-extern int lflag, sflag, xflag, zflag;
+extern bool lflag, sflag, xflag, zflag;
diff --git a/usr.bin/cmp/link.c b/usr.bin/cmp/link.c
--- a/usr.bin/cmp/link.c
+++ b/usr.bin/cmp/link.c
@@ -32,6 +32,7 @@
#include <sys/types.h>
#include <err.h>
#include <limits.h>
+#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
diff --git a/usr.bin/cmp/misc.c b/usr.bin/cmp/misc.c
--- a/usr.bin/cmp/misc.c
+++ b/usr.bin/cmp/misc.c
@@ -41,6 +41,7 @@
#include <sys/types.h>
#include <err.h>
+#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Oct 6, 6:41 AM (21 h, 22 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
13707570
Default Alt Text
D28072.id82048.diff (2 KB)
Attached To
Mode
D28072: cmp: use C99 bool
Attached
Detach File
Event Timeline
Log In to Comment