Deleted Added
full compact
var.c (223060) var.c (223183)
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

--- 22 unchanged lines hidden (view full) ---

31 */
32
33#ifndef lint
34#if 0
35static char sccsid[] = "@(#)var.c 8.3 (Berkeley) 5/4/95";
36#endif
37#endif /* not lint */
38#include <sys/cdefs.h>
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

--- 22 unchanged lines hidden (view full) ---

31 */
32
33#ifndef lint
34#if 0
35static char sccsid[] = "@(#)var.c 8.3 (Berkeley) 5/4/95";
36#endif
37#endif /* not lint */
38#include <sys/cdefs.h>
39__FBSDID("$FreeBSD: head/bin/sh/var.c 223060 2011-06-13 21:03:27Z jilles $");
39__FBSDID("$FreeBSD: head/bin/sh/var.c 223183 2011-06-17 10:21:24Z jilles $");
40
41#include <unistd.h>
42#include <stdlib.h>
43#include <paths.h>
44
45/*
46 * Shell variables.
47 */

--- 559 unchanged lines hidden (view full) ---

607 for (vp = *vpp; vp; vp = vp->next) {
608 if (!(vp->flags & VUNSET))
609 vars[i++] = vp->text;
610 }
611 }
612
613 qsort(vars, n, sizeof(*vars), var_compare);
614 for (i = 0; i < n; i++) {
40
41#include <unistd.h>
42#include <stdlib.h>
43#include <paths.h>
44
45/*
46 * Shell variables.
47 */

--- 559 unchanged lines hidden (view full) ---

607 for (vp = *vpp; vp; vp = vp->next) {
608 if (!(vp->flags & VUNSET))
609 vars[i++] = vp->text;
610 }
611 }
612
613 qsort(vars, n, sizeof(*vars), var_compare);
614 for (i = 0; i < n; i++) {
615 /*
616 * Skip improper variable names so the output remains usable as
617 * shell input.
618 */
619 if (!isassignment(vars[i]))
620 continue;
615 s = strchr(vars[i], '=');
616 s++;
617 outbin(vars[i], s - vars[i], out1);
618 out1qstr(s);
619 out1c('\n');
620 }
621 ckfree(vars);
622 INTOFF;

--- 55 unchanged lines hidden (view full) ---

678 }
679 setvar(name, p, flag);
680 }
681 } else {
682 for (vpp = vartab ; vpp < vartab + VTABSIZE ; vpp++) {
683 for (vp = *vpp ; vp ; vp = vp->next) {
684 if (vp->flags & flag) {
685 if (values) {
621 s = strchr(vars[i], '=');
622 s++;
623 outbin(vars[i], s - vars[i], out1);
624 out1qstr(s);
625 out1c('\n');
626 }
627 ckfree(vars);
628 INTOFF;

--- 55 unchanged lines hidden (view full) ---

684 }
685 setvar(name, p, flag);
686 }
687 } else {
688 for (vpp = vartab ; vpp < vartab + VTABSIZE ; vpp++) {
689 for (vp = *vpp ; vp ; vp = vp->next) {
690 if (vp->flags & flag) {
691 if (values) {
692 /*
693 * Skip improper variable names
694 * so the output remains usable
695 * as shell input.
696 */
697 if (!isassignment(vp->text))
698 continue;
686 out1str(cmdname);
687 out1c(' ');
688 }
689 if (values && !(vp->flags & VUNSET)) {
690 outbin(vp->text,
691 vp->name_len + 1, out1);
692 out1qstr(vp->text +
693 vp->name_len + 1);

--- 242 unchanged lines hidden ---
699 out1str(cmdname);
700 out1c(' ');
701 }
702 if (values && !(vp->flags & VUNSET)) {
703 outbin(vp->text,
704 vp->name_len + 1, out1);
705 out1qstr(vp->text +
706 vp->name_len + 1);

--- 242 unchanged lines hidden ---