changeset 3407:d9ac3b8746e4

6499494 libshare's Makefiles need cleanup 6500069 libshare incorrectly uses gettext()
author dougm
date Thu, 11 Jan 2007 16:21:40 -0800
parents 65b3165d3917
children 67ca9373b99e
files usr/src/lib/libshare/Makefile usr/src/lib/libshare/Makefile.com usr/src/lib/libshare/common/libshare.c usr/src/lib/libshare/common/libshare_zfs.c usr/src/lib/libshare/common/libsharecore.c usr/src/lib/libshare/common/plugin.c
diffstat 6 files changed, 61 insertions(+), 72 deletions(-) [+]
line wrap: on
line diff
--- a/usr/src/lib/libshare/Makefile	Thu Jan 11 15:39:02 2007 -0800
+++ b/usr/src/lib/libshare/Makefile	Thu Jan 11 16:21:40 2007 -0800
@@ -21,22 +21,18 @@
 #
 # ident	"%Z%%M%	%I%	%E% SMI"
 #
-# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+# Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
 # Use is subject to license terms.
 #
 
-include ../../Makefile.master
-
 include ../Makefile.lib
 
 HDRS =		libshare.h
 HDRDIR =	common
 SUBDIRS =	$(MACH)
-ROOTHDRDIR=     $(ROOT)/usr/include
-ROOTHDRS=       $(HDRS:%=$(ROOTHDRDIR)/%)
 
 MSGFILES=	common/libshare.c common/libsharecore.c common/scfutil.c \
-		common/parser.c common/libshare_zfs.c
+		common/plugin.c common/parser.c common/libshare_zfs.c
 POFILE=		libshare.po
 
 all :=		TARGET = all
--- a/usr/src/lib/libshare/Makefile.com	Thu Jan 11 15:39:02 2007 -0800
+++ b/usr/src/lib/libshare/Makefile.com	Thu Jan 11 16:21:40 2007 -0800
@@ -21,61 +21,43 @@
 #
 # ident	"%Z%%M%	%I%	%E% SMI"
 #
-# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+# Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
 # Use is subject to license terms.
 #
 LIBRARY =	libshare.a
 VERS =		.1
 NFSLIB_DIR =	$(SRC)/cmd/fs.d/nfs/lib
-NFSSECSRC  =	$(NFSLIB_DIR)/nfs_sec.c
-NFSSHARETAB =	$(NFSLIB_DIR)/sharetab.c
 
 LIBOBJS =	libshare.o libsharecore.o scfutil.o libshare_zfs.o \
 		plugin.o parser.o issubdir.o
 OTHOBJS =	sharetab.o nfs_sec.o
 OBJECTS =	$(LIBOBJS) $(OTHOBJS)
-COMMON =	../common
-
-SRCS =		$(OBJECTS:%.o=../%.c)
-LIBSRCS =	$(LIBOBJS:%.o=$(COMMON)/%.c)
-POFILES	=	$(OBJECTS:%.o=%.po)
-POFILE  =	libshare.po
 
 include ../../Makefile.lib
-
-ROOTDIRS= $(ROOT)/usr/include
+SRCDIR =	../common
 
-ROOTHDRS= $(HDRS:%=$(ROOTDIRS)/%)
-
-CHECKHDRS= $(HDRS:%.h=%.check)
+LIBSRCS =	$(LIBOBJS:%.o=$(SRCDIR)/%.c)
+# we don't want to lint the sharetab and nfs_sec files
+lintcheck := SRCS = $(LIBSRCS)
 
 LIBS =		$(DYNLIB) $(LINTLIB)
 LDLIBS +=	-lc -lnsl -lscf -lzfs -luuid
 all install := LDLIBS += -lxml2
 $(LINTLIB) :=	SRCS = $(SRCDIR)/$(LINTSRC)
 
-SRCDIR =	../common
-MAPDIR =	../spec/$(TRANSMACH)
-SPECMAPFILE =	$(MAPDIR)/mapfile
-
 #add nfs/lib directory as part of the include path
-CFLAGS +=	$(CCVERBOSE) -g
-CPPFLAGS +=	-D_REENTRANT -I$(SRC)/cmd/fs.d/nfs/lib -I/usr/include/libxml2 \
-		-I../common
+CFLAGS +=	$(CCVERBOSE)
+CPPFLAGS +=	-D_REENTRANT -I$(NFSLIB_DIR) -I/usr/include/libxml2 \
+		-I$(SRCDIR)
 
 .KEEP_STATE:
 
 all: $(LIBS)
 
-# we don't want to lint the sharetab and nfs_sec files
-lint: $$(LIBSRCS)
-	$(LINT.c) $(LINTCHECKFLAGS) $(LIBSRCS) $(LDLIBS)
+lint: lintcheck
 
 pics/%.o:	$(NFSLIB_DIR)/%.c
 	$(COMPILE.c) -o $@ $<
 	$(POST_PROCESS_O)
 
 include ../../Makefile.targ
