Wanderer/Info: fix compilation
[AROS.git] / tools / flexcat / src / getft.c
blob126adbb1db5f8f89a2c9966e4ba716943ac72615
1 /*
2 * $Id$
4 * Copyright (C) 1993-1999 by Jochen Wiedmann and Marcin Orlowski
5 * Copyright (C) 2002-2010 by the FlexCat Open Source Team
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or (at
10 * your option) any later version.
12 * This program is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
23 #include <proto/dos.h>
24 #include "flexcat.h"
26 #ifndef ZERO
27 # define ZERO (BPTR)NULL
28 #endif
30 /// getft
32 /* Returns the time of change.
33 Used for compatibility. */
34 int32 getft(char *filename)
36 int32 timestamp = 0;
37 #if defined(__amigaos4__)
38 struct ExamineData *ed;
39 #else // __amigaos4__
40 BPTR p_flock;
41 struct FileInfoBlock *p_fib;
42 #endif // __amigaos4__
44 #if defined(__amigaos4__)
45 if((ed = ExamineObjectTags(EX_StringNameInput, filename, TAG_DONE)) != NULL)
47 timestamp = ed->Date.ds_Days * 86400; /* days */
48 timestamp += ed->Date.ds_Minute * 60; /* minutes */
49 timestamp += ed->Date.ds_Tick / TICKS_PER_SECOND; /* seconds */
51 FreeDosObject(DOS_EXAMINEDATA, ed);
53 #else // __amigaos4__
54 if((p_fib = AllocDosObject(DOS_FIB, NULL)) != NULL)
56 if((p_flock = Lock(filename, ACCESS_READ)) != ZERO)
58 Examine(p_flock, p_fib);
60 timestamp = p_fib->fib_Date.ds_Days * 86400; /* days */
61 timestamp += p_fib->fib_Date.ds_Minute * 60; /* minutes */
62 timestamp += p_fib->fib_Date.ds_Tick / TICKS_PER_SECOND; /* seconds */
64 UnLock(p_flock);
67 FreeDosObject(DOS_FIB, p_fib);
69 #endif // __amigaos4__
71 return timestamp;
74 ///