Print this page
6139 help gcc figure out variable initialization


  10  * or http://www.opensolaris.org/os/licensing.
  11  * See the License for the specific language governing permissions
  12  * and limitations under the License.
  13  *
  14  * When distributing Covered Code, include this CDDL HEADER in each
  15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  16  * If applicable, add the following below this CDDL HEADER, with the
  17  * fields enclosed by brackets "[]" replaced with your own identifying
  18  * information: Portions Copyright [yyyy] [name of copyright owner]
  19  *
  20  * CDDL HEADER END
  21  */
  22 /*
  23  * Copyright 2003 Sun Microsystems, Inc.  All rights reserved.
  24  * Use is subject to license terms.
  25  *
  26  * Device policy specific subroutines.  We cannot merge them with
  27  * drvsubr.c because of static linking requirements.
  28  */
  29 
  30 #pragma ident   "%Z%%M% %I%     %E% SMI"
  31 
  32 #include <stdio.h>
  33 #include <stdlib.h>
  34 #include <unistd.h>
  35 #include <string.h>
  36 #include <ctype.h>
  37 #include <priv.h>
  38 #include <string.h>
  39 #include <libgen.h>
  40 #include <libintl.h>
  41 #include <errno.h>
  42 #include <alloca.h>
  43 #include <sys/modctl.h>
  44 #include <sys/devpolicy.h>
  45 #include <sys/stat.h>
  46 #include <sys/sysmacros.h>
  47 
  48 #include "addrem.h"
  49 #include "errmsg.h"
  50 #include "plcysubr.h"
  51 


 320                         (void) fputs(fep->rawbuf, new);
 321                         break;
 322                 }
 323 
 324                 tok = fep->entry;
 325                 while (*tok && isspace(*tok))
 326                         tok++;
 327 
 328                 if (*tok == '\0') {
 329                         (void) fputs(fep->rawbuf, new);
 330                         break;
 331                 }
 332 
 333                 /* Make sure we can recover the remainder incl. whitespace */
 334                 tail = strpbrk(tok, "\t\n ");
 335                 if (tail == NULL)
 336                         tail = tok + strlen(tok);
 337                 tc = *tail;
 338                 *tail = '\0';
 339 
 340                 if (delall || delrange) {
 341                         min = strchr(tok, ':');
 342                         if (min)
 343                                 *min++ = '\0';
 344                 }
 345 
 346                 len = strlen(tok);
 347                 if (delrange) {
 348                         minor_t lo, hi;
 349                         char type;
 350 
 351                         /*
 352                          * Delete or shrink overlapping ranges.
 353                          */
 354                         if (strncmp(entry, tok, len) == 0 &&
 355                             entry[len] == ':' &&
 356                             min != NULL &&
 357                             parse_minor_range(min, &lo, &hi, &type) == 0 &&
 358                             (type == rtype || rtype == '\0') &&
 359                             lo <= rhi && hi >= rlo) {
 360                                 minor_t newlo, newhi;
 361 
 362                                 /* Complete overlap, then drop it. */
 363                                 if (lo >= rlo && hi <= rhi)
 364                                         continue;




  10  * or http://www.opensolaris.org/os/licensing.
  11  * See the License for the specific language governing permissions
  12  * and limitations under the License.
  13  *
  14  * When distributing Covered Code, include this CDDL HEADER in each
  15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  16  * If applicable, add the following below this CDDL HEADER, with the
  17  * fields enclosed by brackets "[]" replaced with your own identifying
  18  * information: Portions Copyright [yyyy] [name of copyright owner]
  19  *
  20  * CDDL HEADER END
  21  */
  22 /*
  23  * Copyright 2003 Sun Microsystems, Inc.  All rights reserved.
  24  * Use is subject to license terms.
  25  *
  26  * Device policy specific subroutines.  We cannot merge them with
  27  * drvsubr.c because of static linking requirements.
  28  */
  29 


  30 #include <stdio.h>
  31 #include <stdlib.h>
  32 #include <unistd.h>
  33 #include <string.h>
  34 #include <ctype.h>
  35 #include <priv.h>
  36 #include <string.h>
  37 #include <libgen.h>
  38 #include <libintl.h>
  39 #include <errno.h>
  40 #include <alloca.h>
  41 #include <sys/modctl.h>
  42 #include <sys/devpolicy.h>
  43 #include <sys/stat.h>
  44 #include <sys/sysmacros.h>
  45 
  46 #include "addrem.h"
  47 #include "errmsg.h"
  48 #include "plcysubr.h"
  49 


 318                         (void) fputs(fep->rawbuf, new);
 319                         break;
 320                 }
 321 
 322                 tok = fep->entry;
 323                 while (*tok && isspace(*tok))
 324                         tok++;
 325 
 326                 if (*tok == '\0') {
 327                         (void) fputs(fep->rawbuf, new);
 328                         break;
 329                 }
 330 
 331                 /* Make sure we can recover the remainder incl. whitespace */
 332                 tail = strpbrk(tok, "\t\n ");
 333                 if (tail == NULL)
 334                         tail = tok + strlen(tok);
 335                 tc = *tail;
 336                 *tail = '\0';
 337 

 338                 min = strchr(tok, ':');
 339                 if (min && (delall || delrange))
 340                         *min++ = '\0';

 341 
 342                 len = strlen(tok);
 343                 if (delrange) {
 344                         minor_t lo, hi;
 345                         char type;
 346 
 347                         /*
 348                          * Delete or shrink overlapping ranges.
 349                          */
 350                         if (strncmp(entry, tok, len) == 0 &&
 351                             entry[len] == ':' &&
 352                             min != NULL &&
 353                             parse_minor_range(min, &lo, &hi, &type) == 0 &&
 354                             (type == rtype || rtype == '\0') &&
 355                             lo <= rhi && hi >= rlo) {
 356                                 minor_t newlo, newhi;
 357 
 358                                 /* Complete overlap, then drop it. */
 359                                 if (lo >= rlo && hi <= rhi)
 360                                         continue;