File: os.h

package info (click to toggle)
htp 1.11-2
  • links: PTS
  • area: main
  • in suites: woody
  • size: 316 kB
  • ctags: 429
  • sloc: ansic: 5,108; makefile: 55
file content (108 lines) | stat: -rw-r--r-- 2,620 bytes parent folder | download | duplicates (2)
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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
/*
//
// os.h
//
// Operating system definitions and constants
//
// Copyright (c) 1995-96 Jim Nelson.  Permission to distribute
// granted by the author.  No warranties are made on the fitness of this
// source code.
//
*/

#ifndef OS_H
#define OS_H

#if __MSDOS__

#define PROGRAM_OS              ("DOS")

/*
// this section should (but is not guaranteed) to conform to most MS-DOS
// compilers
*/

#include <dir.h>

/* not defined in the standard include files */
typedef unsigned int            uint;
typedef unsigned long           ulong;

/* directory delimiters */
#define DIR_DELIMITER           '\\'
#define DIR_DELIMITER_STRING    "\\"
#define DIR_CURRENT_STRING      ".\\"

/* the "other" filesystem delimiter table (for conversion) */
#define OTHER_FILESYSTEM_DELIMITER  "/"

/* DOS filesystem does not support pathnames beyond 64 characters (!!) */
#define MAX_PATHNAME_LEN        (64)
#define MAX_CMDLINE_LEN         (128)
#define MAX_FILENAME_LEN        (13)

#elif __WIN32__

#define PROGRAM_OS              ("Win32")

/*
// this section specifically designed for Microsoft Visual C++ 4.0
*/

#include <direct.h>

/* not defined in the standard include files */
typedef unsigned int            uint;
typedef unsigned long           ulong;

/* directory delimiters */
#define DIR_DELIMITER           '\\'
#define DIR_DELIMITER_STRING    "\\"
#define DIR_CURRENT_STRING      ".\\"

/* the "other" filesystem delimiter table (for conversion) */
#define OTHER_FILESYSTEM_DELIMITER  "/"

/* Win32 filesystem supports long filenames! */
#define MAX_PATHNAME_LEN        (1024)
#define MAX_CMDLINE_LEN         (1024)
#define MAX_FILENAME_LEN        (256)

#else

#define PROGRAM_OS              ("Linux/Posix")

/*
// Linux/UNIX is the only other OS being actively developed
// other UNIX platforms should pretty much look like this, though
*/

#include <unistd.h>

#define stricmp                 strcasecmp
#define strnicmp                strncasecmp

/* directory delimiters */
#define DIR_DELIMITER           '/'
#define DIR_DELIMITER_STRING    "/"
#define DIR_CURRENT_STRING      "./"

/* the "other" filesystem delimiter table (for conversion) */
#define OTHER_FILESYSTEM_DELIMITER  "\\"

/* max pathname for UNIX (may be more, but this is sufficient) */
/* (BTW, these values may be incorrect, but they should be sufficient. */
/* Anyone with more concrete values, please email me.) */
#define MAX_PATHNAME_LEN        (256)
#define MAX_CMDLINE_LEN         (1024)
#define MAX_FILENAME_LEN        (32)

#endif

/*
// all supported filesystem delimiters
*/
#define ALL_FILESYSTEM_DELIMITERS   "/\\"

#endif