Plan 9 from Bell Labs’s /usr/web/sources/contrib/de0u/root/sys/src/cmd/divergefs/filepath.h

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.



/** copy from to self */
void filepath_copy(String **self, String *from);

/** appends slash and name to self */
void filepath_append(String **self, char *name);

/** convience function for allocating new string appending path for c strings */
char *filepath_append_cstr(char *path, char *name);

/** removes everything after last slash including the slash */
void filepath_remove_last(String *self);

/** remove the last element in the path, and replace with newname */
void filepath_replace_last(String **self, char *newname);

/** returns true if self includes a slash as first character, false otherwise */
bool filepath_isabsolute(String *self);

/** returns !filepath_isabsolute */
bool filepath_isrelative(String *self);

/** make self an absolute path if it's not already one by prepending getwd() */
void filepath_make_absolute(String **self);

/** convience function that return a newly allocated absolute path */
char *filepath_make_absolute_cstr(char *path);

enum { FILEPATH_BUFFER_MAX = 4096 };


Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to [email protected].