1 | /****************************** Module Header *******************************
|
---|
2 | *
|
---|
3 | * Module Name: querypathinfo.e
|
---|
4 | *
|
---|
5 | * .e wrapper routine to access the NEPMD library DLL.
|
---|
6 | * include of nepmdlib.e
|
---|
7 | *
|
---|
8 | * Copyright (c) Netlabs EPM Distribution Project 2002
|
---|
9 | *
|
---|
10 | * $Id: querypathinfo.e 2417 2011-05-15 23:32:51Z aschn $
|
---|
11 | *
|
---|
12 | * ===========================================================================
|
---|
13 | *
|
---|
14 | * This file is part of the Netlabs EPM Distribution package and is free
|
---|
15 | * software. You can redistribute it and/or modify it under the terms of the
|
---|
16 | * GNU General Public License as published by the Free Software
|
---|
17 | * Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
18 | * Netlabs EPM Distribution. This library is distributed in the hope that it
|
---|
19 | * will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty
|
---|
20 | * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
---|
21 | * General Public License for more details.
|
---|
22 | *
|
---|
23 | ****************************************************************************/
|
---|
24 |
|
---|
25 | /*
|
---|
26 | @@NepmdQueryPathInfo@PROTOTYPE
|
---|
27 | InfoValue = NepmdQueryPathInfo( Pathname, ValueTag);
|
---|
28 |
|
---|
29 | @@NepmdQueryPathInfo@CATEGORY@FILE
|
---|
30 |
|
---|
31 | @@NepmdQueryPathInfo@SYNTAX
|
---|
32 | This function queries installation related values
|
---|
33 | from the [=TITLE].
|
---|
34 |
|
---|
35 | @@NepmdQueryPathInfo@PARM@Pathname
|
---|
36 | This parameter specifies the pathname of the file or directory, of
|
---|
37 | which a path information value is requested.
|
---|
38 |
|
---|
39 | @@NepmdQueryPathInfo@PARM@ValueTag
|
---|
40 | This parameter specifies a keyword determining the
|
---|
41 | path information value to be returned.
|
---|
42 | The following keywords are supported:
|
---|
43 | .pl bold
|
---|
44 | - ATIME
|
---|
45 | = returns the last access time
|
---|
46 | - MTIME
|
---|
47 | = returns the last modification time
|
---|
48 | - CTIME
|
---|
49 | = returns the creation time
|
---|
50 | - SIZE
|
---|
51 | = returns the size of the file
|
---|
52 | - EASIZE
|
---|
53 | = returns the size of the extended attributes attached to the file
|
---|
54 | - ATTR
|
---|
55 | = returns the file attributes
|
---|
56 | .el
|
---|
57 |
|
---|
58 | @@NepmdQueryPathInfo@RETURNS
|
---|
59 | *NepmdQueryPathInfo* returns either
|
---|
60 | .ul compact
|
---|
61 | - the information value or
|
---|
62 | - the string *ERROR:xxx*, where *xxx* is an OS/2 error code.
|
---|
63 |
|
---|
64 | @@NepmdQueryPathInfo@TESTCASE
|
---|
65 | You can test this function from the *EPM* commandline by
|
---|
66 | executing:
|
---|
67 | .sl
|
---|
68 | - *NepmdQueryPathInfo* [.IDPNL_EFUNC_NEPMDQUERYPATHINFO_PARM_PATHNAME pathname]
|
---|
69 | - or
|
---|
70 | - *QueryPathInfo* [.IDPNL_EFUNC_NEPMDQUERYPATHINFO_PARM_PATHNAME pathname]
|
---|
71 |
|
---|
72 | Executing this command will
|
---|
73 | open up a virtual file and
|
---|
74 | write all [.IDPNL_EFUNC_NEPMDQUERYPATHINFO_PARM_VALUETAG supported path info values]
|
---|
75 | about the specified file or directory into it.
|
---|
76 |
|
---|
77 | @@
|
---|
78 | */
|
---|
79 |
|
---|
80 | /* ------------------------------------------------------------- */
|
---|
81 | /* allow editor command to call function */
|
---|
82 | /* ------------------------------------------------------------- */
|
---|
83 | compile if NEPMD_LIB_TEST
|
---|
84 |
|
---|
85 | defc NepmdQueryPathInfo, QueryPathInfo
|
---|
86 |
|
---|
87 | PathName = arg( 1);
|
---|
88 | if (PathName = '') then
|
---|
89 | sayerror 'error: no pathname specified !';
|
---|
90 | return;
|
---|
91 | endif
|
---|
92 |
|
---|
93 | /* create virtual file */
|
---|
94 | helperNepmdCreateDumpfile( 'NepmdQueryPathInfo', NepmdQueryFullname( PathName));
|
---|
95 |
|
---|
96 | insertline helperNepmdQueryPathInfoValue( PathName, 'ATIME');
|
---|
97 | insertline helperNepmdQueryPathInfoValue( PathName, 'MTIME');
|
---|
98 | insertline helperNepmdQueryPathInfoValue( PathName, 'CTIME');
|
---|
99 | insertline helperNepmdQueryPathInfoValue( PathName, 'SIZE');
|
---|
100 | insertline helperNepmdQueryPathInfoValue( PathName, 'EASIZE');
|
---|
101 | insertline helperNepmdQueryPathInfoValue( PathName, 'ATTR');
|
---|
102 | .modify = 0;
|
---|
103 |
|
---|
104 | return;
|
---|
105 |
|
---|
106 | defproc helperNepmdQueryPathInfoValue( Pathname, ValueTag) =
|
---|
107 | return leftstr( ValueTag, 6) ':' NepmdQueryPathInfo( PathName, ValueTag);
|
---|
108 |
|
---|
109 | compile endif
|
---|
110 |
|
---|
111 | /* ------------------------------------------------------------- */
|
---|
112 | /* procedure: NepmdQueryPathInfo */
|
---|
113 | /* ------------------------------------------------------------- */
|
---|
114 | /* .e Syntax: */
|
---|
115 | /* InfoValue = NepmdQueryPathInfo( PathName, ValueTag); */
|
---|
116 | /* */
|
---|
117 | /* See valig tags in src\gui\nepmdlib\nepmdlib.h: */
|
---|
118 | /* NEPMD_PATHINFO_* */
|
---|
119 | /* ------------------------------------------------------------- */
|
---|
120 | /* C prototype: */
|
---|
121 | /* APIRET EXPENTRY NepmdQueryPathInfo( PSZ pszPathname, */
|
---|
122 | /* PSZ pszInfoTag, */
|
---|
123 | /* PSZ pszBuffer, */
|
---|
124 | /* ULONG ulBuflen) */
|
---|
125 | /* ------------------------------------------------------------- */
|
---|
126 |
|
---|
127 | defproc NepmdQueryPathInfo( Pathname, ValueTag) =
|
---|
128 |
|
---|
129 | BufLen = 260;
|
---|
130 | InfoValue = copies( atoi( 0), BufLen);
|
---|
131 |
|
---|
132 | /* prepare parameters for C routine */
|
---|
133 | Pathname = Pathname''atoi( 0);
|
---|
134 | ValueTag = ValueTag''atoi( 0);
|
---|
135 |
|
---|
136 | /* call C routine */
|
---|
137 | LibFile = helperNepmdGetlibfile();
|
---|
138 | rc = dynalink32( LibFile,
|
---|
139 | "NepmdQueryPathInfo",
|
---|
140 | address( Pathname) ||
|
---|
141 | address( ValueTag) ||
|
---|
142 | address( InfoValue) ||
|
---|
143 | atol( Buflen));
|
---|
144 |
|
---|
145 | helperNepmdCheckliberror( LibFile, rc);
|
---|
146 |
|
---|
147 | return makerexxstring( InfoValue);
|
---|
148 |
|
---|