source: branches/libc-0.6/src/emx/include/InnoTekLIBC/pathrewrite.h

Last change on this file was 2021, checked in by bird, 20 years ago

o Changed the LIBC_PATHREADWRITERS to a generic LIBC_HOOK_DLLS.

See src/emx/src/lib/sys/hooks.c for details.

  • Property cvs2svn:cvs-rev set to 1.3
  • Property svn:eol-style set to native
  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
File size: 4.2 KB
Line 
1/* $Id: pathrewrite.h 2021 2005-06-13 02:16:10Z bird $ */
2/** @file
3 *
4 * InnoTek LIBC - Path Rewrite.
5 *
6 * Copyright (c) 2004-2005 knut st. osmundsen <bird-srcspam@anduin.net>
7 *
8 *
9 * This file is part of InnoTek LIBC.
10 *
11 * InnoTek LIBC is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU Lesser General Public License as published
13 * by the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
15 *
16 * InnoTek LIBC is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU Lesser General Public License for more details.
20 *
21 * You should have received a copy of the GNU Lesser General Public License
22 * along with InnoTek LIBC; if not, write to the Free Software
23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
24 *
25 */
26
27
28#ifndef __libc_InnoTekLIBC_pathrewrite_h__
29#define __libc_InnoTekLIBC_pathrewrite_h__
30/** @group __libc_PathReWrite
31 * @{ */
32
33/*******************************************************************************
34* Header Files *
35*******************************************************************************/
36#include <sys/cdefs.h>
37
38
39/*******************************************************************************
40* Structures and Typedefs *
41*******************************************************************************/
42/**
43 * Path rewrite.
44 */
45typedef struct __libc_PathRewrite
46{
47 /** Flags.
48 * If __LIBC_PRWF_CASE_SENSITIVE is not set pszFrom *must* be in all
49 * lower case. */
50 unsigned fFlags;
51 /** From path. Unix slashes! */
52 const char *pszFrom;
53 /** Length of from path. */
54 unsigned cchFrom;
55 /** To path. */
56 const char *pszTo;
57 /** Length of to path. */
58 unsigned cchTo;
59 /** Reserved 0 - intended for function pointer to special open. */
60 unsigned uReserved0;
61 /** Reserved 1 - intended for function pointer to special parser. */
62 unsigned uReserved1;
63 /** Reserved 2 - 8 byte alignment*/
64 unsigned uReserved2;
65} __LIBC_PATHREWRITE, *__LIBC_PPATHREWRITE;
66
67
68/** @group __libc_PathReWrite_flags
69 * @{ */
70/** The rule rewrites a file. */
71#define __LIBC_PRWF_TYPE_FILE 0x00000001
72/** The rule rewrites a directory. */
73#define __LIBC_PRWF_TYPE_DIR 0x00000002
74
75/** From path is case sensitive. */
76#define __LIBC_PRWF_CASE_SENSITIVE 0x00000010
77/** From path is case insensitive. */
78#define __LIBC_PRWF_CASE_INSENSITIVE 0x00000000
79/** @} */
80
81__BEGIN_DECLS
82
83/**
84 * Adds a set of new rules to the rewrite rule set.
85 *
86 * The rules will be validated before any of them are processed
87 * and added to the current rewrite rule set. Make sure the rules
88 * conform to the specifications.
89 *
90 * The rewrites are 1:1, no nested processing.
91 *
92 * @returns 0 on success.
93 * @returns -1 and errno set on failure.
94 * @param paRules Pointer to an array of rules to add.
95 * The rules will _not_ be duplicated but used until
96 * a remove call is issued.
97 * @param cRules Number of rules in the array.
98 */
99int __libc_PathRewriteAdd(const __LIBC_PPATHREWRITE paRules, unsigned cRules);
100
101
102/**
103 * Removes a set of rules from the current rewrite rule set.
104 *
105 * The specified rule array must be the eact same as for the add call.
106 *
107 * @returns 0 on success.
108 * @returns -1 and errno set on failure.
109 * @param paRules Pointer to an array of rules to remove.
110 * @param cRules Number of rules in the array.
111 */
112int __libc_PathRewriteRemove(const __LIBC_PPATHREWRITE paRules, unsigned cRules);
113
114
115/**
116 * Rewrites a path using a caller supplied buffer.
117 *
118 * @returns 0 if no rewrite was necessary.
119 * @returns length of the rewritten name including the terminating zero.
120 * @returns -1 on failure, errno not set.
121 * @param pszPath Path to rewrite.
122 * @param pszBuf Where to store the rewritten path.
123 * This can be NULL.
124 * @param cchBuf Size of the buffer.
125 */
126int __libc_PathRewrite(const char *pszPath, char *pszBuf, unsigned cchBuf);
127
128
129__END_DECLS
130
131/** @} */
132#endif
133
Note: See TracBrowser for help on using the repository browser.