Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.3 4.3bsd-beta 6/6/85; site ucbvax.BERKELEY.EDU Path: utzoo!decvax!bellcore!ulysses!cbosgd!ucbvax!su-star.arpa!cal From: cal@SU-STAR.ARPA (Calvin Teague) Newsgroups: mod.mac Subject: AppleTalk node name routine Message-ID: <8603211614.AA07930@ucbvax.berkeley.edu> Date: Thu, 20-Mar-86 18:03:00 EST Article-I.D.: ucbvax.8603211614.AA07930 Posted: Thu Mar 20 18:03:00 1986 Date-Received: Sat, 22-Mar-86 20:19:44 EST Sender: daemon@ucbvax.BERKELEY.EDU Reply-To: Calvin Teague Organization: The ARPA Internet Lines: 35 Approved: info-mac@sumex-aim.arpa Following Walter Smith's suggestion, I found the AppleTalk node name as a string resource in the system. It turns out that it belongs to .MPP rather than to Chooser, so it may be intended for more general use than just printer status messages. The following routine (written for Megamax C) returns the node name in a user-supplied text buffer. It works under System 3.1.1 and Finder 5.2. I haven't tried it under earlier versions yet, but the name should be returned as an empty string if the handle comes back zero. Calvin Teague -------------------------- getnodename(name, max_len) char *name; int max_len; { int i, mpp_id, name_id; char type[5], *s; handle h; h = getnamedresource("DRVR", ".MPP"); if(h) { getresinfo(h, &mpp_id, type, name); name_id = -16384 + 32*mpp_id; /* STR is type 0, name id is 0 */ h = getresource("STR ", name_id); if(h) { s = (char *) *h; i = (*s++) & 0xFF; if(i > max_len) i = max_len; while(i--) *name++ = *s++; } } *name = 0; } ------