var.c (36150) | var.c (45263) |
---|---|
1/*- 2 * Copyright (c) 1991, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * This code is derived from software contributed to Berkeley by 6 * Kenneth Almquist. 7 * 8 * Redistribution and use in source and binary forms, with or without --- 25 unchanged lines hidden (view full) --- 34 * SUCH DAMAGE. 35 */ 36 37#ifndef lint 38#if 0 39static char sccsid[] = "@(#)var.c 8.3 (Berkeley) 5/4/95"; 40#endif 41static const char rcsid[] = | 1/*- 2 * Copyright (c) 1991, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * This code is derived from software contributed to Berkeley by 6 * Kenneth Almquist. 7 * 8 * Redistribution and use in source and binary forms, with or without --- 25 unchanged lines hidden (view full) --- 34 * SUCH DAMAGE. 35 */ 36 37#ifndef lint 38#if 0 39static char sccsid[] = "@(#)var.c 8.3 (Berkeley) 5/4/95"; 40#endif 41static const char rcsid[] = |
42 "$Id$"; | 42 "$Id: var.c,v 1.12 1998/05/18 06:44:24 charnier Exp $"; |
43#endif /* not lint */ 44 45#include <unistd.h> 46#include <stdlib.h> 47 48/* 49 * Shell variables. 50 */ --- 162 unchanged lines hidden (view full) --- 213 handler = &jmploc; 214 setvar(name, val, flags); 215 } 216 handler = savehandler; 217 return err; 218} 219 220/* | 43#endif /* not lint */ 44 45#include <unistd.h> 46#include <stdlib.h> 47 48/* 49 * Shell variables. 50 */ --- 162 unchanged lines hidden (view full) --- 213 handler = &jmploc; 214 setvar(name, val, flags); 215 } 216 handler = savehandler; 217 return err; 218} 219 220/* |
221 * Set the value of a variable. The flags argument is ored with the | 221 * Set the value of a variable. The flags argument is stored with the |
222 * flags of the variable. If val is NULL, the variable is unset. 223 */ 224 225void 226setvar(name, val, flags) 227 char *name, *val; 228 int flags; 229{ --- 67 unchanged lines hidden (view full) --- 297 298void 299setvareq(s, flags) 300 char *s; 301 int flags; 302{ 303 struct var *vp, **vpp; 304 | 222 * flags of the variable. If val is NULL, the variable is unset. 223 */ 224 225void 226setvar(name, val, flags) 227 char *name, *val; 228 int flags; 229{ --- 67 unchanged lines hidden (view full) --- 297 298void 299setvareq(s, flags) 300 char *s; 301 int flags; 302{ 303 struct var *vp, **vpp; 304 |
305 if (aflag) 306 flags |= VEXPORT; |
|
305 vpp = hashvar(s); 306 for (vp = *vpp ; vp ; vp = vp->next) { 307 if (varequal(s, vp->text)) { 308 if (vp->flags & VREADONLY) { 309 size_t len = strchr(s, '=') - s; 310 error("%.*s: is read only", len, s); 311 } 312 INTOFF; --- 483 unchanged lines hidden --- | 307 vpp = hashvar(s); 308 for (vp = *vpp ; vp ; vp = vp->next) { 309 if (varequal(s, vp->text)) { 310 if (vp->flags & VREADONLY) { 311 size_t len = strchr(s, '=') - s; 312 error("%.*s: is read only", len, s); 313 } 314 INTOFF; --- 483 unchanged lines hidden --- |