summaryrefslogtreecommitdiff
path: root/mtd_debug.c
diff options
context:
space:
mode:
authorBrian Norris <computersforpeace@gmail.com>2011-08-19 10:07:48 -0700
committerArtem Bityutskiy <artem.bityutskiy@intel.com>2011-08-23 09:27:48 +0300
commitf5518639f329bbb88ace9b301bd77d22d2c179c5 (patch)
tree748a83e9b093640aceb580fe06ba6bac23a2a1b2 /mtd_debug.c
parent307ac3d60cb168af8531f6eba75950d4c96b7ffe (diff)
mtd_debug: replace #defines with enum
enum provides a cleaner mechanism that creating single-purpose `#define`s. Signed-off-by: Brian Norris <computersforpeace@gmail.com> Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
Diffstat (limited to 'mtd_debug.c')
-rw-r--r--mtd_debug.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/mtd_debug.c b/mtd_debug.c
index a348a4c..b98de50 100644
--- a/mtd_debug.c
+++ b/mtd_debug.c
@@ -342,16 +342,18 @@ void showusage(void)
exit(EXIT_FAILURE);
}
-#define OPT_INFO 1
-#define OPT_READ 2
-#define OPT_WRITE 3
-#define OPT_ERASE 4
-
int main(int argc, char *argv[])
{
- int err = 0, fd, option = OPT_INFO;
+ int err = 0, fd;
int open_flag;
+ enum {
+ OPT_INFO,
+ OPT_READ,
+ OPT_WRITE,
+ OPT_ERASE
+ } option = OPT_INFO;
+
/* parse command-line options */
if (argc == 3 && !strcmp(argv[1], "info"))
option = OPT_INFO;