rewite cmdtok function