1 /* 2 * Copyright 2011, Oliver Tappe <zooey@hirschkaefer.de> 3 * Distributed under the terms of the MIT License. 4 */ 5 #ifndef PKGMAN_H 6 #define PKGMAN_H 7 8 9 #include <stdio.h> 10 #include <stdlib.h> 11 #include <string.h> 12 13 #include <String.h> 14 15 16 extern const char* kProgramName; 17 18 #define DIE(result, msg...) \ 19 do { \ 20 fprintf(stderr, "*** " msg); \ 21 fprintf(stderr, " : %s\n", strerror(result)); \ 22 exit(5); \ 23 } while(0) 24 25 #define ERROR(result, msg...) \ 26 do { \ 27 fprintf(stderr, "*** " msg); \ 28 fprintf(stderr, " : %s\n", strerror(result)); \ 29 } while(0) 30 31 #define WARN(result, msg...) \ 32 do { \ 33 fprintf(stderr, "* " msg); \ 34 fprintf(stderr, " : %s\n", strerror(result)); \ 35 } while(0) 36 37 38 void print_usage_and_exit(bool error); 39 40 41 extern const BString kCommandCategoryPackages; 42 extern const BString kCommandCategoryRepositories; 43 extern const BString kCommandCategoryOther; 44 45 46 #endif // PKGMAN_H 47