Use stdbool.h

While we are at it, alphabetize (system) headers and clean up a typo.

BUG=chromium-os:21568
TEST=builds clean

Change-Id: Ie93f0c0b86db43cdeb9aa7269e0d2ba42a9a63ae
diff --git a/cyapa_fw_update.c b/cyapa_fw_update.c
index ec4201d..b83c664 100644
--- a/cyapa_fw_update.c
+++ b/cyapa_fw_update.c
@@ -46,21 +46,23 @@
 *       1.0.0   2011/07/26      Initial release of cyapa_fw_update utility tool.
 */
 
-#include <stdio.h>
-#include <string.h>
-#include <errno.h>
-#include <unistd.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <sys/time.h>
-#include <fcntl.h>
-#include <sys/ioctl.h>
-#include <libgen.h>
-#include <stdlib.h>
 #include <ctype.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <getopt.h>
+#include <libgen.h>
 #include <linux/limits.h>
 #include <linux/reboot.h>
+#include <stdbool.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/ioctl.h>
 #include <sys/reboot.h>
+#include <sys/stat.h>
+#include <sys/time.h>
+#include <sys/types.h>
+#include <unistd.h>
 
 #include "cyapa.h"
 
@@ -81,7 +83,7 @@
 #define CYAPA_FW_UPDATE_VER  "1.0.0"
 
 #define DEFAULT_PROGRAM_NAME "cyapa_fw_update"
-#define DEFALUT_FW_BAK_FOLDER "/tmp/cypress"
+#define DEFAULT_FW_BAK_FOLDER "/tmp/cypress"
 #define DEFAULT_FW_BAK_IMAGE_NAME "/tmp/cypress/cyapa_bak_firmware.bin"
 
 #define FILE_TYPE_IIC  0
@@ -99,15 +101,12 @@
 #define CYAPA_IIC_CMD_OP_DELAY  3
 #define CYAPA_IIC_CMD_OP_tries_WRITE  4
 
-#define TRUE  1
-#define FALSE 0
-
 
 struct args {
 	/* the value should be FILE_TYPE_IIC or FILE_TYPE_BIN. */
 	int file_type;
-	int backup_fw;
-	int force;
+	bool backup_fw;
+	bool force;
 
 	char *new_fw_image;
 	char *bak_fw_image;
@@ -247,7 +246,7 @@
 	/* parse options for this program. */
 	for (i = 0; i < argc; i++) {
 		if (!strcmp(argv[i], "-b")) {
-			args->backup_fw = TRUE;
+			args->backup_fw = true;
 		} else if (!strcmp(argv[i], "-o")) {
 			i++;
 			if (argv[i] == NULL) {
@@ -278,7 +277,7 @@
 			ret = 2;
 			goto error;
 		} else if (!strcmp(argv[i], "-f")) {
-			args->force = TRUE;
+			args->force = true;
 		} else {
 			/* parse new firmware file. */
 			if (argv[i] == NULL || access(argv[i], R_OK)) {
@@ -324,7 +323,7 @@
 		}
 
 		strcpy(args->bak_fw_image, DEFAULT_FW_BAK_IMAGE_NAME);
-		mkdir(DEFALUT_FW_BAK_FOLDER, 0777);
+		mkdir(DEFAULT_FW_BAK_FOLDER, 0777);
 		remove(args->bak_fw_image);
 		fd = creat(args->bak_fw_image, O_CREAT |
 			O_TRUNC | S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP);
@@ -1789,7 +1788,7 @@
 				" firmware without firmware backup? <Y/N>: ");
 			while ((input = getchar()) != EOF) {
 				if (toupper(input) == 'Y') {
-					args.backup_fw = FALSE;
+					args.backup_fw = false;
 					prt_info("Continue update trackpad"
 						" firmware ...\n");
 					break;
@@ -1833,7 +1832,7 @@
 			prt_info("Do you want to continue updating, <Y|N>: ");
 			while ((input = getchar()) != EOF) {
 				if (toupper(input) == 'Y') {
-					args.backup_fw = FALSE;
+					args.backup_fw = false;
 					prt_info("Continue update trackpad"
 						" firmware ...\n");
 					break;
@@ -1923,6 +1922,3 @@
 	system_reboot_check(&args, new_protocol, old_protocol);
 	return err_code;
 }
-
-
-