source: trunk/guitools/shared/smbtree.vrs@ 642

Last change on this file since 642 was 641, checked in by Herwig Bauernfeind, 14 years ago

GUI-Tools: EVFSGUI 2.5.x: More work done

File size: 22.9 KB
Line 
1/* Routines to handle smbtree output */
2
3/*:VRX */
4_RefreshTree:
5 say time()' _RefreshTree() started'
6 FirstRun = 0
7
8 ok = SysFileDelete(samba.!msg)
9
10 if UserCred = 'USERCRED' | UserCred = '' | UserCred = '--user=%' then UserCred = '-N'
11 if ShowHidden = 'SHOWHIDDEN' | ShowHidden = '' then ShowHidden = 0
12 if BroadCast = 1 then BroadCast = '-b'; else BroadCast = ''
13
14 say " UserCred="UserCred
15
16 /* smbtree -S = List workgroups (domains) and servers of tree */
17 say ' detach 'samba.!smbtreeexe' 'BroadCast' -S 'UserCred' 'debuglevel' >'samba.!msg
18 address cmd 'detach 'samba.!smbtreeexe' 'BroadCast' -S 'UserCred' 'debuglevel' >'samba.!msg
19
20 if BroadCast = '-b' then BroadCast = 1; else BroadCast = 0
21 if UserCred = '-N' then UserCred = ''
22
23 ok = VRMethod("CN_smbtree", "RemoveRecord", "ALL")
24
25 RefreshMode = "TREE"
26 ok = VRSet("CN_smbtree","Enabled", 0)
27 ok = VRset("TM_RefreshTreeDisplay","Enabled",1)
28
29 say time()' _RefreshTree() done'
30return
31
32/*:VRX */
33_RefreshTreeDisplay:
34 say time()' _RefreshTreeDisplay() started'
35
36 stat = stream(samba.!msg,'c','open read')
37 if stat <> "READY:" then return
38
39 if UserCred = 'USERCRED' | UserCred = '' | UserCred = '--user=%' then UserCred = '-N'
40 if ShowHidden = 'SHOWHIDDEN' | ShowHidden = '' then ShowHidden = 0
41 if BroadCast = 1 then BroadCast = '-b'; else BroadCast = ''
42
43 ok = VRset("TM_RefreshTreeDisplay","Enabled",0)
44 ok = VRSet("CN_smbtree", 'Enabled', 0 )
45
46 ok = VRSet( "CN_smbtree", "Painting", 0 )
47 ok = VRMethod("CN_smbtree", "RemoveRecord", "ALL")
48
49 drop smbtree.
50
51 ok = file2stem(samba.!msg,"smbtreeline.")
52
53 do sl = 1 to smbtreeline.0
54 Header = c2x(left(smbtreeline.sl,3))
55 select
56 when Header = "09095C" then nop /* share - obsolete, we only list domains and servers here */
57 when Header = "095C5C" then do /* machine */
58 smbtreeline.sl = strip(smbtreeline.sl,,'09'x)
59 parse var smbtreeline.sl '\\'machine '0909'x comment
60 machine = strip(machine)
61 comment = strip(comment)
62 if VRGet("CN_smbtree","View") = "IconTree" then parent = smbtree.!workgroup; else parent = ""
63 /* We make any machine as sleeping initially */
64 smbtree.!machine = _AddSleepingMachine(machine,comment,parent)
65
66 ok = VRSet( "CN_smbtree", "Painting", 1 )
67 ok = VRSet( "CN_smbtree", "Painting", 0 )
68
69 if VRGet("CN_smbtree","View") <> "Detail" then do
70 /* Tree view */
71 call _RefreshShares
72 end
73 else do /* Fill records for details view */
74 ok = VRSet("Main", 'Pointer', 'Wait' )
75 /* Get NMBLookup Status for machine */
76 NMBStatus = _GetMachineNMBSTatus(machine)
77 parse var NMBStatus IPStr'|'MAC '|' Roles; drop NMBStatus
78 if pos("PDC",Roles) > 0 then ok = VRMethod( "CN_smbtree", "SetRecordAttr", smbtree.!machine, "Icon","#63:PMWP.DLL")
79 ok = VRMethod( "CN_smbtree", "SetFieldData", smbtree.!machine, IPFH, IPStr,MBFH, Roles, MacFH,MAC)
80
81 /* FIXME: Possibly obsolete */
82 parse var IPStr MachineIP ',' .
83 if strip(MachineIP) = "" then MachineIP = machine
84
85 ok = VRSet("Main", 'Pointer', '<default>' )
86
87 /* Find out OS, version */
88 say ' 'samba.!smbclientexe' -L "'machine'" 'UserCred' 'debuglevel' 2>'samba.!msg' 1>NUL'
89 address cmd samba.!smbclientexe' -L "'machine'" 'UserCred' 'debuglevel' 2>'samba.!msg' 1>NUL'
90 smbline = linein(samba.!msg)
91 ok = stream(samba.!msg,'c','close')
92 parse var smbline "Domain=["WorkGroup"] OS=["OS"] Server=["Version"]"Rest
93 ok = VRMethod( "CN_smbtree", "SetFieldData", smbtree.!machine, OSFH, OS, VersionFH, Version, WorkgroupFH, WorkGroup)
94 end
95 end
96 when smbtreeline.sl = "" then nop /* skip empty lines */
97 otherwise do /* possibly a new workgroup */
98 say ' Possible workgroup: "'smbtreeline.sl'"'
99 /* check for eventual error messages */
100 if pos("RECEIVING",translate(smbtreeline.sl)) > 0 | pos("TDB(",translate(smbtreeline.sl)) > 0 then do
101 Msg.Type = "W"
102 Msg.Text = smbtreeline.sl
103 call _ShowMsg
104 end
105 else do /* it is really a new workgroup */
106 if VRGet("CN_smbtree","View") = "IconTree" then do
107 smbtree.!workgroup = _AddWorkGroup(smbtreeline.sl)
108 end
109 CurWG = smbtreeline.sl
110 end
111 end
112 end
113 end
114
115 ok = VRSet( "CN_smbtree", "Painting", 1 )
116
117/* ok = VRSet("Main", 'Pointer', '<default>' ) */
118 ok = VRSet("CN_smbtree","Enabled", 1)
119 ok = VRSet("TM_Throbber","Enabled", 0)
120 ok = VRSet("Pict_Throbber","Visible", 0)
121 say time()' _RefreshTreeDisplay() done'
122return
123
124/*:VRX _RefreshShares */
125_RefreshShares:
126 say time()' _RefreshShares() started'
127
128 smbmachine = TempDir||"smbmachine."||machine
129 MaxSmbClient = 32 /* Do not run more than MaxSmbClient instances of smbclient.exe at the same time */
130
131 Defer = 1
132 do while Defer = 1
133 SmbCltCount = 0
134 ok = PRProcessList(proc)
135
136 do I = 1 to proc.0
137 CurProc = VRParseFileName(proc.i.name,'NE')
138 if CurProc = "SMBCLIENT.EXE" then SmbCltCount = SmbCltCount + 1
139 end
140 say ' 'SmbCltCount' instance(s) of 'samba.!smbclientexe' is/are running.'
141 if SmbCltCount >= MaxSmbClient then do
142 say " Waiting until at least "SmbCltCount-MaxSmbClient+1" instance(s) of smbclient.exe terminate(s)."
143 ok = SysSleep(1)
144 end
145 else Defer = 0
146 end
147
148 if UserCred = 'USERCRED' | UserCred = '' | UserCred = '--user=%' then UserCred = '-N'
149
150 say ' detach 'samba.!smbclientexe' -L "'machine'" 'UserCred' 'debuglevel' 2>'smbmachine' 1>&2'
151 address cmd 'detach 'samba.!smbclientexe' -L "'machine'" 'UserCred' 'debuglevel' 2>'smbmachine' 1>&2'
152
153 if UserCred = '-N' then UserCred = ''
154
155 RefreshMode = "SHARE"
156
157 ok = VRSet("CN_smbtree","Enabled", 0)
158 ok = VRset("TM_RefreshTreeDisplay","Enabled",1)
159 say time()' _RefreshShares() done'
160return
161
162/*:VRX _AddSharesDisplay
163*/
164_AddSharesDisplay: /* New get shares code - uses smbclient output and is much faster */
165 say time()' _AddSharesDisplay() started'
166
167 ok = SysFileTree(Tempdir||'smbmachine.*',smbmachine.,'FO')
168 if smbmachine.0 = 0 then do /* we are done, no more files around, cleanup, disable Timer and exit */
169 RefreshMode = ""
170 ok = VRset("TM_RefreshTreeDisplay","Enabled", 0)
171 ok = VRSet("TM_RefreshTreeDisplay","Delay", 1000)
172 ok = VRSet("CN_smbtree","Enabled", 1)
173 ok = VRSet("CN_smbtree", "Painting", 0 )
174 ok = VRSet("CN_smbtree", "Painting", 1 )
175 say time()' _AddSharesDisplay() completed'
176 return /* exit here */
177 end
178 else do
179 say ' 'smbmachine.0' file(s) to process.'
180 if smbmachine.0 = 1 then ok = VRSet("TM_RefreshTreeDisplay", "Delay", VRGet("TM_RefreshTreeDisplay", "Delay") * 2)
181 end
182
183 if UserCred = 'USERCRED' | UserCred = '' | UserCred = '--user=%' then UserCred = '-N'
184 if ShowHidden = 'SHOWHIDDEN' | ShowHidden = '' then ShowHidden = 0
185
186 do I = 1 to smbmachine.0
187 call charout , ' Going for "'smbmachine.I'", got '
188 if VRIsValidObject("DT_STATUSBAR") then ok = VRSet("DT_STATUSBAR","Caption", VRGet("DT_STATUSBAR","Caption")||'.')
189 stat = stream(smbmachine.I,'c','open read')
190 say '"'stat'"'
191 if stat = "READY:" & smbmachine.0 = 1 then do /* We just found out we are processing the last machine */
192 ok = VRSet("TM_RefreshTreeDisplay","Delay", 1000)
193 end
194 infoline = ""
195 if stat = "READY:" then do /* we found a readable output file */
196 OneWorkGroupOnly = 0
197
198 Machine = substr(smbmachine.I,pos('.',smbmachine.I)+1)
199
200 smbtree.!machine = _GetMachinehandle(Machine)
201
202 if smbtree.!machine = "" then do /* invalid (old) file */
203 say time()' _AddSharesDisplay() exit with Invalid file found (no corresponding machine)'
204 ok = stream(smbmachine.I,'c','close')
205 ok = SysFileDelete(smbmachine.I)
206 iterate
207 end
208 line = linein(smbmachine.I) /* PID line */
209 line = linein(smbmachine.I)
210 if pos('creating lame', line) > 0 then do
211 line = linein(smbmachine.I)
212 line = linein(smbmachine.I)
213 end
214 if pos('Server=[', line) > 0 then do
215 infoline = linein(smbmachine.I)
216 parse var infoline "Domain=["WorkGroup"] OS=["OS"] Server=["Server"]"Rest
217 ok = VRMethod( "CN_smbtree", "SetFieldData", smbtree.!machine, OSFH, OS, VersionFH, Server)
218 line = linein(smbmachine.I)
219 end
220 say ' Answer "'line'"'
221 ok = VRMethod('CN_smbtree', 'SetRecordAttr', smbtree.!machine, 'UserData', "SERVER|"||strip(line))
222
223 if pos("FAIL", translate(line)) > 0 then do /* we see an error message - the term "FAIL" seems to be common to all */
224 say time()' _AddSharesDisplay() exit with "'line'"'
225 ok = stream(smbmachine.I,'c','close')
226 ok = SysFileDelete(smbmachine.I)
227 iterate
228 end
229
230 retries = 0
231 do while(left(line,1) <> '09'x)
232 line = linein(smbmachine.I)
233 retries = retries + 1
234 say ' Skip 'retries' "'line'"'
235 if retries >=10 then do /* No valid output - error */
236 say time()' _AddSharesDisplay() exit with invalid output error'
237 ok = stream(smbmachine.I,'c','close')
238 ok = SysFileDelete(smbmachine.I)
239 leave
240 end
241 end
242 if retries >=10 then iterate
243
244 /* Skip header */
245 line = linein(smbmachine.I)
246 line = linein(smbmachine.I)
247
248 if translate(left(strip(line),5)) = "ERROR" then ok = VRMethod('CN_smbtree', 'SetRecordAttr', smbtree.!machine, 'UserData', "SERVER|"||strip(line))
249
250 do while(left(line,1) = '09'x) /* Share loop */
251 parse var line '09'x share type comment
252 type = translate(strip(type))
253 comment = strip(comment)
254
255 select
256 when type = "DISK" then res = '#64:PMWP.DLL'
257 when type = "PRINTER" then res = '#65:PMWP.DLL'
258 when type = "IPC" then res = '#59:PMWP.DLL'
259 when type = "DEVICE" then res = '#84:PMWP.DLL' /* There might be better ones around */
260 otherwise res = ''
261 end
262
263 /* Now the machine receives the wakeup icon */
264 ok = VRMethod('CN_smbtree', 'SetRecordAttr', smbtree.!machine, 'Icon', "#35:PMWP.DLL")
265 parent = smbtree.!machine
266 smbtree.!share = VRMethod( "CN_smbtree", "AddRecord",parent,, share||'0D0A'x||comment, res)
267 ok = VRMethod( "CN_smbtree", "SetRecordAttr", smbtree.!share, "ReadOnly", 1, 'UserData', type"|")
268 if pos("$", share) > 0 then ok = VRMethod( "CN_smbtree", "SetRecordAttr", smbtree.!share, "Visible", ShowHidden)
269
270 /* get next share */
271 line = linein(smbmachine.I)
272 end /* Share loop */
273
274 do until left(line,10) = '09'x||'Workgroup'
275 line = linein(smbmachine.I)
276 end
277 line = linein(smbmachine.I)
278 /* Reading FIRST workgroup and master - eventually both empty */
279 line = linein(smbmachine.I)
280
281 /* Multiple workgroups? */
282 if lines(smbmachine.I) = 0 then OneWorkGroupOnly = 1
283 else OneWorkGroupOnly = 0
284 say " OneWorkGroupOnly = "OneWorkGroupOnly
285
286 parse var line '09'x workgroup master
287 master = strip(master)
288
289 /* we use this to set the workgroup for manually added servers - if there is ONLY ONE workgroup */
290 if workgroup <> "" & OneWorkGroupOnly = 1 then do
291 wgh = _GetMachinehandle(workgroup)
292 if wgh = "" then do /* The machine appears to be in a new workgroup - add it as well */
293 /* NOTE: This should be obsolete now because the list of available */
294 /* workgroups should always have been updated before we get here */
295 wgh = _AddWorkGroup(workgroup)
296 end
297 /* we only do this for machines with empty parent (=workgroup) handle */
298 /* IF there is only one workgroup */
299 if wgh <> "" & VRMethod('CN_smbtree', 'GetRecordAttr', smbtree.!machine, 'Parent') = "" then do
300 ok = VRMethod('CN_smbtree', 'SetRecordAttr', smbtree.!machine, 'Parent', wgh)
301 end
302 end
303 else do
304 if workgroup <> "" then do
305 /* There are multiple workgroups, we need additional */
306 /* measures to find out which is our workgroup */
307 if infoline <> "" then do
308 say ' 'samba.!smbclientexe' -L "'Machine'" -N 'debuglevel' 2>'samba.!msg' 1>NUL'
309 address cmd samba.!smbclientexe' -L "'Machine'" -N 'debuglevel' 2>'samba.!msg' 1>NUL'
310 infoline = linein(samba.!msg)
311
312 if word(infoline,1) = "creating" then do /* upcase tables are missing */
313 say "Missing upcase tables detected!"
314 infoline = linein(samba.!msg)
315 infoline = linein(samba.!msg)
316 end
317 IF options.!debug == 1 THEN say ' Response = "'Infoline'"'
318 ok = stream(samba.!msg,'c','close')
319 ok = SysFileDelete(samba.!msg)
320 end
321
322 parse var infoline "Domain=["WorkGroup"] OS=["OS"] Server=["Server"]"Rest
323
324 wgh = _GetMachinehandle(workgroup)
325 if wgh <> "" & VRMethod('CN_smbtree', 'GetRecordAttr', smbtree.!machine, 'Parent') = "" then do
326 ok = VRMethod('CN_smbtree', 'SetRecordAttr', smbtree.!machine, 'Parent', wgh)
327 end
328 end
329 else do
330 /* The machine does not allow browsing and does not report a workgroup here */
331 say ' "'Machine'" does not allow browsing.'
332 end
333 end
334
335 ok = VRSet("Main", 'Pointer', 'Wait' )
336
337 /* Get NMBLookup Status for machine */
338 NMBStatus = _GetMachineNMBSTatus(machine)
339 parse var NMBStatus IPStr'|'MAC '|' Roles; drop NMBStatus
340 if pos("PDC",Roles) > 0 then ok = VRMethod( "CN_smbtree", "SetRecordAttr", smbtree.!machine, "Icon","#63:PMWP.DLL")
341 ok = VRMethod( "CN_smbtree", "SetFieldData", smbtree.!machine, IPFH, IPStr,MBFH, Roles, MacFH,MAC)
342
343 ok = VRSet("Main", 'Pointer', '<default>' )
344
345 say time()' _AddSharesDisplay() success and cleanup'
346 ok = stream(smbmachine.I,'c','close')
347 ok = SysFileDelete(smbmachine.I)
348 if ok <> 0 then say ' Failure 'ok' deleting "'smbmachine.I'"!'
349 end
350 end
351
352 if UserCred = '-N' then UserCred = ''
353
354 if VRIsValidObject("DT_STATUSBAR") then ok = VRSet("DT_STATUSBAR","Caption", "Ready.")
355 say time()' _AddSharesDisplay() loop end'
356return
357
358/*:VRX _GetMachinehandle
359*/
360
361_GetMachinehandle: procedure /* get recordhandle by machine name (also works for workgroups) */
362 Machine = translate(arg(1))
363 say ' _GetMachineHandle("'Machine'") started.'
364 ok = VRMethod("CN_smbtree", "GetRecordList", "All", rh.)
365 match = 0
366
367 do I = 1 to rh.0
368 ResName = translate(VRMethod("CN_smbtree","GetRecordAttr",rh.I,"Caption"))
369
370 parse var ResName ResName '0D0A'x .
371 ResName = strip(ResName)
372
373 if Machine = ResName then do /* we got a matching name */
374 match = 1
375 leave
376 end
377 end
378 if match = 0 then rh.I = "" /* return an empty handle, if there was no match */
379 say ' _GetMachineHandle("'Machine'") done, handle = "'rh.I'"'
380return rh.I
381
382/*:VRX _RefreshWorkgroups
383*/
384_RefreshWorkgroups:
385 say time()' _RefreshWorkgroups() started'
386 if UserCred = 'USERCRED' | UserCred = '' | UserCred = '--user=%' then UserCred = '-N'
387 if BroadCast = 1 then BroadCast = '-b'; else BroadCast = ''
388
389 say ' 'samba.!smbtreeexe' 'BroadCast' -D 'debuglevel' 'UserCred' >'samba.!msg
390 address cmd samba.!smbtreeexe' 'BroadCast' -D 'debuglevel' 'UserCred' >'samba.!msg
391
392 if BroadCast = '-b' then BroadCast = 1; else BroadCast = 0
393 if UserCred = '-N' then UserCred = ''
394
395 ok = File2Stem(samba.!msg,"workgroups.")
396 do I = 1 to workgroups.0
397 workgroup = translate(workgroups.I)
398 if pos("RECEIVING",workgroup) > 0 | pos("TDB(",workgroup) > 0 then iterate /* We ignore errors here */
399 wgh = _GetMachinehandle(workgroup)
400 if wgh = "" then wgh = _AddWorkGroup(workgroup) /* A new workgroup was found -- add it */
401 end
402 say time()' _RefreshWorkgroups() done'
403return
404
405/*:VRX _AddWorkgroup
406*/
407_AddWorkGroup: procedure expose WorkGroupFH
408 workgroup = arg(1)
409 say ' _AddWorkGroup("'workgroup'") started.'
410 wgh= VRMethod( "CN_smbtree", "AddRecord",,, workgroup,"#62:PMWP.DLL")
411 ok = VRMethod( "CN_smbtree", "SetFieldData", wgh, WorkGroupFH, workgroup)
412 ok = VRMethod( "CN_smbtree", "SetRecordAttr", wgh, "Collapsed", 0)
413 ok = VRMethod( "CN_smbtree", "SetRecordAttr", wgh, "ReadOnly", 1)
414 ok = VRMethod( "CN_smbtree", 'SetRecordAttr', wgh, "UserData", "WORKGROUP|")
415 say ' _AddWorkGroup("'workgroup'") done.'
416return wgh
417
418/*:VRX _AddSleepingMachine
419*/
420_AddSleepingMachine: procedure expose WorkGroupFH NBFH CommentFH
421 machine = arg(1)
422 comment = arg(2)
423 parent = arg(3)
424 mh = VRMethod( "CN_smbtree", "AddRecord",parent,, machine||'0D0A'x||comment)
425 ok = VRMethod( "CN_smbtree", "SetFieldData", mh, NBFH, machine, CommentFH, comment)
426 ok = VRMethod( "CN_smbtree", "SetRecordAttr", mh, "Icon","#61:PMWP.DLL")
427 ok = VRMethod( "CN_smbtree", "SetRecordAttr", mh, "ReadOnly", 1)
428 ok = VRMethod( "CN_smbtree", "SetRecordAttr", mh, "Collapsed", 1)
429 ok = VRMethod( "CN_smbtree", 'SetRecordAttr', mh, "UserData", "SERVER|")
430 if parent <> "" then do
431 WGName = translate(VRMethod("CN_smbtree","GetRecordAttr",parent,"Caption"))
432 parse var WGName WGName '0D0A'x .
433 ok = VRMethod( "CN_smbtree", "SetFieldData", mh, WorkgroupFH, strip(WGName))
434 end
435return mh
436
437/*:VRX _GetMachineIP
438*/
439_GetMachineIP: procedure expose debuglevel samba.
440 /* Get all IP addresses of the machine */
441 machine = arg(1)
442 say ' 'samba.!nmblookupexe' 'machine' 'debuglevel' >'samba.!msg
443 address cmd samba.!nmblookupexe' 'machine' 'debuglevel' >'samba.!msg
444 ok = file2stem(samba.!msg,"nmblookup.")
445 ipstr = ""; ip = ""
446 do i = 1 to nmblookup.0
447 if pos(strip(machine)'<',nmblookup.i) = 0 then iterate
448 parse var nmblookup.i ip .
449 if pos(strip(ip), ipstr) = 0 then ipstr = ipstr||ip','
450 end
451 ipstr = strip(ipstr,,',')
452return IpStr
453
454/*:VRX _GetMachineRole
455*/
456_GetMachineMACRoles: procedure expose debuglevel samba.
457 machine = arg(1) /* May be name or IP */
458 say ' 'samba.!nmblookupexe' -A 'machine' 'debuglevel' >'samba.!msg
459 address cmd samba.!nmblookupexe' -A 'machine' 'debuglevel' >'samba.!msg
460 ok = file2stem(samba.!msg,"nmblookup.")
461 Roles = ""
462 MAC = 'xx-xx-xx-xx-xx-xx'
463 do I = 1 to nmblookup.0
464 select
465 when pos('<1c>', nmblookup.I) > 0 then Roles = Roles||"PDC," /* # */
466 when pos('<1b>', nmblookup.I) > 0 then Roles = Roles||"LMB," /* + */
467 when pos('<1d>', nmblookup.I) > 0 then Roles = Roles||"DMB," /* * */
468 when pos('MAC', nmblookup.I) > 0 then do
469 parse var nmblookup.I . '=' MAC
470 MAC = strip(MAC)
471 end
472 otherwise nop
473 end
474 end
475 Roles = strip(Roles,,',')
476 if Roles = "" then Roles = "Workstation"
477return MAC'|'Roles
478
479/*:VRX _GetMachineNMBStatus
480*/
481_GetMachineNMBStatus: procedure expose debuglevel samba.
482 machine = arg(1) /* name only allowed */
483 say ' 'samba.!nmblookupexe' -S 'machine' 'debuglevel' >'samba.!msg
484 address cmd samba.!nmblookupexe' -S 'machine' 'debuglevel' >'samba.!msg
485 ok = file2stem(samba.!msg,"nmblookup.")
486 IPStr = ""
487 Roles = ""
488 MAC = 'xx-xx-xx-xx-xx-xx'
489 do I = 1 to nmblookup.0
490 select
491 when pos(machine'<',nmblookup.I) > 0 then do
492 parse var nmblookup.i ip .
493 ip = strip(ip)
494 if pos(ip, ipstr) = 0 then ipstr = ipstr||ip','
495 end
496 when pos('<1c>', nmblookup.I) > 0 then Roles = Roles||"PDC," /* # */
497 when pos('<1b>', nmblookup.I) > 0 then Roles = Roles||"LMB," /* + */
498 when pos('<1d>', nmblookup.I) > 0 then Roles = Roles||"DMB," /* * */
499 when pos('MAC', nmblookup.I) > 0 then do
500 parse var nmblookup.I . '=' MAC
501 MAC = strip(MAC)
502 end
503 otherwise nop
504 end
505 end
506 Roles = strip(Roles,,',')
507 if Roles = "" then Roles = "Workstation"
508 ipstr = strip(ipstr,,',')
509return IPStr'|'MAC'|'Roles
510
511/*:VRX file2stem
512*/
513file2stem:
514 msgfile = arg(1)
515 msgstem = arg(2)
516 if right(msgstem,1) <> '.' then msgstem = msgstem'.'
517 say ' file2stem("'msgfile'","'msgstem'")'
518 dyn = 'drop 'msgstem
519 interpret dyn
520 stemcount = 0
521 do while lines(msgfile) > 0
522 stemcount = stemcount + 1
523 inline = linein(msgfile)
524 if pos('creating lame',inline) > 0 then do
525 stemcount = stemcount - 1
526 iterate
527 end
528 dyn = msgstem||stemcount' = inline'
529 interpret dyn
530 end
531 dyn = msgstem||"0 = "stemcount
532 interpret dyn
533 ok = stream(msgfile,'c','close')
534 ok = SysFileDelete(msgfile)
535 drop msgfile msgstem
536return stemcount
Note: See TracBrowser for help on using the repository browser.