#!/bin/sh
# (c) Robert Shingledecker 2010
# Called from startx to setup initial hackedbox system, tce, & ondemand menus.

writeMenuItem() {
busybox awk '
BEGIN {
  FS = "="
}
{
  if ( $1 == "Name") {
    name = $2
    gsub(/ /, "_", name)
  } else if ( $1 == "Exec" ) {
    exec = $2
    test = match(exec,"%")
    if ( test ) exec = substr(exec,0,test-1)
  } else if ( $1 == "Terminal" ) {
    terminal = $2
  }
}
END {
  if ( terminal == "true" ) {
     print "<Program label=\""name"\">exec aterm +tr +sb -T \""name"\" -e " exec"</Program>"
  } else {
    print "<Program label=\""name"\">exec "exec"</Program>"
  }
} ' "$1"
}
