diff options
author | Ulrich Drepper <drepper@redhat.com> | 1997-05-07 15:31:21 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 1997-05-07 15:31:21 +0000 |
commit | 51702635af8445431054291c86aaace7c30b0970 (patch) | |
tree | e9cc4d28c401bd6046f71f62d186865d37c0141f /nis/nis_server.c | |
parent | 1f07e6177553845817af5f7c90f148edd2e59d32 (diff) | |
download | glibc-51702635af8445431054291c86aaace7c30b0970.tar.gz glibc-51702635af8445431054291c86aaace7c30b0970.tar.xz glibc-51702635af8445431054291c86aaace7c30b0970.zip |
Update. cvs/libc-ud-970507
* locale/categories.def: Change type of _NL_CTYPE_CLASS_NAMES and _NL_CTYPE_MAP_NAMES field to stringlist. Change name of _NL_CTYPE_CODESET_NAME to "charmap". * locale/localeinfo.h (enum value_type): Add stringlist. * locale/programs/locale.c (show_info): Handle stringlist. * locale/programs/charmap.c (charmap_read): If charmap file is not using the given name try to find it by looking through all available charmap files and compare the code set name. * locale/programs/locale.c (write_charmaps): Also print names of charset in <code_set_name> fields in the files. * elf/ldd.bash.in: Correct translatable strings. * posix/TESTS: Add some more tests for character class matching. * posix/regex.c: Merge with GNU awk version. (regex_compile): Use ISO C/amend 1 functions for character class handling. * posix/regex.h: Merge with GNU awk version. * posix/getopt.c: Declare as master copies. * posix/getopt1.c: Likewise. * posix/getopt.h: Likewise. * sysdeps/unix/sysv/linux/sys/mount.h: Add definitions for option value to mount functions. Patch by a sun <asun@zoology.washington.edu>. * stdio-common/bug4.c (main): Use /tmp/bug4.test for concurrency with other tests. * sunrpc/svc_run.c (svc_exit): New, defined. (svc_run): Test for svc_stop variable. * sysdeps/m68k/s_cexp.c: Rewritten. * sysdeps/m68k/s_cexpf.c: Likewise. * sysdeps/m68k/s_cexpl.c: Likewise.
Diffstat (limited to 'nis/nis_server.c')
-rw-r--r-- | nis/nis_server.c | 154 |
1 files changed, 69 insertions, 85 deletions
diff --git a/nis/nis_server.c b/nis/nis_server.c index 431fbe7f2a..393f6c6eb4 100644 --- a/nis/nis_server.c +++ b/nis/nis_server.c @@ -17,93 +17,104 @@ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +#include <string.h> #include <rpcsvc/nis.h> #include <rpcsvc/nislib.h> #include "nis_intern.h" nis_error -nis_mkdir (const_nis_name dir, const nis_server *server) +nis_servstate (const nis_server *serv, const nis_tag *tags, + const int numtags, nis_tag **result) { - nis_error res; + nis_taglist taglist; + nis_taglist tagres; + + tagres.tags.tags_len = 0; + tagres.tags.tags_val = NULL; + *result = NULL; + taglist.tags.tags_len = numtags; + taglist.tags.tags_val = (nis_tag *)tags; - if (server == NULL) + if (serv == NULL) { - int result; - if ((result = __do_niscall (NULL, 0, NIS_MKDIR, (xdrproc_t) xdr_nis_name, - (caddr_t) &dir, (xdrproc_t) xdr_nis_error, - (caddr_t) &res, 0)) != RPC_SUCCESS) - { - fprintf (stderr, _("__do_niscall: Error #%d\n"), result); - return NIS_RPCERROR; - } + if (__do_niscall (NULL, 0, NIS_SERVSTATE, (xdrproc_t) xdr_nis_taglist, + (caddr_t) &taglist, (xdrproc_t) xdr_nis_taglist, + (caddr_t) &tagres, 0) != RPC_SUCCESS) + return NIS_RPCERROR; } else { - int result; - if ((result = __do_niscall (server, 1, NIS_MKDIR, - (xdrproc_t) xdr_nis_name, - (caddr_t) &dir, (xdrproc_t) xdr_nis_error, - (caddr_t) &res, 0)) != RPC_SUCCESS) + if (__do_niscall (serv, 1, NIS_SERVSTATE, (xdrproc_t) xdr_nis_taglist, + (caddr_t) &taglist, (xdrproc_t) xdr_nis_taglist, + (caddr_t) &tagres, 0) != RPC_SUCCESS) + return NIS_RPCERROR; + } + if (tagres.tags.tags_len > 0) + { + u_long i; + + result = malloc (sizeof (nis_tag *) * tagres.tags.tags_len); + if (result == NULL) + return NIS_NOMEMORY; + for (i = 0; i < tagres.tags.tags_len; ++i) { - fprintf (stderr, _("__do_niscall: Error #%d\n"), result); - return NIS_RPCERROR; + result[i] = malloc (sizeof (nis_tag)); + if (result[i] == NULL) + return NIS_NOMEMORY; + result[i]->tag_val = strdup (tagres.tags.tags_val[i].tag_val); + result[i]->tag_type = tagres.tags.tags_val[i].tag_type; } } - return res; + return NIS_SUCCESS; } nis_error -nis_rmdir (const_nis_name dir, const nis_server *server) +nis_stats (const nis_server *serv, const nis_tag *tags, + const int numtags, nis_tag **result) { - nis_error res; + nis_taglist taglist; + nis_taglist tagres; - if (server == NULL) + tagres.tags.tags_len = 0; + tagres.tags.tags_val = NULL; + *result = NULL; + taglist.tags.tags_len = numtags; + taglist.tags.tags_val = (nis_tag *)tags; + + if (serv == NULL) { - int result; - if ((result = __do_niscall (NULL, 0, NIS_RMDIR, (xdrproc_t) xdr_nis_name, - (caddr_t) &dir, (xdrproc_t) xdr_nis_error, - (caddr_t) &res, 0)) != RPC_SUCCESS) - { - fprintf (stderr, _("__do_niscall: Error #%d\n"), result); - return NIS_RPCERROR; - } + if (__do_niscall (NULL, 0, NIS_STATUS, (xdrproc_t) xdr_nis_taglist, + (caddr_t) &taglist, (xdrproc_t) xdr_nis_taglist, + (caddr_t) &tagres, 0) != RPC_SUCCESS) + return NIS_RPCERROR; } else { - int result; - if ((result = __do_niscall (server, 1, NIS_RMDIR, - (xdrproc_t) xdr_nis_name, - (caddr_t) &dir, (xdrproc_t) xdr_nis_error, - (caddr_t) &res, 0)) != RPC_SUCCESS) + if (__do_niscall (serv, 1, NIS_STATUS, (xdrproc_t) xdr_nis_taglist, + (caddr_t) &taglist, (xdrproc_t) xdr_nis_taglist, + (caddr_t) &tagres, 0) != RPC_SUCCESS) + return NIS_RPCERROR; + } + if (tagres.tags.tags_len > 0) + { + u_long i; + + result = malloc (sizeof (nis_tag *) * tagres.tags.tags_len); + if (result == NULL) + return NIS_NOMEMORY; + for (i = 0; i < tagres.tags.tags_len; ++i) { - fprintf (stderr, _("__do_niscall: Error #%d\n"), result); - return NIS_RPCERROR; + result[i] = malloc (sizeof (nis_tag)); + if (result[i] == NULL) + return NIS_NOMEMORY; + result[i]->tag_val = strdup (tagres.tags.tags_val[i].tag_val); + result[i]->tag_type = tagres.tags.tags_val[i].tag_type; } } - return res; -} - -nis_error -nis_servstate (const nis_server *serv, const nis_tag *tags, - const int numtags, nis_tag **result) -{ - *result = NULL; - return NIS_FAIL; -} -stub_warning (nis_servstate) - -nis_error -nis_stats (const nis_server *serv, const nis_tag *tags, - const int numtags, nis_tag **result) -{ - result = malloc (sizeof (nis_tag *)); - if (result != NULL) - result[0] = NULL; - return NIS_FAIL; + return NIS_SUCCESS; } -stub_warning (nis_stats); void nis_freetags (nis_tag *tags, const int numtags) @@ -114,30 +125,3 @@ nis_freetags (nis_tag *tags, const int numtags) free (tags->tag_val); free (tags); } - -nis_server ** -nis_getservlist (const_nis_name dir) -{ - nis_server **serv; - - serv = malloc (sizeof (nis_server *)); - if (serv != NULL) - serv[0] = NULL; - - return serv; -} -stub_warning (nis_getservlist); - -void -nis_freeservlist (nis_server **serv) -{ - int i; - - if (serv == NULL) - return; - - i = 0; - while (serv[i] != NULL) - nis_free_servers (serv[i], 1); - free (serv); -} |