20 lines
501 B
Plaintext
20 lines
501 B
Plaintext
DIM path$(3)
|
|
|
|
path$(1) = "/home/user1/tmp/coverage/test"
|
|
path$(2) = "/home/user1/tmp/covert/operator"
|
|
path$(3) = "/home/user1/tmp/coven/members"
|
|
|
|
PRINT FNcommonpath(path$(), "/")
|
|
END
|
|
|
|
DEF FNcommonpath(p$(), s$)
|
|
LOCAL I%, J%, O%
|
|
REPEAT
|
|
O% = I%
|
|
I% = INSTR(p$(1), s$, I%+1)
|
|
FOR J% = 2 TO DIM(p$(), 1)
|
|
IF LEFT$(p$(1), I%) <> LEFT$(p$(J%), I%) EXIT REPEAT
|
|
NEXT J%
|
|
UNTIL I% = 0
|
|
= LEFT$(p$(1), O%-1)
|