]> err.no Git - sope/blobdiff - sope-mime/samples/ImapListTool.m
replaced usage of getCString on MacOS >= 10.4
[sope] / sope-mime / samples / ImapListTool.m
index 35a9e56c477658769acccdcf373bb02959288ce5..9256b42f3654a4646066841ad5860a81ba062d72 100644 (file)
@@ -1,20 +1,20 @@
 /*
-  Copyright (C) 2000-2004 SKYRIX Software AG
+  Copyright (C) 2000-2005 SKYRIX Software AG
 
-  This file is part of OpenGroupware.org.
+  This file is part of SOPE.
 
-  OGo is free software; you can redistribute it and/or modify it under
+  SOPE is free software; you can redistribute it and/or modify it under
   the terms of the GNU Lesser General Public License as published by the
   Free Software Foundation; either version 2, or (at your option) any
   later version.
 
-  OGo is distributed in the hope that it will be useful, but WITHOUT ANY
+  SOPE is distributed in the hope that it will be useful, but WITHOUT ANY
   WARRANTY; without even the implied warranty of MERCHANTABILITY or
   FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
   License for more details.
 
   You should have received a copy of the GNU Lesser General Public
-  License along with OGo; see the file COPYING.  If not, write to the
+  License along with SOPE; see the file COPYING.  If not, write to the
   Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
   02111-1307, USA.
 */
@@ -40,6 +40,7 @@
     NSString     *cpath, *apath;
     NSDictionary *info;
     NSString     *mid;
+    const unsigned char *datestr;
         
     if (!self->useDataSource) {
       cpath = [dirContents objectAtIndex:i];
       mid = [mid substringToIndex:37];
       mid = [mid stringByAppendingString:@"..."];
     }
-        
+    
     /* id uid date name */
     if (_part) {
       printf("%10d ",
              [[fm contentsAtPath:[info valueForKey:@"NSFilePath"]
                   part:_part] length]);
     }
+
+    datestr = [[[info valueForKey:NSFileModificationDate]
+                description] cString];
+
     printf("%-40s  %8s  %8i  %-32s %s",
-          [mid cString],
+          (mid ? [mid cString] : ""),
           [[info valueForKey:NSFileOwnerAccountName]      cString],
           [[info valueForKey:NSFileSize] intValue],
-          [[[info valueForKey:NSFileModificationDate]
-             description] cString],
+          (datestr ? (char *)datestr : ""),
           [apath cString]);
 
     if ([[info valueForKey:NSFileType]
@@ -81,8 +85,6 @@
       printf("/\n");
     else
       printf("\n");
-
-    
   }
   return YES;
 }
   if (![fm changeCurrentDirectoryPath:path]) {
     NSLog(@"%s: could not change to directory: '%@'", path);
   }
-
+  
   ds = self->useDataSource
     ? [(id<NGFileManagerDataSources>)fm dataSourceAtPath:path]
     : nil;
     return;
   }
     
-  if (isDir) {
+  if (isDir)
     [self processFolder:path fileManager:fm part:part];
-  }
-  else {
+  else
     [self processFile:path fileManager:fm part:part];
-  }
 }
 
 /* tool operation */