public inbox for glibc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Adhemerval Zanella <azanella@sourceware.org>
To: glibc-cvs@sourceware.org
Subject: [glibc/azanella/clang] nis: Fix nis_print_directory
Date: Fri, 13 May 2022 14:15:58 +0000 (GMT)	[thread overview]
Message-ID: <20220513141558.99151396E058@sourceware.org> (raw)

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=fc4d4f9319a96426f1a8e7c473ca544f050254f6

commit fc4d4f9319a96426f1a8e7c473ca544f050254f6
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date:   Thu Mar 10 17:10:39 2022 -0300

    nis: Fix nis_print_directory

Diff:
---
 nis/nis_print.c | 59 +++++++++++++++++++++++++++------------------------------
 1 file changed, 28 insertions(+), 31 deletions(-)

diff --git a/nis/nis_print.c b/nis/nis_print.c
index d0efd98e86..2708c29ef0 100644
--- a/nis/nis_print.c
+++ b/nis/nis_print.c
@@ -52,6 +52,32 @@ nis_nstype2str (const nstype type)
     }
 }
 
+static const char *
+nis_objtype (const zotypes type)
+{
+  switch (type)
+    {
+    case NIS_BOGUS_OBJ:
+      return _("BOGUS OBJECT");
+    case NIS_NO_OBJ:
+      return _("NO OBJECT");
+    case NIS_DIRECTORY_OBJ:
+      return _("DIRECTORY");
+    case NIS_GROUP_OBJ:
+      return _("GROUP");
+    case NIS_TABLE_OBJ:
+      return _("TABLE");
+    case NIS_ENTRY_OBJ:
+      return _("ENTRY");
+    case NIS_LINK_OBJ:
+      return _("LINK");
+    case NIS_PRIVATE_OBJ:
+      return _("PRIVATE\n");
+    default:
+      return _("(Unknown object");
+    }
+}
+
 static void
 print_ttl (const uint32_t ttl)
 {
@@ -103,36 +129,7 @@ print_flags (const unsigned int flags)
 static void
 nis_print_objtype (enum zotypes type)
 {
-  switch (type)
-    {
-    case NIS_BOGUS_OBJ:
-      fputs (_("BOGUS OBJECT\n"), stdout);
-      break;
-    case NIS_NO_OBJ:
-      fputs (_("NO OBJECT\n"), stdout);
-      break;
-    case NIS_DIRECTORY_OBJ:
-      fputs (_("DIRECTORY\n"), stdout);
-      break;
-    case NIS_GROUP_OBJ:
-      fputs (_("GROUP\n"), stdout);
-      break;
-    case NIS_TABLE_OBJ:
-      fputs (_("TABLE\n"), stdout);
-      break;
-    case NIS_ENTRY_OBJ:
-      fputs (_("ENTRY\n"), stdout);
-      break;
-    case NIS_LINK_OBJ:
-      fputs (_("LINK\n"), stdout);
-      break;
-    case NIS_PRIVATE_OBJ:
-      fputs (_("PRIVATE\n"), stdout);
-      break;
-    default:
-      fputs (_("(Unknown object)\n"), stdout);
-      break;
-    }
+  printf ("%s\n", nis_objtype (type));
 }
 
 void
@@ -236,7 +233,7 @@ nis_print_directory (const directory_obj *dir)
       for (i = 0; i < dir->do_armask.do_armask_len; i++)
 	{
 	  nis_print_rights (ptr->oa_rights);
-	  printf (_("\tType         : %s\n"), nis_nstype2str (ptr->oa_otype));
+	  printf (_("\tType         : %s\n"), nis_objtype (ptr->oa_otype));
 	  fputs (_("\tAccess rights: "), stdout);
 	  nis_print_rights (ptr->oa_rights);
 	  fputs ("\n", stdout);


             reply	other threads:[~2022-05-13 14:15 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-13 14:15 Adhemerval Zanella [this message]
  -- strict thread matches above, loose matches on Subject: below --
2022-10-04 12:55 Adhemerval Zanella
2022-06-09 21:16 Adhemerval Zanella
2022-06-09 13:12 Adhemerval Zanella
2022-06-03 14:02 Adhemerval Zanella
2022-05-12 19:29 Adhemerval Zanella
2022-05-10 18:20 Adhemerval Zanella
2022-04-29 14:00 Adhemerval Zanella
2022-04-04 12:50 Adhemerval Zanella
2022-03-31 19:02 Adhemerval Zanella
2022-03-29 20:25 Adhemerval Zanella
2022-03-16 18:03 Adhemerval Zanella
2022-03-15 18:40 Adhemerval Zanella
2022-03-11 17:25 Adhemerval Zanella

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220513141558.99151396E058@sourceware.org \
    --to=azanella@sourceware.org \
    --cc=glibc-cvs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).