-
-$(POFILE):      $(POFILES)
-	$(RM) $@; cat $(POFILES) > $@
--- a/usr/src/lib/libshare/common/libshare.c	Thu Jan 11 15:39:02 2007 -0800
+++ b/usr/src/lib/libshare/common/libshare.c	Thu Jan 11 16:21:40 2007 -0800
@@ -87,80 +87,80 @@
 
 	switch (err) {
 	case SA_OK:
-	    ret = gettext("ok");
+	    ret = dgettext(TEXT_DOMAIN, "ok");
 	    break;
 	case SA_NO_SUCH_PATH:
-	    ret = gettext("path doesn't exist");
+	    ret = dgettext(TEXT_DOMAIN, "path doesn't exist");
 	    break;
 	case SA_NO_MEMORY:
-	    ret = gettext("no memory");
+	    ret = dgettext(TEXT_DOMAIN, "no memory");
 	    break;
 	case SA_DUPLICATE_NAME:
-	    ret = gettext("name in use");
+	    ret = dgettext(TEXT_DOMAIN, "name in use");
 	    break;
 	case SA_BAD_PATH:
-	    ret = gettext("bad path");
+	    ret = dgettext(TEXT_DOMAIN, "bad path");
 	    break;
 	case SA_NO_SUCH_GROUP:
-	    ret = gettext("no such group");
+	    ret = dgettext(TEXT_DOMAIN, "no such group");
 	    break;
 	case SA_CONFIG_ERR:
-	    ret = gettext("configuration error");
+	    ret = dgettext(TEXT_DOMAIN, "configuration error");
 	    break;
 	case SA_SYSTEM_ERR:
-	    ret = gettext("system error");
+	    ret = dgettext(TEXT_DOMAIN, "system error");
 	    break;
 	case SA_SYNTAX_ERR:
-	    ret = gettext("syntax error");
+	    ret = dgettext(TEXT_DOMAIN, "syntax error");
 	    break;
 	case SA_NO_PERMISSION:
-	    ret = gettext("no permission");
+	    ret = dgettext(TEXT_DOMAIN, "no permission");
 	    break;
 	case SA_BUSY:
-	    ret = gettext("busy");
+	    ret = dgettext(TEXT_DOMAIN, "busy");
 	    break;
 	case SA_NO_SUCH_PROP:
-	    ret = gettext("no such property");
+	    ret = dgettext(TEXT_DOMAIN, "no such property");
 	    break;
 	case SA_INVALID_NAME:
-	    ret = gettext("invalid name");
+	    ret = dgettext(TEXT_DOMAIN, "invalid name");
 	    break;
 	case SA_INVALID_PROTOCOL:
-	    ret = gettext("invalid protocol");
+	    ret = dgettext(TEXT_DOMAIN, "invalid protocol");
 	    break;
 	case SA_NOT_ALLOWED:
-	    ret = gettext("operation not allowed");
+	    ret = dgettext(TEXT_DOMAIN, "operation not allowed");
 	    break;
 	case SA_BAD_VALUE:
-	    ret = gettext("bad property value");
+	    ret = dgettext(TEXT_DOMAIN, "bad property value");
 	    break;
 	case SA_INVALID_SECURITY:
-	    ret = gettext("invalid security type");
+	    ret = dgettext(TEXT_DOMAIN, "invalid security type");
 	    break;
 	case SA_NO_SUCH_SECURITY:
-	    ret = gettext("security type not found");
+	    ret = dgettext(TEXT_DOMAIN, "security type not found");
 	    break;
 	case SA_VALUE_CONFLICT:
-	    ret = gettext("property value conflict");
+	    ret = dgettext(TEXT_DOMAIN, "property value conflict");
 	    break;
 	case SA_NOT_IMPLEMENTED:
-	    ret = gettext("not implemented");
+	    ret = dgettext(TEXT_DOMAIN, "not implemented");
 	    break;
 	case SA_INVALID_PATH:
-	    ret = gettext("invalid path");
+	    ret = dgettext(TEXT_DOMAIN, "invalid path");
 	    break;
 	case SA_NOT_SUPPORTED:
-	    ret = gettext("operation not supported");
+	    ret = dgettext(TEXT_DOMAIN, "operation not supported");
 	    break;
 	case SA_PROP_SHARE_ONLY:
-	    ret = gettext("property not valid for group");
+	    ret = dgettext(TEXT_DOMAIN, "property not valid for group");
 	    break;
 	case SA_NOT_SHARED:
-	    ret = gettext("not shared");
+	    ret = dgettext(TEXT_DOMAIN, "not shared");
 	    break;
 	default:
 	    (void) snprintf(errstr, sizeof (errstr),
-				gettext("unknown %d"), err);
+				dgettext(TEXT_DOMAIN, "unknown %d"), err);
 	    ret = errstr;
 	}
 	return (ret);
