2
3
4
5
6
7
8
11
12
13
14
15
16
17
18
19
20
29Menu *
new_menu(Init *init,
int,
char **,
int,
int);
30Pick *
new_pick(Init *init,
int,
char **,
int,
int);
31Form *
new_form(Init *init,
int,
char **,
int,
int);
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
72 Init *init = calloc(1,
sizeof(Init));
88 for (i = 0; i < init
->argc; i++)
92 init
->sio = (SIO *)calloc(1,
sizeof(SIO));
101
102
103
104
139
140
141
142
143
144
145
146
147
148Menu *
new_menu(Init *init,
int argc,
char **argv,
int begy,
int begx) {
149 init
->menu = (Menu *)calloc(1,
sizeof(Menu));
157 abend(-1
, "init_menu_files failed");
165
166
167
168
191
192
193
194
195
196
197
198
199
200Pick *
new_pick(Init *init,
int argc,
char **argv,
int begy,
int begx) {
201 init
->pick = (Pick *)calloc(1,
sizeof(Pick));
209 abend(-1
, "init_pick_files failed");
216 "calloc pick->object = calloc(%d, %d) failed\n",
219 abend(-1
, "User terminated program");
226
227
228
229
244
245
246
247
248
249
250
251
252
253Form *
new_form(Init *init,
int argc,
char **argv,
int begy,
int begx) {
254 init
->form = (Form *)calloc(1,
sizeof(Form));
262 abend(-1
, "init_form_files failed");
272
273
274
275
297
298
299
302 init
->view = (View *)calloc(1,
sizeof(View));
306 __LINE__ - 1
, errno
);
311 abend(-1
, "calloc init->view failed");
321 __LINE__ - 1
, errno
);
326 abend(-1
, "User terminated program");
336 abend(-1
, "init_view_files failed");
342
343
344
345
362
363
364
365
366
367
368
369
370
371
372
391 s1 = strtok(try_spec,
" \t\n");
400 if (try_spec[0] ==
'/') {
409 if (!f_dir && dir[0]) {
410 if (strcmp(dir,
"$PATH") == 0) {
428 if (!f_spec && alt_dir && alt_dir[0] !=
'\0') {
429 if (strcmp(alt_dir,
"$PATH") == 0) {
452 if (!f_spec && mode == W_OK) {
454 FILE *fp = fopen(try_spec,
"a");
465 if (try_spec[0] ==
'\0' && idio_spec[0] !=
'\0')
469 if (s2_s[0] !=
'\0') {
479
480
481
482
483
484
485
492 "~/menuapp/msrc", R_OK
);
499 "~/menuapp/help", R_OK
);
526
527
528
529
530
531
532
533
547 if (init
->cmd[0] !=
'\0') {
560 "~/menuapp/help", R_OK
);
564 "~/menuapp/data", R_OK
);
576 if (argv[optind][0] !=
'\0') {
589 if (argv[optind][0] !=
'\0') {
601 if (argv[optind][0] !=
'\0') {
616 "~/menuapp/help", R_OK
);
625
626
627
628
629
630
636 "~/menuapp/msrc", R_OK
);
647 if (init
->cmd[0] !=
'\0') {
658 "~/menuapp/help", R_OK
);
662 "~/menuapp/msrc", R_OK
);
669 "~/menuapp/data", R_OK
);
681 if (argv[optind][0] !=
'\0') {
694 if (argv[optind][0] !=
'\0') {
706 if (argv[optind][0] !=
'\0') {
721 "~/menuapp/help", R_OK
);
733
734
735
745 e = getenv(
"VIEW_HELP_FILE");
746 if (e && e[0] !=
'\0') {
751 "~/menuapp/help", R_OK
);
int Perror(char *)
Display a simple error message window or print to stderr.
int display_error(char *em0, char *em1, char *em2, char *em3)
Display an error message window or print to stderr.
void abend(int, char *)
Abnormal program termination.
bool locate_file_in_path(char *, char *)
Locates a file in the system PATH.
void destroy_argv(int argc, char **argv)
Deallocates memory allocated for argument strings in argv.
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
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 expand_tilde(char *, int)
Replace Leading Tilde With Home Directory.
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]