iPXE
settings_ui.c
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2006 Michael Brown <mbrown@fensystems.co.uk>.
3  *
4  * This program is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU General Public License as
6  * published by the Free Software Foundation; either version 2 of the
7  * License, or any later version.
8  *
9  * This program is distributed in the hope that it will be useful, but
10  * WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  * General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
17  * 02110-1301, USA.
18  *
19  * You can also choose to distribute this program under the terms of
20  * the Unmodified Binary Distribution Licence (as given in the file
21  * COPYING.UBDL), provided that you have satisfied its requirements.
22  */
23 
24 FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
25 
26 #include <stdio.h>
27 #include <stdarg.h>
28 #include <stdlib.h>
29 #include <unistd.h>
30 #include <string.h>
31 #include <curses.h>
32 #include <ipxe/console.h>
33 #include <ipxe/settings.h>
34 #include <ipxe/editbox.h>
35 #include <ipxe/keys.h>
36 #include <ipxe/ansicol.h>
37 #include <ipxe/jumpscroll.h>
38 #include <ipxe/message.h>
39 #include <ipxe/settings_ui.h>
40 #include <config/branding.h>
41 
42 /** @file
43  *
44  * Option configuration console
45  *
46  */
47 
48 /* Screen layout */
49 #define TITLE_ROW 1U
50 #define SETTINGS_LIST_ROW 3U
51 #define SETTINGS_LIST_COL 1U
52 #define SETTINGS_LIST_ROWS ( LINES - 6U - SETTINGS_LIST_ROW )
53 #define INFO_ROW ( LINES - 5U )
54 #define ALERT_ROW ( LINES - 2U )
55 #define INSTRUCTION_ROW ( LINES - 2U )
56 #define INSTRUCTION_PAD " "
57 
58 /** Layout of text within a setting row */
59 #define SETTING_ROW_TEXT( cols ) struct { \
60  char start[0]; \
61  char pad1[1]; \
62  union { \
63  struct { \
64  char name[ cols - 1 - 1 - 1 - 1 - 1 ]; \
65  char pad2[1]; \
66  } __attribute__ (( packed )) settings; \
67  struct { \
68  char name[15]; \
69  char pad2[1]; \
70  char value[ cols - 1 - 15 - 1 - 1 - 1 - 1 ]; \
71  } __attribute__ (( packed )) setting; \
72  } u; \
73  char pad3[1]; \
74  char nul; \
75 } __attribute__ (( packed ))
76 
77 /** A settings user interface row */
79  /** Target configuration settings block
80  *
81  * Valid only for rows that lead to new settings blocks.
82  */
83  struct settings *settings;
84  /** Configuration setting origin
85  *
86  * Valid only for rows that represent individual settings.
87  */
88  struct settings *origin;
89  /** Configuration setting
90  *
91  * Valid only for rows that represent individual settings.
92  */
93  struct setting setting;
94  /** Screen row */
95  unsigned int row;
96  /** Edit box widget used for editing setting */
97  struct edit_box editbox;
98  /** Editing in progress flag */
99  int editing;
100  /** Dynamically allocated buffer for setting's value */
101  char *buf;
102 };
103 
104 /** A settings user interface */
105 struct settings_ui {
106  /** Settings block */
108  /** Jump scroller */
110  /** Current row */
112 };
113 
114 /**
115  * Select a setting
116  *
117  * @v ui Settings user interface
118  * @v index Index of setting row
119  * @ret count Number of setting rows
120  */
121 static unsigned int select_setting_row ( struct settings_ui *ui,
122  unsigned int index ) {
123  SETTING_ROW_TEXT ( COLS ) *text;
124  struct settings *settings;
125  struct setting *setting;
126  struct setting *previous = NULL;
127  unsigned int count = 0;
128 
129  /* Free any previous setting value */
130  free ( ui->row.buf );
131  ui->row.buf = NULL;
132 
133  /* Initialise structure */
134  memset ( &ui->row, 0, sizeof ( ui->row ) );
135  ui->row.row = ( SETTINGS_LIST_ROW + index - ui->scroll.first );
136 
137  /* Include parent settings block, if applicable */
138  if ( ui->settings->parent && ( count++ == index ) )
139  ui->row.settings = ui->settings->parent;
140 
141  /* Include any child settings blocks, if applicable */
142  list_for_each_entry ( settings, &ui->settings->children, siblings ) {
143  if ( count++ == index )
144  ui->row.settings = settings;
145  }
146 
147  /* Include any applicable settings */
149 
150  /* Skip inapplicable settings */
151  if ( ! setting_applies ( ui->settings, setting ) )
152  continue;
153 
154  /* Skip duplicate settings */
155  if ( previous && ( setting_cmp ( setting, previous ) == 0 ) )
156  continue;
157  previous = setting;
158 
159  /* Read current setting value and origin */
160  if ( count++ == index ) {
162  &ui->row.origin,
163  &ui->row.setting, &ui->row.buf );
164  }
165  }
166 
167  /* Initialise edit box */
168  memset ( &ui->row.editbox, 0, sizeof ( ui->row.editbox ) );
169  init_editbox ( &ui->row.editbox, ui->row.row,
171  offsetof ( typeof ( *text ), u.setting.value ) ),
172  sizeof ( text->u.setting.value ), 0, &ui->row.buf );
173 
174  return count;
175 }
176 
177 /**
178  * Copy string without NUL termination
179  *
180  * @v dest Destination
181  * @v src Source
182  * @v len Maximum length of destination
183  * @ret len Length of (unterminated) string
184  */
185 static size_t string_copy ( char *dest, const char *src, size_t len ) {
186  size_t src_len;
187 
188  src_len = strlen ( src );
189  if ( len > src_len )
190  len = src_len;
191  memcpy ( dest, src, len );
192  return len;
193 }
194 
195 /**
196  * Draw setting row
197  *
198  * @v ui Settings UI
199  */
200 static void draw_setting_row ( struct settings_ui *ui ) {
201  SETTING_ROW_TEXT ( COLS ) text;
202  unsigned int curs_offset;
203  const char *value;
204 
205  /* Fill row with spaces */
206  memset ( &text, ' ', sizeof ( text ) );
207  text.nul = '\0';
208 
209  /* Construct row content */
210  if ( ui->row.settings ) {
211 
212  /* Construct space-padded name */
213  value = ( ( ui->row.settings == ui->settings->parent ) ?
214  ".." : ui->row.settings->name );
215  curs_offset = string_copy ( text.u.settings.name, value,
216  sizeof ( text.u.settings.name ) );
217  text.u.settings.name[curs_offset] = '/';
218  curs_offset += offsetof ( typeof ( text ), u.settings );
219 
220  } else {
221 
222  /* Construct dot-padded name */
223  memset ( text.u.setting.name, '.',
224  sizeof ( text.u.setting.name ) );
225  string_copy ( text.u.setting.name, ui->row.setting.name,
226  sizeof ( text.u.setting.name ) );
227 
228  /* Construct space-padded value */
229  value = ui->row.buf;
230  if ( ! ( value && value[0] ) )
231  value = "<not specified>";
232  curs_offset = string_copy ( text.u.setting.value, value,
233  sizeof ( text.u.setting.value ) );
234  curs_offset += offsetof ( typeof ( text ), u.setting.value );
235  }
236 
237  /* Print row */
238  if ( ( ui->row.origin == ui->settings ) || ( ui->row.settings != NULL ))
239  attron ( A_BOLD );
240  mvprintw ( ui->row.row, SETTINGS_LIST_COL, "%s", text.start );
241  attroff ( A_BOLD );
242  move ( ui->row.row, ( SETTINGS_LIST_COL + curs_offset ) );
243 }
244 
245 /**
246  * Edit setting ui
247  *
248  * @v ui Settings UI
249  * @v key Key pressed by user
250  * @ret key Key returned to application, or zero
251  */
252 static int edit_setting ( struct settings_ui *ui, int key ) {
253  assert ( ui->row.setting.name != NULL );
254  ui->row.editing = 1;
255  return edit_widget ( &ui->row.editbox.widget, key );
256 }
257 
258 /**
259  * Save setting ui value back to configuration settings
260  *
261  * @v ui Settings UI
262  */
263 static int save_setting ( struct settings_ui *ui ) {
264  assert ( ui->row.setting.name != NULL );
265  return storef_setting ( ui->settings, &ui->row.setting, ui->row.buf );
266 }
267 
268 /**
269  * Draw title row
270  *
271  * @v ui Settings UI
272  */
273 static void draw_title_row ( struct settings_ui *ui ) {
274  const char *name;
275 
276  clearmsg ( TITLE_ROW );
277  name = settings_name ( ui->settings );
278  attron ( A_BOLD );
279  msg ( TITLE_ROW, PRODUCT_SHORT_NAME " configuration settings%s%s",
280  ( name[0] ? " - " : "" ), name );
281  attroff ( A_BOLD );
282 }
283 
284 /**
285  * Draw information row
286  *
287  * @v ui Settings UI
288  */
289 static void draw_info_row ( struct settings_ui *ui ) {
290  char buf[32];
291 
292  /* Draw nothing unless this row represents a setting */
293  clearmsg ( INFO_ROW );
294  clearmsg ( INFO_ROW + 1 );
295  if ( ! ui->row.setting.name )
296  return;
297 
298  /* Determine a suitable setting name */
299  setting_name ( ( ui->row.origin ?
300  ui->row.origin : ui->settings ),
301  &ui->row.setting, buf, sizeof ( buf ) );
302 
303  /* Draw row */
304  attron ( A_BOLD );
305  msg ( INFO_ROW, "%s - %s", buf, ui->row.setting.description );
306  attroff ( A_BOLD );
307  color_set ( CPAIR_URL, NULL );
308  msg ( ( INFO_ROW + 1 ), PRODUCT_SETTING_URI, ui->row.setting.name );
310 }
311 
312 /**
313  * Draw instruction row
314  *
315  * @v ui Settings UI
316  */
317 static void draw_instruction_row ( struct settings_ui *ui ) {
318 
320  if ( ui->row.editing ) {
322  "Enter - accept changes" INSTRUCTION_PAD
323  "Ctrl-C - discard changes" );
324  } else {
326  "%sCtrl-X - exit configuration utility",
327  ( ( ui->row.origin == ui->settings ) ?
328  "Ctrl-D - delete setting" INSTRUCTION_PAD : "" ) );
329  }
330 }
331 
332 /**
333  * Draw the current block of setting rows
334  *
335  * @v ui Settings UI
336  */
337 static void draw_setting_rows ( struct settings_ui *ui ) {
338  unsigned int i;
339 
340  /* Draw ellipses before and/or after the list as necessary */
342  mvaddstr ( ( SETTINGS_LIST_ROW - 1 ), ( SETTINGS_LIST_COL + 1 ),
343  jump_scroll_is_first ( &ui->scroll ) ? " " : "..." );
345  ( SETTINGS_LIST_COL + 1 ),
346  jump_scroll_is_last ( &ui->scroll ) ? " " : "..." );
348 
349  /* Draw visible settings. */
350  for ( i = 0 ; i < SETTINGS_LIST_ROWS ; i++ ) {
351  if ( ( ui->scroll.first + i ) < ui->scroll.count ) {
352  select_setting_row ( ui, ( ui->scroll.first + i ) );
353  draw_setting_row ( ui );
354  } else {
355  clearmsg ( SETTINGS_LIST_ROW + i );
356  }
357  }
358 }
359 
360 /**
361  * Select settings block
362  *
363  * @v ui Settings UI
364  * @v settings Settings block
365  */
366 static void select_settings ( struct settings_ui *ui,
367  struct settings *settings ) {
368 
370  ui->scroll.count = select_setting_row ( ui, 0 );
372  ui->scroll.current = 0;
373  ui->scroll.first = 0;
374  draw_title_row ( ui );
375  draw_setting_rows ( ui );
376  select_setting_row ( ui, 0 );
377 }
378 
379 static int main_loop ( struct settings *settings ) {
380  struct settings_ui ui;
381  unsigned int previous;
382  unsigned int move;
383  int redraw = 1;
384  int key;
385  int rc;
386 
387  /* Print initial screen content */
389  memset ( &ui, 0, sizeof ( ui ) );
390  select_settings ( &ui, settings );
391 
392  while ( 1 ) {
393 
394  /* Redraw rows if necessary */
395  if ( redraw ) {
396  draw_info_row ( &ui );
397  draw_instruction_row ( &ui );
398  color_set ( ( ui.row.editing ?
400  draw_setting_row ( &ui );
402  curs_set ( ui.row.editing );
403  redraw = 0;
404  }
405 
406  /* Edit setting, if we are currently editing */
407  if ( ui.row.editing ) {
408 
409  /* Sanity check */
410  assert ( ui.row.setting.name != NULL );
411 
412  /* Redraw edit box */
413  draw_widget ( &ui.row.editbox.widget );
414 
415  /* Process keypress */
416  key = edit_setting ( &ui, getkey ( 0 ) );
417  switch ( key ) {
418  case CR:
419  case LF:
420  if ( ( rc = save_setting ( &ui ) ) != 0 ) {
421  alert ( ALERT_ROW, " %s ",
422  strerror ( rc ) );
423  }
424  /* Fall through */
425  case CTRL_C:
426  select_setting_row ( &ui, ui.scroll.current );
427  redraw = 1;
428  break;
429  default:
430  /* Do nothing */
431  break;
432  }
433 
434  continue;
435  }
436 
437  /* Otherwise, navigate through settings */
438  key = getkey ( 0 );
439  move = jump_scroll_key ( &ui.scroll, key );
440  if ( move ) {
441  previous = ui.scroll.current;
442  jump_scroll_move ( &ui.scroll, move );
443  if ( ui.scroll.current != previous ) {
444  draw_setting_row ( &ui );
445  redraw = 1;
446  if ( jump_scroll ( &ui.scroll ) )
447  draw_setting_rows ( &ui );
448  select_setting_row ( &ui, ui.scroll.current );
449  }
450  continue;
451  }
452 
453  /* Handle non-navigation keys */
454  switch ( key ) {
455  case CTRL_D:
456  if ( ! ui.row.setting.name )
457  break;
458  if ( ( rc = delete_setting ( ui.settings,
459  &ui.row.setting ) ) != 0 ){
460  alert ( ALERT_ROW, " %s ", strerror ( rc ) );
461  }
462  select_setting_row ( &ui, ui.scroll.current );
463  redraw = 1;
464  break;
465  case CTRL_X:
466  select_setting_row ( &ui, -1U );
467  return 0;
468  case CR:
469  case LF:
470  if ( ui.row.settings ) {
471  select_settings ( &ui, ui.row.settings );
472  redraw = 1;
473  }
474  /* Fall through */
475  default:
476  if ( ui.row.setting.name ) {
477  edit_setting ( &ui, key );
478  redraw = 1;
479  }
480  break;
481  }
482  }
483 }
484 
485 int settings_ui ( struct settings *settings ) {
486  int rc;
487 
488  initscr();
489  start_color();
491  curs_set ( 0 );
492  erase();
493 
494  rc = main_loop ( settings );
495 
496  endwin();
497 
498  return rc;
499 }
int getkey(unsigned long timeout)
Get single keypress.
Definition: getkey.c:71
MuCurses header file.
int editing
Editing in progress flag.
Definition: settings_ui.c:99
struct arbelprm_rc_send_wqe rc
Definition: arbel.h:14
const char * name
Definition: ath9k_hw.c:1984
Editable text box widget.
static void draw_widget(struct widget *widget)
Draw text widget.
Definition: widget.h:86
#define PRODUCT_SHORT_NAME
Definition: branding.h:28
void msg(unsigned int row, const char *fmt,...)
Print message centred on specified row.
Definition: message.c:61
int erase(void)
Completely clear the screen.
Definition: clear.c:97
int settings_ui(struct settings *settings)
Definition: settings_ui.c:485
static void draw_setting_row(struct settings_ui *ui)
Draw setting row.
Definition: settings_ui.c:200
int fetchf_setting_copy(struct settings *settings, const struct setting *setting, struct settings **origin, struct setting *fetched, char **value)
Fetch copy of formatted value of setting.
Definition: settings.c:1276
struct settings * parent
Parent settings block.
Definition: settings.h:138
static int attroff(int attrs)
Definition: curses.h:508
#define CPAIR_EDIT
Editable text.
Definition: ansicol.h:49
A settings user interface.
Definition: settings_ui.c:105
static int main_loop(struct settings *settings)
Definition: settings_ui.c:379
struct settings_ui_row row
Current row.
Definition: settings_ui.c:111
static void const void * src
Definition: crypto.h:244
void clearmsg(unsigned int row)
Clear message on specified row.
Definition: message.c:74
static int delete_setting(struct settings *settings, const struct setting *setting)
Delete setting.
Definition: settings.h:531
#define start_color()
Definition: curses.h:396
int endwin(void)
Finalise console environment.
Definition: wininit.c:31
A settings user interface row.
Definition: settings_ui.c:78
#define mvprintw(y, x, fmt,...)
Definition: curses.h:648
const char * settings_name(struct settings *settings)
Return settings block name.
Definition: settings.c:345
#define SETTINGS_LIST_ROW
Definition: settings_ui.c:50
void alert(unsigned int row, const char *fmt,...)
Show alert message.
Definition: message.c:103
static void draw_instruction_row(struct settings_ui *ui)
Draw instruction row.
Definition: settings_ui.c:317
Branding configuration.
#define offsetof(type, field)
Get offset of a field within a structure.
Definition: stddef.h:24
const char * description
Description.
Definition: settings.h:30
static unsigned int select_setting_row(struct settings_ui *ui, unsigned int index)
Select a setting.
Definition: settings_ui.c:121
A jump scroller.
Definition: jumpscroll.h:15
Message printing.
#define CPAIR_NORMAL
Normal text.
Definition: ansicol.h:40
struct settings * origin
Configuration setting origin.
Definition: settings_ui.c:88
const char * name
Name.
Definition: settings.h:28
#define SETTINGS
Configuration setting table.
Definition: settings.h:53
#define CTRL_X
Definition: keys.h:41
static int save_setting(struct settings_ui *ui)
Save setting ui value back to configuration settings.
Definition: settings_ui.c:263
void * memcpy(void *dest, const void *src, size_t len) __nonnull
struct settings * settings_target(struct settings *settings)
Redirect to target settings block.
Definition: settings.c:549
static void draw_setting_rows(struct settings_ui *ui)
Draw the current block of setting rows.
Definition: settings_ui.c:337
WINDOW * initscr(void)
Initialise console environment.
Definition: wininit.c:17
static void draw_info_row(struct settings_ui *ui)
Draw information row.
Definition: settings_ui.c:289
assert((readw(&hdr->flags) &(GTF_reading|GTF_writing))==0)
#define PRODUCT_SETTING_URI
Definition: branding.h:170
#define list_for_each_entry(pos, head, member)
Iterate over entries in a list.
Definition: list.h:431
unsigned int first
First visible item.
Definition: jumpscroll.h:23
FILE_LICENCE(GPL2_OR_LATER_OR_UBDL)
unsigned int count
Total number of items.
Definition: jumpscroll.h:19
int jump_scroll(struct jump_scroller *scroll)
Jump scroll to new page (if applicable)
Definition: jumpscroll.c:140
#define CTRL_C
Definition: keys.h:20
#define CPAIR_URL
URL text.
Definition: ansicol.h:55
struct settings * settings
Target configuration settings block.
Definition: settings_ui.c:83
An editable text box widget.
Definition: editbox.h:17
User interaction.
static void * dest
Definition: strings.h:176
#define ALERT_ROW
Definition: settings_ui.c:54
#define TITLE_ROW
Definition: settings_ui.c:49
pseudo_bit_t value[0x00020]
Definition: arbel.h:13
Configuration settings.
int storef_setting(struct settings *settings, const struct setting *setting, const char *value)
Store formatted value of setting.
Definition: settings.c:1319
struct settings * settings
Settings block.
Definition: settings_ui.c:107
Option configuration console.
char * strerror(int errno)
Retrieve string representation of error number.
Definition: strerror.c:78
static void(* free)(struct refcnt *refcnt))
Definition: refcnt.h:54
static void select_settings(struct settings_ui *ui, struct settings *settings)
Select settings block.
Definition: settings_ui.c:366
int setting_applies(struct settings *settings, const struct setting *setting)
Check applicability of setting.
Definition: settings.c:570
unsigned int jump_scroll_move(struct jump_scroller *scroll, unsigned int move)
Move scroller.
Definition: jumpscroll.c:92
#define for_each_table_entry(pointer, table)
Iterate through all entries within a linker table.
Definition: tables.h:385
size_t strlen(const char *src)
Get length of string.
Definition: string.c:243
A settings block.
Definition: settings.h:132
#define INSTRUCTION_ROW
Definition: settings_ui.c:55
#define CPAIR_SEPARATOR
Unselectable text (e.g.
Definition: ansicol.h:46
const char * name
Name.
Definition: settings.h:136
#define INFO_ROW
Definition: settings_ui.c:53
#define COLS
Definition: curses.h:111
#define INSTRUCTION_PAD
Definition: settings_ui.c:56
#define LF
Definition: keys.h:47
A setting.
Definition: settings.h:23
char * buf
Dynamically allocated buffer for setting's value.
Definition: settings_ui.c:101
static void init_editbox(struct edit_box *box, unsigned int row, unsigned int col, unsigned int width, unsigned int flags, char **buf)
Initialise text box widget.
Definition: editbox.h:39
static int jump_scroll_is_last(struct jump_scroller *scroll)
Check if jump scroller is currently on last page.
Definition: jumpscroll.h:72
int curs_set(int visibility)
Set cursor visibility.
Definition: mucurses.c:153
uint32_t len
Length.
Definition: ena.h:14
Key definitions.
unsigned int row
Screen row.
Definition: settings_ui.c:95
struct setting setting
Configuration setting.
Definition: settings_ui.c:93
uint16_t count
Number of entries.
Definition: ena.h:22
struct jump_scroller scroll
Jump scroller.
Definition: settings_ui.c:109
static int jump_scroll_is_first(struct jump_scroller *scroll)
Check if jump scroller is currently on first page.
Definition: jumpscroll.h:61
struct edit_box editbox
Edit box widget used for editing setting.
Definition: settings_ui.c:97
static int move(int y, int x)
Definition: curses.h:593
#define CPAIR_SELECT
Highlighted text.
Definition: ansicol.h:43
#define SETTINGS_LIST_COL
Definition: settings_ui.c:51
Jump scrolling.
#define CR
Definition: keys.h:48
union @17 u
unsigned int rows
Maximum number of visible rows.
Definition: jumpscroll.h:17
struct list_head children
Child settings blocks.
Definition: settings.h:142
#define color_set(cpno, opts)
Definition: curses.h:240
static void draw_title_row(struct settings_ui *ui)
Draw title row.
Definition: settings_ui.c:273
struct widget widget
Text widget.
Definition: editbox.h:19
typeof(acpi_finder=acpi_find)
ACPI table finder.
Definition: acpi.c:45
#define CTRL_D
Definition: keys.h:21
uint64_t index
Index of the first segment within the content.
Definition: pccrc.h:21
#define A_BOLD
Definition: curses.h:138
static size_t string_copy(char *dest, const char *src, size_t len)
Copy string without NUL termination.
Definition: settings_ui.c:185
static int edit_setting(struct settings_ui *ui, int key)
Edit setting ui.
Definition: settings_ui.c:252
unsigned int current
Currently selected item.
Definition: jumpscroll.h:21
#define SETTINGS_LIST_ROWS
Definition: settings_ui.c:52
int setting_name(struct settings *settings, const struct setting *setting, char *buf, size_t len)
Return full setting name.
Definition: settings.c:1606
int setting_cmp(const struct setting *a, const struct setting *b)
Compare two settings.
Definition: settings.c:1120
#define NULL
NULL pointer (VOID *)
Definition: Base.h:321
String functions.
unsigned int jump_scroll_key(struct jump_scroller *scroll, int key)
Jump scrolling.
Definition: jumpscroll.c:42
static int edit_widget(struct widget *widget, int key)
Edit text widget.
Definition: widget.h:103
static int mvaddstr(int y, int x, const char *str)
Definition: curses.h:617
#define SETTING_ROW_TEXT(cols)
Layout of text within a setting row.
Definition: settings_ui.c:59
union @383 key
Sense key.
Definition: crypto.h:284
ANSI colours.
static int attron(int attrs)
Definition: curses.h:512
void * memset(void *dest, int character, size_t len) __nonnull