sh: Minor optimization to output from ulimit/export/readonly.
authorPeter Avalos <pavalos@dragonflybsd.org>
Tue, 5 Jul 2011 03:32:26 +0000 (17:32 -1000)
committerPeter Avalos <pavalos@dragonflybsd.org>
Sun, 21 Aug 2011 20:49:06 +0000 (13:49 -0700)
Obtained-from:   FreeBSD SVN rev 221975

bin/sh/miscbltin.c
bin/sh/var.c

index ebb66a4..ae34d9f 100644 (file)
@@ -34,7 +34,7 @@
  * SUCH DAMAGE.
  *
  * @(#)miscbltin.c     8.4 (Berkeley) 5/4/95
- * $FreeBSD: src/bin/sh/miscbltin.c,v 1.44 2010/11/23 22:17:39 jilles Exp $
+ * $FreeBSD: src/bin/sh/miscbltin.c,v 1.45 2011/05/15 22:09:27 jilles Exp $
  */
 
 /*
@@ -464,7 +464,7 @@ ulimitcmd(int argc __unused, char **argv __unused)
                                        "(-%c) ", l->option);
                        out1fmt("%-18s %18s ", l->name, optbuf);
                        if (val == RLIM_INFINITY)
-                               out1fmt("unlimited\n");
+                               out1str("unlimited\n");
                        else
                        {
                                val /= l->factor;
@@ -490,7 +490,7 @@ ulimitcmd(int argc __unused, char **argv __unused)
                        val = limit.rlim_max;
 
                if (val == RLIM_INFINITY)
-                       out1fmt("unlimited\n");
+                       out1str("unlimited\n");
                else
                {
                        val /= l->factor;
index c9b93a3..16552a3 100644 (file)
@@ -34,7 +34,7 @@
  * SUCH DAMAGE.
  *
  * @(#)var.c   8.3 (Berkeley) 5/4/95
- * $FreeBSD: src/bin/sh/var.c,v 1.59 2011/05/08 17:40:10 jilles Exp $
+ * $FreeBSD: src/bin/sh/var.c,v 1.60 2011/05/15 22:09:27 jilles Exp $
  */
 
 #include <unistd.h>
@@ -678,14 +678,13 @@ exportcmd(int argc, char **argv)
                                                out1str(cmdname);
                                                out1c(' ');
                                        }
-                                       p = strchr(vp->text, '=');
                                        if (values && !(vp->flags & VUNSET)) {
-                                               p++;
-                                               outbin(vp->text, p - vp->text,
-                                                   out1);
-                                               out1qstr(p);
+                                               outbin(vp->text,
+                                                   vp->name_len + 1, out1);
+                                               out1qstr(vp->text +
+                                                   vp->name_len + 1);
                                        } else
-                                               outbin(vp->text, p - vp->text,
+                                               outbin(vp->text, vp->name_len,
                                                    out1);
                                        out1c('\n');
                                }