🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sys.amiga.tech
Article #6843

Re: DateStamp HELP!

#6843
From: Huver
Date: Tue, 20 Nov 1990 03:49
81 lines
2617 bytes
In article <1990Nov18.030410.7819@hoss.unl.edu>, Phil Dietz wrote:
> ...
> I need to change the DateStamp on a ton of files, but I do not know the
> proper command.

Read 1.3 Enhancer manual page 2-25, the SETDATE command.

If you need to do it from inside a program, Thad Floryan just posted to
comp.sys.amiga (as a follow-up to `compress' spawned question) an example,
in C source, by Jeff Lydiatt.

NOTICE, however, in Lydiatt's setDate() function he used:

   arg[1] = (ULONG)IoErr(); /* lock on parent director set by DeviceProc() */

which is incorrect.  ParentDir() should be used for this purpose.

A similar function that I use with Manx 3.6/5.0 (under WB 1.3 or 1.3.2),
modified slightly from original PDmake posting, is attached below.


-huver  ...!uunet!amgraf!huver  -or-  huver%amgraf@uunet.uu.net
------
#include <exec/types.h>
#include <exec/memory.h>
#include <exec/io.h>
#include <exec/ports.h>
#include <libraries/dosextens.h>
#include <string.h>


/*
 * Set date of a given file.
 * -- !!  Uses Manx dos_packet() function  !! --
 *
 * Returns: 0 -- all is well; 1 -- whatever error we encounter.
*/

int setfdate (name, date)
char *name;		/* C string of file (including path) */
ULONG date[3];		/* desired datestamp, ala DateStamp(). */
{
	struct MsgPort *task, *DeviceProc();
	UBYTE *bcpls, *AllocMem();
	BPTR  lock, plock, Lock(), ParentDir();

	/* heck, need to convert to BCPL string */
	if (strlen(name) > 255) return 1;

	if ((bcpls = AllocMem(256L, MEMF_PUBLIC)) == 0) return 1;

	/* get file system handler process */
	if ((task = DeviceProc(name)) == 0) {
		FreeMem (bcpls, 256L);
		return 1;
	}

	if ((lock = Lock(name, SHARED_LOCK)) == 0) {
		FreeMem (bcpls, 256L);
		return 1;
	}
	plock = ParentDir (lock);
	UnLock (lock);

	strcpy ((char *)(bcpls + 1), name);
	*bcpls = strlen (name);

	dos_packet (task, ACTION_SET_DATE, 0L, plock, (ULONG)bcpls >> 2,
		    date, 0L, 0L, 0L);

	UnLock (plock);
	FreeMem (bcpls, 256L);
	return 0;
}
/* end setfdate.c */
-- 
-----
20th century miracle:
"A disk dos not have to be inserted to be examined by DISKED." -- AmigaDOS
Technical Reference Manual, 1 & 2ed.
Technical Details
Message-ID: <364@amgraf.UUCP>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uunet!amgraf!huver
References: <1990Nov18.030410.7819@hoss.unl.edu>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uunet!amgraf!huver
From: huver@amgraf.UUCP (Huver)
Newsgroups: comp.sys.amiga.tech
Subject: Re: DateStamp HELP!
Summary: Setdate in 1.3; beware of Lydiatt's use of IoErr().
Message-ID: <364@amgraf.UUCP>
Date: 20 Nov 90 03:49:04 GMT
References: <1990Nov18.030410.7819@hoss.unl.edu>
Organization: Amgraf Inc.,  Kansas City
Lines: 81