Lines Matching refs:path

48 static int berval_from_file( const char *path, struct berval *bvp,
52 * Convert a file URL to a local path.
64 * file:///path
65 * file:/path
66 * file://localhost/path
67 * file://host/path (rejected with a ...NONLOCAL error)
71 * path. Otherwise, the leading slash is returned.
77 const char *path;
87 path = fileurl + 5; /* skip past "file:" scheme prefix */
89 if ( *path != '/' ) {
93 ++path; /* skip past '/' at end of "file:/" */
95 if ( *path == '/' ) {
96 ++path; /* remainder is now host/path or /path */
97 if ( *path != '/' ) {
101 if ( str_starts_with( path, "localhost/" )) {
102 path += 9;
107 } else { /* URL is of the form file:/path */
108 --path;
112 * The remainder is now of the form /path. On Windows, skip past the
116 if ( isalpha( path[1] ) && ( path[2] == '|' || path[2] == ':' )) {
117 ++path;
122 * Duplicate the path so we can safely alter it.
125 if (( pathcopy = strdup( path )) == NULL ) {
134 * at the beginning of the path, replace the '|' with a ':'.
157 * Convert a local path to a file URL.
164 * This function produces file URLs of the form file:path.
170 ldaptool_path2fileurl( char *path, char **urlp )
174 if ( NULL == path ) {
175 path = "/";
179 * Allocate space for the URL, taking into account that path may
182 if (( url = malloc( strlen( prefix ) + 3 * strlen( path ) + 1 )) == NULL ) {
194 if ( isalpha( path[0] ) && path[1] == ':' ) {
195 *p++ = path[0];
197 path += 2;
203 * Append the path, encoding any URL-special characters using the %HH
205 * On Windows, convert backwards slashes in the path to forward ones.
207 strcpy_escaped_and_convert( p, path );
261 char *path;
263 rc = ldaptool_fileurl2path( url, &path );
273 " missing path.\n"), ldaptool_progname, url );
288 if ( stat( path, &fstats ) != 0 ) {
289 if ( reporterrs ) perror( path );
293 ldaptool_progname, path );
296 rc = berval_from_file( path, bvp, reporterrs );
298 free( path );
348 * Populate *bvp with the contents of the file named by "path".
359 berval_from_file( const char *path, struct berval *bvp, int reporterrs )
371 if (( fp = fopen( path, mode )) == NULL ) {
373 if (( fp = ldaptool_open_file( path, mode )) == NULL ) {
375 if ( reporterrs ) perror( path );
380 if ( reporterrs ) perror( path );
394 if ( reporterrs ) perror( path );
404 if ( reporterrs ) perror( path );