summaryrefslogtreecommitdiffstats
path: root/docs/wizard.doc
blob: 0bbf8d25477b53563c06f200cd02e4cb2cba3588 (plain)
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
How to handle wizard?

to switch in wizard mode:
set $::isWizard to true;
if $::Wizard_no_previous is set to true, the wizard won't display the previous button. Usefull for first step
if $::Wizard_finished is set to true, the wizard will display Finish instead of Next. Usefull for last step

how to code:
Code as if there were no wizard.
OK button is displayed as Next
Cancel is displayed as Previous
a additional button Cancel is added, xhich die with the exception 'wizard_cancelled'

You have to handle the previous button. For example:

step 1:
ask_from list( blablablabl) or return;
step2:
ask_from list( blablablabl) or goto step1;
step3:
ask_from list( blablablabl) or goto step2;

etc... You don't have to handle the wizard Cancel button as it send an exception.

Understood? If yes, you'll see that there is a pb with ask_yesorno. In this case, yes+next returns true, no+next returns false, Cancel send the exception 'wizard_canceled' and previous send the exception 'wizard previous'. So you have to handle the previous button manually.

plop.

dam's, pour vous servir


b22c02a995540a3a7d5453226082ed4.tar.gz'>drakx-backup-do-not-use-4022d5f26b22c02a995540a3a7d5453226082ed4.tar.gz
drakx-backup-do-not-use-4022d5f26b22c02a995540a3a7d5453226082ed4.tar.bz2
drakx-backup-do-not-use-4022d5f26b22c02a995540a3a7d5453226082ed4.tar.xz
drakx-backup-do-not-use-4022d5f26b22c02a995540a3a7d5453226082ed4.zip
reput back hasNetDevice() instead of getNetInterfaces() since
SIOCGIFCONF only list *active* network interfaces
Diffstat (limited to 'perl-install/c')
-rw-r--r--perl-install/c/stuff.xs.pl45
1 files changed, 12 insertions, 33 deletions
diff --git a/perl-install/c/stuff.xs.pl b/perl-install/c/stuff.xs.pl
index 422c96069..ca73bfb65 100644
--- a/perl-install/c/stuff.xs.pl
+++ b/perl-install/c/stuff.xs.pl
@@ -395,41 +395,20 @@ usb_probe()
unsigned int
getpagesize()
-void
-getNetInterfaces()
- PPCODE:
- struct ifconf ifc;
- struct ifreq *ifr;
- int fd, n;
-
- if ((fd = socket (PF_INET, SOCK_DGRAM, 0)) == -1) {
- perror("getNetInterfaces() >> creating socket");
- XSRETURN_EMPTY;
- }
-
- // SIOCGIFCOUNT is unimplemented, let\'s call SIOCGIFCONF(0) to get number of interfaces
- ifc.ifc_len = 0; ifc.ifc_buf = NULL; ifc.ifc_req = NULL;
- if (ioctl (fd, SIOCGIFCONF, &ifc) == -1) {
- perror("getNetInterfaces() >> SIOCGIFCONF(0)");
- XSRETURN_EMPTY;
- }
-
- // allocate enough space
- n = ifc.ifc_len / sizeof (struct ifreq);
- New (0xbad, ifr, ifc.ifc_len, struct ifreq);
-
- // Get the network interfaces list
- ifc.ifc_req = ifr;
- if (ioctl (fd, SIOCGIFCONF, &ifc) == -1) {
- perror("getNetInterfaces() >> SIOCGIFCONF()");
- XSRETURN_EMPTY;
- }
+int
+hasNetDevice(device)
+ char * device
+ CODE:
+ struct ifreq req;
+ int s = socket(AF_INET, SOCK_DGRAM, 0);
+ if (s == -1) { RETVAL = 0; return; }
- EXTEND(SP, n);
- for (; n; --n, ++ifr)
- PUSHs(sv_2mortal(newSVpv(ifr->ifr_name, 0)));
- Safefree (ifc.ifc_req);
+ strcpy(req.ifr_name, device);
+ RETVAL = ioctl(s, SIOCGIFFLAGS, &req) == 0;
+ close(s);
+ OUTPUT:
+ RETVAL
int
addDefaultRoute(gateway)