bin/sh/var.c
/*
 * This routine initializes the builtin variables.  It is called when the
 * shell is initialized and again when a shell procedure is spawned.
 */
This routine initializes the builtin variables.  It is called when the
shell is initialized and again when a shell procedure is spawned.
This routine initializes the builtin variables . It is called when the shell is initialized and again when a shell procedure is spawned .
void
initvar() {
	const struct varinit *ip;
	struct var *vp;
	struct var **vpp;
	for (ip = varinit ; (vp = ip->var) != NULL ; ip++) {
		if ((vp->flags & VEXPORT) == 0) {
			vpp = hashvar(ip->text);
			vp->next = *vpp;
			*vpp = vp;
			vp->text = ip->text;
			vp->flags = ip->flags;
		}
	}
	if ((vps1.flags & VEXPORT) == 0) {
		vpp = hashvar("PS1=");
		vps1.next = *vpp;
		*vpp = &vps1;
		vps1.text = geteuid() ? "PS1=$ " : "PS1=# ";
		vps1.flags = VSTRFIXED|VTEXTFIXED;
	}
}
void initvar ( ) { const struct varinit * ip ; struct var * vp ; struct var * * vpp ; for ( ip = varinit ; ( vp = ip -> var ) != NULL ; ip ++ ) { if ( ( vp -> flags & VEXPORT ) == 0 ) { vpp = hashvar ( ip -> text ) ; vp -> next = * vpp ; * vpp = vp ; vp -> text = ip -> text ; vp -> flags = ip -> flags ; } } if ( ( vps1 . flags & VEXPORT ) == 0 ) { vpp = hashvar ( " " ) ; vps1 . next = * vpp ; * vpp = & vps1 ; vps1 . text = geteuid ( ) ? " " : " " ; vps1 . flags = VSTRFIXED | VTEXTFIXED ; } }
This routine initializes the builtin variables.
This routine initializes the builtin variables .
/*
	 * PS1 depends on uid
	 */