]> git.ipfire.org Git - thirdparty/shadow.git/commitdiff
lib/shadow/, lib/: getsgent(): Move to separate file
authorAlejandro Colomar <alx@kernel.org>
Sun, 10 Nov 2024 18:04:06 +0000 (19:04 +0100)
committerIker Pedrosa <ikerpedrosam@gmail.com>
Tue, 7 Oct 2025 09:03:09 +0000 (11:03 +0200)
Signed-off-by: Alejandro Colomar <alx@kernel.org>
lib/Makefile.am
lib/gshadow.c [deleted file]
lib/gshadow_.h
lib/shadow/gshadow/getsgent.c [new file with mode: 0644]
lib/shadow/gshadow/getsgent.h [new file with mode: 0644]
lib/shadow/gshadow/getsgnam.c
po/POTFILES.in

index 300162b582213a20e5ce9b8945ad00104c9d85fe..10b7d176c0550816efa469a2c2e6e4c5af30cf0d 100644 (file)
@@ -119,7 +119,6 @@ libshadow_la_SOURCES = \
        groupio.c \
        groupmem.c \
        groupio.h \
-       gshadow.c \
        hushed.c \
        idmapping.h \
        idmapping.c \
@@ -178,6 +177,8 @@ libshadow_la_SOURCES = \
        shadow/gshadow/endsgent.h \
        shadow/gshadow/fgetsgent.c \
        shadow/gshadow/fgetsgent.h \
+       shadow/gshadow/getsgent.c \
+       shadow/gshadow/getsgent.h \
        shadow/gshadow/getsgnam.c \
        shadow/gshadow/getsgnam.h \
        shadow/gshadow/gshadow.c \
diff --git a/lib/gshadow.c b/lib/gshadow.c
deleted file mode 100644 (file)
index b16ca47..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * SPDX-FileCopyrightText: 1990 - 1994, Julianne Frances Haugh
- * SPDX-FileCopyrightText: 1996 - 1998, Marek Michałkiewicz
- * SPDX-FileCopyrightText: 2005       , Tomasz Kłoczko
- * SPDX-FileCopyrightText: 2008 - 2009, Nicolas François
- *
- * SPDX-License-Identifier: BSD-3-Clause
- */
-
-#include "config.h"
-
-#if defined(SHADOWGRP) && !__has_include(<gshadow.h>)
-
-#ident "$Id$"
-
-#include <stddef.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "defines.h"
-#include "prototypes.h"
-#include "shadow/gshadow/fgetsgent.h"
-#include "shadow/gshadow/gshadow.h"
-#include "shadow/gshadow/setsgent.h"
-#include "shadow/gshadow/sgrp.h"
-#include "string/strcmp/streq.h"
-
-
-/*
- * getsgent - get a single shadow group entry
- */
-
-/*@observer@*//*@null@*/struct sgrp *getsgent (void)
-{
-       if (NULL == gshadow) {
-               setsgent ();
-       }
-       return fgetsgent(gshadow);
-}
-#else
-extern int ISO_C_forbids_an_empty_translation_unit;
-#endif  // !SHADOWGRP
index ed7f6a9f300b3735f38a9d6ab5137d63302db7e5..f2015dcde08e39820b6e0ba81aa77e89b0511a44 100644 (file)
 
 #include <config.h>
 
-#include "shadow/gshadow/sgrp.h"
-
-
-/*@observer@*//*@null@*/struct sgrp *getsgent (void);
 
 #define        GSHADOW "/etc/gshadow"
 
diff --git a/lib/shadow/gshadow/getsgent.c b/lib/shadow/gshadow/getsgent.c
new file mode 100644 (file)
index 0000000..0e4c559
--- /dev/null
@@ -0,0 +1,31 @@
+// SPDX-FileCopyrightText: 1990-1994, Julianne Frances Haugh
+// SPDX-FileCopyrightText: 1996-1998, Marek Michałkiewicz
+// SPDX-FileCopyrightText: 2005, Tomasz Kłoczko
+// SPDX-FileCopyrightText: 2008-2009, Nicolas François
+// SPDX-FileCopyrightText: 2024, Alejandro Colomar <alx@kernel.org>
+// SPDX-License-Identifier: BSD-3-Clause
+
+
+#include "config.h"
+
+#include "shadow/gshadow/getsgent.h"
+
+#include <stddef.h>
+
+#include "shadow/gshadow/fgetsgent.h"
+#include "shadow/gshadow/gshadow.h"
+#include "shadow/gshadow/setsgent.h"
+#include "shadow/gshadow/sgrp.h"
+
+
+#if defined(SHADOWGRP) && !__has_include(<gshadow.h>)
+// get-next shadow group entry
+struct sgrp *
+getsgent(void)
+{
+       if (NULL == gshadow) {
+               setsgent ();
+       }
+       return fgetsgent(gshadow);
+}
+#endif
diff --git a/lib/shadow/gshadow/getsgent.h b/lib/shadow/gshadow/getsgent.h
new file mode 100644 (file)
index 0000000..6107daa
--- /dev/null
@@ -0,0 +1,24 @@
+// SPDX-FileCopyrightText: 1988-1994, Julianne Frances Haugh
+// SPDX-FileCopyrightText: 1996-1997, Marek Michałkiewicz
+// SPDX-FileCopyrightText: 2003-2005, Tomasz Kłoczko
+// SPDX-FileCopyrightText: 2024, Alejandro Colomar <alx@kernel.org>
+// SPDX-License-Identifier: BSD-3-Clause
+
+
+#ifndef SHADOW_INCLUDE_LIB_SHADOW_GSHADOW_GETSGENT_H_
+#define SHADOW_INCLUDE_LIB_SHADOW_GSHADOW_GETSGENT_H_
+
+
+#include "config.h"
+
+#include "shadow/gshadow/sgrp.h"
+
+
+#if __has_include(<gshadow.h>)
+# include <gshadow.h>
+#else
+struct sgrp *getsgent(void);
+#endif
+
+
+#endif  // include guard
index d78a57564f4c92e180a059c56fbcc0923b8e6c77..86fb9ad49ddf15f80c24f458e2a3f0beb3ec9eb3 100644 (file)
@@ -14,6 +14,7 @@
 #include <string.h>
 
 #include "defines.h"
+#include "shadow/gshadow/getsgent.h"
 #include "shadow/gshadow/setsgent.h"
 #include "shadow/gshadow/sgrp.h"
 
index a925b2350b05daf95a048f580559451c9cf8bced..614415c23d6a56bcaa0d75c2a28cb1e243b01b5e 100644 (file)
@@ -27,7 +27,6 @@ lib/getgr_nam_gid.c
 lib/getrange.c
 lib/groupio.c
 lib/groupmem.c
-lib/gshadow.c
 lib/hushed.c
 lib/idmapping.c
 lib/isexpired.c