Print this page
5910 libnisdb won't build with modern GCC

@@ -18,16 +18,15 @@
  * information: Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
  */
 /*
+ * Copyright 2015 Gary Mills
  * Copyright 2001-2003 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
 
-#pragma ident   "%Z%%M% %I%     %E% SMI"
-
 #include <stdio.h>
 #include <string.h>
 #include <stdlib.h>
 #include <ctype.h>
 #include <fcntl.h>

@@ -34,10 +33,12 @@
 #include <unistd.h>
 #include <locale.h>
 
 #include "ldap_parse.h"
 #include "nis_parse_ldap_conf.h"
+#include "nis_parse_ldap_yp_util.h"
+#include "nis_parse_ldap_util.h"
 
 /* other attribute functions */
 static char *getIndex(const char **s_cur, const char *end_s);
 static bool_t get_ttls(const char *s, const char *s_end,
     __nis_table_mapping_t *t_mapping);

@@ -91,11 +92,10 @@
 {
         const char              *s;
         const char              *attrib_end;
         const char              *db_id_end;
         const char              *begin_token;
-        const char              *end_token;
         char                    *index_string;
         __nis_object_dn_t       *objectDN;
         __nis_table_mapping_t   *t_mapping;
         __nis_table_mapping_t   *t;
 

@@ -376,13 +376,10 @@
         __yp_domain_context_t   *ypDomains)
 {
         const char              *s;
         const char              *attrib_end;
         int                             numDomains = 0;
-        int                     i;
-        char                    *tmp_str;
-        int                             ret = 0;
 
         attrib_end = attrib_val + attrib_len;
         for (s = attrib_val; s < attrib_end; s++) {
                 if (*s == COLON_CHAR) {
                         break;

@@ -1509,12 +1506,12 @@
                                         parse_format_string_expected_error;
                                     break;
                                 }
 
                                 if (end_token == begin_token + 1 ||
-                                    *begin_token == ESCAPE_CHAR &&
-                                    end_token == begin_token + 2) {
+                                    (*begin_token == ESCAPE_CHAR &&
+                                    end_token == begin_token + 2)) {
                                         e->type = me_split;
                                         e->element.split.item = item;
                                         e->element.split.delim = *begin_token;
                                 } else {
                                         str = s_strndup(begin_token,

@@ -1651,12 +1648,12 @@
                         begin_token = s;
                         end_token = end_s;
                         s = get_next_token(&begin_token, &end_token, &t);
                         if (s != NULL && t == quoted_string_token &&
                                 (end_token == begin_token + 1 ||
-                                    *begin_token == ESCAPE_CHAR &&
-                                    end_token == begin_token + 2)) {
+                            (*begin_token == ESCAPE_CHAR &&
+                            end_token == begin_token + 2))) {
                                 if (numSubElements != 1 ||
                                     subElement->type == me_extract ||
                                     subElement->type == me_split) {
                                         p_error = parse_cannot_elide;
                                         break;

@@ -2065,12 +2062,12 @@
                         if (s == NULL || t != quoted_string_token) {
                                 p_error = parse_format_string_expected_error;
                                 break;
                         }
                         if (end_token == begin_token + 1 ||
-                            *begin_token == ESCAPE_CHAR &&
-                            end_token == begin_token + 2) {
+                            (*begin_token == ESCAPE_CHAR &&
+                            end_token == begin_token + 2)) {
                                         /* me_split */
                                 delim = (unsigned char)end_token[-1];
                                 s = skip_token(s, end_s, close_paren_token);
                                 if (s == NULL)
                                         break;