From: "Piotr Eljasiak" Newsgroups: comp.os.msdos.djgpp References: 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: 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