Minor nitpick: this won't work for the (admittedly contrived) case of appname("0"), you might want to use defined() on the argument passed here.