Does this help clarify?

Cheers,


Nick
-- 
Nick Phillips / nick.phill...@otago.ac.nz / 03 479 4195
# These statements are mine, not those of the University of Otago
Index: ocsinventory-agent-2.0.5/lib/Ocsinventory/Agent/Backend/OS/Generic/Screen.pm
===================================================================
--- ocsinventory-agent-2.0.5.orig/lib/Ocsinventory/Agent/Backend/OS/Generic/Screen.pm	2012-04-02 02:12:25.000000000 +1200
+++ ocsinventory-agent-2.0.5/lib/Ocsinventory/Agent/Backend/OS/Generic/Screen.pm	2015-03-24 12:23:21.475677751 +1300
@@ -607,12 +607,35 @@
 
   eval "use MIME::Base64;";
   $base64 = encode_base64($raw_edid) if !$@;
-  if (can_run("uuencode")) {
-    chomp($uuencode = `echo $raw_edid|uuencode -`);
-    if (!$base64) {
-      chomp($base64 = `echo $raw_edid|uuencode -m -`);
-    }
+
+  $uuencode = "begin 644 -\n";
+  while ($raw_edid =~ m/\G(.{1,45})/sgc) {
+      $uuencode .= pack("u", $1);
   }
+  $uuencode .= "`\nend";
+
+  if (!$base64) {
+      $base64 = "";
+      my ($string, $mod3, $enc);
+      $raw_edid = $raw_edid . "";
+      while ($raw_edid =~ m/\G(.{1,45})/sgc) {
+  	  $string = $1;
+  	  $mod3 - length($string) % 3;
+  	  $string .= "\0", $mod3 -= 3 if $mod3;
+  	  $enc = pack("u", $string);
+  	  $enc =~ s/.//;
+  	  $enc =~ tr#`!-_#A-Za-z0-9+/#;
+  	  substr($enc, $mod3) =~ tr/A/=/;
+  	  $base64 .= $enc;
+      }
+  }      
+
+#  if (can_run("uuencode")) {
+#    chomp($uuencode = `echo $raw_edid|uuencode -`);
+#    if (!$base64) {
+#      chomp($base64 = `echo $raw_edid|uuencode -m -`);
+#    }
+#  }
   $common->addMonitors ({
 
       BASE64 => $base64,

Reply via email to