1 /*
2 *
3 * Copyright (c) 2003 The Regents of the University of California. All
4 * rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:
9 *
10 * - Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 *
13 * - Neither the name of the University nor the names of its
14 * contributors may be used to endorse or promote products derived
15 * from this software without specific prior written permission.
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS''
18 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
19 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
20 * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR
21 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
22 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
23 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
24 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
25 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 *
29 */
30
31
32 /*
33 * part of liblink - helper library for dealing with links
34 *
35 * $Id: link_name.c,v 1.24 2005-01-20 19:00:51 girod Exp $
36 */
37
38 char link_name_cvsid[] = "$Id: link_name.c,v 1.24 2005-01-20 19:00:51 girod Exp $";
39
40 #include <stdio.h>
41 #include <stdlib.h>
42
43 #include "libmisc/misc.h"
44 #include "liblink_i.h"
45
46 char *link_name_s_nosim(char *name, char *suffix)
47 {
48 DECLARE_STATIC_BUF_RING(buf, 5, FUSD_MAX_NAME_LENGTH+1);
49
50 if (name == NULL) return NULL;
51
52 if (suffix)
53 sprintf(buf, "/dev/link/%s/%s", name, suffix);
54 else
55 sprintf(buf, "/dev/link/%s", name);
56
57 return buf;
58 }
59
60
61 char *link_name_s(char *name, char *suffix)
62 {
63 if (name == NULL) return NULL;
64 return sim_path(link_name_s_nosim(name, suffix));
65 }
66
67
68 char *link_name(link_opts_t *l_opts, char *suffix)
69 {
70 return l_opts ? link_name_s(l_opts->name, suffix) : NULL;
71 }
72
This page was automatically generated by the
LXR engine.
Visit the LXR main site for more
information.