tweak
authorNiklas Cathor <nilclass@riseup.net>
Sun, 28 Jul 2013 20:42:19 +0000 (22:42 +0200)
committerNiklas Cathor <nilclass@riseup.net>
Sun, 28 Jul 2013 20:42:19 +0000 (22:42 +0200)
src/tools/remove-token.c

index 128c917..4143b3f 100644 (file)
  * along with this program. If not, see <http://www.gnu.org/licenses/>.
  */
 
+#define _GNU_SOURCE
+
 #include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
 #include <fcntl.h>
 #include <errno.h>
+#include <string.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <stdint.h>
+#include <db.h>
 
 #include "common/auth.h"
 
@@ -31,9 +36,8 @@ int main(int argc, char **argv) {
   struct rs_authorization auth;
   auth.username = argv[1];
   auth.token = argv[2];
-  auth.scopes = NULL;
   int success = remove_authorization(&auth);
   close_authorizations();
-  fprintf(stderr, (success == 0) ? "Token removed.\n" : "Token not found!\n");
+  fprintf(stderr, (success == DB_NOTFOUND) ? "Token not found!\n" : (success == 0 ? "Token removed.\n" : "Error removing token!\n"));
   return success;
 }