Set the name of the current application which is stored in each command node. The input string is copied and it is the callers responibility to free `app'. The previous application name is returned.