Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 18 Aug 2018 20:23:53 +0000 (UTC)
From:      John Baldwin <jhb@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r338021 - head/usr.bin/kdump
Message-ID:  <201808182023.w7IKNrei095984@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: jhb
Date: Sat Aug 18 20:23:53 2018
New Revision: 338021
URL: https://svnweb.freebsd.org/changeset/base/338021

Log:
  Use 'bool' instead of 'int' for various boolean flags.
  
  Reviewed by:	kib
  MFC after:	2 weeks
  Differential Revision:	https://reviews.freebsd.org/D16611

Modified:
  head/usr.bin/kdump/kdump.c

Modified: head/usr.bin/kdump/kdump.c
==============================================================================
--- head/usr.bin/kdump/kdump.c	Sat Aug 18 19:45:56 2018	(r338020)
+++ head/usr.bin/kdump/kdump.c	Sat Aug 18 20:23:53 2018	(r338021)
@@ -125,8 +125,9 @@ void usage(void);
 #define	TIMESTAMP_ELAPSED	0x2
 #define	TIMESTAMP_RELATIVE	0x4
 
-static int timestamp, decimal, fancy = 1, suppressdata, tail, threads, maxdata,
-    resolv = 0, abiflag = 0, syscallno = 0;
+static bool abiflag, decimal, fancy = true, resolv, suppressdata, syscallno,
+    tail, threads;
+static int timestamp, maxdata;
 static const char *tracefile = DEF_TRACEFILE;
 static struct ktr_header ktr_header;
 
@@ -363,40 +364,40 @@ main(int argc, char *argv[])
 	while ((ch = getopt(argc,argv,"f:dElm:np:AHRrSsTt:")) != -1)
 		switch (ch) {
 		case 'A':
-			abiflag = 1;
+			abiflag = true;
 			break;
 		case 'f':
 			tracefile = optarg;
 			break;
 		case 'd':
-			decimal = 1;
+			decimal = true;
 			break;
 		case 'l':
-			tail = 1;
+			tail = true;
 			break;
 		case 'm':
 			maxdata = atoi(optarg);
 			break;
 		case 'n':
-			fancy = 0;
+			fancy = false;
 			break;
 		case 'p':
 			pid = atoi(optarg);
 			break;
 		case 'r':
-			resolv = 1;
+			resolv = true;
 			break;
 		case 'S':
-			syscallno = 1;
+			syscallno = true;
 			break;
 		case 's':
-			suppressdata = 1;
+			suppressdata = true;
 			break;
 		case 'E':
 			timestamp |= TIMESTAMP_ELAPSED;
 			break;
 		case 'H':
-			threads = 1;
+			threads = true;
 			break;
 		case 'R':
 			timestamp |= TIMESTAMP_RELATIVE;
@@ -427,18 +428,18 @@ main(int argc, char *argv[])
 	caph_cache_tzdata();
 
 #ifdef WITH_CASPER
-	if (resolv != 0) {
+	if (resolv) {
 		if (cappwdgrp_setup(&cappwd, &capgrp) < 0) {
 			cappwd = NULL;
 			capgrp = NULL;
 		}
 	}
-	if (resolv == 0 || (cappwd != NULL && capgrp != NULL)) {
+	if (!resolv || (cappwd != NULL && capgrp != NULL)) {
 		if (caph_enter() < 0)
 			err(1, "unable to enter capability mode");
 	}
 #else
-	if (resolv == 0) {
+	if (!resolv) {
 		if (caph_enter() < 0)
 			err(1, "unable to enter capability mode");
 	}
@@ -1835,14 +1836,14 @@ ktrstat(struct stat *statp)
 	printf("struct stat {");
 	printf("dev=%ju, ino=%ju, ",
 		(uintmax_t)statp->st_dev, (uintmax_t)statp->st_ino);
-	if (resolv == 0)
+	if (!resolv)
 		printf("mode=0%jo, ", (uintmax_t)statp->st_mode);
 	else {
 		strmode(statp->st_mode, mode);
 		printf("mode=%s, ", mode);
 	}
 	printf("nlink=%ju, ", (uintmax_t)statp->st_nlink);
-	if (resolv == 0) {
+	if (!resolv) {
 		pwd = NULL;
 	} else {
 #ifdef WITH_CASPER
@@ -1856,7 +1857,7 @@ ktrstat(struct stat *statp)
 		printf("uid=%ju, ", (uintmax_t)statp->st_uid);
 	else
 		printf("uid=\"%s\", ", pwd->pw_name);
-	if (resolv == 0) {
+	if (!resolv) {
 		grp = NULL;
 	} else {
 #ifdef WITH_CASPER
@@ -1872,7 +1873,7 @@ ktrstat(struct stat *statp)
 		printf("gid=\"%s\", ", grp->gr_name);
 	printf("rdev=%ju, ", (uintmax_t)statp->st_rdev);
 	printf("atime=");
-	if (resolv == 0)
+	if (!resolv)
 		printf("%jd", (intmax_t)statp->st_atim.tv_sec);
 	else {
 		tm = localtime(&statp->st_atim.tv_sec);
@@ -1884,7 +1885,7 @@ ktrstat(struct stat *statp)
 	else
 		printf(", ");
 	printf("mtime=");
-	if (resolv == 0)
+	if (!resolv)
 		printf("%jd", (intmax_t)statp->st_mtim.tv_sec);
 	else {
 		tm = localtime(&statp->st_mtim.tv_sec);
@@ -1896,7 +1897,7 @@ ktrstat(struct stat *statp)
 	else
 		printf(", ");
 	printf("ctime=");
-	if (resolv == 0)
+	if (!resolv)
 		printf("%jd", (intmax_t)statp->st_ctim.tv_sec);
 	else {
 		tm = localtime(&statp->st_ctim.tv_sec);
@@ -1908,7 +1909,7 @@ ktrstat(struct stat *statp)
 	else
 		printf(", ");
 	printf("birthtime=");
-	if (resolv == 0)
+	if (!resolv)
 		printf("%jd", (intmax_t)statp->st_birthtim.tv_sec);
 	else {
 		tm = localtime(&statp->st_birthtim.tv_sec);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201808182023.w7IKNrei095984>