Update of /cvsroot/fink/dists/10.4-transitional/unstable/main/finkinfo/utils
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15250

Modified Files:
        osxutils.info osxutils.patch 
Log Message:
more tiger fixes

Index: osxutils.info
===================================================================
RCS file: 
/cvsroot/fink/dists/10.4-transitional/unstable/main/finkinfo/utils/osxutils.info,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- osxutils.info       2 Jun 2005 02:25:09 -0000       1.3
+++ osxutils.info       6 Jun 2005 10:47:53 -0000       1.4
@@ -1,6 +1,6 @@
 Package: osxutils
 Version: 1.6
-Revision: 11
+Revision: 12
 License: GPL
 Replaces: lsmac
 HomePage: http://sourceforge.net/projects/osxutils/
@@ -18,11 +18,15 @@
  flags, heritage file Type and Creator codes, icons, comments, labels
  and suffixes / file extensions. See 'man osxutils' for details.
 <<
-DescUsage: <<
+DescPackaging: <<
  uninstall.command is included for those who previously installed
  osxutils manually or via a pkg, and now wish to install it via Fink
  instead. It will not remove any osxutils components installed and
  managed by Fink.
+ 
+ Fixes included to allow building on Tiger, make getfcomment aware of
+ Spotlight comments, make rcmac compatible with GNU find, make fileinfo
+ work with GCC 4.
 <<
 Patch: %n.patch
 CompileScript: <<

Index: osxutils.patch
===================================================================
RCS file: 
/cvsroot/fink/dists/10.4-transitional/unstable/main/finkinfo/utils/osxutils.patch,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- osxutils.patch      29 Apr 2005 00:22:09 -0000      1.1
+++ osxutils.patch      6 Jun 2005 10:47:53 -0000       1.2
@@ -1,5 +1,6 @@
---- osxutils-1.6/src/fileinfo.c.bak    2005-04-16 12:39:55.000000000 -0700
-+++ osxutils-1.6/src/fileinfo.c        2005-04-16 13:06:48.000000000 -0700
+diff -Naur osxutils-old/src/fileinfo.c osxutils-new/src/fileinfo.c
+--- osxutils-old/src/fileinfo.c        2004-12-19 17:57:45.000000000 -0500
++++ osxutils-new/src/fileinfo.c        2005-06-06 04:36:41.000000000 -0400
 @@ -199,6 +199,15 @@
  
  
