summaryrefslogtreecommitdiffstats
path: root/flash.h
diff options
context:
space:
mode:
authorCarl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>2012-05-14 22:54:58 +0000
committerCarl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>2012-05-14 22:54:58 +0000
commit901a3ba023fd64e29309637f5ad835218e1bb2ac (patch)
treed0f024b5f8820e6bfdba5d599c607859e2f15a0d /flash.h
parent2cef9164ef1e35e4d1f347ff58722104e8143454 (diff)
downloadflashrom-901a3ba023fd64e29309637f5ad835218e1bb2ac.tar.gz
flashrom-901a3ba023fd64e29309637f5ad835218e1bb2ac.tar.bz2
flashrom-901a3ba023fd64e29309637f5ad835218e1bb2ac.zip
Convert printf to msg_* where appropriate
Clean up cli_output.c to be more readable. Use enum instead of #define for message levels. Kill a few exit(0) calls. Print the command line arguments in verbose mode. Move actions (--list-supported etc.) after argument sanity checks. Reduce the number of code paths which have their own programmer_shutdown(). Corresponding to flashrom svn r1536. Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net> Acked-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Diffstat (limited to 'flash.h')
-rw-r--r--flash.h20
1 files changed, 11 insertions, 9 deletions
diff --git a/flash.h b/flash.h
index 0dac13d73..0c14ce110 100644
--- a/flash.h
+++ b/flash.h
@@ -268,13 +268,15 @@ int write_buf_to_file(unsigned char *buf, unsigned long size, const char *filena
#define ERROR_FLASHROM_LIMIT -201
/* cli_output.c */
+enum msglevel {
+ MSG_ERROR = 0,
+ MSG_INFO = 1,
+ MSG_DEBUG = 2,
+ MSG_DEBUG2 = 3,
+ MSG_SPEW = 4,
+};
/* Let gcc and clang check for correct printf-style format strings. */
-int print(int type, const char *fmt, ...) __attribute__((format(printf, 2, 3)));
-#define MSG_ERROR 0
-#define MSG_INFO 1
-#define MSG_DEBUG 2
-#define MSG_DEBUG2 3
-#define MSG_BARF 4
+int print(enum msglevel level, const char *fmt, ...) __attribute__((format(printf, 2, 3)));
#define msg_gerr(...) print(MSG_ERROR, __VA_ARGS__) /* general errors */
#define msg_perr(...) print(MSG_ERROR, __VA_ARGS__) /* programmer errors */
#define msg_cerr(...) print(MSG_ERROR, __VA_ARGS__) /* chip errors */
@@ -287,9 +289,9 @@ int print(int type, const char *fmt, ...) __attribute__((format(printf, 2, 3)));
#define msg_gdbg2(...) print(MSG_DEBUG2, __VA_ARGS__) /* general debug2 */
#define msg_pdbg2(...) print(MSG_DEBUG2, __VA_ARGS__) /* programmer debug2 */
#define msg_cdbg2(...) print(MSG_DEBUG2, __VA_ARGS__) /* chip debug2 */
-#define msg_gspew(...) print(MSG_BARF, __VA_ARGS__) /* general debug barf */
-#define msg_pspew(...) print(MSG_BARF, __VA_ARGS__) /* programmer debug barf */
-#define msg_cspew(...) print(MSG_BARF, __VA_ARGS__) /* chip debug barf */
+#define msg_gspew(...) print(MSG_SPEW, __VA_ARGS__) /* general debug spew */
+#define msg_pspew(...) print(MSG_SPEW, __VA_ARGS__) /* programmer debug spew */
+#define msg_cspew(...) print(MSG_SPEW, __VA_ARGS__) /* chip debug spew */
/* layout.c */
int register_include_arg(char *name);