2
3
4
5
6
7
8
11
12
13
14
15
16
17
18
19
20
30Menu *
new_menu(Init *init,
int,
char **,
int,
int);
31Pick *
new_pick(Init *init,
int,
char **,
int,
int);
32Form *
new_form(Init *init,
int,
char **,
int,
int);
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
73 Init *init = calloc(1,
sizeof(Init));
74 if (init ==
nullptr) {
79 if (init
->argv ==
nullptr) {
89 for (i = 0; i < init
->argc; i++)
93 init
->sio = (SIO *)calloc(1,
sizeof(SIO));
102
103
104
105
126 if (init
->argv !=
nullptr)
128 if (init !=
nullptr) {
136
137
138
139
140
141
142
143
144
145Menu *
new_menu(Init *init,
int argc,
char **argv,
int begy,
int begx) {
146 init
->menu = (Menu *)calloc(1,
sizeof(Menu));
154 abend(-1
, "init_menu_files failed");
162
163
164
165
188
189
190
191
192
193
194
195
196
197Pick *
new_pick(Init *init,
int argc,
char **argv,
int begy,
int begx) {
198 init
->pick = (Pick *)calloc(1,
sizeof(Pick));
206 abend(-1
, "init_pick_files failed");
213 "calloc pick->m_object = calloc(%d, %d) failed\n",
216 abend(-1
, "User terminated program");
222 "calloc pick->d_object = calloc(%d, %d) failed\n",
225 abend(-1
, "User terminated program");
232
233
234
235
254
255
256
257
258
259
260
261
262
263Form *
new_form(Init *init,
int argc,
char **argv,
int begy,
int begx) {
264 init
->form = (Form *)calloc(1,
sizeof(Form));
272 abend(-1
, "init_form_files failed");
282
283
284
285
307
308
309
312 init
->view = (View *)calloc(1,
sizeof(View));
316 __LINE__ - 1
, errno
);
321 abend(-1
, "calloc init->view failed");
331 __LINE__ - 1
, errno
);
336 abend(-1
, "User terminated program");
346 abend(-1
, "init_view_files failed");
352
353
354
355
369
370
371
372
373
374
375
376
377
378
379
400 s1 = strtok(try_spec,
" \t\n");
403 s2 = strtok(
nullptr,
"\n");
413 if (try_spec[0] ==
'/') {
424 if (!f_dir && dir[0]) {
425 if (strcmp(dir,
"$PATH") == 0) {
444 if (!f_spec && alt_dir && alt_dir[0] !=
'\0') {
445 if (strcmp(alt_dir,
"$PATH") == 0) {
468 if (!f_spec && mode == W_OK) {
470 FILE *fp = fopen(try_spec,
"a");
481 if (try_spec[0] ==
'\0' && idio_spec[0] !=
'\0')
485 if (s2_s[0] !=
'\0') {
495
496
497
498
499
500
501
508 "~/menuapp/msrc", R_OK
);
515 "~/menuapp/help", R_OK
);
532 nullptr, nullptr, R_OK
);
542
543
544
545
546
547
548
549
563 if (init
->cmd[0] !=
'\0') {
576 "~/menuapp/help", R_OK
);
580 "~/menuapp/data", R_OK
);
592 if (argv[optind][0] !=
'\0') {
605 if (argv[optind][0] !=
'\0') {
617 if (argv[optind][0] !=
'\0') {
632 "~/menuapp/help", R_OK
);
647
648
649
650
651
652
658 "~/menuapp/msrc", R_OK
);
669 if (init
->cmd[0] !=
'\0') {
680 "~/menuapp/help", R_OK
);
684 "~/menuapp/msrc", R_OK
);
691 "~/menuapp/data", R_OK
);
703 if (argv[optind][0] !=
'\0') {
716 if (argv[optind][0] !=
'\0') {
728 if (argv[optind][0] !=
'\0') {
743 "~/menuapp/help", R_OK
);
762
763
764
778 e = getenv(
"VIEW_HELP_FILE");
779 if (e && e[0] !=
'\0') {
784 "~/menuapp/help", R_OK
);
int Perror(char *)
Display a simple error message window or print to stderr.
void abend(int, char *)
Abnormal program termination.
int display_error(char *, char *, char *, char *)
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
int destroy_argv(int argc, char **argv)
Deallocates memory allocated for argument strings in argv.
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 expand_tilde(char *, int)
Replaces "~/" in string with the user's home directory.
bool strip_quotes(char *)
removes leading and trailing double quotes if present
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 *, int)
Verifies that the file specified by "in_spec" exists and is accessible with the permissions specified...
bool verify_dir(char *, int)
Verifies that the directory specified by "spec" exists and is accessible with the permissions specifi...
bool base_name(char *, char *)
Returns the base name of a file specification.
bool init_form_files(Init *, int, char **)
Initialize Form file specifications.
View * destroy_view(Init *init)
Destroy View structure.
Form * new_form(Init *, int, char **, int, int)
Create and initialize Form structure.
bool init_menu_files(Init *, int, char **)
Initialize Menu file specifications.
bool verify_spec_arg(char *, char *, char *, char *, int)
Verify file specification argument.
Init * new_init(int, char **)
Create and initialize Init structure.
Menu * new_menu(Init *, int, char **, int, int)
Create and initialize Menu structure.
Menu * destroy_menu(Init *init)
Destroy Menu structure.
Form * destroy_form(Init *init)
Destroy Form structure.
View * new_view(Init *)
Create and initialize View structure.
Pick * new_pick(Init *, int, char **, int, int)
Create and initialize Pick structure.
Init * destroy_init(Init *init)
Destroy Init structure.
bool init_pick_files(Init *, int, char **)
Initialize Pick file specifications.
bool init_view_files(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]