Linux bluetooth development
 help / color / mirror / Atom feed
From: "Gustavo F. Padovan" <gustavo@las.ic.unicamp.br>
To: linux-bluetooth@vger.kernel.org
Subject: [PATCH 3/6] Change fprintf(stderr,...) to perror()
Date: Sun, 15 Feb 2009 16:47:23 -0300	[thread overview]
Message-ID: <1234727246-21064-3-git-send-email-gustavo@las.ic.unicamp.br> (raw)
In-Reply-To: <1234727246-21064-2-git-send-email-gustavo@las.ic.unicamp.br>

Clean up code. Now hcitool use only perror to show errors messages
without  parameters.
---
 tools/hcitool.c |   38 +++++++++++++++++++-------------------
 1 files changed, 19 insertions(+), 19 deletions(-)

diff --git a/tools/hcitool.c b/tools/hcitool.c
index 4793c46..9687ab2 100644
--- a/tools/hcitool.c
+++ b/tools/hcitool.c
@@ -797,7 +797,7 @@ static void cmd_name(int dev_id, int argc, char **argv)
 	if (dev_id < 0) {
 		dev_id = hci_get_route(&bdaddr);
 		if (dev_id < 0) {
-			fprintf(stderr, "Device is not available.\n");
+			perror("Device is not available.");
 			exit(1);
 		}
 	}
@@ -860,7 +860,7 @@ static void cmd_info(int dev_id, int argc, char **argv)
 		dev_id = hci_get_route(&bdaddr);
 
 	if (dev_id < 0) {
-		fprintf(stderr, "Device is not available or not connected.\n");
+		perror("Device is not available or not connected.");
 		exit(1);
 	}
 
@@ -1231,7 +1231,7 @@ static void cmd_cc(int dev_id, int argc, char **argv)
 	if (dev_id < 0) {
 		dev_id = hci_get_route(&bdaddr);
 		if (dev_id < 0) {
-			fprintf(stderr, "Device is not available.\n");
+			perror("Device is not available.");
 			exit(1);
 		}
 	}
@@ -1288,7 +1288,7 @@ static void cmd_dc(int dev_id, int argc, char **argv)
 	if (dev_id < 0) {
 		dev_id = hci_for_each_dev(HCI_UP, find_conn, (long) &bdaddr);
 		if (dev_id < 0) {
-			fprintf(stderr, "Not connected.\n");
+			perror("Not connected.");
 			exit(1);
 		}
 	}
@@ -1369,7 +1369,7 @@ static void cmd_sr(int dev_id, int argc, char **argv)
 	if (dev_id < 0) {
 		dev_id = hci_for_each_dev(HCI_UP, find_conn, (long) &bdaddr);
 		if (dev_id < 0) {
-			fprintf(stderr, "Not connected.\n");
+			perror("Not connected.");
 			exit(1);
 		}
 	}
@@ -1426,7 +1426,7 @@ static void cmd_rssi(int dev_id, int argc, char **argv)
 	if (dev_id < 0) {
 		dev_id = hci_for_each_dev(HCI_UP, find_conn, (long) &bdaddr);
 		if (dev_id < 0) {
-			fprintf(stderr, "Not connected.\n");
+			perror("Not connected.");
 			exit(1);
 		}
 	}
@@ -1500,7 +1500,7 @@ static void cmd_lq(int dev_id, int argc, char **argv)
 	if (dev_id < 0) {
 		dev_id = hci_for_each_dev(HCI_UP, find_conn, (long) &bdaddr);
 		if (dev_id < 0) {
-			fprintf(stderr, "Not connected.\n");
+			perror("Not connected.");
 			exit(1);
 		}
 	}
@@ -1576,7 +1576,7 @@ static void cmd_tpl(int dev_id, int argc, char **argv)
 	if (dev_id < 0) {
 		dev_id = hci_for_each_dev(HCI_UP, find_conn, (long) &bdaddr);
 		if (dev_id < 0) {
-			fprintf(stderr, "Not connected.\n");
+			perror("Not connected.");
 			exit(1);
 		}
 	}
@@ -1652,7 +1652,7 @@ static void cmd_afh(int dev_id, int argc, char **argv)
 	if (dev_id < 0) {
 		dev_id = hci_for_each_dev(HCI_UP, find_conn, (long) &bdaddr);
 		if (dev_id < 0) {
-			fprintf(stderr, "Not connected.\n");
+			perror("Not connected.");
 			exit(1);
 		}
 	}
@@ -1739,7 +1739,7 @@ static void cmd_cpt(int dev_id, int argc, char **argv)
 	if (dev_id < 0) {
 		dev_id = hci_for_each_dev(HCI_UP, find_conn, (long) &bdaddr);
 		if (dev_id < 0) {
-			fprintf(stderr, "Not connected.\n");
+			perror("Not connected.");
 			exit(1);
 		}
 	}
