1 | Issue: Cwd->abs_path('F:testpl.cmd') generates the message
|
---|
2 | sys_is_absolute2 = Cwd
|
---|
3 | LF
|
---|
4 | sys_is_relative2 = Cwd
|
---|
5 |
|
---|
6 | The string appears in perlE147.dll but I couldn't find an associated source file.
|
---|
7 |
|
---|
8 | Issue: Cwd->abs_path('F:testpl.cmd') returns F:/ecs/testpl.cmd/Cwd instead of F:/ecs/testpl.cmd
|
---|
9 |
|
---|
10 | Query: is it legal to do
|
---|
11 | CD \\server\netname\directoru
|
---|
12 | for directories on a LAN drive. Should getdcwd support that?
|
---|
13 |
|
---|
14 | Q:\programs\perl\lib\5.10.0\os2\Cwd.pm
|
---|
15 | H:\vendors\cpan\PathTools-3.39_01\Cwd.pm
|
---|
16 | H:\vendors\cpan\PathTools-3.39_01\Cwd.xs
|
---|
17 | H:\vendors\cpan\PathTools-3.39_01\lib\File\Spec\OS2.pm
|
---|
18 | H:\vendors\cpan\PathTools-3.39_01\lib\File\Spec\Win32.pm
|
---|
19 |
|
---|
20 | EMX
|
---|
21 |
|
---|
22 | char *getcwd (char *buffer, size_t size);
|
---|
23 |
|
---|
24 | int _getcwd1 (char *buffer, char drive);
|
---|
25 | Does not check size!
|
---|
26 |
|
---|
27 | char *_getcwd2 (char *buffer, int size);
|
---|
28 |
|
---|
29 | char _getdrive (void);
|
---|
30 |
|
---|
31 | OS/2
|
---|
32 |
|
---|
33 |
|
---|
34 | Q:\OS2TK45\h\os2.h
|
---|
35 |
|
---|
36 |
|
---|
37 | Gets the current default drive for the requesting process.
|
---|
38 |
|
---|
39 |
|
---|
40 | #define INCL_DOSFILEMGR
|
---|
41 | #include <os2.h>
|
---|
42 |
|
---|
43 | PULONG pdisknum; /* Address of the number of the default drive. */
|
---|
44 | PULONG plogical; /* Address of the bit map where the system returns the mapping of the logical drives. */
|
---|
45 | APIRET ulrc; /* Return Code. */
|
---|
46 |
|
---|
47 | ulrc = DosQueryCurrentDisk(pdisknum, plogical);
|
---|
48 |
|
---|
49 | pdisknum (PULONG) - output
|
---|
50 | Address of the number of the default drive.
|
---|
51 |
|
---|
52 | The value 1 means drive A, 2 means drive B, 3 means drive C, and so on. The maximum possible value is 26, which corresponds to drive Z.
|
---|
53 |
|
---|
54 | plogical (PULONG) - output
|
---|
55 | Address of the bit map where the system returns the mapping of the logical drives.
|
---|
56 |
|
---|
57 | This bit map is stored in the low-order portion of the 32-bit area.
|
---|
58 |
|
---|
59 | Logical drives A to Z have one-to-one mapping with bit positions 0 to 25 of the map; for example, bit 0 represents drive A, bit 1 represents drive B, and so on. The settings of these bits indicate which drives exist, as follows:
|
---|
60 |
|
---|
61 | 0The logical drive does not exist.
|
---|
62 | 1The logical drive exists.
|
---|
63 |
|
---|
64 | ulrc (APIRET) - returns
|
---|
65 | Return Code.
|
---|
66 |
|
---|
67 | DosQueryCurrentDisk returns the following value:
|
---|
68 |
|
---|
69 | 0 NO_ERROR
|
---|
70 |
|
---|
71 | For a full list of error codes, see Errors.
|
---|
72 |
|
---|
73 | Gets the full path of the current directory for the requesting process on the specified drive.
|
---|
74 |
|
---|
75 |
|
---|
76 | #define INCL_DOSFILEMGR
|
---|
77 | #include <os2.h>
|
---|
78 |
|
---|
79 | ULONG disknum; /* The drive number. */
|
---|
80 | PBYTE pBuf; /* Address of the full path of the current directory. */
|
---|
81 | PULONG pcbBuf; /* Address of the length, in bytes, of the pBuf buffer. */
|
---|
82 | APIRET ulrc; /* Return Code. */
|
---|
83 |
|
---|
84 | ulrc = DosQueryCurrentDir(disknum, pBuf, pcbBuf);
|
---|
85 |
|
---|
86 | disknum (ULONG) - input
|
---|
87 | The drive number.
|
---|
88 |
|
---|
89 | The value 0 means the current drive, 1 means drive A, 2 means drive B, 3 means drive C, and so on. The maximum possible value is 26, which corresponds to drive Z.
|
---|
90 |
|
---|
91 | pBuf (PBYTE) - output
|
---|
92 | Address of the full path of the current directory.
|
---|
93 |
|
---|
94 | pcbBuf (PULONG) - in/out
|
---|
95 | Address of the length, in bytes, of the pBuf buffer.
|
---|
96 |
|
---|
97 |
|
---|
98 | Input This field contains the length, in bytes, of the directory path buffer.
|
---|
99 |
|
---|
100 | Output If an error is returned because the buffer is too small, this field contains the required length, in bytes, of the buffer.
|
---|
101 |
|
---|
102 | ulrc (APIRET) - returns
|
---|
103 | Return Code.
|
---|
104 |
|
---|
105 | DosQueryCurrentDir returns one of the following values:
|
---|
106 |
|
---|
107 | 0 NO_ERROR
|
---|
108 | 15 ERROR_INVALID_DRIVE
|
---|
109 | 26 ERROR_NOT_DOS_DISK
|
---|
110 | 108 ERROR_DRIVE_LOCKED
|
---|
111 | 111 ERROR_BUFFER_OVERFLOW
|
---|
112 |
|
---|
113 | For a full list of error codes, see Errors.
|
---|
114 |
|
---|
115 |
|
---|
116 |
|
---|
117 |
|
---|
118 |
|
---|
119 | For Cwd.pm
|
---|
120 |
|
---|
121 | sub _os2_cwd {
|
---|
122 | my $drive = shift;
|
---|
123 | $ENV{'PWD'} = `cmd /c cd $drive\:`;
|
---|
124 | chomp $ENV{'PWD'};
|
---|
125 | $ENV{'PWD'} =~ s:\\:/:g ;
|
---|
126 | return $ENV{'PWD'};
|
---|
127 | }
|
---|
128 |
|
---|
129 |
|
---|
130 |
|
---|
131 | For Cwd.xs, assuming EMX
|
---|
132 |
|
---|
133 | #if defined(OS2)
|
---|
134 | void
|
---|
135 | getdcwd(...)
|
---|
136 | PROTOTYPE: ENABLE
|
---|
137 | PPCODE:
|
---|
138 | {
|
---|
139 | dXSTARG;
|
---|
140 | char drive;
|
---|
141 | char *dir;
|
---|
142 |
|
---|
143 | /* Drive 0 is the current drive, A-Z are A-Z. */
|
---|
144 | if ( items == 0 ||
|
---|
145 | (items == 1 && (!SvOK(ST(0)) || (SvPOK(ST(0)) && !SvCUR(ST(0))))))
|
---|
146 | drive = 0;
|
---|
147 | else if (items == 1 && SvPOK(ST(0)) && SvCUR(ST(0)) &&
|
---|
148 | isALPHA(SvPVX(ST(0))[0]))
|
---|
149 | drive = SvPVX(ST(0))[0];
|
---|
150 | else
|
---|
151 | croak("Usage: getdcwd(DRIVE)");
|
---|
152 |
|
---|
153 | New(0,dir,MAXPATHLEN,char);
|
---|
154 | if (_getcwd1(dir, drive)) {
|
---|
155 | sv_setpv_mg(TARG, dir);
|
---|
156 | SvPOK_only(TARG);
|
---|
157 | }
|
---|
158 | else
|
---|
159 | sv_setsv(TARG, &PL_sv_undef);
|
---|
160 |
|
---|
161 | Safefree(dir);
|
---|
162 |
|
---|
163 | XSprePUSH; PUSHs(TARG);
|
---|
164 | #ifndef INCOMPLETE_TAINTS
|
---|
165 | SvTAINTED_on(TARG);
|
---|
166 | #endif
|
---|
167 | }
|
---|
168 |
|
---|
169 | #endif
|
---|
170 |
|
---|
171 |
|
---|
172 |
|
---|
173 |
|
---|
174 | For Cwd.xs, if not using EMX,
|
---|
175 |
|
---|
176 | #if defined(OS2)
|
---|
177 |
|
---|
178 | #define INCL_DOSFILEMGR
|
---|
179 | #include <os2.h>
|
---|
180 |
|
---|
181 | void
|
---|
182 | getdcwd(...)
|
---|
183 | PROTOTYPE: ENABLE
|
---|
184 | PPCODE:
|
---|
185 | {
|
---|
186 | dXSTARG;
|
---|
187 | ULONG drive;
|
---|
188 | PULONG *dir;
|
---|
189 |
|
---|
190 | /* Drive 0 is the current drive, 1 is A:, 2 is B:, 3 is C: and so on. */
|
---|
191 | if ( items == 0 ||
|
---|
192 | (items == 1 && (!SvOK(ST(0)) || (SvPOK(ST(0)) && !SvCUR(ST(0))))))
|
---|
193 | drive = 0;
|
---|
194 | else if (items == 1 && SvPOK(ST(0)) && SvCUR(ST(0)) &&
|
---|
195 | isALPHA(SvPVX(ST(0))[0]))
|
---|
196 | drive = toUPPER(SvPVX(ST(0))[0]) - 'A' + 1;
|
---|
197 | else
|
---|
198 | croak("Usage: getdcwd(DRIVE)");
|
---|
199 |
|
---|
200 | New(0,dir,MAXPATHLEN,char);
|
---|
201 | if (_getdcwd(drive, dir, MAXPATHLEN)) {
|
---|
202 | sv_setpv_mg(TARG, dir);
|
---|
203 | SvPOK_only(TARG);
|
---|
204 | }
|
---|
205 | else
|
---|
206 | sv_setsv(TARG, &PL_sv_undef);
|
---|
207 |
|
---|
208 | Safefree(dir);
|
---|
209 |
|
---|
210 | XSprePUSH; PUSHs(TARG);
|
---|
211 | SvTAINTED_on(TARG);
|
---|
212 | }
|
---|
213 |
|
---|
214 | #endif
|
---|