Print this page
8485 Remove set but unused variables in usr/src/cmd


   3  *
   4  * The contents of this file are subject to the terms of the
   5  * Common Development and Distribution License (the "License").
   6  * You may not use this file except in compliance with the License.
   7  *
   8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
   9  * or http://www.opensolaris.org/os/licensing.
  10  * See the License for the specific language governing permissions
  11  * and limitations under the License.
  12  *
  13  * When distributing Covered Code, include this CDDL HEADER in each
  14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15  * If applicable, add the following below this CDDL HEADER, with the
  16  * fields enclosed by brackets "[]" replaced with your own identifying
  17  * information: Portions Copyright [yyyy] [name of copyright owner]
  18  *
  19  * CDDL HEADER END
  20  */
  21 
  22 /*

  23  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
  24  * Use is subject to license terms.
  25  */
  26 
  27 /*      Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T     */
  28 /*        All Rights Reserved   */
  29 
  30 /*
  31  *
  32  * UNIX shell
  33  *
  34  */
  35 
  36 
  37 #include        "defs.h"
  38 #include        <errno.h>
  39 #include        "sym.h"
  40 #include        "hash.h"
  41 #include        <sys/types.h>
  42 #include        <sys/times.h>


 107                                  * free of the defining function. If we are
 108                                  * in a loop, fndnod may be reused, so it
 109                                  * should never be freed.
 110                                  */
 111                                 if (funcnt != 0 || loopcnt != 0)
 112                                         f->fndref++;
 113 
 114                                 /*
 115                                  * We hang a fndnod on the namenv so that
 116                                  * ref cnt(fndref) can be increased while
 117                                  * running in the function.
 118                                  */
 119                                 n->namenv = (unsigned char *)f;
 120                                 attrib(n, N_FUNCTN);
 121                                 hash_func(n->namid);
 122                                 break;
 123                         }
 124 
 125                 case TCOM:
 126                         {
 127                                 unsigned char   *a1, *name;
 128                                 int     argn, internal;
 129                                 struct argnod   *schain = gchain;
 130                                 struct ionod    *io = t->treio;
 131                                 short   cmdhash;
 132                                 short   comtype;
 133 
 134                                 exitval = 0;
 135 
 136                                 gchain = 0;
 137                                 argn = getarg(t);
 138                                 com = scan(argn);
 139                                 a1 = com[1];
 140                                 gchain = schain;
 141 
 142                                 if (argn != 0)
 143                                         cmdhash = pathlook(com[0], 1, comptr(t)->comset);
 144 
 145                                 if (argn == 0 || (comtype = hashtype(cmdhash)) == BUILTIN) {
 146                                         setlist(comptr(t)->comset, 0);
 147                                 }
 148 
 149                                 if (argn && (flags&noexec) == 0)
 150                                 {
 151 
 152                                         /* print command if execpr */
 153                                         if (flags & execpr)
 154                                                 execprint(com);
 155 
 156                                         if (comtype == NOTFOUND)
 157                                         {
 158                                                 pos = hashdata(cmdhash);
 159                                                 if (pos == 1)




   3  *
   4  * The contents of this file are subject to the terms of the
   5  * Common Development and Distribution License (the "License").
   6  * You may not use this file except in compliance with the License.
   7  *
   8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
   9  * or http://www.opensolaris.org/os/licensing.
  10  * See the License for the specific language governing permissions
  11  * and limitations under the License.
  12  *
  13  * When distributing Covered Code, include this CDDL HEADER in each
  14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15  * If applicable, add the following below this CDDL HEADER, with the
  16  * fields enclosed by brackets "[]" replaced with your own identifying
  17  * information: Portions Copyright [yyyy] [name of copyright owner]
  18  *
  19  * CDDL HEADER END
  20  */
  21 
  22 /*
  23  * Copyright 2017 Gary Mills
  24  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
  25  * Use is subject to license terms.
  26  */
  27 
  28 /*      Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T     */
  29 /*        All Rights Reserved   */
  30 
  31 /*
  32  *
  33  * UNIX shell
  34  *
  35  */
  36 
  37 
  38 #include        "defs.h"
  39 #include        <errno.h>
  40 #include        "sym.h"
  41 #include        "hash.h"
  42 #include        <sys/types.h>
  43 #include        <sys/times.h>


 108                                  * free of the defining function. If we are
 109                                  * in a loop, fndnod may be reused, so it
 110                                  * should never be freed.
 111                                  */
 112                                 if (funcnt != 0 || loopcnt != 0)
 113                                         f->fndref++;
 114 
 115                                 /*
 116                                  * We hang a fndnod on the namenv so that
 117                                  * ref cnt(fndref) can be increased while
 118                                  * running in the function.
 119                                  */
 120                                 n->namenv = (unsigned char *)f;
 121                                 attrib(n, N_FUNCTN);
 122                                 hash_func(n->namid);
 123                                 break;
 124                         }
 125 
 126                 case TCOM:
 127                         {
 128                                 unsigned char   *name;
 129                                 int     argn, internal;
 130                                 struct argnod   *schain = gchain;
 131                                 struct ionod    *io = t->treio;
 132                                 short   cmdhash;
 133                                 short   comtype;
 134 
 135                                 exitval = 0;
 136 
 137                                 gchain = 0;
 138                                 argn = getarg(t);
 139                                 com = scan(argn);

 140                                 gchain = schain;
 141 
 142                                 if (argn != 0)
 143                                         cmdhash = pathlook(com[0], 1, comptr(t)->comset);
 144 
 145                                 if (argn == 0 || (comtype = hashtype(cmdhash)) == BUILTIN) {
 146                                         setlist(comptr(t)->comset, 0);
 147                                 }
 148 
 149                                 if (argn && (flags&noexec) == 0)
 150                                 {
 151 
 152                                         /* print command if execpr */
 153                                         if (flags & execpr)
 154                                                 execprint(com);
 155 
 156                                         if (comtype == NOTFOUND)
 157                                         {
 158                                                 pos = hashdata(cmdhash);
 159                                                 if (pos == 1)