2
3
4
5
6
7
8
11
12
13
14
15
16
17
18
19
20
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
62 Init *init = calloc(1,
sizeof(Init));
63 if (init ==
nullptr) {
68 if (init
->argv ==
nullptr) {
78 for (i = 0; i < init
->argc; i++)
82 init
->sio = (SIO *)calloc(1,
sizeof(SIO));
91
92
93
94
115 if (init
->argv !=
nullptr)
117 if (init !=
nullptr) {
125
126
127
128
129
130
131
132
133
134Menu *
new_menu(Init *init,
int argc,
char **argv, uint begy, uint begx) {
135 init
->menu = (Menu *)calloc(1,
sizeof(Menu));
143 abend(-1
, "init_menu_files failed");
151
152
153
154
177
178
179
180
181
182
183
184
185
186Pick *
new_pick(Init *init,
int argc,
char **argv, uint begy, uint begx) {
187 init
->pick = (Pick *)calloc(1,
sizeof(Pick));
195 abend(-1
, "init_pick_files failed");
202 "calloc pick->m_object = calloc(%d, %d) failed\n",
205 abend(-1
, "User terminated program");
211 "calloc pick->d_object = calloc(%d, %d) failed\n",
214 abend(-1
, "User terminated program");
221
222
223
224
243
244
245
246
247
248
249
250
251
252Form *
new_form(Init *init,
int argc,
char **argv, uint begy, uint begx) {
253 init
->form = (Form *)calloc(1,
sizeof(Form));
261 abend(-1
, "init_form_files failed");
271
272
273
274
296
297
298
301 init
->view = (View *)calloc(1,
sizeof(View));
305 __LINE__ - 1
, errno
);
310 abend(-1
, "calloc init->view failed");
320 __LINE__ - 1
, errno
);
325 abend(-1
, "User terminated program");
335 abend(-1
, "init_view_files failed");
341
342
343
344
358
359
360
361
362
363
364
365
366
367
368
389 s1 = strtok(try_spec,
" \t\n");
392 s2 = strtok(
nullptr,
"\n");
402 if (try_spec[0] ==
'/') {
413 if (!f_dir && dir[0]) {
414 if (strcmp(dir,
"$PATH") == 0) {
433 if (!f_spec && alt_dir && alt_dir[0] !=
'\0') {
434 if (strcmp(alt_dir,
"$PATH") == 0) {
457 if (!f_spec && mode == W_OK) {
459 FILE *fp = fopen(try_spec,
"a");
470 if (try_spec[0] ==
'\0' && idio_spec[0] !=
'\0')
474 if (s2_s[0] !=
'\0') {
484
485
486
487
488
489
490
497 "~/menuapp/msrc", R_OK
);
504 "~/menuapp/help", R_OK
);
521 nullptr, nullptr, R_OK
);
531
532
533
534
535
536
537
538
552 if (init
->cmd[0] !=
'\0') {
565 "~/menuapp/help", R_OK
);
569 "~/menuapp/data", R_OK
);
581 if (argv[optind][0] !=
'\0') {
594 if (argv[optind][0] !=
'\0') {
606 if (argv[optind][0] !=
'\0') {
621 "~/menuapp/help", R_OK
);
636
637
638
639
640
641
647 "~/menuapp/msrc", R_OK
);
658 if (init
->cmd[0] !=
'\0') {
669 "~/menuapp/help", R_OK
);
673 "~/menuapp/msrc", R_OK
);
680 "~/menuapp/data", R_OK
);
692 if (argv[optind][0] !=
'\0') {
705 if (argv[optind][0] !=
'\0') {
717 if (argv[optind][0] !=
'\0') {
732 "~/menuapp/help", R_OK
);
751
752
753
768 e = getenv(
"VIEW_HELP_FILE");
769 if (e && e[0] !=
'\0') {
774 "~/menuapp/help", R_OK
);
int Perror(char *emsg_str)
Display a simple error message window or print to stderr.
void abend(int ec, char *s)
Abnormal program termination.
int display_error(char *msg0, char *msg1, char *msg2, char *msg3)
Display an error message window or print to stderr.
bool locate_file_in_path(char *, char *)
Locates a file in the system PATH.
size_t canonicalize_file_spec(char *)
Removes quotes and trims at first space.
size_t strnz__cpy(char *, const char *, size_t)
safer alternative to strncpy
bool stripz_quotes(char *)
removes leading and trailing double quotes if present
size_t ssnprintf(char *, size_t, const char *,...)
ssnprintf was designed to be a safer alternative to snprintf.
bool strip_quotes(char *)
removes leading and trailing double quotes if present
bool expand_tilde(char *, uint)
Replaces "~/" in string with the user's home directory.
char * strnz_dup(char *, size_t)
Allocates memory for and duplicates string s up to length l or until line feed or carriage return.
size_t strnz__cat(char *, const char *, size_t)
safer alternative to strncat
bool verify_file(char *, uint)
Verifies that the file specified by "in_spec" exists and is accessible with the permissions specified...
int destroy_argv(uint argc, char **argv)
Deallocates memory allocated for argument strings in argv.
bool base_name(char *, char *)
Returns the base name of a file specification.
bool verify_dir(char *, uint)
Verifies that the directory specified by "spec" exists and is accessible with the permissions specifi...
bool verify_spec_arg(char *, char *, char *, char *, uint)
Verify file specification argument.
Pick * new_pick(Init *init, int argc, char **argv, uint begy, uint begx)
Create and initialize Pick structure.
bool init_form_files(Init *init, int argc, char **argv)
Initialize Form file specifications.
View * destroy_view(Init *init)
Destroy View structure.
Menu * new_menu(Init *init, int argc, char **argv, uint begy, uint begx)
Create and initialize Menu structure.
bool init_menu_files(Init *init, int argc, char **argv)
Initialize Menu file specifications.
Init * new_init(int argc, char **argv)
Create and initialize Init structure.
Menu * destroy_menu(Init *init)
Destroy Menu structure.
Form * destroy_form(Init *init)
Destroy Form structure.
View * new_view(Init *init)
Create and initialize View structure.
Init * destroy_init(Init *init)
Destroy Init structure.
bool init_pick_files(Init *init, int argc, char **argv)
Initialize Pick file specifications.
Form * new_form(Init *init, int argc, char **argv, uint begy, uint begx)
Create and initialize Form structure.
bool init_view_files(Init *init)
Initialize View file specifications.
Pick * destroy_pick(Init *init)
Destroy Pick structure.
char receiver_cmd[MAXLEN]
char provider_cmd[MAXLEN]
Text * text[FIELD_MAXCNT]
Field * field[FIELD_MAXCNT]
char receiver_cmd[MAXLEN]
char provider_cmd[MAXLEN]
char mapp_spec[FIELD_MAXLEN]
Line * line[MAX_MENU_LINES]
char receiver_cmd[MAXLEN]
char provider_cmd[MAXLEN]
char provider_cmd[MAXLEN]
char receiver_cmd[MAXLEN]