* logname in zsh-2.6b9 @ 1995-06-07 22:34 Ted Scharlemann 1995-06-09 17:25 ` Zoltan Hidvegi 0 siblings, 1 reply; 4+ messages in thread From: Ted Scharlemann @ 1995-06-07 22:34 UTC (permalink / raw) To: zsh-workers 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 <unistd.h> (this is on HPUX 9.05 HP9000/715). May I recommend that you revert to "zlogname"?? And many thanks for your efforts. I have become very fond of zsh. (Incidentally, I am not a subscriber to this list.) Ted Scharlemann ets@llnl.gov ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: logname in zsh-2.6b9 1995-06-07 22:34 logname in zsh-2.6b9 Ted Scharlemann @ 1995-06-09 17:25 ` Zoltan Hidvegi 1995-06-09 17:45 ` Zoltan Hidvegi 1995-06-09 21:02 ` Richard Coleman 0 siblings, 2 replies; 4+ messages in thread From: Zoltan Hidvegi @ 1995-06-09 17:25 UTC (permalink / raw) To: Ted Scharlemann > > 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 <unistd.h> > > (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 */ ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: logname in zsh-2.6b9 1995-06-09 17:25 ` Zoltan Hidvegi @ 1995-06-09 17:45 ` Zoltan Hidvegi 1995-06-09 21:02 ` Richard Coleman 1 sibling, 0 replies; 4+ messages in thread From: Zoltan Hidvegi @ 1995-06-09 17:45 UTC (permalink / raw) To: Zoltan Hidvegi I've just noticed that I forgot the patch to globals.h. Sorry for that. Here is the whole patch again with patch to globals.h. I also had a patch to the manual which I also sent earlier and include now. This patch is necessary because the present manual is wrong. This patch to the manual is necessary even without the source code patch. I hope I did not forget anything this time (I maintain about twohundred patches with RCS which are mostly bugfixes to zsh :-)) 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 */ rcsdiff -qc -kk -r1.6 -r1.7 Src/globals.h *** Src/globals.h --- Src/globals.h 1995/06/02 16:37:56 *************** *** 294,301 **** EXTERN char *hsubr; ! EXTERN char *logname; /* $LOGNAME */ ! EXTERN char *username; /* $USERNAME */ EXTERN long lastval; /* $? */ EXTERN long baud; /* $BAUD */ EXTERN long columns; /* $COLUMNS */ --- 294,303 ---- EXTERN char *hsubr; ! /* the username corresponding to the real userid at startup */ ! ! EXTERN char *username; ! EXTERN long lastval; /* $? */ EXTERN long baud; /* $BAUD */ EXTERN long columns; /* $COLUMNS */ rcsdiff -qc -kk -r1.6 -r1.7 zshparam.1 *** Doc/zshparam.1 --- Doc/zshparam.1 1995/06/02 18:12:39 *************** *** 183,190 **** being executed. .TP .B LOGNAME ! The username corresponding to the user id of the shell process. ! (The same as USERNAME). .TP .B MACHTYPE The machine type (microprocessor class or machine model), --- 183,192 ---- being executed. .TP .B LOGNAME ! If the corresponding variable is not set in the environment of the ! shell, it is initialized to the username corresponding to the real ! user id of the shell process on startup. This parameter is exported ! by default but this can be disabled using the \fBtypeset\fP builtin. .TP .B MACHTYPE The machine type (microprocessor class or machine model), *************** *** 238,245 **** The user id of the shell process. .TP .B USERNAME ! The username corresponding to the user id of the shell process. ! (The same as LOGNAME). .TP .B VENDOR The vendor, as determined at compile time. --- 240,247 ---- The user id of the shell process. .TP .B USERNAME ! The username corresponding to the real user id of the shell process. ! It is only intialised on startup. .TP .B VENDOR The vendor, as determined at compile time. ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: logname in zsh-2.6b9 1995-06-09 17:25 ` Zoltan Hidvegi 1995-06-09 17:45 ` Zoltan Hidvegi @ 1995-06-09 21:02 ` Richard Coleman 1 sibling, 0 replies; 4+ messages in thread From: Richard Coleman @ 1995-06-09 21:02 UTC (permalink / raw) To: zsh-workers; +Cc: hzoli > 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. I'm sorry that it is taking me so long to integrate your patches. It is not that I don't like your patches. The primary reason it is taking so long is that I typically do things in stages. So I've only recently started looking at the param.c code (which seems to be where most of your patches are). I've actually been looking through it this week. It will take a while to integrate them all, but the changes you mention above should be in beta10. So don't take it personally and don't get discouraged. I just have my own convoluted way of doing things. Richard Coleman zsh@math.gatech.edu ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~1995-06-09 21:06 UTC | newest] Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 1995-06-07 22:34 logname in zsh-2.6b9 Ted Scharlemann 1995-06-09 17:25 ` Zoltan Hidvegi 1995-06-09 17:45 ` Zoltan Hidvegi 1995-06-09 21:02 ` Richard Coleman
Code repositories for project(s) associated with this public inbox https://git.vuxu.org/mirror/zsh/ This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).