Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
|
|
@ -0,0 +1,68 @@
|
|||
#COMPILE EXE
|
||||
#DIM ALL
|
||||
#COMPILER PBCC 6
|
||||
$PATH_SEPARATOR = "/"
|
||||
|
||||
FUNCTION CommonDirectoryPath(Paths() AS STRING) AS STRING
|
||||
LOCAL s AS STRING
|
||||
LOCAL i, j, k AS LONG
|
||||
k = 1
|
||||
DO
|
||||
FOR i = 0 TO UBOUND(Paths)
|
||||
IF i THEN
|
||||
IF INSTR(k, Paths(i), $PATH_SEPARATOR) <> j THEN
|
||||
EXIT DO
|
||||
ELSEIF LEFT$(Paths(i), j) <> LEFT$(Paths(0), j) THEN
|
||||
EXIT DO
|
||||
END IF
|
||||
ELSE
|
||||
j = INSTR(k, Paths(i), $PATH_SEPARATOR)
|
||||
IF j = 0 THEN
|
||||
EXIT DO
|
||||
END IF
|
||||
END IF
|
||||
NEXT i
|
||||
s = LEFT$(Paths(0), j + CLNG(k <> 1))
|
||||
k = j + 1
|
||||
LOOP
|
||||
FUNCTION = s
|
||||
|
||||
END FUNCTION
|
||||
|
||||
|
||||
FUNCTION PBMAIN () AS LONG
|
||||
|
||||
' testing the above function
|
||||
|
||||
LOCAL s() AS STRING
|
||||
LOCAL i AS LONG
|
||||
|
||||
REDIM s(0 TO 2)
|
||||
ARRAY ASSIGN s() = "/home/user1/tmp/coverage/test", _
|
||||
"/home/user1/tmp/covert/operator", _
|
||||
"/home/user1/tmp/coven/members"
|
||||
FOR i = 0 TO UBOUND(s()): CON.PRINT s(i): NEXT i
|
||||
CON.PRINT CommonDirectoryPath(s()) & " <- common"
|
||||
CON.PRINT
|
||||
|
||||
REDIM s(0 TO 3)
|
||||
ARRAY ASSIGN s() = "/home/user1/tmp/coverage/test", _
|
||||
"/home/user1/tmp/covert/operator", _
|
||||
"/home/user1/tmp/coven/members", _
|
||||
"/home/user1/abc/coven/members"
|
||||
FOR i = 0 TO UBOUND(s()): CON.PRINT s(i): NEXT i
|
||||
CON.PRINT CommonDirectoryPath(s()) & " <- common"
|
||||
CON.PRINT
|
||||
|
||||
REDIM s(0 TO 2)
|
||||
ARRAY ASSIGN s() = "/home/user1/tmp/coverage/test", _
|
||||
"/hope/user1/tmp/covert/operator", _
|
||||
"/home/user1/tmp/coven/members"
|
||||
FOR i = 0 TO UBOUND(s()): CON.PRINT s(i): NEXT i
|
||||
CON.PRINT CommonDirectoryPath(s()) & " <- common"
|
||||
CON.PRINT
|
||||
|
||||
CON.PRINT "hit any key to end program"
|
||||
CON.WAITKEY$
|
||||
|
||||
END FUNCTION
|
||||
Loading…
Add table
Add a link
Reference in a new issue