Posted By

zingo on 05/12/08


Tagged

osx log FileSystem NSLog fs


Versions (?)

Filesystem - Testing FS Type


 / Published in: Objective C
 

URL: http://www.cocoabuilder.com/archive/message/cocoa/2006/5/18/163842

This can be used to test FS type.

  1. int main (int argc, const char * argv[]) {
  2. NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
  3.  
  4. struct statfs fsInfo;
  5.  
  6. NSLog(@"Testing %s", argv[1]);
  7. if (statfs(argv[1], &fsInfo) == -1) {
  8. NSLog(@"Error %s", argv[1]);
  9. exit(1);
  10. }
  11.  
  12. if (fsInfo.f_flags & MNT_RDONLY) {
  13. NSLog(@"Read only %s", argv[1]);
  14. exit(0);
  15. }
  16.  
  17. NSLog(@"Type %s", fsInfo.f_fstypename);
  18.  
  19. [pool release];
  20. return 0;
  21. }

Report this snippet  

You need to login to post a comment.