[Search for users] [Overall Top Noters] [List of all Conferences] [Download this site]

Conference noted::hackers_v1

Title:-={ H A C K E R S }=-
Notice:Write locked - see NOTED::HACKERS
Moderator:DIEHRD::MORRIS
Created:Thu Feb 20 1986
Last Modified:Mon Aug 03 1992
Last Successful Update:Fri Jun 06 1997
Number of topics:680
Total number of notes:5456

254.0. "ALL the translations of a search list?" by NUWAVE::KARDON () Mon Jun 09 1986 21:12

HELP!!!
    
(I didn't know if this was the right place to post this question, but
 I figured that this was the one place where I was certain to find an
 answer.)
    
I'd like to find an easy way (inside of a [BLISS] program) to find all
of the values of a logical representing a search list of directories.
Currently, I am using LIB$FIND_FILE on the LOGICAL:*.*
This gives me all the different valid directories but it doesn't
return any nonexistant directories.
    
    ex.
    
    $ DEF LOGICAL [BAD],[KARDON]   ! where [BAD] does not exist
    
    returns only the files in [KARDON].  Using LIB$FIND_FILE, I
    would have never known about the logical's primary definition
    [BAD].
    
I would greatly appreciate it if someone could help me out.  I have
been unable to come up with the solution myself.
    
    
    Thanks in advance,
    -Scott                   
    
    
T.RTitleUserPersonal
Name
DateLines
254.1$TRNLNMSHOGUN::BLUEJAYTiger FlyerTue Jun 10 1986 11:513
    Sounds like what you want is the $TRNLNM (translate logical name)
    system service.
    						- Bluejay Adametz, CFII
254.2Some more help !SWIFT::MEGARITYIan Megarity - UK TSCTue Jun 10 1986 12:37101
    Hi,
    	Here'a a BASIC program which translates logical names and which
    	should cater for search lists. Basically, it calls $TRNLNM
    	repeatedly for increasing values of the LNM$_INDEX item code
    	until the length is returned as zero.
    
    	Hope it's of some help.
    
    	Ian M	UK TSC

    
1	!	trn - translates logical names.

	option	type = explicit

	external long function	sys$trnlnm
	external word constant	lnm$_string,	lnm$_index,	&
				lnm$_length,	lnm$_attributes

	declare	word	w_namlen,				&
		long	w_index,				&
		long	w_len,					&
		long	w_stat,					&
		string	w_log

	declare	integer constant w_true = -1

	map (w_buf)	string	w_eqv = 255

	record	item_list
		word	buffer_length_1
		word	item_code_1
		long	buffer_address_1
		long	return_length_address_1

		word	buffer_length_2
		word	item_code_2
		long	buffer_address_2
		long	return_length_address_2

		word	buffer_length_3
		word	item_code_3
		long	buffer_address_3
		long	return_length_address_3

		long	terminator
	end record item_list

	declare	item_list	w_items

	w_items::buffer_length_1 = 4%
	w_items::item_code_1 = lnm$_index
	w_items::buffer_address_1 = loc(w_index)
	w_items::return_length_address_1 = 0%

	w_items::buffer_length_2 = 255%
	w_items::item_code_2 = lnm$_string
	w_items::buffer_address_2 = loc(w_eqv)
	w_items::return_length_address_2 = loc(w_namlen)

	w_items::buffer_length_3 = 4%
	w_items::item_code_3 = lnm$_length
	w_items::buffer_address_3 = loc(w_len)
	w_items::return_length_address_3 = 0%

	w_items::terminator = 0%

  get_logical:

	linput "Logical name to translate "; w_log	! Ask for logical.
	goto 32767 if len(w_log) = 0%			! Abort if nothing.
	w_log = edit$(w_log, 32%)			! Convert to up-case.
	w_index = 0%					! Start at bottom.

	while	w_true

		w_stat = sys$trnlnm (, 'LNM$PROCESS_TABLE',		&
					w_log, , w_items)
							! Translate logical
							!  for current value
							!  of index.
		if (w_stat and 1%) <> 1%	then
			call lib$signal(w_stat by value)
			goto 32767			! Signal errors.
		else
			! Continue translating until the length
			!  is returned as zero.
			if w_len <> 0%	then
			  print "Index "; w_index;		&
				" translation of "; w_log; " is "; w_eqv
			else
			    goto 32767
			end if
		end if

		w_index = w_index + 1%

	next

32767	end

254.3looks GOOD!!NUWAVE::KARDONTue Jun 10 1986 13:426
    Ian,
    
    Looks like that's just what I wanted.
    
    Thanks for your time,
    -Scott