aboutsummaryrefslogtreecommitdiffstats
path: root/src/bin/tycommon.h
blob: 332426b49f02c6bb65a621369577a857e292994c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#ifndef _TY_COMMON_H__
#define _TY_COMMON_H__ 1

Eina_Bool is_running_in_terminology(void);

#define ON_NOT_RUNNING_IN_TERMINOLOGY_EXIT_1()                             \
  do                                                                       \
    {                                                                      \
       if (!is_running_in_terminology())                                   \
         {                                                                 \
            fprintf(stderr, "not running in terminology\n");               \
            exit(1);                                                       \
         }                                                                 \
    }                                                                      \
  while (0)

#define HELP_ARGUMENT_DOC  "  -h or --help Display this help."
#define HELP_ARGUMENT_SHORT "[-h]"

#define ARGUMENT_ENTRY_CHECK(argc, argv, help_func) \
    do \
      { \
         int _i = 0; \
         for(_i = 0; _i < argc; _i++) \
           { \
             if (!strcmp(argv[_i], "--help") || !strcmp(argv[_i],"-h")) \
               { \
                  help_func(argv[0]); \
                  return EXIT_SUCCESS; \
               } \
         } \
      } \
    while(0)

#endif