cal@SU-STAR.ARPA (Calvin Teague) (03/21/86)
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; } ------