www.delorie.com/archives/browse.cgi | search |
From: | "Piotr Eljasiak" <eljasiak AT NO-SPAM DOT zt DOT gdansk DOT tpsa DOT pl> |
Newsgroups: | comp.os.msdos.djgpp |
References: | <Pine DOT SUN DOT 3 DOT 91 DOT 1000719075119 DOT 12022D-100000 AT is> |
Subject: | Re: User login name ? |
Lines: | 37 |
X-Priority: | 3 |
X-MSMail-Priority: | Normal |
X-Newsreader: | Microsoft Outlook Express 5.00.2417.2000 |
X-MimeOLE: | Produced By Microsoft MimeOLE V5.00.2314.1300 |
Message-ID: | <I_od5.22286$pD2.457925@news.tpnet.pl> |
Date: | Wed, 19 Jul 2000 21:22:48 GMT |
NNTP-Posting-Host: | 213.76.28.130 |
X-Complaints-To: | abuse AT tpsa DOT pl |
X-Trace: | news.tpnet.pl 964041768 213.76.28.130 (Wed, 19 Jul 2000 23:22:48 MET DST) |
NNTP-Posting-Date: | Wed, 19 Jul 2000 23:22:48 MET DST |
Organization: | TPNET - http://www.tpnet.pl |
To: | djgpp AT delorie DOT com |
DJ-Gateway: | from newsgroup comp.os.msdos.djgpp |
Reply-To: | djgpp AT delorie DOT com |
> > char * > > getlogin(void) > > { > > char *p; > > > > p = getenv("USER"); > > if (!p) > > p = getenv("LOGNAME"); > > if (!p) > > p = getenv("USERNAME"); > > if (!p) > > p = default_login; > > return p; > > } > > DJGPP's getlogin() already does two of these three; if you want the > third, you could setenv("USERNAME", getenv("USER")) or something. Of course it does, for these are slightly modified DJGPP sources for getlogin() ;o). I can either: 1. use #ifdef __DJGPP__ setenv("USERNAME",getenv("USER")); #endif or 2. have the library modified to read variable USERNAME IMHO the latter is just more portable and elegant. So this is my suggestion to add reading USERNAME to getlogin() as the last (third) alternative. Thanks, Piotr Eljasiak
webmaster | delorie software privacy |
Copyright © 2019 by DJ Delorie | Updated Jul 2019 |