about summary refs log tree commit diff
path: root/cli/btcli.c
diff options
context:
space:
mode:
authorMarq Schneider <queueRAM@gmail.com>2010-08-13 10:55:14 -0500
committerMarq Schneider <queueRAM@gmail.com>2010-08-13 10:55:14 -0500
commita6328070d92c75396c941a6962f4553ee7f3f9c1 (patch)
tree4eae52c83f16f9b82632c894a4e4916cc772ba0d /cli/btcli.c
parent9667cf0694245ead296a4d79a1579448a625fd60 (diff)
downloadbtpd-a6328070d92c75396c941a6962f4553ee7f3f9c1.tar.gz
btpd-a6328070d92c75396c941a6962f4553ee7f3f9c1.zip
Added ARRAY_COUNT() macro to get number of elements in const arrays.
Diffstat (limited to 'cli/btcli.c')
-rw-r--r--cli/btcli.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/cli/btcli.c b/cli/btcli.c
index 8d1aada..61eb535 100644
--- a/cli/btcli.c
+++ b/cli/btcli.c
@@ -1,6 +1,7 @@
 #include <stdarg.h>
 
 #include "btcli.h"
+#include "utils.h"
 
 const char *btpd_dir;
 struct ipc *ipc;
@@ -120,8 +121,6 @@ static struct {
     { "stat", cmd_stat, usage_stat }
 };
 
-int ncmds = sizeof(cmd_table) / sizeof(cmd_table[0]);
-
 static void
 usage(void)
 {
@@ -191,7 +190,7 @@ main(int argc, char **argv)
 
     optind = 0;
     int found = 0;
-    for (int i = 0; !found && i < ncmds; i++) {
+    for (int i = 0; !found && i < ARRAY_COUNT(cmd_table); i++) {
         if (strcmp(argv[0], cmd_table[i].name) == 0) {
             found = 1;
             if (help)