svn commit: samba r2433 - in branches/SAMBA_4_0/source/client: .

tridge at samba.org tridge at samba.org
Mon Sep 20 07:25:07 GMT 2004


Author: tridge
Date: 2004-09-20 07:25:06 +0000 (Mon, 20 Sep 2004)
New Revision: 2433

WebSVN: http://websvn.samba.org/websvn/changeset.php?rep=samba&path=/branches/SAMBA_4_0/source/client&rev=2433&nolog=1

Log:
attrib_string() is now a generally available library function (it will be used by the new RAW-SEARCH test)


Modified:
   branches/SAMBA_4_0/source/client/client.c


Changeset:
Modified: branches/SAMBA_4_0/source/client/client.c
===================================================================
--- branches/SAMBA_4_0/source/client/client.c	2004-09-20 07:24:00 UTC (rev 2432)
+++ branches/SAMBA_4_0/source/client/client.c	2004-09-20 07:25:06 UTC (rev 2433)
@@ -341,44 +341,6 @@
 	return(True);
 }
 
-/*******************************************************************
- Return a string representing an attribute for a file.
-********************************************************************/
-static const char *attrib_string(uint16_t mode)
-{
-	static fstring attrstr;
-	int i, len;
-	const struct {
-		char c;
-		uint16_t attr;
-	} attr_strs[] = {
-		{'V', FILE_ATTRIBUTE_VOLUME},
-		{'D', FILE_ATTRIBUTE_DIRECTORY},
-		{'A', FILE_ATTRIBUTE_ARCHIVE},
-		{'H', FILE_ATTRIBUTE_HIDDEN},
-		{'S', FILE_ATTRIBUTE_SYSTEM},
-		{'R', FILE_ATTRIBUTE_READONLY},
-		{'d', FILE_ATTRIBUTE_DEVICE},
-		{'t', FILE_ATTRIBUTE_TEMPORARY},
-		{'s', FILE_ATTRIBUTE_SPARSE},
-		{'r', FILE_ATTRIBUTE_REPARSE_POINT},
-		{'c', FILE_ATTRIBUTE_COMPRESSED},
-		{'o', FILE_ATTRIBUTE_OFFLINE},
-		{'n', FILE_ATTRIBUTE_NONINDEXED},
-		{'e', FILE_ATTRIBUTE_ENCRYPTED}
-	};
-
-	for (len=i=0; i<ARRAY_SIZE(attr_strs); i++) {
-		if (mode & attr_strs[i].attr) {
-			attrstr[len++] = attr_strs[i].c;
-		}
-	}
-
-	attrstr[len] = 0;
-
-	return(attrstr);
-}
-
 /****************************************************************************
   display info about a file
   ****************************************************************************/
@@ -386,12 +348,14 @@
 {
 	if (do_this_one(finfo)) {
 		time_t t = finfo->mtime; /* the time is assumed to be passed as GMT */
+		char *astr = attrib_string(NULL, finfo->mode);
 		d_printf("  %-30s%7.7s %8.0f  %s",
 			 finfo->name,
-			 attrib_string(finfo->mode),
+			 astr,
 			 (double)finfo->size,
 			 asctime(localtime(&t)));
 		dir_total += finfo->size;
+		talloc_free(astr);
 	}
 }
 
@@ -2402,7 +2366,7 @@
 			matches = 1;
 			cmd = i;
 			break;
-		} else if (strnequal(commands[i].name, tok, tok_len)) {
+		} else if (strncasecmp(commands[i].name, tok, tok_len) == 0) {
 			matches++;
 			cmd = i;
 		}



More information about the samba-cvs mailing list