[Index for tmp_for_tar/mcompat]
[Return to Master Index]
rmpath
(tmp_for_tar/mcompat/rmpath.m)
Function Synopsis
rmpath(...)
Help text
rmpath(dir1,...)
Removes dir1,... from the current LOADPATH.
For m****b compat.
Last modified: January 2000
Listing of function file tmp_for_tar/mcompat/rmpath.m
## rmpath(dir1,...)
##
## Removes dir1,... from the current LOADPATH.
##
## For m****b compat.
##
## Author: Etienne Grossmann <etienne@isr.ist.utl.pt>
## Last modified: January 2000
function rmpath(...)
while nargin--,
p = va_arg() ;
lp = length(p)
printf("removing %s\n",p);
# Nothing like perl for strings!
np = LOADPATH ;
lo = 0 ;
while lo != length(np), # Loop while I can substitute
lo = length(np) ;
np = strrep(np,[":",p,":"],":") ;
end
if length(np)>=lp,
# Check at beginning
f = index(np,p) ;
if f == 1 ,
printf("rmpath : removing from beginning\n") ;
if length(np) == lp ,
np = "" ;
elseif length(np) > lp && strcmp( np(lp+1),":" ) ,
np = np(lp+2:length(np)) ;
end
end
# Check at end
f = rindex(np,p) ;
if f == length(np)-lp+1 && length(np)-lp>0 && \
strcmp(np(length(np)-lp),":") ,
printf("rmpath : removing from end\n") ;
np = np(1:length(np)-lp-1) ;
end
end
end
## LOADPATH
## np
## keyboard
if !strcmp(LOADPATH,np),
printf("rmpath : loadpath is changed\n") ;
LOADPATH = np
end
Produced by oct2html on Tue Apr 4 20:42:02 2000
Cross-Directory links are: ON