[prev in list] [next in list] [prev in thread] [next in thread]
List: linux-ntfs-cvs
Subject: [Linux-NTFS-cvs] CVS: linux-ntfs/ntfstools ntfsinfo.c,1.3,1.4
From: "Matthew J. Fanto" <mattjf () users ! sourceforge ! net>
Date: 2002-05-14 1:02:07
[Download RAW message or body]
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);
-
-
-
+
}
_______________________________________________________________
Have big pipes? SourceForge.net is looking for download mirrors. We supply
the hardware. You get the recognition. Email Us: bandwidth@sourceforge.net
_______________________________________________
Linux-NTFS-cvs mailing list
Linux-NTFS-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-ntfs-cvs
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic