2
3
4
5
6
7
8
11
12
13
46int init_form(Init *,
int,
char **,
int,
int);
51
52
53
54
55
56
57
58
59int init_form(Init *init,
int argc,
char **argv,
int begy,
int begx) {
68 rc =
Perror("Error: No form specification file given");
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
122 Perror("FORM: form data structure is nullptr");
133 if (form_action == 0 || form_action ==
P_CONTINUE)
135 switch (form_action) {
164 eargv[
eargc++] = strdup(
"view");
165 eargv[
eargc++] = strdup(
"-N");
166 eargv[
eargc++] = strdup(
"f");
167 eargv[
eargc++] = strdup(tmp_str);
189
190
191
192
193
210 tcflush(2, TCIFLUSH);
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
281 char earg_str[
MAXLEN + 1];
308 tcflush(2, TCIFLUSH);
325 if (pipe(pipe_fd) == -1) {
327 Perror("pipe(pipe_fd) failed in init_form");
330 if ((pid = fork()) == -1) {
332 Perror("fork() failed in init_form");
337 dup2(pipe_fd[
P_WRITE], STDOUT_FILENO);
339 execvp(eargv[0], eargv);
391
392
393
394
395
396
397
398
399
445 for (
int i = 0; i < form
->fcnt; i++) {
455
456
457
458
459
490 immedok(form->win, TRUE);
503
504
505
506
507
508
509
513 for (n = 0; n < form
->fcnt; n++) {
529
530
531
532
533
534
535
560 form
->field[i] = calloc(1,
sizeof(Field));
562 sprintf(tmp_str,
"FORM: calloc failed for fields");
567 form
->text[i] = calloc(1,
sizeof(Text));
569 sprintf(tmp_str,
"FORM: calloc failed for text");
586 delim[1] = in_buf[1];
590 if (!(token = strtok(tmp_buf_p, delim))) {
594 switch ((
int)directive) {
607 if (!(token = strtok(
nullptr, delim))) {
609 "FORM: receiver_cmd delimiter");
615 if (!(token = strtok(
nullptr, delim))) {
617 "FORM: help_spec delimiter");
623 sprintf(tmp_str,
"FORM: calloc failed for fields");
626 if (!(token = strtok(
nullptr, delim))) {
628 "FORM: line number delimiter");
635 "FORM: invalid line number");
638 if (!(token = strtok(
nullptr, delim))) {
640 "FORM: column number delimiter");
647 "FORM: invalid column number");
650 if (!(token = strtok(
nullptr, delim))) {
661 if (!(token = strtok(
nullptr, delim))) {
663 "FORM: validation code delimiter");
670 if (!strcmp(token,
ff_tbl[i])) {
678 "FORM: invalid format code");
690 sprintf(tmp_str,
"FORM: calloc failed for text");
693 if (!(token = strtok(
nullptr, delim))) {
695 "FORM: line number delimiter");
702 "FORM: invalid line number");
705 if (!(token = strtok(
nullptr, delim))) {
707 "FORM: column number delimiter");
714 "FORM: invalid column number");
717 if (!(token = strtok(
nullptr, delim))) {
736 if ((token = strtok(
nullptr, delim))) {
745 fclose(form_desc_fp);
756
757
758
759
760
768 if ((lstat(form
->in_spec, &sb) == -1) || (sb.st_size == 0) ||
798
799
800
801
802
803
805 char earg_str[
MAXLEN + 1];
808 for (i = 0; i < form
->fcnt; i++) {
820
821
822
823
824
841 form
->out_fp = fdopen(STDOUT_FILENO,
"w");
860 for (n = 0; n < form
->fcnt; n++)
867
868
869
870
871
872
873
874
875
int form_yx_to_fidx(Form *, int, int)
int popup_view(Init *, int, char **, int, int, int, int)
bool waitpid_with_timeout(pid_t pid, int timeout)
void display_chyron(WINDOW *win, Chyron *chyron, int line, int col)
void set_chyron_key(Chyron *, int, char *, int)
int xwgetch(WINDOW *, Chyron *, int)
Wrapper for wgetch that handles signals, mouse events, checks for clicks on the chyron line,...
int win_new(int, int, int, int, char *, int)
Create a new window with optional box and title.
WINDOW * win_del()
Delete the current window and its associated box window.
bool is_set_chyron_key(Chyron *, int)
Check if function key label is set.
Chyron * destroy_chyron(Chyron *chyron)
Destroy Chyron structure.
void set_chyron_key_cp(Chyron *, int, char *, int, int)
Set chyron key.
void compile_chyron(Chyron *)
construct the chyron string from the chyron structure
void unset_chyron_key(Chyron *, int)
Unset chyron key.
Chyron * new_chyron()
Create and initialize Chyron structure.
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.
int shell(char *)
Execute a shell command.
int form_fmt_field(Form *, char *)
Format field according to its format type.
int field_editor(Form *)
Accept input for a field.
int form_display_field_n(Form *, int)
Display field n.
int form_desc_error(int, char *, char *)
Handle errors encountered while parsing the form description file, providing detailed error messages ...
int form_read_data(Form *)
Read initial data for form fields from a specified input source, such as a file or standard input,...
int form_parse_desc(Form *)
Parse the form description file to populate the Form data structure with field definitions,...
int form_write(Form *)
Write form field values to a specified output destination, such as a file or standard output,...
int form_process(Init *)
Handle integration with a getter program which will provide field data.
int form_exec_cmd(Form *)
Execute a provider command specified in the form description file, passing form field values as argum...
int init_form(Init *, int, char **, int, int)
Initialize form data structure and parse description file.
int form_post(Init *)
Handle post-processing after field entry, allowing user to edit data, execute a provider command,...
int form_engine(Init *)
Form main processing loop.
void form_display_fields(Form *)
Display form fields on the screen, populating field values and formatting them according to the form ...
int field_navigator(Form *)
Handle user input for field entry, allowing navigation between fields and looping until an exit actio...
unsigned int form_display_screen(Init *)
Display the form on the screen, including text elements and fields, and set up the form window based ...
void destroy_argv(int argc, char **argv)
Deallocates memory allocated for argument strings in argv.
size_t strnz__cpy(char *, const char *, size_t)
safer alternative to strncpy
size_t trim(char *)
Trims leading and trailing spaces from string s in place.
bool str_to_lower(char *)
Converts a string to lowercase.
bool strnfill(char *, char, int)
Fills string s with character c n.
size_t strnz(char *, size_t)
terminates string at New Line, Carriage Return, or max_len
size_t ssnprintf(char *, size_t, const char *,...)
ssnprintf was designed to be a safer alternative to snprintf.
size_t strnz__cat(char *, const char *, size_t)
safer alternative to strncat
bool base_name(char *, char *)
Returns the base name of a file specification.
int str_to_args(char **, char *, int)
Converts a string into an array of argument strings.
Form * new_form(Init *, int, char **, int, int)
Create and initialize Form structure.
Form * destroy_form(Init *init)
Destroy Form structure.
char display_s[FIELD_MAXLEN]
char accept_s[FIELD_MAXLEN]
char filler_s[FIELD_MAXLEN]
Text * text[FIELD_MAXCNT]
Field * field[FIELD_MAXCNT]
char receiver_cmd[MAXLEN]
char provider_cmd[MAXLEN]
char mapp_spec[FIELD_MAXLEN]