--- a/usr/src/lib/libshare/common/libshare_zfs.c	Thu Jan 11 15:39:02 2007 -0800
+++ b/usr/src/lib/libshare/common/libshare_zfs.c	Thu Jan 11 16:21:40 2007 -0800
@@ -20,7 +20,7 @@
  */
 
 /*
- * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
 
@@ -556,7 +556,8 @@
 				if (err == 0) {
 				    /* only print error once */
 				    (void) fprintf(stderr,
-					gettext("Cannot create ZFS subgroup "
+					dgettext(TEXT_DOMAIN,
+						"Cannot create ZFS subgroup "
 						"during initialization:"
 						" %s\n"),
 					sa_errorstr(SA_SYSTEM_ERR));
--- a/usr/src/lib/libshare/common/libsharecore.c	Thu Jan 11 15:39:02 2007 -0800
+++ b/usr/src/lib/libshare/common/libsharecore.c	Thu Jan 11 16:21:40 2007 -0800
@@ -962,11 +962,12 @@
 		else
 		    sgroup = NULL;
 	    } else {
-		(void) printf(gettext("No share specified in dfstab: "
+		(void) printf(dgettext(TEXT_DOMAIN,
+					"No share specified in dfstab: "
 					"line %d: %s\n"),
 			list->lineno, list->origline);
 		add_syntax_comment(root, list->origline,
-				    gettext("No share specified"),
+				    dgettext(TEXT_DOMAIN, "No share specified"),
 				    1);
 		continue;
 	    }
@@ -977,11 +978,13 @@
 		group = defgroup;
 	    }
 	    if (defined_group && group == NULL) {
-		(void) printf(gettext("Unknown group used in dfstab: "
+		(void) printf(dgettext(TEXT_DOMAIN,
+					"Unknown group used in dfstab: "
 					"line %d: %s\n"),
 			list->lineno, list->origline);
 		add_syntax_comment(root, list->origline,
-				    gettext("Unknown group specified"), 1);
+				    dgettext(TEXT_DOMAIN,
+						"Unknown group specified"), 1);
 		continue;
 	    }
 	    if (group != NULL) {
@@ -1006,26 +1009,31 @@
 				(void) sa_set_share_attr(share, "resource",
 						    list->resource);
 			} else {
-			    (void) printf(gettext("Error in dfstab: "
+			    (void) printf(dgettext(TEXT_DOMAIN,
+					    "Error in dfstab: "
 					    "line %d: %s\n"),
 				    list->lineno, list->origline);
 			    if (err != SA_BAD_PATH)
 				add_syntax_comment(root, list->origline,
-						gettext("Syntax"), 1);
+						dgettext(TEXT_DOMAIN,
+							    "Syntax"), 1);
 			    else
 				add_syntax_comment(root, list->origline,
-						gettext("Path"), 1);
+						dgettext(TEXT_DOMAIN,
+							    "Path"), 1);
 			    continue;
 			}
 		    }
 		} else {
 		    if (group != sgroup) {
-			(void) printf(gettext("Attempt to change"
+			(void) printf(dgettext(TEXT_DOMAIN, "Attempt to change"
 						"configuration in"
 						"dfstab: line %d: %s\n"),
 				list->lineno, list->origline);
 			add_syntax_comment(root, list->origline,
-				gettext("Attempt to change configuration"), 1);
+				dgettext(TEXT_DOMAIN,
+					    "Attempt to change configuration"),
+				1);
 			continue;
 		    }
 		    /* its the same group but could have changed options */
@@ -1295,7 +1303,8 @@
 		    }
 		}
 		if (share == NULL)
-		    (void) printf(gettext("Problem with transient: %s\n"),
+		    (void) printf(dgettext(TEXT_DOMAIN,
+					    "Problem with transient: %s\n"),
 				    sa_errorstr(err));
 		if (share != NULL)
 		    set_node_attr(share, "shared", "true");
--- a/usr/src/lib/libshare/common/plugin.c	Thu Jan 11 15:39:02 2007 -0800
+++ b/usr/src/lib/libshare/common/plugin.c	Thu Jan 11 16:21:40 2007 -0800
@@ -20,7 +20,7 @@
  */
 
 /*
- * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
 
@@ -109,7 +109,8 @@
 		    }
 		} else {
 		    (void) fprintf(stderr,
-			    gettext("Error in plugin for protocol %s: %s\n"),
+			    dgettext(TEXT_DOMAIN,
+				    "Error in plugin for protocol %s: %s\n"),
 			    dent->d_name, dlerror());
 		}
 	    }