1 #include "../include/curses.h"
6 void get_iscsi_chap_secret( char * );
7 void mdelay( int msecs
);
14 box( stdscr
, '|', '-' );
15 get_iscsi_chap_secret(secret
);
17 mvwprintw( stdscr
, 3, 5, "password is \"%s\"", secret
);
20 stdscr
->scr
->exit(stdscr
->scr
);
25 void get_iscsi_chap_secret( char *sec
) {
26 char *title
= "Set new iSCSI CHAP secret",
27 *msg
= "Configure the iSCSI access secret",
31 secret
= newwin( stdscr
->height
/ 2,
36 wborder( secret
, '|', '|', '-', '-', '+', '+', '+', '+' );
37 mvwprintw( secret
, 1, 2, "%s", title
);
38 mvwhline( secret
, 2, 1, '-' | secret
->attrs
, secret
->width
- 2 );
39 mvwprintw( secret
, 4, 2, "%s", msg
);
40 mvwprintw( secret
, 6, 3, "secret" );
41 mvwprintw( secret
, 8, 3, "confirm" );
43 mvwhline( secret
, 6, 12, '_' | secret
->attrs
, 16 );
44 mvwhline( secret
, 8, 12, '_' | secret
->attrs
, 16 );
46 wmove( secret
, 6, 12 );
47 wgetnstr( secret
, pw1
, 16 );
48 wmove( secret
, 8, 12 );
49 wgetnstr( secret
, pw2
, 16 );
51 if ( strcmp( pw1
, pw2
) == 0 ) {
56 mvwprintw( secret
, 10, 3, "Passwords do not match" );
61 void mdelay ( int msecs
) {
62 usleep( msecs
* 1000 );