FreeIPA
banners
Contribute to FreeIPA!

From Free IPA

BEGIN {

   inside = 0
   defline = ""
   if(va > 0) {
       acount = va
   } else {
       acount = 1
   }
   if(vo > 0) {
       ocount = vo
   } else {
       ocount = 1
   }
   oflag = 0
   aflag = 0
   print "dn: cn=schema"

}

{

   if( inside == 0) {
   
       if((( $1 == "objectClass" ) ||
           ( $1 == "objectclass" ) ||
           ( $1 == "attribute" ) ||
           ( $1 == "attributeType" ) ||
           ( $1 == "attributetype" )) &&
           ( $2 == "(")) {
               defline = ""
               if (substr($1,1,1) == "o") {
                   defline = "objectClasses:"
                   if ( $NF == "2.16.840.1.113730.3.8.4.TBD") {
                       oid = substr($NF, 1, length($NF)-3) ocount
                       oflag = 2
                   } else {
                       oid = $NF
                       oflag = 1
                   }
               } else {
                   defline = "attributeTypes:"
                   if ( $NF == "2.16.840.1.113730.3.8.3.TBD") {
                       oid = substr($NF, 1, length($NF)-3) acount
                       aflag = 2
                   } else {
                       oid = $NF
                       aflag = 1
                   }
               }
               for (i=2; i<NF; i++ ) {
                   defline = defline " "
                   defline = defline $i
               }
               defline = defline oid
               inside = 1
               /* print defline */
       }
   } else {
       ind = index($NF,")")
       /* print ind length($NF) $NF */
       if (( $1 != "MAY") && ($1 != "MUST") && ((ind > 0) && (ind == length($NF)))) {
           inside = 0
       }
       for (i=1; i<=NF; i++ ) {
           defline = defline " "
           defline = defline $i
           if ($i == "NAME") {
               /* print $(i+1) */
               if (oflag > 0) {
                   if (onames[$(i+1)] == 1) {
                       oflag = 0
                   } else {
                       onames[$(i+1)] = 1
                   }
               }
               if (aflag > 0) {
                   if (anames[$(i+1)] == 1) {
                       aflag = 0
                   } else {
                       anames[$(i+1)] = 1
                   }
               }
               /* print onames[$(i+1)] */
               /* print anames[$(i+1)] */
           }        
       }
       if ((inside == 0) && ((oflag > 0) || (aflag > 0))) {
           if(oflag == 2) {
               ocount++
           }
           oflag = 0
           if(aflag == 2) {
               acount++
           }
           aflag = 0
           print defline
       }
   }

}

Views Article Discussion Edit History
Personal tools:  Log in / create account
Toolbox What links here Related changes Upload file Special pages Printable version