From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from gatech.edu (gatech.edu [130.207.244.244]) by werple.mira.net.au (8.6.12/8.6.9) with SMTP id CAA14105 for ; Sat, 10 Jun 1995 02:29:29 +1000 Received: from math (math.skiles.gatech.edu) by gatech.edu with SMTP id AA08835 (5.65c/Gatech-10.0-IDA for ); Fri, 9 Jun 1995 12:28:36 -0400 Received: by math (5.x/SMI-SVR4) id AA27198; Fri, 9 Jun 1995 12:26:37 -0400 Resent-Date: Fri, 9 Jun 1995 18:25:15 +0100 (MET DST) Old-Return-Path: From: hzoli@cs.elte.hu (Zoltan Hidvegi) Message-Id: <9506091625.AA03604@turan.elte.hu> Subject: Re: logname in zsh-2.6b9 To: ets@llnl.gov (Ted Scharlemann) Date: Fri, 9 Jun 1995 18:25:15 +0100 (MET DST) In-Reply-To: <199506072234.PAA04723@wsets.llnl.gov> from "Ted Scharlemann" at Jun 7, 95 03:34:16 pm X-Mailer: ELM [version 2.4 PL21] Content-Type: text Sender: hzoli@cs.elte.hu Resent-Message-Id: <"jc9Ed1.0.ue6.yO7sl"@math> Resent-From: zsh-workers@math.gatech.edu X-Mailing-List: archive/latest/93 X-Loop: zsh-workers@math.gatech.edu Precedence: list Resent-Sender: zsh-workers-request@math.gatech.edu > > After many months of happily using zsh-2.6-beta2, I just grabbed > zsh-2.6-beta9 from math.gatech.edu and tried to compile it. My first > attempt was unsuccessful, because somewhere between b2 and b9, > > "EXTERN char *zlogname;" in globals.h, init.c, and params.c > > was changed to > > "EXTERN char *logname;" > > which conflicts with logname(3), declared > > "char *logname(void);" in > > (this is on HPUX 9.05 HP9000/715). > > May I recommend that you revert to "zlogname"?? In my releases logname variable is completely missing. Also the LOGNAME parameter is writable. Zsh use the logname variable only to store the value of the LOGNAME special parameter. I already posted patches for that but it seems that Richard does not like my patches too much. Here is a patch against beta9. It makes HOSTTYPE, OSTYPE, MACHTYPE, VENDOR, ZSH_VERSION, LOGNAME and USERNAME non-special parameters. They will behave exactly as before, except that they are writable, these name can be used as local parameters etc. This increases flexibility and simplifies the code. Zoltan *** Src/params.c.orig Fri Jun 9 18:11:23 1995 --- Src/params.c Fri Jun 9 18:09:33 1995 *************** *** 85,98 **** IPDEF2("LANG", strgetfn, langsetfn, 0), #endif - #define IPDEF3(A) {NULL,A,NULL,IFN(nullsetfn),IFN(strconstgetfn),0,PMFLAG_r|\ - PMFLAG_SPECIAL,NULL,NULL,NULL,NULL,0} - IPDEF3("HOSTTYPE"), - IPDEF3("OSTYPE"), - IPDEF3("MACHTYPE"), - IPDEF3("VENDOR"), - IPDEF3("ZSH_VERSION"), - #define IPDEF4(A,B) {NULL,A,NULL,IFN(nullsetfn),IFN(intvargetfn),10,\ PMFLAG_r|PMFLAG_i|PMFLAG_SPECIAL,(void *)B,NULL,NULL,NULL,0} IPDEF4("!", &lastpid), --- 85,90 ---- *************** *** 121,130 **** #define IPDEF6(A,B) {NULL,A,NULL,IFN(nullsetfn),IFN(strvargetfn),0,\ PMFLAG_r|PMFLAG_SPECIAL,(void *)B,NULL,NULL,NULL,0} - IPDEF6("LOGNAME", &logname), IPDEF6("PWD", &pwd), IPDEF6("TTY", &ttystrname), - IPDEF6("USERNAME", &username), #define IPDEF7(A,B) {NULL,A,NULL,IFN(strvarsetfn),IFN(strvargetfn),0,\ PMFLAG_SPECIAL,(void *)B,NULL,NULL,NULL,0} --- 113,120 ---- *************** *** 196,207 **** addhnode(ztrdup(ip->nam), ip, paramtab, (FFunc) 0); argvparam = (Param) gethnode("argv", paramtab); ! ((struct iparam *)gethnode("HOSTTYPE", paramtab))->data = (void *) ztrdup(HOSTTYPE); ! ((struct iparam *)gethnode("OSTYPE", paramtab))->data = (void *) ztrdup(OSTYPE); ! ((struct iparam *)gethnode("MACHTYPE", paramtab))->data = (void *) ztrdup(MACHTYPE); ! ((struct iparam *)gethnode("VENDOR", paramtab))->data = (void *) ztrdup(VENDOR); ! ((struct iparam *)gethnode("ZSH_VERSION",paramtab))->data = (void *) ztrdup(ZSH_VERSION); ! noerrs = 1; for (envp = environ, ct = 2; *envp; envp++, ct++); envp = environ; --- 186,192 ---- addhnode(ztrdup(ip->nam), ip, paramtab, (FFunc) 0); argvparam = (Param) gethnode("argv", paramtab); ! setsparam("LOGNAME", ztrdup(username)); noerrs = 1; for (envp = environ, ct = 2; *envp; envp++, ct++); envp = environ; *************** *** 242,254 **** pm = (struct param *)gethnode("LOGNAME", paramtab); if (!(pm->flags & PMFLAG_x)) { pm->flags |= PMFLAG_x; ! pm->env = addenv("LOGNAME", logname); } pm = (struct param *)gethnode("SHLVL", paramtab); if (!(pm->flags & PMFLAG_x)) pm->flags |= PMFLAG_x; sprintf(buf, "%d", (int)++shlvl); pm->env = addenv("SHLVL", buf); noerrs = 0; } --- 227,245 ---- pm = (struct param *)gethnode("LOGNAME", paramtab); if (!(pm->flags & PMFLAG_x)) { pm->flags |= PMFLAG_x; ! pm->env = addenv("LOGNAME", pm->u.str); } pm = (struct param *)gethnode("SHLVL", paramtab); if (!(pm->flags & PMFLAG_x)) pm->flags |= PMFLAG_x; sprintf(buf, "%d", (int)++shlvl); pm->env = addenv("SHLVL", buf); + setsparam("HOSTTYPE", ztrdup(HOSTTYPE)); + setsparam("OSTYPE", ztrdup(OSTYPE)); + setsparam("MACHTYPE", ztrdup(MACHTYPE)); + setsparam("VENDOR", ztrdup(VENDOR)); + setsparam("ZSH_VERSION", ztrdup(ZSH_VERSION)); + setsparam("USERNAME", ztrdup(username)); noerrs = 0; } *** Src/init.c.orig Fri Jun 9 18:08:43 1995 --- Src/init.c Fri Jun 9 18:09:47 1995 *************** *** 519,531 **** else home = ztrdup("/"); ! if (!(logname = getlogin())) { if (pswd) ! logname = ztrdup(pswd->pw_name); else ! logname = ztrdup(""); } - username = ztrdup(logname); /* Try a cheap test to see if we can * * initialize $PWD from $HOME */ --- 519,530 ---- else home = ztrdup("/"); ! if (!(username = getlogin())) { if (pswd) ! username = ztrdup(pswd->pw_name); else ! username = ztrdup(""); } /* Try a cheap test to see if we can * * initialize $PWD from $HOME */