355b4669e025ff377602b6fc7caaf30dbc218371jacobs * CDDL HEADER START
355b4669e025ff377602b6fc7caaf30dbc218371jacobs * The contents of this file are subject to the terms of the
355b4669e025ff377602b6fc7caaf30dbc218371jacobs * Common Development and Distribution License (the "License").
355b4669e025ff377602b6fc7caaf30dbc218371jacobs * You may not use this file except in compliance with the License.
355b4669e025ff377602b6fc7caaf30dbc218371jacobs * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
355b4669e025ff377602b6fc7caaf30dbc218371jacobs * See the License for the specific language governing permissions
355b4669e025ff377602b6fc7caaf30dbc218371jacobs * and limitations under the License.
355b4669e025ff377602b6fc7caaf30dbc218371jacobs * When distributing Covered Code, include this CDDL HEADER in each
355b4669e025ff377602b6fc7caaf30dbc218371jacobs * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
355b4669e025ff377602b6fc7caaf30dbc218371jacobs * If applicable, add the following below this CDDL HEADER, with the
355b4669e025ff377602b6fc7caaf30dbc218371jacobs * fields enclosed by brackets "[]" replaced with your own identifying
355b4669e025ff377602b6fc7caaf30dbc218371jacobs * information: Portions Copyright [yyyy] [name of copyright owner]
355b4669e025ff377602b6fc7caaf30dbc218371jacobs * CDDL HEADER END
23a1ccea6aac035f084a7a4cdc968687d1b02dafRoger A. Faulkner * Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
355b4669e025ff377602b6fc7caaf30dbc218371jacobs/* $Id: uri.c 146 2006-03-24 00:26:54Z njacobs $ */
355b4669e025ff377602b6fc7caaf30dbc218371jacobs/*LINTLIBRARY*/
355b4669e025ff377602b6fc7caaf30dbc218371jacobs * This will handle the following forms:
355b4669e025ff377602b6fc7caaf30dbc218371jacobs * scheme:scheme_data
355b4669e025ff377602b6fc7caaf30dbc218371jacobs * scheme://[[user[:password]@]host[:port]]/path[[#fragment]|[?query]]
355b4669e025ff377602b6fc7caaf30dbc218371jacobs return (-1);
355b4669e025ff377602b6fc7caaf30dbc218371jacobs /* find the scheme:scheme_part split */
355b4669e025ff377602b6fc7caaf30dbc218371jacobs return (-1);
355b4669e025ff377602b6fc7caaf30dbc218371jacobs return (-1);
355b4669e025ff377602b6fc7caaf30dbc218371jacobs * scheme://[host_part]/[path_part]
355b4669e025ff377602b6fc7caaf30dbc218371jacobs char *end = NULL, *user = NULL, *host = NULL, *path = NULL;
355b4669e025ff377602b6fc7caaf30dbc218371jacobs /* string to host is the user part */
355b4669e025ff377602b6fc7caaf30dbc218371jacobs /* host+1 to end is the host part */
355b4669e025ff377602b6fc7caaf30dbc218371jacobs for (password = user; (password < host - 1); password++)
355b4669e025ff377602b6fc7caaf30dbc218371jacobs } else { /* scheme:scheme_part */
c1ecd8b9404ee0d96d93f02e82c441b9bb149a3djacobs if ((u->host_part == NULL) && (u->path_part == NULL) &&
c1ecd8b9404ee0d96d93f02e82c441b9bb149a3djacobs return (-1);
355b4669e025ff377602b6fc7caaf30dbc218371jacobs return (0);
355b4669e025ff377602b6fc7caaf30dbc218371jacobsuri_to_string(uri_t *uri, char *buffer, size_t buflen)
355b4669e025ff377602b6fc7caaf30dbc218371jacobs if ((uri == NULL) || (buffer == NULL) || (buflen == 0) ||
355b4669e025ff377602b6fc7caaf30dbc218371jacobs return (-1);
e059026e2da8f12ef0ebea9d686d67f32660cfc0Keerthi Kondaka if (uri->path == NULL || uri->path[0] == '/')
e059026e2da8f12ef0ebea9d686d67f32660cfc0Keerthi Kondaka "%s://%s%s%s%s%s%s%s%s%s%s%s%s%s",
355b4669e025ff377602b6fc7caaf30dbc218371jacobs (void) snprintf(buffer, buflen, "%s:%s", uri->scheme,
355b4669e025ff377602b6fc7caaf30dbc218371jacobs return (0);
355b4669e025ff377602b6fc7caaf30dbc218371jacobs /* help me debug */
355b4669e025ff377602b6fc7caaf30dbc218371jacobs /* help me debug */
355b4669e025ff377602b6fc7caaf30dbc218371jacobs printf(" failed for %s (%s)\n", argv[1], strerror(errno));
355b4669e025ff377602b6fc7caaf30dbc218371jacobs#endif /* DEADBEEF */