1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
|
/*
File: nodisk.c
Copyright (C) 1998-2009 Christophe GRENIER <grenier@cgsecurity.org>
This software is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write the Free Software Foundation, Inc., 51
Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#if defined(DISABLED_FOR_FRAMAC)
#undef HAVE_NCURSES
#endif
#if defined(__CYGWIN__) || defined(__MINGW32__) || defined(DJGPP) || !defined(HAVE_GETEUID)
#undef SUDO_BIN
#endif
#ifdef HAVE_NCURSES
#include <stdio.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include "types.h"
#include "common.h"
#include "intrf.h"
#include "intrfn.h"
#include "nodisk.h"
int intrf_no_disk_ncurses(const char *prog_name)
{
aff_copy(stdscr);
wmove(stdscr,4,0);
wprintw(stdscr," %s is free software, and",prog_name);
wmove(stdscr,5,0);
wprintw(stdscr,"comes with ABSOLUTELY NO WARRANTY.");
wmove(stdscr,7,0);
wprintw(stdscr,"No hard disk found\n");
#if defined(__CYGWIN__) || defined(__MINGW32__)
wmove(stdscr,8,0);
wprintw(stdscr,"You need to be administrator to use %s.\n", prog_name);
wmove(stdscr,9,0);
wprintw(stdscr,"Under Win9x, use the DOS version instead.\n");
wmove(stdscr,10,0);
wprintw(stdscr,"Under Vista or later, select %s, right-click and\n", prog_name);
wmove(stdscr,11,0);
wprintw(stdscr,"choose \"Run as administrator\".\n");
#elif defined(DJGPP)
#elif defined(HAVE_GETEUID)
if(geteuid()!=0)
{
wmove(stdscr,8,0);
wprintw(stdscr,"You need to be root to use %s.\n", prog_name);
#ifdef SUDO_BIN
{
static const struct MenuItem menuSudo[]=
{
{'S',"Sudo","Use the sudo command to restart as root"},
{'Q',"Quit",""},
{0,NULL,NULL}
};
unsigned int menu=0;
int command;
command = wmenuSelect_ext(stdscr,23, 20, 0, menuSudo, 8,
"SQ", MENU_VERT | MENU_VERT_WARN | MENU_BUTTON, &menu,NULL);
if(command=='s' || command=='S')
return 1;
return 0;
}
#endif
}
#endif
wmove(stdscr,22,0);
wattrset(stdscr, A_REVERSE);
waddstr(stdscr,"[ Quit ]");
wattroff(stdscr, A_REVERSE);
wrefresh(stdscr);
while(wgetch(stdscr)==ERR);
return 0;
}
#endif
|