Added a test for MUIA_Listview_SelectChange.
[AROS.git] / rom / dos / pathpart.c
blob8849c43ab32c5e96e8147ed8476ededac787df25
1 /*
2 Copyright © 1995-2008, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc: Return a pointer to after the directories in a path.
6 Lang: English
7 */
8 #ifndef TEST
9 # include "dos_intern.h"
10 #else
11 # define AROS_LH1(t,fn,a1,bt,bn,o,lib) t fn (a1)
12 # define AROS_LHA(t,n,r) t n
13 # define AROS_LIBFUNC_INIT
14 # define AROS_LIBFUNC_EXIT
15 # define CLIB_DOS_PROTOS_H
16 # include <exec/types.h>
17 #endif
19 /*****************************************************************************
21 NAME */
22 #include <proto/dos.h>
24 AROS_LH1(STRPTR, PathPart,
26 /* SYNOPSIS */
27 AROS_LHA(CONST_STRPTR, path, D1),
29 /* LOCATION */
30 struct DosLibrary *, DOSBase, 146, Dos)
32 /* FUNCTION
33 Returns a pointer to the character after the last
34 directory in path (see examples).
36 INPUTS
37 path - Search this path.
39 RESULT
40 A pointer to a character in path.
42 NOTES
44 EXAMPLE
45 PathPart("xxx:yyy/zzz/qqq") would return a pointer to the last '/'.
46 PathPart("xxx:yyy") would return a pointer to the first 'y').
48 BUGS
50 SEE ALSO
52 INTERNALS
54 *****************************************************************************/
56 AROS_LIBFUNC_INIT
58 const char *ptr;
60 /* '/' at the beginning of the string really is part of the path */
61 while (*path == '/')
63 ++path;
66 ptr = path;
68 while (*ptr)
70 if (*ptr == '/')
72 path = ptr;
74 else if (*ptr == ':')
76 path = ptr + 1;
79 ptr++;
82 return (STRPTR)path;
83 AROS_LIBFUNC_EXIT
84 } /* PathPart */
86 #ifdef TEST
88 # include <stdio.h>
90 int main (int argc, char ** argv)
92 UWORD i;
93 STRPTR s,fileptr;
95 while (--argc)
97 s = *++argv;
98 fileptr = PathPart(s);
100 printf("Pfad: %s\nErg.: %s\n", s, fileptr);
104 #endif /* TEST */