#! /usr/bin/perl use CGI (':standard'); use IPC::Run ('run'); use MIME::Base32 ('RFC'); use Sys::Syslog (':standard', ':macros'); use HTML::Template; $template = << 'END'; EyeBot Cross Compiler 6.5

EyeBot Cross Compiler 6.5

Enter the path of your source file.
Compile with or ?
Notes:
Tip:
In Windows NT, 2K or XP, if you create a ".bat" file containing the below three lines, you can then drag-and-drop your ".hex" files onto the batch file in Windows Explorer to quickly send them to the EyeBot connected to your COM port.
@echo off
mode com1: baud=115200 parity=n data=8 stop=1 to=off xon=off odsr=off octs=on dtr=off rts=hs idsr=off > nul
copy /b %1 com1: > nul
Resources:
END $robios = '/usr/local/robios'; $uploads = '/roboti/html/eyebot'; $session = MIME::Base32::encode(sprintf('%s.%s', $ENV{'REMOTE_ADDR'}, time() % 1000)); $ENV{'ROBIOS'} = $robios; $ENV{'PATH'} .= ":/usr/local/bin:$robios/bin/linux"; $q = CGI->new(); $t = HTML::Template->new('scalarref' => \$template); print header(); if ($q->param()) { LogIt(); if ($fhandle = upload('filename')) { $filename = pop(@{[split(/\\\//, $q->param('filename'))]}); # remove leading path if present $filename = substr($filename, 0, rindex($filename, '.')) if (rindex($filename, '.') != -1); # remove filename extension if present $filename =~ s/[^0-9A-Za-z\.\-_]//g; # remove non alpha-numerics if present $compiler = $robios . '/bin/linux/' . (($q->param('compiler') eq 'gcc68') ? 'gcc68' : 'gcchdt'); run [ '/bin/bash', '-c', "mkdir -p $uploads/$session; cd $uploads/$session; dos2unix > $filename.c; $compiler -o $filename.hex $filename.c; rm $filename.elf $filename.c" ], $fhandle, \$out, \$err; $t->param('out', $out); $t->param('err', $err); $t->param('hex', "$filename.hex") if (-e "$uploads/$session/$filename.hex"); } } print $t->output(); sub LogIt { openlog('robios', 'cons', LOG_USER); syslog(LOG_INFO, '%s %s', $ENV{'REMOTE_ADDR'}, $q->param('compiler')); closelog(); }