Thread View: comp.sys.amiga.tech
5 messages
5 total messages
Started by Phil Dietz
Sun, 18 Nov 1990 03:04
DateStamp HELP!
Author: Phil Dietz
Date: Sun, 18 Nov 1990 03:04
Date: Sun, 18 Nov 1990 03:04
16 lines
1178 bytes
1178 bytes
Once again I've run into a DOS problem (I sure wish the RKM's had the
info in it like it should! What book do I need).
I need to change the DateStamp on a ton of files, but I do not know the
proper command. I can get it VIA the FILEINFO deally, but how can a
change it on disk??? Do I have to recopy the whole file with a new
DateStamp or is there a goofy funtion like ChangeDS(FILE *fp, ds_Days,
ds_Minute, ds_Tick).......
Phil Dietz
<<<=================--------- Cheap Ad ---------===================<<<
Phil Dietz SWL Lincoln 565 MEGS! 2 lines
252u3130@fergvax.unl.edu (402)421-1963 AMIGA, IBM, MAC, GIFS
IBM'ers and Mac'ers are shopping for a life. Amiga the best!
Re: DateStamp HELP!
Author: John J. Szucs
Date: Mon, 19 Nov 1990 16:48
Date: Mon, 19 Nov 1990 16:48
40 lines
1972 bytes
1972 bytes
In article <1990Nov18.030410.7819@hoss.unl.edu> 252u3130@fergvax.unl.edu (Phil Dietz) writes:
>I need to change the DateStamp on a ton of files, but I do not know the
>proper command.
Under 2.0, the function:
BOOL SetFileDate(char *Name,struct DateStamp *DateStamp)
while change the date of the file/directory named <Name> to the date in
the DateStamp structure DateStamp.
For example, to set the date of the file "foo" to 1:05:03 am, Jan 4, 1978
(yes, I chose that DateStamp because it was easy to figure out in my
head :-)):
...
static struct DateStamp DateStamp ={
3, /* 3 days since Jan 1, 1978 */
65, /* 65 minutes past midnight */
150, /* 150 ticks past minute */
};
BOOL Success;
...
Success=SetFileDate("foo",&DateStamp);
if (Success) {
printf("Succesfully set the date\n");
} else {
printf("Couldn't set the date\n");
}
>Phil Dietz
--
============================================================================
|| John J. Szucs || The opinions expressed are my own and ||
|| Systems Evaluation Group || in no way represent the opinions or ||
|| Product Assurance Department || policies of Commodore Technology, Inc. ||
|| Commodore Technology, Inc. || or any associated entity. ||
============================================================================
...{rutgers|uunet|pyramid}!cbmvax!jjszucs "Nice boys don't play
jjszucs@cbmvax.commodore.com rock 'n' roll"
Re: DateStamp HELP!
Author: Huver
Date: Tue, 20 Nov 1990 03:49
Date: Tue, 20 Nov 1990 03:49
81 lines
2617 bytes
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.
Re: DateStamp HELP!
Author: Phil Kernick
Date: Tue, 20 Nov 1990 23:53
Date: Tue, 20 Nov 1990 23:53
36 lines
1977 bytes
1977 bytes
huver@amgraf.UUCP (Huver) writes: >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. I was the one who started the 'compress' discussion, and Lydiatt (and Thad) are correct and you are wrong. Consulting the RKM L&D and looking for DeviceProc() it says that a lock for the parent directory is returned by IoErr() - but remember that if you do any other dos calls inbetween, IoErr() will not return what you think. So the code stub has to go something like... mesg = DeviceProc(<whatever>); stuff the parameters into the struct StandardPacket and using IoErr() to set arg[1], and then call PutMsg. I suspect that you did something else inbetween the DeviceProc and the PutMsg (like maybe a Lock) and this changed the return from IoErr and so you though that this would not work. It does. Phil. -- Phil Kernick EMail: phil@adam.adelaide.edu.au Departmental Engineer Phone: +618 228 5914 Dept. of Psychology Fax: +618 224 0464 University of Adelaide Mail: GPO Box 498 Adelaide SA 5001
Re: DateStamp HELP!
Author: Gregory Kritsch
Date: Sat, 21 Nov 2020 02:13
Date: Sat, 21 Nov 2020 02:13
36 lines
2141 bytes
2141 bytes
huver@amgraf.UUCP (Huver) writes:
>In article <1990Nov18.030410.7819@hoss.unl.edu>, Phil Dietz wrote:
>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.
On the contrary, using (ULONG)IoErr() is quite correct, and using
ParentDir() won't work in most cases. See, DeviceProc() is a somewhat
magical function, at the heart of AmigaDOS. You call it with a pointer
to a volume:path/filename - it returns in D0 the address of the message
port of the associated filesystem, and in IoErr() the parent directory
lock relative to the volume:path/filename you passed. This is fully
documented in the Tech Ref Man.
Calling ParentDir() will only work correctly if there is no
volume:path/, or you strip that off before calling ACTION_SET_DATE.
It is my understanding that if I pass the name "a/b", the appropriate
parent directory lock to pass is the current directory lock, whereas if
I pass "a:b/c", the appropriate lock to pass is a lock on a: (obtained
from the device list, I think). I've looked through a few filesystems
and this seems to be correct.
>-huver ...!uunet!amgraf!huver -or- huver%amgraf@uunet.uu.net
Gregory Kritsch | University of Waterloo
Fido: 1:221/208.11110 [1:163/109.30] | 1A Computer Engineering
OCUG: ggk@tirith.ocug.on.ca |----------------------------
UUCP: ggk@tirith.UUCP | The University doesn't get
...!watmath!xenitec!tirith!ggk | a chance to censor me!
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads