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->m_object = calloc(%d, %d) failed\n",
219 abend(-1
, "User terminated program");
225 "calloc pick->d_object = calloc(%d, %d) failed\n",
228 abend(-1
, "User terminated program");
235
236
237
238
257
258
259
260
261
262
263
264
265
266Form *
new_form(Init *init,
int argc,
char **argv,
int begy,
int begx) {
267 init
->form = (Form *)calloc(1,
sizeof(Form));
275 abend(-1
, "init_form_files failed");
285
286
287
288
310
311
312
315 init
->view = (View *)calloc(1,
sizeof(View));
319 __LINE__ - 1
, errno
);
324 abend(-1
, "calloc init->view failed");
334 __LINE__ - 1
, errno
);
339 abend(-1
, "User terminated program");
349 abend(-1
, "init_view_files failed");
355
356
357
358
395
396
397
398
399
400
401
402
403
404
405
426 s1 = strtok(try_spec,
" \t\n");
439 if (try_spec[0] ==
'/') {
450 if (!f_dir && dir[0]) {
451 if (strcmp(dir,
"$PATH") == 0) {
470 if (!f_spec && alt_dir && alt_dir[0] !=
'\0') {
471 if (strcmp(alt_dir,
"$PATH") == 0) {
494 if (!f_spec && mode == W_OK) {
496 FILE *fp = fopen(try_spec,
"a");
507 if (try_spec[0] ==
'\0' && idio_spec[0] !=
'\0')
511 if (s2_s[0] !=
'\0') {
521
522
523
524
525
526
527
534 "~/menuapp/msrc", R_OK
);
541 "~/menuapp/help", R_OK
);
568
569
570
571
572
573
574
575
589 if (init
->cmd[0] !=
'\0') {
602 "~/menuapp/help", R_OK
);
606 "~/menuapp/data", R_OK
);
618 if (argv[optind][0] !=
'\0') {
631 if (argv[optind][0] !=
'\0') {
643 if (argv[optind][0] !=
'\0') {
658 "~/menuapp/help", R_OK
);
671
672
673
674
675
676
682 "~/menuapp/msrc", R_OK
);
693 if (init
->cmd[0] !=
'\0') {
704 "~/menuapp/help", R_OK
);
708 "~/menuapp/msrc", R_OK
);
715 "~/menuapp/data", R_OK
);
727 if (argv[optind][0] !=
'\0') {
740 if (argv[optind][0] !=
'\0') {
752 if (argv[optind][0] !=
'\0') {
767 "~/menuapp/help", R_OK
);
786
787
788
798 e = getenv(
"VIEW_HELP_FILE");
799 if (e && e[0] !=
'\0') {
804 "~/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.
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]