.key mypath/a,askuser
;
;   $VER: CheckDir 1.0 (23.09.93)
;
;   Written 21. September 1993 by J.Matern
;   This file is part of the 'UpTime'-package © by Jürgen Matern.
;   The package may be redistributed under limitations discribed
;   in the file 'UpTime.doc' which should have come with this
;   distribution. Read this file for more information!
;
;   Last changed: 23. September 1993
;
set retcode 0
unset askuser
set askuser <askuser>
if not exists "<mypath>"
   if $askuser not eq "*$askuser"
      echo "*N '<mypath>' does not exist."
      echo " Shall I create it (y/n)? " noline
      set >nil: yesno ?
      if $yesno eq y
         skip create
      endif
      set retcode 5
      skip end
   endif
   lab create
   makedir "<mypath>"
   if warn
      echo "*N Failed to create '<mypath>'."
      set retcode 5
      skip end
   endif
else
   set fromdir `cd`
   cd >nil: "<mypath>"
   if warn
      echo "*N Desired destination exists already as file!"
      echo " Can't create directory: '<mypath>'."
      cd $fromdir
      set retcode 5
      skip end
   endif
   cd $fromdir
endif

lab end
unset askuser
