$ od -c -N 50000 [_CDCSL_93-16_]<1>Cedar>release>CedarCore>GetXNSid.c 0000000 / * \n G e t X N S i d . c \n - - 0000020 C o p y r i g h t 323 1 9 8 0000040 8 b y X e r o x C o r p o 0000060 r a t i o n . A l l r i g 0000100 h t s r e s e r v e d . \n * 0000120 A g r a n d k l u d g e 0000140 f o r g e t t i n g t h e 0000160 X N S I D f r o m a s 0000200 t a n d a r d S U N O S 4 . 0000220 0 k e r n e l ; \n * T h 0000240 e p r o b l e m i s t h a 0000260 t t o o p e n t h e N I 0000300 T , y o u h a v e t o b 0000320 e S U I D r o o t , a n d 0000340 w e d o n ' t \n * w a 0000360 n t c e d a r r u n n i n g 0000400 t h a t w a y , s o w e 0000420 f o r k a n o t h e r l i 0000440 t t l e p r o g r a m t o 0000460 d o t h e \n * r e a l 0000500 w o r k , t h e n r e a d 0000520 t h e r e s u l t s f r o m 0000540 a p i p e . \n * / \n # i n 0000560 c l u d e < s t d i o . h > \n 0000600 \n t y p e d e f u n s i g n e 0000620 d s h o r t B Y T E ; \t \t \t 0000640 \t \n \n t y p e d e f s t r u c 0000660 t H o s t N u m b e r _ s e l 0000700 f { \n \t B Y T E a : 8 ; \n 0000720 \t B Y T E b : 8 ; \n \t B Y T 0000740 E c : 8 ; \n \t B Y T E d 0000760 : 8 ; \n \t B Y T E e : 8 ; \n 0001000 \t B Y T E f : 8 ; \n \t } X 0001020 N S I D _ H o s t N u m b e r ; 0001040 \n \n t y p e d e f s t r u c t 0001060 P r o c e s s o r I D _ s e l 0001100 f { \n \t X N S I D _ H o s t N 0001120 u m b e r a n o n 0 ; \n \t } 0001140 X N S I D _ P r o c e s s o r I 0001160 D ; \n \n e x t e r n v o i d \n 0001200 X R _ g e t x n s h o s t i d ( 0001220 p i d ) \n X N S I D _ P r o c e 0001240 s s o r I D * p i d ; \n { \n 0001260 i n t i , s c a n r e s u 0001300 l t ; \n i n t b u f f e r 0001320 [ 6 ] ; \n i n t e r r o r 0001340 v a l = 1 0 ; \n F I L E 0001360 * s h ; \n \n i f ( p 0001400 i d = = N U L L ) r e t u 0001420 r n ; \n \n s h = p o 0001440 p e n ( " g e t x n s h o s t i 0001460 d " , " r " ) ; \n \n / 0001500 * a l l 0 r e t u r n - 0001520 > e r r o r * / \n p i d 0001540 - > a n o n 0 . a = 0 ; \n 0001560 p i d - > a n o n 0 . b = 0001600 0 ; \n p i d - > a n o n 0 . 0001620 c = 0 ; \n p i d - > a n 0001640 o n 0 . d = 0 ; \n p i d 0001660 - > a n o n 0 . e = 0 ; \n 0001700 p i d - > a n o n 0 . f = 0001720 0 ; \n \n i f ( s h = 0001740 = N U L L ) r e t u r n ; 0001760 / * a l l 0 r e t u r n 0002000 - > e r r o r * / \n \n 0002020 f o r ( i = 0 ; i < 0002040 6 ; i + + ) { \n s 0002060 c a n r e s u l t = f s c a 0002100 n f ( s h , " % x " , & b u 0002120 f f e r [ i ] ) ; \n i f 0002140 ( s c a n r e s u l t ! = 0002160 1 ) b r e a k ; / * a l l 0002200 0 r e t u r n - > e r r 0002220 o r * / \n } ; \n p 0002240 c l o s e ( s h ) ; \n \n \n 0002260 i f ( i < 6 ) r e t u 0002300 r n ; / * a l l 0 r e t 0002320 u r n - > e r r o r * / \n 0002340 \n p i d - > a n o n 0 . a 0002360 = b u f f e r [ 0 ] ; \n p 0002400 i d - > a n o n 0 . b = b u 0002420 f f e r [ 1 ] ; \n p i d - > 0002440 a n o n 0 . c = b u f f e r 0002460 [ 2 ] ; \n p i d - > a n o n 0002500 0 . d = b u f f e r [ 3 ] ; 0002520 \n p i d - > a n o n 0 . e 0002540 = b u f f e r [ 4 ] ; \n p 0002560 i d - > a n o n 0 . f = b u 0002600 f f e r [ 5 ] ; \n \n r e t u 0002620 r n ; \n } \n \n 0002627