Blame gnulib-tests/test-getlogin.c

Packit Service 2723c6
/* Test of getting user name.
Packit Service 2723c6
   Copyright (C) 2010-2018 Free Software Foundation, Inc.
Packit Service 2723c6
Packit Service 2723c6
   This program is free software: you can redistribute it and/or modify
Packit Service 2723c6
   it under the terms of the GNU General Public License as published by
Packit Service 2723c6
   the Free Software Foundation; either version 3 of the License, or
Packit Service 2723c6
   (at your option) any later version.
Packit Service 2723c6
Packit Service 2723c6
   This program is distributed in the hope that it will be useful,
Packit Service 2723c6
   but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit Service 2723c6
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
Packit Service 2723c6
   GNU General Public License for more details.
Packit Service 2723c6
Packit Service 2723c6
   You should have received a copy of the GNU General Public License
Packit Service 2723c6
   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
Packit Service 2723c6
Packit Service 2723c6
/* Written by Bruno Haible and Paul Eggert.  */
Packit Service 2723c6
Packit Service 2723c6
#include <config.h>
Packit Service 2723c6
Packit Service 2723c6
#include <unistd.h>
Packit Service 2723c6
Packit Service 2723c6
#include "signature.h"
Packit Service 2723c6
SIGNATURE_CHECK (getlogin, char *, (void));
Packit Service 2723c6
Packit Service 2723c6
#include "test-getlogin.h"
Packit Service 2723c6
Packit Service 2723c6
int
Packit Service 2723c6
main (void)
Packit Service 2723c6
{
Packit Service 2723c6
  /* Test value.  */
Packit Service 2723c6
  char *buf = getlogin ();
Packit Service 2723c6
  int err = buf ? 0 : errno;
Packit Service 2723c6
  ASSERT (buf || err);
Packit Service 2723c6
  test_getlogin_result (buf, err);
Packit Service 2723c6
Packit Service 2723c6
  return 0;
Packit Service 2723c6
}