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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
|
#ifndef MAIN_MESMS_H
#define MAIN_MESMS_H
#ifndef _DEFAULT_SOURCE
#define _DEFAULT_SOURCE
#endif
#ifndef _XOPEN_SOURCE
#define _XOPEN_SOURCE 700 // For strnlen()
#endif
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <ncurses.h>
#include <getopt.h>
#include "contactList.h"
#include "wind.h"
#include "sms.h"
#include "config.h"
#define HIDDEN 1
void resize(void);
void fail_exit(const char *msg);
// Checks errors for (most) ncurses functions. CHECK(fn, x, y, z) is a checked
// version of fn(x, y, z).
#define CHECK(fn, ...) \
do \
if (fn(__VA_ARGS__) == ERR) \
fail_exit(#fn"() failed"); \
while (false)
#define max(a, b) \
({ typeof(a) _a = a; \
typeof(b) _b = b; \
_a > _b ? _a : _b; })
#define VERSION_MESMS "Beta"
#define HELP_STRING_MESMS "Usage : mesms [OPTION]..." "\n"\
"SMS Manager" "\n"\
"Options :" "\n"\
"\t\t--help -h Show this help mesage\n"\
"\t\t--version -v Print the version \n"\
"\t\t[--contact NUMBER_OR_NAME] [-c NUMBER_OR_NAME] Retrive a contact \n"\
"\n" "\n"\
"Examples :" "\n"\
" $ mesms -c +5555 will retrive the name of the contact with number +5555 \n"\
" Alexis " "\n"\
" $ mesms -c Alexis will do the contrary" "\n"\
" +5555" "\n"\
"\n" "\n"\
" $ mesms will launch the main program" "\n"\
"\n" "\n"\
"Note : type 'h' in the main program to get help" "\n"\
""
#define RUNTIME_HELP_STRING \
" Will in the main program, you can manage contact, display SMS and send SMS. \n"\
" Just type the letter associated with the action." "\n"\
"" "\n"\
" 'a' to Add a contact, you will be asked for some information" "\n"\
"" "\n"\
" 'd' to Delete a contact, you will be asked for confirmation" "\n"\
"" "\n"\
" 'q' to exit the program" "\n"\
"" "\n"\
" '/' to search for a contact, you will be asked for a name" "\n"\
"" "\n"\
" 'n' to toogle display number option" "\n"\
"" "\n"\
" 'jk' Vim's equivalent of arrow keys, to select a contact" "\n"\
" When a conversation is selected, navigate througth the SMS" "\n"\
"" "\n"\
" 'e' to Edit a contact" "\n"\
"" "\n"\
" '\t' Tab key, toogle selection of a the conversion (SMSs)" "\n"\
" with the highlighted contact" "\n"\
"" "\n"\
" 's' to send a SMS to the highlighted contact, you will be asked" "\n"\
" for confirmation." "\n"\
"" "\n"\
" 'i' to send a SMS. Identical to 's' but a Vim shortcut" "\n"\
""
#endif
|