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

writeMenuItem() {
busybox awk '
BEGIN {
  FS = "="
}

{
  if ( $1 == "Name") {
    name = $2
  } else if ( $1 == "Exec" ) {
    exec = $2 $3 $4
    test = match(exec,"%")
    if ( test ) exec = substr(exec,0,test-1)
  } else if ( $1 == "Terminal" ) {
    terminal = $2
  } 
}
END {
  if ( terminal == "true" ) {
     print "prog \""name"\" \"-\" aterm +tr +sb -T \""name"\" -e " exec""
  } else {
     print "prog \""name"\" \"-\" "exec""
  }
} ' "$1"
}
