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

📄 getpwent.3

📁 Unix操作系统minix 2.0源码
💻 3
字号:
%!PS-Adobe-1.0%%Creator: devps (Pipeline Associates, Inc.)%%CreationDate: Fri Sep 13 13:06:47 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(GETPWENT)S1273(\()S1315(3)S1373(\))S2696(Eighth)S(Edition)296 2989 A4574(GETPWENT)S5127(\()S5169(3)S5227(\))S960 V9 R720(N)S722(NA)S790(AM)S858(ME)S940(E)S1080 V10 R1080(getpwent,)S1499(getpwnam,)S1968(getpwuid,)S2392(setpwent,)S(endpwent,)416 2800 A3241(setpw\256le)S10 R-13630(-)S10 R3712(password)S4117(\256le)S4271(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(<pwd.h>)S1608 V1080(struct)S1371(passwd)S1722(*getpwent\(void\))S1728 V1080(struct)S1371(passwd)S1722(*getpwnam\(const)S2516(char)S2750(*)S10 I2800(name)S10 B3018(\))S1848 V1080(struct)S1371(passwd)S1722(*getpwuid\(uid_t)S10 I2466(uid)S10 B2594(\))S1968 V1080(int)S1236(setpwent\(void\))S2088 V1080(void)S(endpwent\(void\))673 1302 A2208 V1080(void)S1302(setpw\256le\(const)S1974(char)S2208(*)S10 I2258(\256le)S10 B2381(\))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)S1349(functions)S1751(are)S1903(used)S2115(to)S2221(obtain)S2501(information)S3005(from)S3230(the)S3382(password)S3791(\256le.)S3999(They)S4235(return)S4505(this)S4679(information)S5183(in)S2616 V1080(a)S10 B1150(struct)S1428(passwd)S10 R1766(as)S1875(de\256ned)S2196(by)S2321(<pwd.h>:)S2784 V1080(struct)S1329(passwd)S1650({)S2904 V1280(char)S1580(*pw_name;)S2330(/*)S2433(login)S2664(name)S2907(*/)S3024 V1280(char)S1580(*pw_passwd;)S2330(/*)S2433(encrypted)S2855(password)S3260(*/)S3144 V1280(uid_t)S1580(pw_uid;)S2330(/*)S2433(numeric)S2788(user)S2981(id)S3084(*/)S3264 V1280(gid_t)S1580(pw_gid;)S2330(/*)S2433(numeric)S(group)234 2788 A3047(id)S3150(*/)S3384 V1280(char)S1580(*pw_gecos;)S2330(/*)S2433(user)S2626(full)S2791(name)S3034(and)S3204(other)S3436(info)S3623(*/)S3504 V1280(char)S1580(*pw_dir;)S2330(/*)S2433(user's)S2699(home)S2947(directory)S3336(*/)S3624 V1280(char)S(*pw_shell;)441 1580 A2330(/*)S2433(name)S2676(of)S2785(the)S2933(user's)S3199(shell)S3414(*/)S3744 V1080(};)S3912 V10 B(Getpwent\(\))489 1080 A10 R1596(reads)S1836(the)S1987(password)S2395(\256le)S2552(entry)S2787(by)S2915(entry.)S10 B3200(Getpwnam\(\))S10 R3772(scans)S4018(the)S4169(entire)S4427(password)S4835(\256le)S4992(for)S5138(the)S4032 V1080(user)S1276(with)S1483(the)S1634(given)S10 I1885(name)S10 R2111(.)S10 B2189(Getpwuid\(\))S10 R(looks)217 2711 A2956(for)S3102(the)S3253(\256rst)S3438(user)S3634(with)S3841(the)S3992(given)S10 I4242(uid)S10 R4378(.)S4455(The)S10 B(setpwent\(\))450 4639 A10 R5116(and)S4152 V10 B(endpwent\(\))489 1080 A10 R1608(functions)S2021(are)S2184(used)S2407(to)S2524(open)S2758(and)S2942(later)S3162(close)S3409(the)S3572(password)S3992(\256le.)S4211(With)S10 B4452(setpw\256le\(\))S10 R4936(one)S5121(can)S4272 V1080(specify)S1423(the)S1598(\256le)S1778(to)S1907(read)S2132(other)S2390(than)S2614(the)S2788(normal)S3124(password)S3555(\256le.)S3785(This)S4015(only)S4244(sets)S4446(the)S4620(name,)S4914(the)S5088(next)S4392 V10 B(setpwent\(\))450 1080 A10 R1557(call)S(will)157 1730 A1914(open)S2136(the)S2286(\256le.)S2492(Do)S2642(not)S2797(touch)S3048(the)S3199(\256le)S3356(name)S3602(while)S3854(it)S3938(is)S4033(active.)S4352(Use)S10 B4537(setpw\256le\(NULL\))S4512 V10 R1080(to)S1183(revert)S1444(back)S1659(to)S1762(the)S1910(normal)S2220(password)S2625(\256le.)S4680 V1080(The)S1262(usual)S1499(way)S1692(to)S1795(scan)S1999(the)S2147(password)S2552(\256le)S2706(is)S2798(\(error)S3054(checking)S(omitted\):)369 3442 A4848 V1440(setpwent\(\);)S4968 V1440(while)S1689(\(\(pw)S1905(=)S(getpwent\(\)\))471 1987 A2483(!=)S2599(NULL\))S5088 V1800(if)S1887(\(appropriate_test\(pw\)\))S2820(break;)S5208 V(endpwent\(\);)487 1440 A5376 V1080(The)S10 B1276(pw)S10 R1444(variable)S1808(contains)S2182(the)S2344(entry)S2590(that)S2780(is)S2886(wanted)S3216(if)S(non-NULL.)479 3317 A3860(The)S10 B4056(getpwnam\(\))S10 R4611(and)S10 B4795(getpwuid\(\))S5496 V10 R1080(functions)S1479(are)S1628(implemented)S2178(as)S2287(in)S2390(this)S2560(example,)S2951(with)S3155(error)S3377(checking)S3765(of)S3874(course.)S5664 V10 B(Getpwent\(\))489 1080 A10 R1605(calls)S10 B(setpwent\(\))450 1826 A10 R2312(if)S2410(this)S2591(has)S2761(not)S2925(yet)S3084(been)S(done.)220 3311 A10 B(Setpwent\(\))467 3593 A10 R4097(\256rst)S4291(calls)S10 B(endpwent\(\))489 4513 A10 R5039(if)S5138(the)S5784 V1080(password)S1485(\256le)S1639(is)S(still)151 1731 A1907(open.)S2177(\(Other)S2466(implementations)S3161(may)S3359(simply)S3657(rewind)S3962(the)S4110(\256le.\))S5952 V9 R720(F)S722(FI)S774(IL)S807(LE)S865(ES)S923(S)S6072 V10 B1080(/etc/passwd)S10 R1830(The)S2012(password)S2417(\256le)S2571(database.)S6240 V9 R720(S)S722(SE)S774(EE)S832(E)S913(A)S915(AL)S983(LS)S1041(SO)S1093(O)S6360 V10 B1080(cuserid)S10 R1394(\(3\),)S10 B1562(getlogin)S10 R1903(\(3\),)S10 B2071(getgrent)S10 R2430(\(3\),)S10 B2598(passwd)S10 R2911(\(5\).)S6528 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)S6648 V10 B(Setpwent\(\))467 1080 A10 R1576(has)S1739(the)S1891(same)S2128(return)S2399(value)S2647(and)S2822(error)S3049(codes)S3308(as)S3422(the)S10 B3575(open)S10 R3782(\(2\))S3930(call)S4106(it)S4192(uses)S4395(to)S4503(open)S4728(the)S4881(password)S6768 V1080(\256le.)S1290(The)S10 B1478(get)S10 I(xxx)135 1607 A10 B1750(\(\))S10 R1849(functions)S2254(return)S2526(NULL)S2827(on)S2957(end)S3132(of)S3246(\256le,)S3430(entry)S3667(not)S(found,)259 3825 A4114(or)S4228(error.)S4505(You)S4708(can)S4878(set)S10 B(errno)241 5020 A6888 V10 R1080(to)S1183(zero)S1382(before)S1665(the)S1813(call)S1984(and)S2154(check)S2414(it)S2495(after.)S7056 V9 R720(N)S722(NO)S790(OT)S858(TE)S916(ES)S974(S)S7176 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.)S7344 V1080(Only)S10 B1324(getpwnam\(\))S10 R1883(and)S10 B2071(getpwuid\(\))S10 R2580(are)S2747(de\256ned)S3086(by)S8 R3224(POSIX)S10 R3457(.)S3550(The)S10 B(_MINIX_SOURCE)839 3750 A10 R4632(macro)S4927(must)S5166(be)S7464 V1080(de\256ned)S1405(before)S1692(including)S2099(<pwd.h>)S2489(to)S2595(make)S2841(the)S2992(other)S3227(functions)S3629(visible.)S3975(The)S10 B4160(pw_passwd)S10 R4680(and)S10 B4853(pw_gecos)S7903 V10 R720(Page)S941(1)S4455(September)S4911(13,)S(1996)200 5061 A8143 VEP%%Page: 2 2BP/slant 0 def/height 0 def480 V10 R720(GETPWENT)S1273(\()S1315(3)S1373(\))S2696(Eighth)S(Edition)296 2989 A4574(GETPWENT)S5127(\()S5169(3)S5227(\))S960 V1080(\256elds)S1327(are)S1480(also)S1671(not)S1828(de\256ned)S2153(by)S8 R2277(POSIX)S10 R2510(,)S2564(but)S2721(are)S2874(always)S3184(visible.)S3532(Portable)S3898(code)S(cannot)268 4118 A4416(reliably)S4754(detect)S5025(errors)S1080 V1080(by)S(setting)268 1215 A10 B(errno)241 1517 A10 R1792(to)S1904(zero.)S2162(Under)S2448(Minix)S2727(it)S2817(is)S2918(better)S3182(to)S3294(make)S3546(a)S10 B(getpwent\(\))461 3625 A10 R4120(scan)S4333(if)S(you)150 4429 A4613(need)S4837(to)S(look)178 4949 A5161(up)S1200 V1080(several)S1398(user-id's)S1783(or)S1899(names,)S2213(but)S2373(portable)S2736(code)S2959(had)S3137(better)S3400(use)S3567(several)S10 B3886(getpwuid\(\))S10 R4385(or)S10 B4502(getpwnam\(\))S10 R5051(calls.)S1320 V1080(The)S10 B(getpwent\(\))461 1262 A10 R1748(is)S1840(usually)S2155(available)S2544(on)S2669(other)S2901(systems,)S3269(but)S3422(may)S3620(be)S3740(very)S3944(expensive.)S1488 V9 R720(A)S722(AU)S790(UT)S858(TH)S916(HO)S984(OR)S1052(R)S1608 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 + -