1 rizwank 1.1 /*
2 * Replacement for the passwd related functions for micro ports.
3 * Copyright (c) 1996 Markku Rossi.
4 *
5 * Author: Markku Rossi <mtr@iki.fi>
6 */
7
8 /*
9 * This file is part of GNU enscript.
10 *
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2, or (at your option)
14 * any later version.
15 *
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
20 *
21 * You should have received a copy of the GNU General Public License
22 rizwank 1.1 * along with this program; see the file COPYING. If not, write to
23 * the Free Software Foundation, 59 Temple Place - Suite 330,
24 * Boston, MA 02111-1307, USA.
25 */
26
27 #include <stdio.h>
28 #include <stdlib.h>
29
30 #if defined(WIN32)
31 #include <windows.h>
32 #endif
33
34 #include "dummypwd.h"
35
36 /*
37 * Static variables
38 */
39
40 static struct passwd dummy_passwd =
41 {
42 "dos", "Dos User", "/home",
43 rizwank 1.1 };
44
45
46 /*
47 * Global functions
48 */
49
50 struct passwd *
51 getpwuid ()
52 {
53 #if defined(WIN32)
54
55 static char userName[32];
56 DWORD userNameLen = sizeof (userName);
57
58 if (GetUserName (userName, &userNameLen))
59 {
60 dummy_passwd.pw_name = userName;
61 dummy_passwd.pw_gecos = userName;
62 }
63
64 rizwank 1.1 return &dummy_passwd;
65
66 #else /* not WIN32 */
67
68 return &dummy_passwd;
69
70 #endif /* not WIN32 */
71 }
72
73
74 struct passwd *
75 getpwnam (name)
76 char *name;
77 {
78 return getpwuid ();
79 }
|