/****************************************************************************
- * Copyright (c) 2003-2012,2013 Free Software Foundation, Inc. *
+ * Copyright (c) 2003-2016,2017 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
* authorization. *
****************************************************************************/
/*
- * $Id: demo_forms.c,v 1.46 2013/09/28 21:55:54 tom Exp $
+ * $Id: demo_forms.c,v 1.53 2017/04/10 00:28:54 tom Exp $
*
* Demonstrate a variety of functions from the form library.
* Thomas Dickey - 2003/4/26
char *value = typeRealloc(char, need, prior);
if (value == 0)
failed("realloc");
- strcat(value, "\n");
- strcat(value, buffer);
+ _nc_STRCAT(value, "\n", need);
+ _nc_STRCAT(value, buffer, need);
my_data[more - 1].value = value;
} else {
more = 0;
failed("expected a colon");
}
}
+ fclose(fp);
} else {
failed(filename);
}
if (d_option) {
if (has_colors()) {
set_field_fore(f, (chtype) COLOR_PAIR(2));
- set_field_back(f, A_UNDERLINE | COLOR_PAIR(3));
+ set_field_back(f, (A_UNDERLINE | (chtype) COLOR_PAIR(3)));
} else {
set_field_fore(f, A_BOLD);
}
}
static void
-display_form(FORM * f)
+display_form(FORM *f)
{
WINDOW *w;
int rows, cols;
}
static void
-erase_form(FORM * f)
+erase_form(FORM *f)
{
WINDOW *w = form_win(f);
WINDOW *s = form_sub(f);
#define O_SELECTABLE (O_ACTIVE | O_VISIBLE)
static FIELD *
-another_field(FORM * form, FIELD * field)
+another_field(FORM *form, FIELD *field)
{
FIELD **f = form_fields(form);
FIELD *result = 0;
}
static int
-my_form_driver(FORM * form, int c)
+my_form_driver(FORM *form, int c)
{
static bool insert_mode = TRUE;
FIELD *field;
}
static void
-show_current_field(WINDOW *win, FORM * form)
+show_current_field(WINDOW *win, FORM *form)
{
FIELD *field;
FIELDTYPE *type;
}
waddch(win, ' ');
- (void) wattrset(win, (int) field_fore(field));
+ (void) wattrset(win, AttrArg(field_fore(field), 0));
waddstr(win, "fore");
wattroff(win, (int) field_fore(field));
waddch(win, '/');
- (void) wattrset(win, (int) field_back(field));
+ (void) wattrset(win, AttrArg(field_back(field), 0));
waddstr(win, "back");
wattroff(win, (int) field_back(field));
memset(f, 0, sizeof(f));
for (pg = 0; pg < 4; ++pg) {
char label[80];
- sprintf(label, "Sample Form Page %d", pg + 1);
+ _nc_SPRINTF(label, _nc_SLIMIT(sizeof(label))
+ "Sample Form Page %d", pg + 1);
f[n++] = make_label(label, 0, 15);
set_new_page(f[n - 1], TRUE);
free_form(form);
}
for (c = 0; f[c] != 0; c++) {
- void *ptr = field_userptr(f[c]);
- free(ptr);
+ free_edit_field(f[c]);
free_field(f[c]);
}
noraw();