(root)/
gettext-0.22.4/
gettext-tools/
misc/
cvsuser.c
       1  /* Customization of the cvs command.
       2     Copyright (C) 2002, 2019 Free Software Foundation, Inc.
       3     Written by Bruno Haible <bruno@clisp.org>, 2002.
       4  
       5     This program is free software: you can redistribute it and/or modify
       6     it under the terms of the GNU General Public License as published by
       7     the Free Software Foundation; either version 3 of the License, or
       8     (at your option) any later version.
       9  
      10     This program 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
      13     GNU General Public License for more details.
      14  
      15     You should have received a copy of the GNU General Public License
      16     along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
      17  
      18  /* Enable a variable CVSUSER for cvs.  */
      19  /* See cvs/subr.c: getcaller().  */
      20  
      21  #include <stdlib.h>
      22  #include <string.h>
      23  #include <pwd.h>
      24  
      25  int getuid (void)
      26  {
      27    return 0;
      28  }
      29  
      30  char * getlogin (void)
      31  {
      32    char *s;
      33  
      34    s = getenv ("CVSUSER");
      35    if (s && *s)
      36      return s;
      37    s = getenv ("USER");
      38    if (s && *s)
      39      return s;
      40    return NULL;
      41  }
      42  
      43  struct passwd * getpwnam (const char *name)
      44  {
      45    static struct passwd pw;
      46    static char namebuf[100];
      47  
      48    pw.pw_name = strcpy (namebuf, name);
      49    pw.pw_passwd = "*";
      50    pw.pw_uid = 100;
      51    pw.pw_gid = 100;
      52    pw.pw_gecos = "";
      53    pw.pw_dir = "/";
      54    pw.pw_shell = "/bin/sh";
      55  
      56    return &pw;
      57  }