@@ -16,3 +17,164 @@
  void OutputFileInfo (char *path)
  {
        short                           i = 0;
+@@ -412,7 +421,8 @@
+ 
+       /* Is Stationery */
+       file->finderFlags[5] = (file->finderInfo.fdFlags & kIsStationery) ? 1 : 
0;
+-
++      
++      return noErr;
+ }
+ 
+ 
+diff -Naur osxutils-old/src/getfcomment.c osxutils-new/src/getfcomment.c
+--- osxutils-old/src/getfcomment.c     2004-12-18 18:31:38.000000000 -0500
++++ osxutils-new/src/getfcomment.c     2005-06-06 06:34:36.000000000 -0400
+@@ -106,6 +106,41 @@
+     return 0;
+ }
+ 
++/* Try to get a comment from spotlight, copying it into 'buf' and returning
++ *    true if successful. */
++static int TrySpotlightComment(char *path, char *buf) {
++      if (MDItemCreate == NULL) {
++              return 0; /* Spotlight not around */
++      } else {
++              MDItemRef mditem = NULL;
++              CFStringRef cfpath = NULL, comment = NULL;
++              int result = 0;
++              
++              cfpath = CFStringCreateWithFileSystemRepresentation(NULL, path);
++              if (cfpath == NULL)
++                      goto done;
++              
++              mditem = MDItemCreate(NULL, cfpath);
++              if (mditem == NULL)
++                      goto done;
++              
++              comment = MDItemCopyAttribute(mditem, kMDItemFinderComment);
++              if (comment == NULL)
++                      goto done;
++              
++              result = CFStringGetCString(comment, buf, MAX_COMMENT_LENGTH - 
1,
++                      GetApplicationTextEncoding());
++                                      
++              done:
++                      if (cfpath != NULL)
++                              CFRelease(cfpath);
++                      if (mditem != NULL)
++                              CFRelease(mditem);
++                      if (comment != NULL)
++                              CFRelease(comment);
++                      return result;
++      }
++}
+ 
+ static void PrintFileComment (char *path)
+ {
+@@ -113,8 +148,8 @@
+     FSRef     fileRef;
+     FSSpec    fileSpec;
+       DTPBRec dt;
+-      char    buf[255] = "\0";
+-      char    comment[255] = "\0";
++      char    buf[MAX_COMMENT_LENGTH] = "\0";
++      char    comment[MAX_COMMENT_LENGTH] = "\0";
+ 
+       //see if the file in question exists and we can write it
+       if (access(path, R_OK|F_OK) == -1)
+@@ -123,44 +158,46 @@
+               return;
+       }
+       
+-      //get file reference from path
+-      err = FSPathMakeRef(path, &fileRef, NULL);
+-      if (err != noErr)
+-      {
+-              fprintf(stderr, "FSPathMakeRef: Error %d for file %s\n", err, 
path);
+-              return;
+-      }
+-
+-      //retrieve filespec from file ref
+-      err = FSGetCatalogInfo (&fileRef, NULL, NULL, NULL, &fileSpec, NULL);
+-      if (err != noErr)
+-      {
+-              fprintf(stderr, "FSGetCatalogInfo(): Error %d getting file spec 
for %s\n", err, path);
+-              return;
+-      }
+-
+-    ///////////// oK, now we can go about getting the comment /////////////
+-
+-      dt.ioVRefNum = fileSpec.vRefNum;
+-        
+-    err = PBDTGetPath(&dt);
+-    
+-    //fill in the relevant fields (using parameters)
+-    dt.ioNamePtr = fileSpec.name;
+-    dt.ioDirID = fileSpec.parID;
+-    dt.ioDTBuffer = (char *)&buf;
+-      
+-      PBDTGetCommentSync(&dt);
+-      
+-      if (dt.ioDTActCount != 0) //if zero, that means no comment
+-      {
++      if (!TrySpotlightComment(path, comment)) {
++              //get file reference from path
++              err = FSPathMakeRef(path, &fileRef, NULL);
++              if (err != noErr)
++              {
++                      fprintf(stderr, "FSPathMakeRef: Error %d for file 
%s\n", err, path);
++                      return;
++              }
++
++              //retrieve filespec from file ref
++              err = FSGetCatalogInfo (&fileRef, NULL, NULL, NULL, &fileSpec, 
NULL);
++              if (err != noErr)
++              {
++                      fprintf(stderr, "FSGetCatalogInfo(): Error %d getting 
file spec for %s\n", err, path);
++                      return;
++              }
++
++              ///////////// oK, now we can go about getting the comment 
/////////////
++
++              dt.ioVRefNum = fileSpec.vRefNum;
++                      
++              err = PBDTGetPath(&dt);
++              
++              //fill in the relevant fields (using parameters)
++              dt.ioNamePtr = fileSpec.name;
++              dt.ioDirID = fileSpec.parID;
++              dt.ioDTBuffer = (char *)&buf;
++              
++              PBDTGetCommentSync(&dt);
++              
++              if (dt.ioDTActCount == 0) //if zero, that means no comment
++                      return;
++              
+               strncpy((char *)&comment, (char *)&buf, dt.ioDTActCount);
+-              if (!printFileName)
+-                      printf("%s\n", (char *)&comment);
+-              else
+-                      printf("Comment for '%s':\n%s\n", path, (char 
*)&comment);
+       }
+-      return;
++      
++      if (!printFileName)
++              printf("%s\n", (char *)&comment);
++      else
++              printf("Comment for '%s':\n%s\n", path, (char *)&comment);
+ }
+ 
+ 
+diff -Naur osxutils-old/src/rcmac osxutils-new/src/rcmac
+--- osxutils-old/src/rcmac     2004-12-17 00:35:04.000000000 -0500
++++ osxutils-new/src/rcmac     2005-06-06 04:56:10.000000000 -0400
+@@ -46,6 +46,7 @@
+ done
+ if [ $u ] || [ $vv ] ; then exit $u ; fi
+ if ! [ $1 ] ; then set $1 "." ; fi
++if echo -- "$1" | grep '^[-()!,]'; then set $1 "./$1"; fi
+ #echo "DEBUG: find -f \"$1\" \( -type d \) -exec echo '{}': \; -exec lsmac 
$lsmacoptions -o $escape '{}' \; -exec echo \;"
+ #echo "DEBUG: \$f is $f, \$1 is $1, \$@ is $@, \$lsmacoptions is 
$lsmacoptions, \$escape is $escape."
+-find -f $1 \( -type d \) -exec echo '{}': \; -exec lsmac $lsmacoptions -o 
$escape '{}' \; -exec echo \;
++find $1 \( -type d \) -exec echo '{}': \; -exec lsmac $lsmacoptions -o 
$escape '{}' \; -exec echo \;



-------------------------------------------------------
This SF.Net email is sponsored by: NEC IT Guy Games.  How far can you shotput
a projector? How fast can you ride your desk chair down the office luge track?
If you want to score the big prize, get to know the little guy.  
Play to win an NEC 61" plasma display: http://www.necitguy.com/?r=20
_______________________________________________
Fink-commits mailing list
Fink-commits@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/fink-commits

Reply via email to