Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

LOGNAME no longer special parameter



This patch (again) removes LOGNAME from the special parameters. This is
already part of my releases so do not apply that if you use that version.

Nothing is changed in the visible behaviour, but after the patch LOGNAME
becames a changable non-special parameter. This is useful for RCS which uses
LOGNAME to determine the author field when it checks in a file. Hopefully I
included everything here which is necessary (it is an old patch from my RCS).

Bye,

   Zoltan

rcsdiff -qc -kk -r1.11 -r1.12 Src/params.c
*** Src/params.c
--- Src/params.c	1995/07/04 18:21:23
***************
*** 66,71 ****
--- 66,72 ----
  
      argvparam = (Param) paramtab->getnode(paramtab, "argv");
  
+     setsparam("LOGNAME", ztrdup((str = getlogin()) && *str ? str : cached_username));
      noerrs = 1;
  
      /* Copy the environment variables we are inheriting to dynamic *
***************
*** 110,116 ****
      pm = (Param) paramtab->getnode(paramtab, "LOGNAME");
      if (!(pm->flags & PM_EXPORTED)) {
  	pm->flags |= PM_EXPORTED;
! 	pm->env = addenv("LOGNAME", login_name);
      }
      pm = (Param) paramtab->getnode(paramtab, "SHLVL");
      if (!(pm->flags & PM_EXPORTED))
--- 111,117 ----
      pm = (Param) paramtab->getnode(paramtab, "LOGNAME");
      if (!(pm->flags & PM_EXPORTED)) {
  	pm->flags |= PM_EXPORTED;
! 	pm->env = addenv("LOGNAME", pm->u.str);
      }
      pm = (Param) paramtab->getnode(paramtab, "SHLVL");
      if (!(pm->flags & PM_EXPORTED))
rcsdiff -qc -kk -r1.5 -r1.6 Src/init.c
*** Src/init.c
--- Src/init.c	1995/07/04 12:32:51
***************
*** 555,565 ****
  	cached_username = ztrdup("");
      }
  
-     /* Get info for `LOGNAME'.  If getlogin fails, *
-      * we'll take whatever is in `USERNAME'.       */
-     if (!(login_name = getlogin()))
- 	login_name = ztrdup(cached_username);
- 
      /* Try a cheap test to see if we can *
       * initialize `PWD' from `HOME'      */
      if (ispwd(home))
--- 555,560 ----
rcsdiff -qc -kk -r1.3 -r1.4 Src/params.h
*** Src/params.h
--- Src/params.h	1995/07/04 14:23:18
***************
*** 105,111 ****
  
  #define IPDEF6(A,B) {NULL,A,NULL,IFN(nullsetfn),IFN(strvargetfn),0,\
  		PM_SCALAR|PM_READONLY|PM_SPECIAL,(void *)B,NULL,NULL,NULL,0}
- 	IPDEF6("LOGNAME", &login_name),
  	IPDEF6("PWD", &pwd),
  	IPDEF6("TTY", &ttystrname),
  
--- 105,110 ----
rcsdiff -qc -kk -r1.6 -r1.7 Src/globals.h
*** Src/globals.h
--- Src/globals.h	1995/07/04 12:17:04
***************
*** 305,311 ****
  
  EXTERN uid_t cached_uid;
  EXTERN char *cached_username;   /* $USERNAME   */
- EXTERN char *login_name;	/* $LOGNAME    */
  EXTERN char *zsh_name;		/* ZSH_NAME    */
  
  EXTERN char *underscore;	/* $_          */
--- 305,310 ----
rcsdiff -qc -kk -r1.6 -r1.7 Doc/zshparam.1
*** Doc/zshparam.1
--- Doc/zshparam.1	1995/07/04 17:28:36
***************
*** 205,212 ****
  being executed.
  .TP
  .B LOGNAME
! The username corresponding to the user id of the shell process
! at the time of login.
  .TP
  .B MACHTYPE
  The machine type (microprocessor class or machine model),
--- 205,214 ----
  being executed.
  .TP
  .B LOGNAME
! If the corresponding variable is not set in the environment of the
! shell, it is initialized to the login name corresponding to the
! current login session. 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),



Messages sorted by: Reverse Date, Date, Thread, Author