Rewrite of basename with libcmd, var.