*! NJC 1.2.3 14 December 1999
* NJC 1.2.2 6 December 1999
* NJC 1.2.1 1 December 1999
program def adotype, rclass
        version 6.0

	if "`1'" == "" | "`2'" != "" {
		di in r "incorrect syntax"
		exit 198
	}
	args cmd

	local dotado = index("`cmd'",".ado")
	if `dotado' {
		local cmd = substr("`cmd'",1,`dotado'-1)
	}

        local init = substr("`cmd'",1,1)
	local sep : dirsep

	tokenize `"$S_ADO"', parse(";")

	while `"`1'"' != "" {
		if `"`1'"' != ";" {
			local 1 : sysdir `1'
			local j = 1
			while `j' <= 2 {
				local jj = cond(`j'==1,"", "`init'`sep'")
				local file `"`1'`jj'`cmd'.ado"'
				capture type `"`file'"'
		        	if _rc == 0 {
                			di in g `"`file':"' _n
			                type `"`file'"'
					return local file `"`file'"'
					exit 0
				}
				local j = `j' + 1
			}
       		}
		mac shift
        }

	* got to here: did not find it
	which `cmd'
end