@@ -1823,7 +1823,7 @@ static void cmd_lp(int dev_id, int argc, char **argv)
 	if (dev_id < 0) {
 		dev_id = hci_for_each_dev(HCI_UP, find_conn, (long) &bdaddr);
 		if (dev_id < 0) {
-			fprintf(stderr, "Not connected.\n");
+			perror("Not connected.");
 			exit(1);
 		}
 	}
@@ -1861,13 +1861,13 @@ static void cmd_lp(int dev_id, int argc, char **argv)
 			printf("Link policy settings: %s\n", str);
 			bt_free(str);
 		} else {
-			fprintf(stderr, "Can't allocate memory\n");
+			perror("Can't allocate memory");
 			exit(1);
 		}
 	} else {
 		unsigned int val;
 		if (hci_strtolp(argv[1], &val) < 0) {
-			fprintf(stderr, "Invalig arguments\n");
+			perror("Invalig arguments");
 			exit(1);
 		}
 		policy = val;
@@ -1922,7 +1922,7 @@ static void cmd_lst(int dev_id, int argc, char **argv)
 	if (dev_id < 0) {
 		dev_id = hci_for_each_dev(HCI_UP, find_conn, (long) &bdaddr);
 		if (dev_id < 0) {
-			fprintf(stderr, "Not connected.\n");
+			perror("Not connected.");
 			exit(1);
 		}
 	}
@@ -2012,7 +2012,7 @@ static void cmd_auth(int dev_id, int argc, char **argv)
 	if (dev_id < 0) {
 		dev_id = hci_for_each_dev(HCI_UP, find_conn, (long) &bdaddr);
 		if (dev_id < 0) {
-			fprintf(stderr, "Not connected.\n");
+			perror("Not connected.");
 			exit(1);
 		}
 	}
@@ -2084,7 +2084,7 @@ static void cmd_enc(int dev_id, int argc, char **argv)
 	if (dev_id < 0) {
 		dev_id = hci_for_each_dev(HCI_UP, find_conn, (long) &bdaddr);
 		if (dev_id < 0) {
-			fprintf(stderr, "Not connected.\n");
+			perror("Not connected.");
 			exit(1);
 		}
 	}
@@ -2157,7 +2157,7 @@ static void cmd_key(int dev_id, int argc, char **argv)
 	if (dev_id < 0) {
 		dev_id = hci_for_each_dev(HCI_UP, find_conn, (long) &bdaddr);
 		if (dev_id < 0) {
-			fprintf(stderr, "Not connected.\n");
+			perror("Not connected.");
 			exit(1);
 		}
 	}
@@ -2229,7 +2229,7 @@ static void cmd_clkoff(int dev_id, int argc, char **argv)
 	if (dev_id < 0) {
 		dev_id = hci_for_each_dev(HCI_UP, find_conn, (long) &bdaddr);
 		if (dev_id < 0) {
-			fprintf(stderr, "Not connected.\n");
+			perror( "Not connected.");
 			exit(1);
 		}
 	}
@@ -2306,7 +2306,7 @@ static void cmd_clock(int dev_id, int argc, char **argv)
 	if (dev_id < 0) {
 		dev_id = hci_for_each_dev(HCI_UP, find_conn, (long) &bdaddr);
 		if (dev_id < 0) {
-			fprintf(stderr, "Not connected.\n");
+			perror("Not connected.");
 			exit(1);
 		}
 	}
-- 
1.6.0.6


  reply	other threads:[~2009-02-15 19:47 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-02-15 19:47 [PATCH 1/6] Fix more memory leaks in hcitool Gustavo F. Padovan
2009-02-15 19:47 ` [PATCH 2/6] hcitool: fix error message Gustavo F. Padovan
2009-02-15 19:47   ` Gustavo F. Padovan [this message]
2009-02-15 19:47     ` [PATCH 4/6] remove verification before free Gustavo F. Padovan
2009-02-15 19:47       ` [PATCH 5/6] Remove unnecessary attribution Gustavo F. Padovan
2009-02-15 19:47         ` [PATCH 6/6] Make expand_name a void function Gustavo F. Padovan
2009-02-16 12:21     ` [PATCH 3/6] Change fprintf(stderr,...) to perror() David Vrabel
2009-02-16 12:37       ` Gustavo F. Padovan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1234727246-21064-3-git-send-email-gustavo@las.ic.unicamp.br \
    --to=gustavo@las.ic.unicamp.br \
    --cc=linux-bluetooth@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox