The issue here was emulating a check box in a console, not representing true and false in the code. That would be confusing if I was trying to do that in the code, but this is just to print.
Wesley Erich Focht wrote: > On Thursday 27 July 2006 19:24, Bernard Li wrote: > >> Hey Wesley: >> >> Wouldn't it be better to have a function which returns "true" or "false" >> instead of creating extra variables to hold the string? >> >> Also, there might already be a built-in function to convert 0 to false >> and 1 to true - not 100% positive though. >> > > Aehm, 0 means logically "false", 1 means "true". > > if (1) # is allways true > if (0) # is allways false > if (!0) # is true, too. > > No need to add string compares here, this is overkill and makes code actually > less readable. At least to programmers... > > But maybe I misunderstood the issue... > > Regards, > Erich > > >> Cheers, >> >> Bernard >> >> >>> -----Original Message----- >>> From: [EMAIL PROTECTED] >>> [mailto:[EMAIL PROTECTED] On >>> Behalf Of [EMAIL PROTECTED] >>> Sent: Thursday, July 27, 2006 10:05 >>> To: [EMAIL PROTECTED] >>> Subject: [Oscar-checkins] r5238 - trunk/lib/OSCAR >>> >>> Author: wesbland >>> Date: 2006-07-27 13:05:12 -0400 (Thu, 27 Jul 2006) >>> New Revision: 5238 >>> >>> Modified: >>> trunk/lib/OSCAR/MAC.pm >>> Log: >>> Replaced the 1 and 0 with true and false. Also added a return code. >>> >>> >>> Modified: trunk/lib/OSCAR/MAC.pm >>> =================================================================== >>> --- trunk/lib/OSCAR/MAC.pm 2006-07-27 17:04:39 UTC (rev 5237) >>> +++ trunk/lib/OSCAR/MAC.pm 2006-07-27 17:05:12 UTC (rev 5238) >>> @@ -1180,6 +1180,8 @@ >>> >>> #Start printing the menu >>> cli_menu($autofile); >>> + >>> + return 0; >>> } >>> >>> #The interface for the cli version of the MAC setup >>> @@ -1200,12 +1202,26 @@ >>> if($auto) {open(FILE, "$infile") || die "Can't open the >>> input file\n";} >>> >>> while (!$done) { >>> + # Make text representations of the true/false for #4 & #6 >>> + my $dyndhcptxt; >>> + my $uyoktxt; >>> + if($dyndhcp) { >>> + $dyndhcptxt = "true"; >>> + } else { >>> + $dyndhcptxt = "false"; >>> + } >>> + if($uyok) { >>> + $uyoktxt = "true"; >>> + } else { >>> + $uyoktxt = "false"; >>> + } >>> + >>> print "1) Import MACs from file\n" . >>> "2) Installation Mode: $install_mode\n" . >>> "3) Enable Install Mode\n" . >>> - "4) Dynamic DHCP update: $dyndhcp\n" . >>> + "4) Dynamic DHCP update: $dyndhcptxt\n" . >>> "5) Configure DHCP Server\n" . >>> - "6) Enable UYOK: $uyok\n" . >>> + "6) Enable UYOK: $uyoktxt\n" . >>> "7) Build AutoInstall CD\n" . >>> "8) Setup Network Boot\n" . >>> "9) Finish\n" . >>> >>> >>> -------------------------------------------------------------- >>> > > ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys -- and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV _______________________________________________ Oscar-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/oscar-devel
