build system: Don't use ${#var} etc.
[cmus.git] / prog.h
blob111885458b41280c98f2ebfc6e6d26deb41c44c1
1 /*
2 * Copyright 2005 Timo Hirvonen
3 */
5 #ifndef PROG_H
6 #define PROG_H
8 #include <compiler.h>
10 /* set in beginning of main */
11 extern char *program_name;
13 struct option {
14 /* short option or 0 */
15 int short_opt;
17 /* long option or NULL */
18 const char *long_opt;
20 /* does option have an argument */
21 int has_arg;
25 * arg: returned argument if .has_arg is 1
27 * returns: index to options array or -1 of no more options
29 int get_option(char **argv[], const struct option *options, char **arg);
31 void warn(const char *format, ...) __FORMAT(1, 2);
32 void warn_errno(const char *format, ...) __FORMAT(1, 2);
33 void die(const char *format, ...) __FORMAT(1, 2) __NORETURN;
34 void die_errno(const char *format, ...) __FORMAT(1, 2) __NORETURN;
36 #endif