⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 getgrent.3

📁 操作系统设计与实现源码
💻 3
字号:
%!PS-Adobe-1.0%%Creator: devps (Pipeline Associates, Inc.)%%CreationDate: Fri Sep 13 13:06:45 1996%%Pages: (atend)%%DocumentFonts: (atend)/devps 180 dict def devps begin/res 10.000000 def/y_offset 843 def/X{exch}bind def/mm {transform round X round X itransform} bind def/r{rmoveto}bind def/m{moveto}bind def/l{lineto}bind def/rl{rlineto}bind def/st{stroke}bind def/gs{gsave}bind def/gr{grestore}bind def/cp{currentpoint}bind def/np{newpath}bind def/ct{curveto}bind defsystemdict /setpacking known { /savepacking currentpacking def true setpacking } if/m0{0 0 moveto}bind def/xc{//res div}bind def/yc{//res neg div //y_offset add}bind def/lc{yc X xc X l st}bind def/mc{yc X xc X m}bind def/el{gs /a X def a div 1 X scale cp np a xc 2 div 0 360 arc st gr}bind def/ar{cp 7 2 roll np xc 5 1 roll atan 3 1 roll atan X arc st}bind def/sp{yc X xc X 6 2 roll yc X xc X 6 2 roll yc X xc X 6 2 roll ct}bind def/V{//res neg div //y_offset addcurrentpoint pop Xm}bind def/H{//res div0 transform X round X itransform popcurrentpoint X popmoveto}bind def/h{//res div 0 r}bind def/v{//res neg div 0 X r}bind def/S{X H show}bind def/A{H //res div 1 index stringwidth pop sub 1 index length div 0 3 2 roll ashow}bind def/psize 10 def/height 0 def/cheight { height 0 ne { height } { psize } ifelse } bind def/slant 0 def/FF{findfont X dup 30 div 0 mm pop setlinewidth /psize X def    [psize 0 cheight slant sin slant cos div mul cheight 0 0]    makefont setfont}bind def/shade{gs /dy X def /dx X def np m 0 /dy rl /dx 0 rl 0 /dy neg rl /dx neg 0 rl closepath .9 setgray fillgr}bind def1 setlinecap/resolution res 72 mul def/startFig {	/SavedState save def	userdict maxlength dict begin	currentpoint transform	DocumentInitState setmiterlimit setgray setdash setlinejoin setlinecap		setlinewidth setmatrix	itransform moveto	/ury exch def	/urx exch def	/lly exch def	/llx exch def	/y exch 72 mul resolution div def	/x exch 72 mul resolution div def		currentpoint /cy exch def /cx exch def	/sx x urx llx sub div def	/sy y ury lly sub div def	sx sy scale	cx sx div llx sub	cy sy div ury sub translate		/DefFigCTM matrix currentmatrix def	/initmatrix {		DefFigCTM setmatrix	} def	/defaultmatrix {		DefFigCTM exch copy	} def	/initgraphics {		DocumentInitState setmiterlimit setgray setdash 			setlinejoin setlinecap setlinewidth setmatrix		DefFigCTM setmatrix	} def	/showpage {		initgraphics	} def}bind  def/clipFig {	currentpoint 6 2 roll	newpath 4 copy	4 2 roll moveto	6 -1 roll exch lineto	exch lineto	exch lineto	closepath clip	newpath	moveto}bind  def/doclip { llx lly urx ury clipFig } def/endFig {	end SavedState restore}bind  def/globalstart {	fontnum psize slant height resolution currentpoint 	pagesave restore gsave }bind  def/globalend {	grestore moveto	/resolution exch def /height exch def	/slant exch def /psize exch def /fontnum exch def	F	/pagesave save def}bind  def/fontnum 1 def systemdict /setpacking known { savepacking setpacking} ifend/BP{save mark devps begin m0/DocumentInitState [ matrix currentmatrix currentlinewidth currentlinecapcurrentlinejoin currentdash currentgray currentmiterlimit ] cvx def}bind def/EP{end cleartomark restore showpage}def/Encoding-1 256 array def0 1 255 {Encoding-1 exch /.notdef put} forEncoding-1 8#301 StandardEncoding 8#101 26 getinterval putinterval %A-BEncoding-1 8#341 StandardEncoding 8#141 26 getinterval putinterval %a-bEncoding-1 8#241 StandardEncoding 8#301 16 getinterval putinterval %accentsEncoding-1 8#373 StandardEncoding 8#365 1 getinterval putinterval %dotlessiEncoding-1dup 8#41 /copyright putdup 8#42 /registered putdup 8#43 /trademark putdup 8#44 /logicalnot putdup 8#45 /Eth putdup 8#46 /eth putdup 8#47 /Thorn putdup 8#50 /thorn putdup 8#51 /brokenbar putdup 8#52 /degree putdup 8#53 /divide putdup 8#54 /multiply putdup 8#55 /minus putdup 8#56 /onehalf putdup 8#57 /onequarter putdup 8#60 /threequarters putdup 8#101 /Aacute putdup 8#102 /Acircumflex putdup 8#103 /Adieresis putdup 8#104 /Agrave putdup 8#105 /Aring putdup 8#106 /Atilde putdup 8#107 /Ccedilla putdup 8#110 /Eacute putdup 8#111 /Ecircumflex putdup 8#112 /Edieresis putdup 8#113 /Egrave putdup 8#114 /Iacute putdup 8#115 /Icircumflex putdup 8#116 /Idieresis putdup 8#117 /Igrave putdup 8#120 /Ntilde putdup 8#121 /Oacute putdup 8#122 /Ocircumflex putdup 8#123 /Odieresis putdup 8#124 /Ograve putdup 8#125 /Otilde putdup 8#126 /Scaron putdup 8#127 /Uacute putdup 8#130 /Ucircumflex putdup 8#131 /Udieresis putdup 8#132 /Ugrave putdup 8#133 /Ydieresis putdup 8#134 /Zcaron putdup 8#135 /aacute putdup 8#136 /acircumflex putdup 8#137 /adieresis putdup 8#140 /agrave putdup 8#141 /aring putdup 8#142 /atilde putdup 8#143 /ccedilla putdup 8#144 /eacute putdup 8#145 /ecircumflex putdup 8#146 /edieresis putdup 8#147 /egrave putdup 8#150 /iacute putdup 8#151 /icircumflex putdup 8#152 /idieresis putdup 8#153 /igrave putdup 8#154 /ntilde putdup 8#155 /oacute putdup 8#156 /ocircumflex putdup 8#157 /odieresis putdup 8#160 /ograve putdup 8#161 /otilde putdup 8#162 /scaron putdup 8#163 /uacute putdup 8#164 /ucircumflex putdup 8#165 /udieresis putdup 8#166 /ugrave putdup 8#167 /ydieresis putdup 8#170 /zcaron putpop/Enc-dict 30 dict defEnc-dict /tmpstr1 50 string putEnc-dict /tmpstr2 50 string putEnc-dict /tmpstr3 50 string dup (Encoding-) exch cvs pop put/AEnc-def { % arguments: the original font's name, encoding nrEnc-dict begintmpstr2 cvs /Enc-no exch def % Remember the number in a stringdup /OrigName exch def % remember the namefindfont dup maxlength dict /newdict exch def % get dictionary for new font{ exch dup /FID ne   { exch newdict 3 1 roll put }   { pop pop } % Ignore FID   ifelse} forallnewdict begin/Encoding  tmpstr3 9 Enc-no putinterval tmpstr3 0 9 Enc-no length add getinterval  cvn load  def % Replace encodingcurrentdict /UniqueID known{ /UniqueID UniqueID Enc-no cvi 49999 mul add def } if % Derive New UniqueIDend % newdict/FNlength OrigName tmpstr1 cvs length def % convert name, remember lengthFNlength 1 add Enc-no length add stringdup 0 OrigName tmpstr1 cvs putintervaldup FNlength (-) putintervaldup FNlength 1 add Enc-no putintervaldup 0 tmpstr1 0 FNlength getinterval putinterval % Add old namecvn dup newdict /FontName 3 2 roll put newdict definefontend % Enc-dict} def/Times-Roman 1 AEnc-def pop/R-1{/Times-Roman-1 FF}def/R{/Times-Roman FF}def/B{/Times-Bold FF}def/I{/Times-Italic FF}def%%EndProlog%%Page: 1 1BP/slant 0 def/height 0 def480 V10 R720(GETGRENT)S1262(\()S1304(3)S1362(\))S2696(Eighth)S(Edition)296 2989 A4585(GETGRENT)S5127(\()S5169(3)S5227(\))S960 V9 R720(N)S722(NA)S790(AM)S858(ME)S940(E)S1080 V10 R1080(getgrent,)S1460(getgrnam,)S1890(getgrgid,)S2275(setgrent,)S(endgrent,)377 2644 A3046(setgr\256le)S10 R-13396(-)S10 R(group)234 3478 A3737(\256le)S3891(routines)S1248 V9 R720(S)S722(SY)S774(YN)S842(NO)S910(OP)S978(PS)S1030(SI)S1082(IS)S1115(S)S1368 V10 B1080(#include)S1482(<grp.h>)S1608 V1080(struct)S1371(group)S1666(*getgrent\(void\))S1728 V1080(struct)S1371(group)S1666(*getgrnam\(const)S2426(char)S2660(*)S10 I2710(name)S10 B2928(\))S1848 V1080(struct)S1371(group)S1666(*getgrgid\(gid_t)S10 I2364(gid)S10 B2492(\))S1968 V1080(int)S1236(setgrent\(void\))S2088 V1080(void)S1302(endgrent\(void\))S2208 V1080(void)S1302(setgr\256le\(const)S1940(char)S2174(*)S10 I2224(\256le)S10 B2347(\))S2376 V9 R720(D)S722(DE)S790(ES)S848(SC)S900(CR)S962(RI)S1024(IP)S1057(PT)S1109(TI)S1167(IO)S1200(ON)S1268(N)S2496 V10 R1080(These)S1354(functions)S1761(are)S1918(used)S2135(to)S2246(obtain)S2530(information)S3038(from)S3267(the)S(group)234 3423 A3690(\256le.)S3902(They)S4142(return)S4416(this)S4595(information)S5104(in)S5216(a)S2616 V10 B1080(struct)S1358(group)S10 R1640(as)S1749(de\256ned)S2070(by)S2195(<grp.h>:)S2784 V1080(struct)S(group)234 1329 A1588({)S2904 V1280(char)S1580(*gr_name;)S2330(/*)S2433(login)S2664(name)S2907(*/)S3024 V1280(char)S1580(*gr_passwd;)S2330(/*)S2433(encrypted)S2855(password)S3260(*/)S3144 V1280(gid_t)S1580(gr_gid;)S2330(/*)S2433(numeric)S(group)234 2788 A3047(id)S3150(*/)S3264 V1280(char)S(**gr_mem;)463 1580 A2330(/*)S2433(null-terminated)S3079(list)S3227(of)S(group)234 3336 A3595(members)S3989(*/)S3384 V1080(};)S3552 V10 B(Getgrent\(\))455 1080 A10 R1569(reads)S1816(the)S(group)234 1973 A2241(\256le)S2404(entry)S2645(by)S2779(entry.)S10 B3070(Getgrnam\(\))S10 R3614(scans)S3866(the)S4023(entire)S(group)234 4287 A4555(\256le)S4718(for)S4870(the)S(group)234 5027 A3672 V1080(with)S1300(the)S1464(given)S10 I1728(name)S10 R1954(.)S10 B2045(Getgrgid\(\))S10 R(looks)217 2540 A2798(for)S2957(the)S3121(\256rst)S(group)234 3318 A3592(with)S3811(the)S3974(given)S10 I4237(gid)S10 R4373(.)S4463(The)S10 B(setgrent\(\))416 4660 A10 R5116(and)S3792 V10 B(endgrent\(\))455 1080 A10 R1567(functions)S1973(are)S2129(used)S2345(to)S2455(open)S2682(and)S2859(later)S3071(close)S3310(the)S(group)234 3465 A3731(\256le.)S3942(With)S10 B4176(setgr\256le\(\))S10 R4619(one)S4797(can)S4970(specify)S3912 V1080(the)S1234(\256le)S1394(to)S1503(read)S1708(other)S1946(than)S2150(the)S2304(normal)S(group)234 2620 A2885(\256le.)S3095(This)S3305(only)S3514(sets)S3696(the)S3850(name,)S4124(the)S4278(next)S10 B(setgrent\(\))416 4482 A10 R4928(call)S(will)157 5104 A4032 V1080(open)S1303(the)S1455(\256le.)S1663(Do)S1815(not)S1972(touch)S2224(the)S2376(\256le)S2534(name)S2781(while)S3034(it)S3119(is)S3215(active.)S3535(Use)S10 B3721(setgr\256le\(NULL\))S10 R4440(to)S4547(revert)S4812(back)S5031(to)S5138(the)S4152 V1080(normal)S(group)234 1390 A1649(\256le.)S4320 V1080(The)S1262(usual)S1499(way)S1692(to)S1795(scan)S1999(the)S(group)234 2147 A2406(\256le)S2560(is)S2652(\(error)S2908(checking)S(omitted\):)369 3296 A4488 V1440(setgrent\(\);)S4608 V1440(while)S1689(\(\(gr)S1866(=)S(getgrent\(\)\))432 1948 A2405(!=)S2521(NULL\))S4728 V1800(if)S(\(appropriate_test\(gr\)\))869 1887 A2781(break;)S4848 V(endgrent\(\);)448 1440 A5016 V1080(The)S10 B1266(gr)S10 R1390(variable)S1744(contains)S2108(the)S2260(entry)S2496(that)S2676(is)S2772(wanted)S3092(if)S(non-NULL.)479 3184 A3718(The)S10 B3905(getgrnam\(\))S10 R4417(and)S10 B4592(getgrgid\(\))S10 R5048(func-)S5136 V1080(tions)S1300(are)S1449(implemented)S1999(as)S2108(in)S2211(this)S2381(example,)S2772(with)S2976(error)S3198(checking)S3586(of)S3695(course.)S5304 V10 B(Getgrent\(\))455 1080 A10 R1563(calls)S10 B(setgrent\(\))416 1776 A10 R2220(if)S2310(this)S2483(has)S2645(not)S2801(yet)S2952(been)S(done.)220 3170 A10 B(Setgrent\(\))433 3443 A10 R3904(\256rst)S4089(calls)S10 B(endgrent\(\))455 4302 A10 R4785(if)S4875(the)S(group)234 5027 A5424 V1080(\256le)S1234(is)S(still)151 1326 A1502(open.)S1772(\(Other)S2061(implementations)S2756(may)S2954(simply)S3252(rewind)S3557(the)S3705(\256le.\))S5592 V9 R720(F)S722(FI)S774(IL)S807(LE)S865(ES)S923(S)S5712 V10 B1080(/etc/group)S10 R1830(The)S(group)234 2012 A2271(\256le)S2425(database.)S5880 V9 R720(S)S722(SE)S774(EE)S832(E)S913(A)S915(AL)S983(LS)S1041(SO)S1093(O)S6000 V10 B1080(getgroups)S10 R1505(\(2\),)S10 B1673(initgroups)S10 R2115(\(3\),)S10 B2283(getpwent)S10 R2676(\(3\),)S10 B2844(passwd)S10 R3157(\(5\).)S6168 V9 R720(D)S722(DI)S790(IA)S823(AG)S891(GN)S959(NO)S1027(OS)S1095(ST)S1147(TI)S1205(IC)S1238(CS)S1300(S)S6288 V10 B(Setgrent\(\))433 1080 A10 R1542(has)S1705(the)S1857(same)S2093(return)S2363(value)S2610(and)S2784(error)S3011(codes)S3270(as)S3384(the)S10 B3537(open)S10 R3744(\(2\))S3892(call)S4068(it)S4154(uses)S4357(to)S4465(open)S4690(the)S(group)234 4843 A5107(\256le.)S6408 V1080(The)S10 B1273(get)S10 I(xxx)135 1402 A10 B1545(\(\))S10 R1649(functions)S2059(return)S2336(NULL)S2642(on)S2778(end)S2959(of)S3079(\256le,)S3269(entry)S3512(not)S(found,)259 3676 A3971(or)S4091(error.)S4374(You)S4583(can)S4759(set)S10 B(errno)241 4907 A10 R5183(to)S6528 V1080(zero)S1279(before)S1562(the)S1710(call)S1881(and)S2051(check)S2311(it)S2392(after.)S6696 V9 R720(N)S722(NO)S790(OT)S858(TE)S916(ES)S974(S)S6816 V10 R1080(All)S10 B1234(get)S10 I(xxx)135 1363 A10 B1506(\(\))S10 R1599(routines)S1948(return)S2214(a)S2284(pointer)S2594(to)S2697(static)S2935(storage)S3251(that)S3427(is)S(overwritten)465 3519 A4009(in)S(each)185 4112 A4322(call.)S6984 V1080(Only)S10 B1330(getgrnam\(\))S10 R1861(and)S10 B2055(getgrgid\(\))S10 R2530(are)S2703(de\256ned)S3048(by)S8 R3192(POSIX)S10 R3425(.)S3524(The)S10 B(_MINIX_SOURCE)839 3730 A10 R4619(macro)S4921(must)S5166(be)S7104 V1080(de\256ned)S1407(before)S1696(including)S2106(<grp.h>)S2460(to)S2569(make)S2818(the)S2971(other)S3208(functions)S3612(visible.)S3960(The)S10 B4147(gr_passwd)S10 R4635(\256eld)S4844(is)S4941(also)S5133(not)S7224 V1080(de\256ned)S1405(by)S8 R1529(POSIX)S10 R1762(,)S1816(but)S1973(is)S2069(always)S2378(visible.)S2725(Portable)S3091(code)S(cannot)268 3311 A3609(reliably)S3947(detect)S4218(errors)S4484(by)S(setting)268 4614 A10 B(errno)241 4912 A10 R5183(to)S7344 V1080(zero.)S1337(Under)S1622(Minix)S1900(it)S1989(is)S2089(better)S2351(to)S2461(make)S2711(a)S10 B(getgrent\(\))427 2788 A10 R3247(scan)S3458(if)S(you)150 3552 A3734(need)S3956(to)S(look)178 4066 A4276(up)S4408(several)S(group-id's)419 4726 A5177(or)S7464 V1080(names,)S1403(but)S1572(portable)S1943(code)S2174(had)S2360(better)S2631(use)S2806(several)S10 B3133(getgrgid\(\))S10 R3600(or)S10 B3725(getgrnam\(\))S10 R4249(calls.)S4526(The)S10 B(getgrent\(\))427 4725 A10 R5194(is)S7903 V720(Page)S941(1)S4455(September)S4911(13,)S(1996)200 5061 A8143 VEP%%Page: 2 2BP/slant 0 def/height 0 def480 V10 R720(GETGRENT)S1262(\()S1304(3)S1362(\))S2696(Eighth)S(Edition)296 2989 A4585(GETGRENT)S5127(\()S5169(3)S5227(\))S960 V1080(usually)S1399(available)S1791(on)S1919(other)S2154(systems,)S2525(but)S2681(may)S2882(be)S3005(very)S3212(expensive.)S3692(See)S10 B3866(initgroups)S10 R4308(\(3\))S4454(if)S(you)150 4544 A4722(are)S4874(after)S5088(sup-)S1080 V1080(plementary)S(group)234 1558 A1817(id's.)S1248 V9 R720(A)S722(AU)S790(UT)S858(TH)S916(HO)S984(OR)S1052(R)S1368 V10 R1080(Kees)S1307(J.)S1396(Bot)S1566(\(kjb@cs.vu.nl\))S7903 V720(September)S1176(13,)S(1996)200 1326 A4990(Page)S5211(2)S8143 VEP%%Trailer%%DocumentFonts: Times-Roman Times-Bold Times-Italic%%Pages: 2

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -