diff options
author | Andrew Tridgell <tridge@samba.org> | 2004-09-20 07:25:06 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 12:58:52 -0500 |
commit | f94de51a4eab98249833b383082467ab001561ce (patch) | |
tree | 7cf28b66ae3c619e37438359b3ee1ce02463e318 /source4/client | |
parent | defe32e9f47d9eca44533056b652f3b1c3f56c8e (diff) | |
download | samba-f94de51a4eab98249833b383082467ab001561ce.tar.gz samba-f94de51a4eab98249833b383082467ab001561ce.tar.bz2 samba-f94de51a4eab98249833b383082467ab001561ce.zip |
r2433: attrib_string() is now a generally available library function (it will be used by the new RAW-SEARCH test)
(This used to be commit bb6bb2735eef58a135ba5cc3d64d75588a505d66)
Diffstat (limited to 'source4/client')
-rw-r--r-- | source4/client/client.c | 44 |
1 files changed, 4 insertions, 40 deletions
diff --git a/source4/client/client.c b/source4/client/client.c index ac2e336cfe..33d3e695f2 100644 --- a/source4/client/client.c +++ b/source4/client/client.c @@ -341,44 +341,6 @@ static BOOL do_this_one(file_info *finfo) 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 @@ static void display_finfo(file_info *finfo) { 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 @@ static int process_tok(fstring tok) 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; } |