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 16extern const char* kProgramName; 17 18#define DIE(result, msg...) \ 19do { \ 20 fprintf(stderr, "*** " msg); \ 21 fprintf(stderr, " : %s\n", strerror(result)); \ 22 exit(5); \ 23} while(0) 24 25#define ERROR(result, msg...) \ 26do { \ 27 fprintf(stderr, "*** " msg); \ 28 fprintf(stderr, " : %s\n", strerror(result)); \ 29} while(0) 30 31#define WARN(result, msg...) \ 32do { \ 33 fprintf(stderr, "* " msg); \ 34 fprintf(stderr, " : %s\n", strerror(result)); \ 35} while(0) 36 37 38void print_usage_and_exit(bool error); 39 40 41#define COMMAND_CATEGORY_PACKAGES "packages" 42#define COMMAND_CATEGORY_REPOSITORIES "repositories" 43#define COMMAND_CATEGORY_OTHER "other" 44 45 46#endif // PKGMAN_H 47