Subject: [netatalk-admins] More Capabilities For Megatron

From: "Frank Morton" <[email-masked]>
Date: Sat, 29 Aug 1998 08:51:27 -0500

As I continue to fine-tune my netatalk based OPI/media management
system, I have found another capability needed in megatron.

The problem: If you rename a netatalk file at the unix level, the old
filename is still embedded in the header, so if you try, as an example,
to make a macbinary file from such a file, megatron picks up the
filename from the header, meaning the macbinary filename does
not match the unix filesystem filename.

Solution: The patch below allows you to specify what filename to
"pretend" is in the header. The syntax is simple:

macbinary -filename "forced_filename" "normal_filename"

The additional patch from my previous patches is below. If anyone
would like the new source, drop me an e-mail and I will send.

>start megatron.c------------------------------------
37d36
<     char        newfilename[128];
61d59
<     *newfilename = 0;
67,71c65
<  if ( strcmp( argv [ c ], "-filename" ) == 0 ) {
<   if(++c < argc) strcpy(newfilename,argv[c]);
<   continue;
<  }
<  if ( rc = megatron( argv[ c ], module, newfilename, showheaderonly ) !=
0 ) {
---
>  if ( rc = megatron( argv[ c ], module , showheaderonly ) != 0 ) {
74d67
<         *newfilename = 0;
79c72
< megatron( path, module, newfilename, showheaderonly )
---
> megatron( path, module, showheaderonly )
82d74
<     char *newfilename;
120,123c112,115
<         for(k=0;k<NUMFORKS;++k) printf("forklen_%d: %u\n", k,
ntohl(fh.forklen[ k ]));
<         printf("create_date: %u\n",ntohl(fh.create_date));
<         printf("mod_date: %u\n",ntohl(fh.mod_date));
<         printf("backup_date: %u\n",ntohl(fh.backup_date));
---
>         for(k=0;k<NUMFORKS;++k) printf("forklen_%d: %u\n", k,
h.forklen[ k ]);
>         printf("create_date: %u\n",fh.create_date);
>         printf("mod_date: %u\n",fh.mod_date);
>         printf("backup_date: %u\n",fh.backup_date);
126c118
<         printf("flags: %x\n",ntohs(fh.finder_info.fdFlags));
---
>         printf("flags: %x\n",fh.finder_info.fdFlags);
132d123
<       set the header to the new filename if it has been supplied.
135,136d125
<     if ( *newfilename != 0) strcpy(fh.name,newfilename);
<
>start megatron.c------------------------------------

_________________________________
Frank Morton ([email-masked])
Voice: (317) 876-3355
FAX: (317) 876-3398
Home: (317) 574-0815