From f04e3ccecefde40307766363209bfd7c13b9c93a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Revol?= Date: Fri, 11 Oct 2002 22:33:36 +0000 Subject: [PATCH] Initial checkin git-svn-id: file:///srv/svn/repos/haiku/trunk/current@1484 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/apps/bin/listattr.cpp | 51 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 src/apps/bin/listattr.cpp diff --git a/src/apps/bin/listattr.cpp b/src/apps/bin/listattr.cpp new file mode 100644 index 0000000000..e394889d39 --- /dev/null +++ b/src/apps/bin/listattr.cpp @@ -0,0 +1,51 @@ +// Author: Ryan Fleet +// Created: 11th October 2002 +// Modified: 11th October 2002 + +#include +#include +#include + +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; +}