[Linux-NTFS-cvs] CVS: linux-ntfs/ntfstools ntfsinfo.c,1.3,1.4
Development moved to https://sourceforge.net/projects/ntfs-3g/
Brought to you by:
antona,
cha0smaster
From: Matthew J. F. <ma...@us...> - 2002-05-14 01:02:08
|
Changes by: mattjf Update of /cvsroot/linux-ntfs/linux-ntfs/ntfstools In directory usw-pr-cvs1:/tmp/cvs-serv24798/ntfstools Modified Files: ntfsinfo.c Log Message: Bugfix and code cleanup. ntfsinfo now returns the filename Index: ntfsinfo.c =================================================================== RCS file: /cvsroot/linux-ntfs/linux-ntfs/ntfstools/ntfsinfo.c,v retrieving revision 1.3 retrieving revision 1.4 diff -U2 -r1.3 -r1.4 --- ntfsinfo.c 13 May 2002 03:44:10 -0000 1.3 +++ ntfsinfo.c 14 May 2002 01:02:04 -0000 1.4 @@ -44,7 +44,17 @@ const char *AUTHOR = "Matthew J. Fanto"; const char *EXEC_NAME = "ntfsinfo"; + const char *locale; int i; - if (argc < 3 || argc > 4) { + locale = setlocale(LC_ALL, ""); + if (!locale) { + char *locale; + + locale = setlocale(LC_ALL, NULL); + printf("Failed to set locale, using default (%s).\n", locale); + } else + printf("Using locale %s.\n", locale); + + if(argc < 3 || argc > 4) { fprintf(stderr, "%s v%s - %s\n", EXEC_NAME, VERSION, AUTHOR); fprintf(stderr, "Usage: ntfsinfo device inode"); @@ -52,7 +62,8 @@ } - else + else { i = atol(argv[2]); get_file_attribute_value(argv[1], i); + } return 0; @@ -72,5 +83,4 @@ uchar_t *file_name; ntfs_inode *inode = NULL; - vol = ntfs_mount(dev,0); @@ -86,8 +96,11 @@ ctx = ntfs_get_attr_search_ctx(inode,mrec); - if(ntfs_lookup_attr(AT_FILE_NAME,NULL,0,0,0,NULL,0,ctx)){ + +//Here is where we need to start searching for each attribute + + if(ntfs_lookup_attr(AT_FILE_NAME,NULL,0,0,0,NULL,0,ctx)) { perror("Error looking up attribute!\n"); exit(1); - } + } attr = ctx->attr; @@ -95,9 +108,6 @@ file_name_attr = (FILE_NAME_ATTR*)((char*)attr + le16_to_cpu(attr->value_offset)); - ntfs_mbstoucs(file_name_attr->file_name,&file_name,0); - + ntfs_ucstombs(file_name_attr->file_name,file_name_attr->file_name_length,&file_name,file_name_attr->file_name_length); printf("%s\n",file_name); - - - + } |