File: z-stat.h

package info (click to toggle)
unzip 5.40-1
  • links: PTS
  • area: non-free
  • in suites: potato
  • size: 4,120 kB
  • ctags: 5,900
  • sloc: ansic: 40,977; cpp: 3,778; makefile: 1,384; asm: 1,228; sh: 133
file content (87 lines) | stat: -rw-r--r-- 2,844 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
#ifndef __amiga_z_stat_h
#define __amiga_z_stat_h

/* Since older versions of the Lattice C compiler for Amiga, and all current */
/* versions of the Manx Aztec C compiler for Amiga, either provide no stat() */
/* function or provide one inadequate for unzip (Aztec's has no st_mode      */
/* field), we provide our own stat() function in stat.c by Paul Wells, and   */
/* this fake stat.h file by Paul Kienitz.  Paul Wells originally used the    */
/* Lattice stat.h but that does not work for Aztec and is not distributable  */
/* with this package, so I made a separate one.  This has to be pulled into  */
/* unzip.h when compiling an Amiga version, as "amiga/z-stat.h".             */

/* We also provide here a "struct dirent" for use with opendir() & readdir() */
/* functions included in amiga/stat.c.  If you use amiga/stat.c, this must   */
/* be included wherever you use either readdir() or stat().                  */

#ifdef AZTEC_C
#  define __STAT_H
#else  /* __SASC */
/* do not include the following header, replacement definitions are here */
#  define _STAT_H      /* do not include SAS/C <stat.h> */
#  define _DIRENT_H    /* do not include SAS/C <dirent.h> */
#  define _SYS_DIR_H   /* do not include SAS/C <sys/dir.h> */
#  define _COMMIFMT_H  /* do not include SAS/C <sys/commifmt.h> */
#  include <dos.h>
#endif
#include <libraries/dos.h>
#include "amiga/z-time.h"


struct stat {
    unsigned short st_mode;
    time_t st_ctime, st_atime, st_mtime;
    long st_size;
    long st_ino;
    long st_blocks;
    short st_attr, st_dev, st_nlink, st_uid, st_gid, st_rdev;
};

#define S_IFDIR  (1<<11)
#define S_IFREG  (1<<10)

#if 0
   /* these values here are totally random: */
#  define S_IFLNK  (1<<14)
#  define S_IFSOCK (1<<13)
#  define S_IFCHR  (1<<8)
#  define S_IFIFO  (1<<7)
#  define S_IFMT   (S_IFDIR|S_IFREG|S_IFCHR|S_IFLNK)
#else
#  define S_IFMT   (S_IFDIR|S_IFREG)
#endif

#define S_IHIDDEN    (1<<7)
#define S_ISCRIPT    (1<<6)
#define S_IPURE      (1<<5)
#define S_IARCHIVE   (1<<4)
#define S_IREAD      (1<<3)
#define S_IWRITE     (1<<2)
#define S_IEXECUTE   (1<<1)
#define S_IDELETE    (1<<0)

int stat(char *name, struct stat *buf);
int fstat(int handle, struct stat *buf);      /* returns dummy values */

typedef struct dirent {
    struct dirent       *d_cleanuplink,
                       **d_cleanupparent;
    BPTR                 d_parentlock;
    struct FileInfoBlock d_fib;
} DIR;
#define                  d_name  d_fib.fib_FileName

extern unsigned short disk_not_mounted;         /* flag set by opendir() */

DIR *opendir(char *);
void closedir(DIR *);
void close_leftover_open_dirs(void);    /* call this if aborted in mid-run */
struct dirent *readdir(DIR *);
int umask(void);

#ifdef AZTEC_C
int rmdir(char *);
int chmod(char *filename, int bits);
#endif

#endif /* __amiga_z_stat_h */