build-many-glibcs.py: Add openrisc hard float glibc variant
[glibc.git] / sysdeps / generic / utmp-equal.h
blobee561bc75296642732b35fd3e083903eb397f61e
1 /* Helper function for utmp functions to see if two entries are equal.
2 Copyright (C) 1996-2024 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the 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 Lesser General Public License for more details.
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; if not, see
17 <https://www.gnu.org/licenses/>. */
19 #include <string.h>
20 #include <utmp.h>
22 #include "utmp-private.h"
24 /* Test whether two entries match. */
25 static int
26 __utmp_equal (const struct utmp *entry, const struct utmp *match)
28 return (entry->ut_type == INIT_PROCESS
29 || entry->ut_type == LOGIN_PROCESS
30 || entry->ut_type == USER_PROCESS
31 || entry->ut_type == DEAD_PROCESS)
32 && (match->ut_type == INIT_PROCESS
33 || match->ut_type == LOGIN_PROCESS
34 || match->ut_type == USER_PROCESS
35 || match->ut_type == DEAD_PROCESS)
36 && (entry->ut_id[0] && match->ut_id[0]
37 ? strncmp (entry->ut_id, match->ut_id, sizeof match->ut_id) == 0
38 : (strncmp (entry->ut_line, match->ut_line, sizeof match->ut_line)
39 == 0));