Update.
[glibc/history.git] / nis / nis_server.c
blob431fbe7f2aac45399985f67f238bc1ceb1849d45
1 /* Copyright (c) 1997 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
3 Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1997.
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Library General Public License as
7 published by the Free Software Foundation; either version 2 of the
8 License, or (at your option) any later version.
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Library General Public License for more details.
15 You should have received a copy of the GNU Library General Public
16 License along with the GNU C Library; see the file COPYING.LIB. If not,
17 write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA. */
20 #include <rpcsvc/nis.h>
21 #include <rpcsvc/nislib.h>
22 #include "nis_intern.h"
24 nis_error
25 nis_mkdir (const_nis_name dir, const nis_server *server)
27 nis_error res;
29 if (server == NULL)
31 int result;
32 if ((result = __do_niscall (NULL, 0, NIS_MKDIR, (xdrproc_t) xdr_nis_name,
33 (caddr_t) &dir, (xdrproc_t) xdr_nis_error,
34 (caddr_t) &res, 0)) != RPC_SUCCESS)
36 fprintf (stderr, _("__do_niscall: Error #%d\n"), result);
37 return NIS_RPCERROR;
40 else
42 int result;
43 if ((result = __do_niscall (server, 1, NIS_MKDIR,
44 (xdrproc_t) xdr_nis_name,
45 (caddr_t) &dir, (xdrproc_t) xdr_nis_error,
46 (caddr_t) &res, 0)) != RPC_SUCCESS)
48 fprintf (stderr, _("__do_niscall: Error #%d\n"), result);
49 return NIS_RPCERROR;
53 return res;
56 nis_error
57 nis_rmdir (const_nis_name dir, const nis_server *server)
59 nis_error res;
61 if (server == NULL)
63 int result;
64 if ((result = __do_niscall (NULL, 0, NIS_RMDIR, (xdrproc_t) xdr_nis_name,
65 (caddr_t) &dir, (xdrproc_t) xdr_nis_error,
66 (caddr_t) &res, 0)) != RPC_SUCCESS)
68 fprintf (stderr, _("__do_niscall: Error #%d\n"), result);
69 return NIS_RPCERROR;
72 else
74 int result;
75 if ((result = __do_niscall (server, 1, NIS_RMDIR,
76 (xdrproc_t) xdr_nis_name,
77 (caddr_t) &dir, (xdrproc_t) xdr_nis_error,
78 (caddr_t) &res, 0)) != RPC_SUCCESS)
80 fprintf (stderr, _("__do_niscall: Error #%d\n"), result);
81 return NIS_RPCERROR;
85 return res;
88 nis_error
89 nis_servstate (const nis_server *serv, const nis_tag *tags,
90 const int numtags, nis_tag **result)
92 *result = NULL;
93 return NIS_FAIL;
95 stub_warning (nis_servstate)
97 nis_error
98 nis_stats (const nis_server *serv, const nis_tag *tags,
99 const int numtags, nis_tag **result)
101 result = malloc (sizeof (nis_tag *));
102 if (result != NULL)
103 result[0] = NULL;
104 return NIS_FAIL;
106 stub_warning (nis_stats);
108 void
109 nis_freetags (nis_tag *tags, const int numtags)
111 int i;
113 for (i = 0; i < numtags; ++i)
114 free (tags->tag_val);
115 free (tags);
118 nis_server **
119 nis_getservlist (const_nis_name dir)
121 nis_server **serv;
123 serv = malloc (sizeof (nis_server *));
124 if (serv != NULL)
125 serv[0] = NULL;
127 return serv;
129 stub_warning (nis_getservlist);
131 void
132 nis_freeservlist (nis_server **serv)
134 int i;
136 if (serv == NULL)
137 return;
139 i = 0;
140 while (serv[i] != NULL)
141 nis_free_servers (serv[i], 1);
142 free (serv);