tdb: remove unused last_ptr
[ccan] / ccan / tdb / _info
index 75f20b455c1a414f18622e17648a57301e1630c6..53ac6059c0bffe7c0a3a207bb6fe7202c6e5db1f 100644 (file)
@@ -1,4 +1,5 @@
 #include <string.h>
+#include <stdio.h>
 
 /**
  * tdb - The trivial (transactional) database
  *     #include <err.h>
  *     #include <stdio.h>
  *     
- *     static void usage(void)
+ *     static void usage(const char *argv0)
  *     {
  *             errx(1, "Usage: %s fetch <dbfile> <key>\n"
- *                  "OR %s store <dbfile> <key> <data>");
+ *                  "OR %s store <dbfile> <key> <data>", argv0, argv0);
  *     }
  *     
  *     int main(int argc, char *argv[])
@@ -25,7 +26,7 @@
  *             TDB_DATA key, value;
  *     
  *             if (argc < 4)
- *                     usage();
+ *                     usage(argv[0]);
  *     
  *             tdb = tdb_open(argv[2], 1024, TDB_DEFAULT, O_CREAT|O_RDWR,
  *                             0600);
@@ -37,7 +38,7 @@
  *     
  *             if (streq(argv[1], "fetch")) {
  *                     if (argc != 4)
- *                             usage();
+ *                             usage(argv[0]);
  *                     value = tdb_fetch(tdb, key);
  *                     if (!value.dptr)
  *                             errx(1, "fetch %s: %s",
  *                     free(value.dptr);
  *             } else if (streq(argv[1], "store")) {
  *                     if (argc != 5)
- *                             usage();
+ *                             usage(argv[0]);
  *                     value.dptr = (void *)argv[4];
  *                     value.dsize = strlen(argv[4]);
  *                     if (tdb_store(tdb, key, value, 0) != 0)
  *                             errx(1, "store %s: %s",
  *                                  argv[3], tdb_errorstr(tdb));
  *             } else
- *                     usage();
+ *                     usage(argv[0]);
  *     
  *             return 0;
  *     }
  *
  * Author: Andrew Tridgell, Jeremy Allison, Rusty Russell
  *
- * Licence: LGPLv3 (or later)
+ * License: LGPLv3 (or later)
+ *
+ * Ccanlint:
+ *     // valgrind breaks fcntl locks.
+ *     tests_pass_valgrind FAIL
  */
 int main(int argc, char *argv[])
 {
        if (argc != 2)
                return 1;
 
-       if (strcmp(argv[1], "depends") == 0)
+       if (strcmp(argv[1], "depends") == 0) {
+               printf("ccan/compiler\n");
                return 0;
+       }
 
        return 1;
 }