* Initialization
let space = chr(32)
let tmpfile = strcat("/dd/tmp/si.", right($("date -j":q), 5))

* Get device names (redirecting to temp file)
* We must get this information line by line,
* so mshell's $("command") construction can't be used

do execute(var_rep("devs!grep samba>-%tmpfile"))

* Open temp file
if(assign(fd, open(%tmpfile, READ)) < 0)
   print("Error reading temp file, aborting...\n")
   end 
endif

echo "Device     Type     Mounted by   Internet addr    Resource"
echo "---------- -------- ------------ ---------------- ------------------"
* Main cycle
while(readln(%fd, str) > 0)
   if(assign(pos, index(%str, %space)))
      let dev = left(%str, %pos-1)
      smbmount %dev -i
   endif
endwhile

* Cleaning
do close(%fd)
del -f %tmpfile

end
