bowman@reed.UUCP (Eric Bowman) (02/04/90)
I have no idea whether such a program has already been distributed (frankly, I wasn't paying attention), but having come face to face with grim, cold reality that OrphanFiles is a SCRIPT (?) and takes a VERY VERY LONG TIME on REALLY REALLY BIG PROJECTS, I just submitted to comp.sources.mac the source for a quick n dirty tool to strip out the ckid's from a file list to comp.sources.mac. ============================================================================== | The Insidious Uncle BoBo | ------------------------------------------------------------------------------ | "As I see it, my friends can access my private | | members in a public class..." | ============================================================================== | Eric Bowman -> | | ShitNet: bowman@reed.bitnet | | FarFromFreeNet: (503)234-7158 (Like I'll Really Answer) | | Disclaimer: "If my employer ever found out my opinions, well..." | /=\=/=\=/=\=/=\=/=\=/=\=/=\=/=\=/=\=/=\=/=\=/=\=/=\=/=\=/=\=/=\=/=\=/=\=/=\=/=
bowman@reed.UUCP (Eric Bowman) (02/04/90)
/* MPW 3.0 Tool to replace that God-Forsaken script, OrphanFiles */
/* This might work on 2.0.2 -- I haven't tried -- I don't see why
it wouldn't */
/* Deez Part, C: (3.0) */
#include <stdio.h>
#include <string.h>
#include <resources.h>
main(int argc,char *argv[])
{
char i,j,k;
short resid,oldres;
Boolean progress;
Handle tempHandle;
if (argc < 2) {
fprintf(stderr,"## OrphanFiles [-p] file [filesI]\n");
return 1;
}
InitCursorCtl(nil);
for (i=1;i<argc;i++) {
SpinCursor(1);
if (!strcmp(argv[i],"-p")) {
progress = true;
for (j=i+1;j<argc;j++)
argv[j-1] = argv[j];
argc--;
break;
} else progress = false;
}
if (progress) {
printf("\nOrphanFiles -- Very Fast Tool to replace Very Slow Script\n");
printf("February 3, 1990 by [Go For It]\n\n");
}
SetResLoad(false);
oldres = CurResFile();
for (i=1;i<argc;i++) {
SpinCursor(1);
resid = openresfile(argv[i]);
if (ResError()) {
fprintf(stderr,"# File %s not found\n",argv[i]);
break;
}
if (j = CountResources('ckid')) {
for (k=1;k<=j;k++) {
tempHandle=GetIndResource('ckid',k);
if (ResError() && progress)
printf(
"# Could not access 'ckid' resource index %d (error :%d) in file: %s\n"
,k,ResError(),argv[i]);
RmveResource(tempHandle);
if (progress) {
if (ResError())
printf(
"# Could not remove 'ckid' resource index %d (error :%d) in file: %s\n"
,k,ResError(),argv[i]);
else
printf("# Removed 'ckid' resource in file: %s\n",argv[i]);
}
}
} else if (progress)
printf("# %s has no 'ckid' resource\n",argv[i]);
CloseResFile(resid);
}
UseResFile(oldres);
}
/* Deez Part, rez */
#include "cmdo.r"
resource 'cmdo' (323, "OrphanFiles") {
{ /* array dialogs: 1 elements */
/* [1] */
175,
"Disassociate a file from a project by de"
"leting the ckid of the file.The content "
"of the project is unaffected.",
{ /* array itemArray: 1 elements */
/* [1] */
NotDependent {
},
MultiFiles {
"Files to OrphanI",
"This button brings up a dialog allowing "
"selection of files to orphan.",
{30, 161, 50, 321},
"Files to orphan:",
"",
MultiInputFiles {
{ /* array MultiTypesArray: 1 elements */
/* [1] */
text
},
FilterTypes,
"Only TEXT files",
"All Files"
}
},
NotDependent { },
CheckOption {
NotSet, {20,10,36,235}, "Progress Info","-p",
"Prints progress information to StdOut",
}
}
}
};
==============================================================================
| The Insidious Uncle BoBo |
------------------------------------------------------------------------------
| "As I see it, my friends can access my private |
| members in a public class..." |
==============================================================================
| Eric Bowman -> |
| ShitNet: bowman@reed.bitnet |
| FarFromFreeNet: (503)234-7158 (Like I'll Really Answer) |
| Disclaimer: "If my employer ever found out my opinions, well..." |
/=\=/=\=/=\=/=\=/=\=/=\=/=\=/=\=/=\=/=\=/=\=/=\=/=\=/=\=/=\=/=\=/=\=/=\=/=\=/=
"Tabs are for wienies"