xref: /haiku/src/bin/pkgman/pkgman.h (revision e8cd7007416a323259791ac09c013dcce2956976)
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 
14 extern const char* kProgramName;
15 
16 #define DIE(result, msg...)											\
17 do {																\
18 	fprintf(stderr, "*** " msg);									\
19 	fprintf(stderr, " : %s\n", strerror(result));					\
20 	exit(5);														\
21 } while(0)
22 
23 #define ERROR(result, msg...)										\
24 do {																\
25 	fprintf(stderr, "*** " msg);									\
26 	fprintf(stderr, " : %s\n", strerror(result));					\
27 } while(0)
28 
29 #define WARN(result, msg...)										\
30 do {																\
31 	fprintf(stderr, "* " msg);										\
32 	fprintf(stderr, " : %s\n", strerror(result));					\
33 } while(0)
34 
35 
36 void	print_usage_and_exit(bool error);
37 
38 int		command_add_repo(int argc, const char* const* argv);
39 int		command_drop_repo(int argc, const char* const* argv);
40 int		command_list_repos(int argc, const char* const* argv);
41 int		command_refresh(int argc, const char* const* argv);
42 
43 
44 #endif	// PKGMAN_H
45