Initial checkin

git-svn-id: file:///srv/svn/repos/haiku/trunk/current@1484 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
François Revol 2002-10-11 22:33:36 +00:00
parent 9a125bf5e0
commit f04e3ccece

51
src/apps/bin/listattr.cpp Normal file
View File

@ -0,0 +1,51 @@
// Author: Ryan Fleet
// Created: 11th October 2002
// Modified: 11th October 2002
#include <cstdio>
#include <Node.h>
#include <fs_attr.h>
int main(int argc, char *argv[])
{
if(argc < 2)
{
printf("usage: listattr 'filename' ['filename' ...]\n");
return 0;
}
for(int i = 1; i < argc; ++i)
{
BNode node(argv[i]);
if (B_OK != node.InitCheck())
{
printf("listattr: error for '%s' (Initialization failed)\n", argv[i]);
return 0;
}
printf("file %s\n", argv[i]);
printf(" Type Size Name\n");
printf("---------- --------- -------------------------------\n");
char szBuffer[B_ATTR_NAME_LENGTH];
while(B_OK == node.GetNextAttrName(szBuffer))
{
attr_info attrInfo;
node.GetAttrInfo(szBuffer, &attrInfo);
switch(attrInfo.type)
{
case 0x4d494d53:
printf(" MIME str");
break;
default:
printf("0x%lx", attrInfo.type);
break;
};
printf("% 11lli", attrInfo.size);
printf("%34s\n", szBuffer);
}
}
return 0;
}