standards.info 222 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780
  1. This is standards.info, produced by makeinfo version 4.13 from
  2. standards.texi.
  3. INFO-DIR-SECTION GNU organization
  4. START-INFO-DIR-ENTRY
  5. * Standards: (standards). GNU coding standards.
  6. END-INFO-DIR-ENTRY
  7. The GNU coding standards, last updated April 7, 2012.
  8. Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
  9. 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012
  10. Free Software Foundation, Inc.
  11. Permission is granted to copy, distribute and/or modify this document
  12. under the terms of the GNU Free Documentation License, Version 1.3 or
  13. any later version published by the Free Software Foundation; with no
  14. Invariant Sections, with no Front-Cover Texts, and with no Back-Cover
  15. Texts. A copy of the license is included in the section entitled "GNU
  16. Free Documentation License".
  17. 
  18. File: standards.info, Node: Top, Next: Preface, Up: (dir)
  19. GNU Coding Standards
  20. ********************
  21. The GNU coding standards, last updated April 7, 2012.
  22. Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
  23. 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012
  24. Free Software Foundation, Inc.
  25. Permission is granted to copy, distribute and/or modify this document
  26. under the terms of the GNU Free Documentation License, Version 1.3 or
  27. any later version published by the Free Software Foundation; with no
  28. Invariant Sections, with no Front-Cover Texts, and with no Back-Cover
  29. Texts. A copy of the license is included in the section entitled "GNU
  30. Free Documentation License".
  31. * Menu:
  32. * Preface:: About the GNU Coding Standards.
  33. * Legal Issues:: Keeping free software free.
  34. * Design Advice:: General program design.
  35. * Program Behavior:: Program behavior for all programs
  36. * Writing C:: Making the best use of C.
  37. * Documentation:: Documenting programs.
  38. * Managing Releases:: The release process.
  39. * References:: Mentioning non-free software or documentation.
  40. * GNU Free Documentation License:: Copying and sharing this manual.
  41. * Index::
  42. 
  43. File: standards.info, Node: Preface, Next: Legal Issues, Prev: Top, Up: Top
  44. 1 About the GNU Coding Standards
  45. ********************************
  46. The GNU Coding Standards were written by Richard Stallman and other GNU
  47. Project volunteers. Their purpose is to make the GNU system clean,
  48. consistent, and easy to install. This document can also be read as a
  49. guide to writing portable, robust and reliable programs. It focuses on
  50. programs written in C, but many of the rules and principles are useful
  51. even if you write in another programming language. The rules often
  52. state reasons for writing in a certain way.
  53. If you did not obtain this file directly from the GNU project and
  54. recently, please check for a newer version. You can get the GNU Coding
  55. Standards from the GNU web server in many different formats, including
  56. the Texinfo source, PDF, HTML, DVI, plain text, and more, at:
  57. `http://www.gnu.org/prep/standards/'.
  58. If you are maintaining an official GNU package, in addition to this
  59. document, please read and follow the GNU maintainer information (*note
  60. Contents: (maintain)Top.).
  61. If you want to receive diffs for every change to these GNU documents,
  62. join the mailing list `gnustandards-commit@gnu.org', via the web
  63. interface at
  64. `http://lists.gnu.org/mailman/listinfo/gnustandards-commit'. Archives
  65. are also available there.
  66. Please send corrections or suggestions for this document to
  67. <bug-standards@gnu.org>. If you make a suggestion, please include a
  68. suggested new wording for it, to help us consider the suggestion
  69. efficiently. We prefer a context diff to the Texinfo source, but if
  70. that's difficult for you, you can make a context diff for some other
  71. version of this document, or propose it in any way that makes it clear.
  72. The source repository for this document can be found at
  73. `http://savannah.gnu.org/projects/gnustandards'.
  74. These standards cover the minimum of what is important when writing a
  75. GNU package. Likely, the need for additional standards will come up.
  76. Sometimes, you might suggest that such standards be added to this
  77. document. If you think your standards would be generally useful, please
  78. do suggest them.
  79. You should also set standards for your package on many questions not
  80. addressed or not firmly specified here. The most important point is to
  81. be self-consistent--try to stick to the conventions you pick, and try
  82. to document them as much as possible. That way, your program will be
  83. more maintainable by others.
  84. The GNU Hello program serves as an example of how to follow the GNU
  85. coding standards for a trivial program.
  86. `http://www.gnu.org/software/hello/hello.html'.
  87. This release of the GNU Coding Standards was last updated April 7,
  88. 2012.
  89. 
  90. File: standards.info, Node: Legal Issues, Next: Design Advice, Prev: Preface, Up: Top
  91. 2 Keeping Free Software Free
  92. ****************************
  93. This chapter discusses how you can make sure that GNU software avoids
  94. legal difficulties, and other related issues.
  95. * Menu:
  96. * Reading Non-Free Code:: Referring to proprietary programs.
  97. * Contributions:: Accepting contributions.
  98. * Trademarks:: How we deal with trademark issues.
  99. 
  100. File: standards.info, Node: Reading Non-Free Code, Next: Contributions, Up: Legal Issues
  101. 2.1 Referring to Proprietary Programs
  102. =====================================
  103. Don't in any circumstances refer to Unix source code for or during your
  104. work on GNU! (Or to any other proprietary programs.)
  105. If you have a vague recollection of the internals of a Unix program,
  106. this does not absolutely mean you can't write an imitation of it, but
  107. do try to organize the imitation internally along different lines,
  108. because this is likely to make the details of the Unix version
  109. irrelevant and dissimilar to your results.
  110. For example, Unix utilities were generally optimized to minimize
  111. memory use; if you go for speed instead, your program will be very
  112. different. You could keep the entire input file in memory and scan it
  113. there instead of using stdio. Use a smarter algorithm discovered more
  114. recently than the Unix program. Eliminate use of temporary files. Do
  115. it in one pass instead of two (we did this in the assembler).
  116. Or, on the contrary, emphasize simplicity instead of speed. For some
  117. applications, the speed of today's computers makes simpler algorithms
  118. adequate.
  119. Or go for generality. For example, Unix programs often have static
  120. tables or fixed-size strings, which make for arbitrary limits; use
  121. dynamic allocation instead. Make sure your program handles NULs and
  122. other funny characters in the input files. Add a programming language
  123. for extensibility and write part of the program in that language.
  124. Or turn some parts of the program into independently usable
  125. libraries. Or use a simple garbage collector instead of tracking
  126. precisely when to free memory, or use a new GNU facility such as
  127. obstacks.
  128. 
  129. File: standards.info, Node: Contributions, Next: Trademarks, Prev: Reading Non-Free Code, Up: Legal Issues
  130. 2.2 Accepting Contributions
  131. ===========================
  132. If the program you are working on is copyrighted by the Free Software
  133. Foundation, then when someone else sends you a piece of code to add to
  134. the program, we need legal papers to use it--just as we asked you to
  135. sign papers initially. _Each_ person who makes a nontrivial
  136. contribution to a program must sign some sort of legal papers in order
  137. for us to have clear title to the program; the main author alone is not
  138. enough.
  139. So, before adding in any contributions from other people, please tell
  140. us, so we can arrange to get the papers. Then wait until we tell you
  141. that we have received the signed papers, before you actually use the
  142. contribution.
  143. This applies both before you release the program and afterward. If
  144. you receive diffs to fix a bug, and they make significant changes, we
  145. need legal papers for that change.
  146. This also applies to comments and documentation files. For copyright
  147. law, comments and code are just text. Copyright applies to all kinds of
  148. text, so we need legal papers for all kinds.
  149. We know it is frustrating to ask for legal papers; it's frustrating
  150. for us as well. But if you don't wait, you are going out on a limb--for
  151. example, what if the contributor's employer won't sign a disclaimer?
  152. You might have to take that code out again!
  153. You don't need papers for changes of a few lines here or there, since
  154. they are not significant for copyright purposes. Also, you don't need
  155. papers if all you get from the suggestion is some ideas, not actual code
  156. which you use. For example, if someone sent you one implementation, but
  157. you write a different implementation of the same idea, you don't need to
  158. get papers.
  159. The very worst thing is if you forget to tell us about the other
  160. contributor. We could be very embarrassed in court some day as a
  161. result.
  162. We have more detailed advice for maintainers of GNU packages. If you
  163. have reached the stage of maintaining a GNU program (whether released
  164. or not), please take a look: *note Legal Matters: (maintain)Legal
  165. Matters.
  166. 
  167. File: standards.info, Node: Trademarks, Prev: Contributions, Up: Legal Issues
  168. 2.3 Trademarks
  169. ==============
  170. Please do not include any trademark acknowledgements in GNU software
  171. packages or documentation.
  172. Trademark acknowledgements are the statements that such-and-such is a
  173. trademark of so-and-so. The GNU Project has no objection to the basic
  174. idea of trademarks, but these acknowledgements feel like kowtowing, and
  175. there is no legal requirement for them, so we don't use them.
  176. What is legally required, as regards other people's trademarks, is to
  177. avoid using them in ways which a reader might reasonably understand as
  178. naming or labeling our own programs or activities. For example, since
  179. "Objective C" is (or at least was) a trademark, we made sure to say
  180. that we provide a "compiler for the Objective C language" rather than
  181. an "Objective C compiler". The latter would have been meant as a
  182. shorter way of saying the former, but it does not explicitly state the
  183. relationship, so it could be misinterpreted as using "Objective C" as a
  184. label for the compiler rather than for the language.
  185. Please don't use "win" as an abbreviation for Microsoft Windows in
  186. GNU software or documentation. In hacker terminology, calling
  187. something a "win" is a form of praise. If you wish to praise Microsoft
  188. Windows when speaking on your own, by all means do so, but not in GNU
  189. software. Usually we write the name "Windows" in full, but when
  190. brevity is very important (as in file names and sometimes symbol
  191. names), we abbreviate it to "w". For instance, the files and functions
  192. in Emacs that deal with Windows start with `w32'.
  193. 
  194. File: standards.info, Node: Design Advice, Next: Program Behavior, Prev: Legal Issues, Up: Top
  195. 3 General Program Design
  196. ************************
  197. This chapter discusses some of the issues you should take into account
  198. when designing your program.
  199. * Menu:
  200. * Source Language:: Which languages to use.
  201. * Compatibility:: Compatibility with other implementations.
  202. * Using Extensions:: Using non-standard features.
  203. * Standard C:: Using standard C features.
  204. * Conditional Compilation:: Compiling code only if a conditional is true.
  205. 
  206. File: standards.info, Node: Source Language, Next: Compatibility, Up: Design Advice
  207. 3.1 Which Languages to Use
  208. ==========================
  209. When you want to use a language that gets compiled and runs at high
  210. speed, the best language to use is C. Using another language is like
  211. using a non-standard feature: it will cause trouble for users. Even if
  212. GCC supports the other language, users may find it inconvenient to have
  213. to install the compiler for that other language in order to build your
  214. program. For example, if you write your program in C++, people will
  215. have to install the GNU C++ compiler in order to compile your program.
  216. C has one other advantage over C++ and other compiled languages: more
  217. people know C, so more people will find it easy to read and modify the
  218. program if it is written in C.
  219. So in general it is much better to use C, rather than the comparable
  220. alternatives.
  221. But there are two exceptions to that conclusion:
  222. * It is no problem to use another language to write a tool
  223. specifically intended for use with that language. That is because
  224. the only people who want to build the tool will be those who have
  225. installed the other language anyway.
  226. * If an application is of interest only to a narrow part of the
  227. community, then the question of which language it is written in
  228. has less effect on other people, so you may as well please
  229. yourself.
  230. Many programs are designed to be extensible: they include an
  231. interpreter for a language that is higher level than C. Often much of
  232. the program is written in that language, too. The Emacs editor
  233. pioneered this technique.
  234. The standard extensibility interpreter for GNU software is Guile
  235. (`http://www.gnu.org/software/guile/'), which implements the language
  236. Scheme (an especially clean and simple dialect of Lisp). Guile also
  237. includes bindings for GTK+/GNOME, making it practical to write modern
  238. GUI functionality within Guile. We don't reject programs written in
  239. other "scripting languages" such as Perl and Python, but using Guile is
  240. very important for the overall consistency of the GNU system.
  241. 
  242. File: standards.info, Node: Compatibility, Next: Using Extensions, Prev: Source Language, Up: Design Advice
  243. 3.2 Compatibility with Other Implementations
  244. ============================================
  245. With occasional exceptions, utility programs and libraries for GNU
  246. should be upward compatible with those in Berkeley Unix, and upward
  247. compatible with Standard C if Standard C specifies their behavior, and
  248. upward compatible with POSIX if POSIX specifies their behavior.
  249. When these standards conflict, it is useful to offer compatibility
  250. modes for each of them.
  251. Standard C and POSIX prohibit many kinds of extensions. Feel free
  252. to make the extensions anyway, and include a `--ansi', `--posix', or
  253. `--compatible' option to turn them off. However, if the extension has
  254. a significant chance of breaking any real programs or scripts, then it
  255. is not really upward compatible. So you should try to redesign its
  256. interface to make it upward compatible.
  257. Many GNU programs suppress extensions that conflict with POSIX if the
  258. environment variable `POSIXLY_CORRECT' is defined (even if it is
  259. defined with a null value). Please make your program recognize this
  260. variable if appropriate.
  261. When a feature is used only by users (not by programs or command
  262. files), and it is done poorly in Unix, feel free to replace it
  263. completely with something totally different and better. (For example,
  264. `vi' is replaced with Emacs.) But it is nice to offer a compatible
  265. feature as well. (There is a free `vi' clone, so we offer it.)
  266. Additional useful features are welcome regardless of whether there
  267. is any precedent for them.
  268. 
  269. File: standards.info, Node: Using Extensions, Next: Standard C, Prev: Compatibility, Up: Design Advice
  270. 3.3 Using Non-standard Features
  271. ===============================
  272. Many GNU facilities that already exist support a number of convenient
  273. extensions over the comparable Unix facilities. Whether to use these
  274. extensions in implementing your program is a difficult question.
  275. On the one hand, using the extensions can make a cleaner program.
  276. On the other hand, people will not be able to build the program unless
  277. the other GNU tools are available. This might cause the program to
  278. work on fewer kinds of machines.
  279. With some extensions, it might be easy to provide both alternatives.
  280. For example, you can define functions with a "keyword" `INLINE' and
  281. define that as a macro to expand into either `inline' or nothing,
  282. depending on the compiler.
  283. In general, perhaps it is best not to use the extensions if you can
  284. straightforwardly do without them, but to use the extensions if they
  285. are a big improvement.
  286. An exception to this rule are the large, established programs (such
  287. as Emacs) which run on a great variety of systems. Using GNU
  288. extensions in such programs would make many users unhappy, so we don't
  289. do that.
  290. Another exception is for programs that are used as part of
  291. compilation: anything that must be compiled with other compilers in
  292. order to bootstrap the GNU compilation facilities. If these require
  293. the GNU compiler, then no one can compile them without having them
  294. installed already. That would be extremely troublesome in certain
  295. cases.
  296. 
  297. File: standards.info, Node: Standard C, Next: Conditional Compilation, Prev: Using Extensions, Up: Design Advice
  298. 3.4 Standard C and Pre-Standard C
  299. =================================
  300. 1989 Standard C is widespread enough now that it is ok to use its
  301. features in new programs. There is one exception: do not ever use the
  302. "trigraph" feature of Standard C.
  303. 1999 Standard C is not widespread yet, so please do not require its
  304. features in programs. It is ok to use its features if they are present.
  305. However, it is easy to support pre-standard compilers in most
  306. programs, so if you know how to do that, feel free. If a program you
  307. are maintaining has such support, you should try to keep it working.
  308. To support pre-standard C, instead of writing function definitions in
  309. standard prototype form,
  310. int
  311. foo (int x, int y)
  312. ...
  313. write the definition in pre-standard style like this,
  314. int
  315. foo (x, y)
  316. int x, y;
  317. ...
  318. and use a separate declaration to specify the argument prototype:
  319. int foo (int, int);
  320. You need such a declaration anyway, in a header file, to get the
  321. benefit of prototypes in all the files where the function is called.
  322. And once you have the declaration, you normally lose nothing by writing
  323. the function definition in the pre-standard style.
  324. This technique does not work for integer types narrower than `int'.
  325. If you think of an argument as being of a type narrower than `int',
  326. declare it as `int' instead.
  327. There are a few special cases where this technique is hard to use.
  328. For example, if a function argument needs to hold the system type
  329. `dev_t', you run into trouble, because `dev_t' is shorter than `int' on
  330. some machines; but you cannot use `int' instead, because `dev_t' is
  331. wider than `int' on some machines. There is no type you can safely use
  332. on all machines in a non-standard definition. The only way to support
  333. non-standard C and pass such an argument is to check the width of
  334. `dev_t' using Autoconf and choose the argument type accordingly. This
  335. may not be worth the trouble.
  336. In order to support pre-standard compilers that do not recognize
  337. prototypes, you may want to use a preprocessor macro like this:
  338. /* Declare the prototype for a general external function. */
  339. #if defined (__STDC__) || defined (WINDOWSNT)
  340. #define P_(proto) proto
  341. #else
  342. #define P_(proto) ()
  343. #endif
  344. 
  345. File: standards.info, Node: Conditional Compilation, Prev: Standard C, Up: Design Advice
  346. 3.5 Conditional Compilation
  347. ===========================
  348. When supporting configuration options already known when building your
  349. program we prefer using `if (... )' over conditional compilation, as in
  350. the former case the compiler is able to perform more extensive checking
  351. of all possible code paths.
  352. For example, please write
  353. if (HAS_FOO)
  354. ...
  355. else
  356. ...
  357. instead of:
  358. #ifdef HAS_FOO
  359. ...
  360. #else
  361. ...
  362. #endif
  363. A modern compiler such as GCC will generate exactly the same code in
  364. both cases, and we have been using similar techniques with good success
  365. in several projects. Of course, the former method assumes that
  366. `HAS_FOO' is defined as either 0 or 1.
  367. While this is not a silver bullet solving all portability problems,
  368. and is not always appropriate, following this policy would have saved
  369. GCC developers many hours, or even days, per year.
  370. In the case of function-like macros like `REVERSIBLE_CC_MODE' in GCC
  371. which cannot be simply used in `if (...)' statements, there is an easy
  372. workaround. Simply introduce another macro `HAS_REVERSIBLE_CC_MODE' as
  373. in the following example:
  374. #ifdef REVERSIBLE_CC_MODE
  375. #define HAS_REVERSIBLE_CC_MODE 1
  376. #else
  377. #define HAS_REVERSIBLE_CC_MODE 0
  378. #endif
  379. 
  380. File: standards.info, Node: Program Behavior, Next: Writing C, Prev: Design Advice, Up: Top
  381. 4 Program Behavior for All Programs
  382. ***********************************
  383. This chapter describes conventions for writing robust software. It
  384. also describes general standards for error messages, the command line
  385. interface, and how libraries should behave.
  386. * Menu:
  387. * Non-GNU Standards:: We consider standards such as POSIX;
  388. we don't "obey" them.
  389. * Semantics:: Writing robust programs.
  390. * Libraries:: Library behavior.
  391. * Errors:: Formatting error messages.
  392. * User Interfaces:: Standards about interfaces generally.
  393. * Graphical Interfaces:: Standards for graphical interfaces.
  394. * Command-Line Interfaces:: Standards for command line interfaces.
  395. * Dynamic Plug-In Interfaces:: Standards for dynamic plug-in interfaces.
  396. * Option Table:: Table of long options.
  397. * OID Allocations:: Table of OID slots for GNU.
  398. * Memory Usage:: When and how to care about memory needs.
  399. * File Usage:: Which files to use, and where.
  400. 
  401. File: standards.info, Node: Non-GNU Standards, Next: Semantics, Up: Program Behavior
  402. 4.1 Non-GNU Standards
  403. =====================
  404. The GNU Project regards standards published by other organizations as
  405. suggestions, not orders. We consider those standards, but we do not
  406. "obey" them. In developing a GNU program, you should implement an
  407. outside standard's specifications when that makes the GNU system better
  408. overall in an objective sense. When it doesn't, you shouldn't.
  409. In most cases, following published standards is convenient for
  410. users--it means that their programs or scripts will work more portably.
  411. For instance, GCC implements nearly all the features of Standard C as
  412. specified by that standard. C program developers would be unhappy if
  413. it did not. And GNU utilities mostly follow specifications of POSIX.2;
  414. shell script writers and users would be unhappy if our programs were
  415. incompatible.
  416. But we do not follow either of these specifications rigidly, and
  417. there are specific points on which we decided not to follow them, so as
  418. to make the GNU system better for users.
  419. For instance, Standard C says that nearly all extensions to C are
  420. prohibited. How silly! GCC implements many extensions, some of which
  421. were later adopted as part of the standard. If you want these
  422. constructs to give an error message as "required" by the standard, you
  423. must specify `--pedantic', which was implemented only so that we can
  424. say "GCC is a 100% implementation of the standard", not because there
  425. is any reason to actually use it.
  426. POSIX.2 specifies that `df' and `du' must output sizes by default in
  427. units of 512 bytes. What users want is units of 1k, so that is what we
  428. do by default. If you want the ridiculous behavior "required" by
  429. POSIX, you must set the environment variable `POSIXLY_CORRECT' (which
  430. was originally going to be named `POSIX_ME_HARDER').
  431. GNU utilities also depart from the letter of the POSIX.2
  432. specification when they support long-named command-line options, and
  433. intermixing options with ordinary arguments. This minor
  434. incompatibility with POSIX is never a problem in practice, and it is
  435. very useful.
  436. In particular, don't reject a new feature, or remove an old one,
  437. merely because a standard says it is "forbidden" or "deprecated".
  438. 
  439. File: standards.info, Node: Semantics, Next: Libraries, Prev: Non-GNU Standards, Up: Program Behavior
  440. 4.2 Writing Robust Programs
  441. ===========================
  442. Avoid arbitrary limits on the length or number of _any_ data structure,
  443. including file names, lines, files, and symbols, by allocating all data
  444. structures dynamically. In most Unix utilities, "long lines are
  445. silently truncated". This is not acceptable in a GNU utility.
  446. Utilities reading files should not drop NUL characters, or any other
  447. nonprinting characters _including those with codes above 0177_. The
  448. only sensible exceptions would be utilities specifically intended for
  449. interface to certain types of terminals or printers that can't handle
  450. those characters. Whenever possible, try to make programs work
  451. properly with sequences of bytes that represent multibyte characters;
  452. UTF-8 is the most important.
  453. Check every system call for an error return, unless you know you wish
  454. to ignore errors. Include the system error text (from `perror',
  455. `strerror', or equivalent) in _every_ error message resulting from a
  456. failing system call, as well as the name of the file if any and the
  457. name of the utility. Just "cannot open foo.c" or "stat failed" is not
  458. sufficient.
  459. Check every call to `malloc' or `realloc' to see if it returned
  460. zero. Check `realloc' even if you are making the block smaller; in a
  461. system that rounds block sizes to a power of 2, `realloc' may get a
  462. different block if you ask for less space.
  463. In Unix, `realloc' can destroy the storage block if it returns zero.
  464. GNU `realloc' does not have this bug: if it fails, the original block
  465. is unchanged. Feel free to assume the bug is fixed. If you wish to
  466. run your program on Unix, and wish to avoid lossage in this case, you
  467. can use the GNU `malloc'.
  468. You must expect `free' to alter the contents of the block that was
  469. freed. Anything you want to fetch from the block, you must fetch before
  470. calling `free'.
  471. If `malloc' fails in a noninteractive program, make that a fatal
  472. error. In an interactive program (one that reads commands from the
  473. user), it is better to abort the command and return to the command
  474. reader loop. This allows the user to kill other processes to free up
  475. virtual memory, and then try the command again.
  476. Use `getopt_long' to decode arguments, unless the argument syntax
  477. makes this unreasonable.
  478. When static storage is to be written in during program execution, use
  479. explicit C code to initialize it. Reserve C initialized declarations
  480. for data that will not be changed.
  481. Try to avoid low-level interfaces to obscure Unix data structures
  482. (such as file directories, utmp, or the layout of kernel memory), since
  483. these are less likely to work compatibly. If you need to find all the
  484. files in a directory, use `readdir' or some other high-level interface.
  485. These are supported compatibly by GNU.
  486. The preferred signal handling facilities are the BSD variant of
  487. `signal', and the POSIX `sigaction' function; the alternative USG
  488. `signal' interface is an inferior design.
  489. Nowadays, using the POSIX signal functions may be the easiest way to
  490. make a program portable. If you use `signal', then on GNU/Linux
  491. systems running GNU libc version 1, you should include `bsd/signal.h'
  492. instead of `signal.h', so as to get BSD behavior. It is up to you
  493. whether to support systems where `signal' has only the USG behavior, or
  494. give up on them.
  495. In error checks that detect "impossible" conditions, just abort.
  496. There is usually no point in printing any message. These checks
  497. indicate the existence of bugs. Whoever wants to fix the bugs will have
  498. to read the source code and run a debugger. So explain the problem with
  499. comments in the source. The relevant data will be in variables, which
  500. are easy to examine with the debugger, so there is no point moving them
  501. elsewhere.
  502. Do not use a count of errors as the exit status for a program.
  503. _That does not work_, because exit status values are limited to 8 bits
  504. (0 through 255). A single run of the program might have 256 errors; if
  505. you try to return 256 as the exit status, the parent process will see 0
  506. as the status, and it will appear that the program succeeded.
  507. If you make temporary files, check the `TMPDIR' environment
  508. variable; if that variable is defined, use the specified directory
  509. instead of `/tmp'.
  510. In addition, be aware that there is a possible security problem when
  511. creating temporary files in world-writable directories. In C, you can
  512. avoid this problem by creating temporary files in this manner:
  513. fd = open (filename, O_WRONLY | O_CREAT | O_EXCL, 0600);
  514. or by using the `mkstemps' function from Gnulib (*note mkstemps:
  515. (gnulib)mkstemps.).
  516. In bash, use `set -C' (long name `noclobber') to avoid this problem.
  517. In addition, the `mktemp' utility is a more general solution for
  518. creating temporary files from shell scripts (*note mktemp invocation:
  519. (coreutils)mktemp invocation.).
  520. 
  521. File: standards.info, Node: Libraries, Next: Errors, Prev: Semantics, Up: Program Behavior
  522. 4.3 Library Behavior
  523. ====================
  524. Try to make library functions reentrant. If they need to do dynamic
  525. storage allocation, at least try to avoid any nonreentrancy aside from
  526. that of `malloc' itself.
  527. Here are certain name conventions for libraries, to avoid name
  528. conflicts.
  529. Choose a name prefix for the library, more than two characters long.
  530. All external function and variable names should start with this prefix.
  531. In addition, there should only be one of these in any given library
  532. member. This usually means putting each one in a separate source file.
  533. An exception can be made when two external symbols are always used
  534. together, so that no reasonable program could use one without the
  535. other; then they can both go in the same file.
  536. External symbols that are not documented entry points for the user
  537. should have names beginning with `_'. The `_' should be followed by
  538. the chosen name prefix for the library, to prevent collisions with
  539. other libraries. These can go in the same files with user entry points
  540. if you like.
  541. Static functions and variables can be used as you like and need not
  542. fit any naming convention.
  543. 
  544. File: standards.info, Node: Errors, Next: User Interfaces, Prev: Libraries, Up: Program Behavior
  545. 4.4 Formatting Error Messages
  546. =============================
  547. Error messages from compilers should look like this:
  548. SOURCEFILE:LINENO: MESSAGE
  549. If you want to mention the column number, use one of these formats:
  550. SOURCEFILE:LINENO:COLUMN: MESSAGE
  551. SOURCEFILE:LINENO.COLUMN: MESSAGE
  552. Line numbers should start from 1 at the beginning of the file, and
  553. column numbers should start from 1 at the beginning of the line. (Both
  554. of these conventions are chosen for compatibility.) Calculate column
  555. numbers assuming that space and all ASCII printing characters have
  556. equal width, and assuming tab stops every 8 columns. For non-ASCII
  557. characters, Unicode character widths should be used when in a UTF-8
  558. locale; GNU libc and GNU gnulib provide suitable `wcwidth' functions.
  559. The error message can also give both the starting and ending
  560. positions of the erroneous text. There are several formats so that you
  561. can avoid redundant information such as a duplicate line number. Here
  562. are the possible formats:
  563. SOURCEFILE:LINE1.COLUMN1-LINE2.COLUMN2: MESSAGE
  564. SOURCEFILE:LINE1.COLUMN1-COLUMN2: MESSAGE
  565. SOURCEFILE:LINE1-LINE2: MESSAGE
  566. When an error is spread over several files, you can use this format:
  567. FILE1:LINE1.COLUMN1-FILE2:LINE2.COLUMN2: MESSAGE
  568. Error messages from other noninteractive programs should look like
  569. this:
  570. PROGRAM:SOURCEFILE:LINENO: MESSAGE
  571. when there is an appropriate source file, or like this:
  572. PROGRAM: MESSAGE
  573. when there is no relevant source file.
  574. If you want to mention the column number, use this format:
  575. PROGRAM:SOURCEFILE:LINENO:COLUMN: MESSAGE
  576. In an interactive program (one that is reading commands from a
  577. terminal), it is better not to include the program name in an error
  578. message. The place to indicate which program is running is in the
  579. prompt or with the screen layout. (When the same program runs with
  580. input from a source other than a terminal, it is not interactive and
  581. would do best to print error messages using the noninteractive style.)
  582. The string MESSAGE should not begin with a capital letter when it
  583. follows a program name and/or file name, because that isn't the
  584. beginning of a sentence. (The sentence conceptually starts at the
  585. beginning of the line.) Also, it should not end with a period.
  586. Error messages from interactive programs, and other messages such as
  587. usage messages, should start with a capital letter. But they should not
  588. end with a period.
  589. 
  590. File: standards.info, Node: User Interfaces, Next: Graphical Interfaces, Prev: Errors, Up: Program Behavior
  591. 4.5 Standards for Interfaces Generally
  592. ======================================
  593. Please don't make the behavior of a utility depend on the name used to
  594. invoke it. It is useful sometimes to make a link to a utility with a
  595. different name, and that should not change what it does.
  596. Instead, use a run time option or a compilation switch or both to
  597. select among the alternate behaviors.
  598. Likewise, please don't make the behavior of the program depend on the
  599. type of output device it is used with. Device independence is an
  600. important principle of the system's design; do not compromise it merely
  601. to save someone from typing an option now and then. (Variation in error
  602. message syntax when using a terminal is ok, because that is a side issue
  603. that people do not depend on.)
  604. If you think one behavior is most useful when the output is to a
  605. terminal, and another is most useful when the output is a file or a
  606. pipe, then it is usually best to make the default behavior the one that
  607. is useful with output to a terminal, and have an option for the other
  608. behavior.
  609. Compatibility requires certain programs to depend on the type of
  610. output device. It would be disastrous if `ls' or `sh' did not do so in
  611. the way all users expect. In some of these cases, we supplement the
  612. program with a preferred alternate version that does not depend on the
  613. output device type. For example, we provide a `dir' program much like
  614. `ls' except that its default output format is always multi-column
  615. format.
  616. 
  617. File: standards.info, Node: Graphical Interfaces, Next: Command-Line Interfaces, Prev: User Interfaces, Up: Program Behavior
  618. 4.6 Standards for Graphical Interfaces
  619. ======================================
  620. When you write a program that provides a graphical user interface,
  621. please make it work with the X Window System and the GTK+ toolkit
  622. unless the functionality specifically requires some alternative (for
  623. example, "displaying jpeg images while in console mode").
  624. In addition, please provide a command-line interface to control the
  625. functionality. (In many cases, the graphical user interface can be a
  626. separate program which invokes the command-line program.) This is so
  627. that the same jobs can be done from scripts.
  628. Please also consider providing a D-bus interface for use from other
  629. running programs, such as within GNOME. (GNOME used to use CORBA for
  630. this, but that is being phased out.) In addition, consider providing a
  631. library interface (for use from C), and perhaps a keyboard-driven
  632. console interface (for use by users from console mode). Once you are
  633. doing the work to provide the functionality and the graphical
  634. interface, these won't be much extra work.
  635. 
  636. File: standards.info, Node: Command-Line Interfaces, Next: Dynamic Plug-In Interfaces, Prev: Graphical Interfaces, Up: Program Behavior
  637. 4.7 Standards for Command Line Interfaces
  638. =========================================
  639. It is a good idea to follow the POSIX guidelines for the command-line
  640. options of a program. The easiest way to do this is to use `getopt' to
  641. parse them. Note that the GNU version of `getopt' will normally permit
  642. options anywhere among the arguments unless the special argument `--'
  643. is used. This is not what POSIX specifies; it is a GNU extension.
  644. Please define long-named options that are equivalent to the
  645. single-letter Unix-style options. We hope to make GNU more user
  646. friendly this way. This is easy to do with the GNU function
  647. `getopt_long'.
  648. One of the advantages of long-named options is that they can be
  649. consistent from program to program. For example, users should be able
  650. to expect the "verbose" option of any GNU program which has one, to be
  651. spelled precisely `--verbose'. To achieve this uniformity, look at the
  652. table of common long-option names when you choose the option names for
  653. your program (*note Option Table::).
  654. It is usually a good idea for file names given as ordinary arguments
  655. to be input files only; any output files would be specified using
  656. options (preferably `-o' or `--output'). Even if you allow an output
  657. file name as an ordinary argument for compatibility, try to provide an
  658. option as another way to specify it. This will lead to more consistency
  659. among GNU utilities, and fewer idiosyncrasies for users to remember.
  660. All programs should support two standard options: `--version' and
  661. `--help'. CGI programs should accept these as command-line options,
  662. and also if given as the `PATH_INFO'; for instance, visiting
  663. `http://example.org/p.cgi/--help' in a browser should output the same
  664. information as invoking `p.cgi --help' from the command line.
  665. * Menu:
  666. * --version:: The standard output for --version.
  667. * --help:: The standard output for --help.
  668. 
  669. File: standards.info, Node: --version, Next: --help, Up: Command-Line Interfaces
  670. 4.7.1 `--version'
  671. -----------------
  672. The standard `--version' option should direct the program to print
  673. information about its name, version, origin and legal status, all on
  674. standard output, and then exit successfully. Other options and
  675. arguments should be ignored once this is seen, and the program should
  676. not perform its normal function.
  677. The first line is meant to be easy for a program to parse; the
  678. version number proper starts after the last space. In addition, it
  679. contains the canonical name for this program, in this format:
  680. GNU Emacs 19.30
  681. The program's name should be a constant string; _don't_ compute it from
  682. `argv[0]'. The idea is to state the standard or canonical name for the
  683. program, not its file name. There are other ways to find out the
  684. precise file name where a command is found in `PATH'.
  685. If the program is a subsidiary part of a larger package, mention the
  686. package name in parentheses, like this:
  687. emacsserver (GNU Emacs) 19.30
  688. If the package has a version number which is different from this
  689. program's version number, you can mention the package version number
  690. just before the close-parenthesis.
  691. If you _need_ to mention the version numbers of libraries which are
  692. distributed separately from the package which contains this program,
  693. you can do so by printing an additional line of version info for each
  694. library you want to mention. Use the same format for these lines as for
  695. the first line.
  696. Please do not mention all of the libraries that the program uses
  697. "just for completeness"--that would produce a lot of unhelpful clutter.
  698. Please mention library version numbers only if you find in practice that
  699. they are very important to you in debugging.
  700. The following line, after the version number line or lines, should
  701. be a copyright notice. If more than one copyright notice is called
  702. for, put each on a separate line.
  703. Next should follow a line stating the license, preferably using one
  704. of abbreviations below, and a brief statement that the program is free
  705. software, and that users are free to copy and change it. Also mention
  706. that there is no warranty, to the extent permitted by law. See
  707. recommended wording below.
  708. It is ok to finish the output with a list of the major authors of the
  709. program, as a way of giving credit.
  710. Here's an example of output that follows these rules:
  711. GNU hello 2.3
  712. Copyright (C) 2007 Free Software Foundation, Inc.
  713. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
  714. This is free software: you are free to change and redistribute it.
  715. There is NO WARRANTY, to the extent permitted by law.
  716. You should adapt this to your program, of course, filling in the
  717. proper year, copyright holder, name of program, and the references to
  718. distribution terms, and changing the rest of the wording as necessary.
  719. This copyright notice only needs to mention the most recent year in
  720. which changes were made--there's no need to list the years for previous
  721. versions' changes. You don't have to mention the name of the program in
  722. these notices, if that is inconvenient, since it appeared in the first
  723. line. (The rules are different for copyright notices in source files;
  724. *note Copyright Notices: (maintain)Copyright Notices.)
  725. Translations of the above lines must preserve the validity of the
  726. copyright notices (*note Internationalization::). If the translation's
  727. character set supports it, the `(C)' should be replaced with the
  728. copyright symbol, as follows:
  729. (the official copyright symbol, which is the letter C in a circle);
  730. Write the word "Copyright" exactly like that, in English. Do not
  731. translate it into another language. International treaties recognize
  732. the English word "Copyright"; translations into other languages do not
  733. have legal significance.
  734. Finally, here is the table of our suggested license abbreviations.
  735. Any abbreviation can be followed by `vVERSION[+]', meaning that
  736. particular version, or later versions with the `+', as shown above.
  737. In the case of exceptions for extra permissions with the GPL, we use
  738. `/' for a separator; the version number can follow the license
  739. abbreviation as usual, as in the examples below.
  740. GPL
  741. GNU General Public License, `http://www.gnu.org/licenses/gpl.html'.
  742. LGPL
  743. GNU Lesser General Public License,
  744. `http://www.gnu.org/licenses/lgpl.html'.
  745. GPL/Ada
  746. GNU GPL with the exception for Ada.
  747. Apache
  748. The Apache Software Foundation license,
  749. `http://www.apache.org/licenses'.
  750. Artistic
  751. The Artistic license used for Perl,
  752. `http://www.perlfoundation.org/legal'.
  753. Expat
  754. The Expat license, `http://www.jclark.com/xml/copying.txt'.
  755. MPL
  756. The Mozilla Public License, `http://www.mozilla.org/MPL/'.
  757. OBSD
  758. The original (4-clause) BSD license, incompatible with the GNU GPL
  759. `http://www.xfree86.org/3.3.6/COPYRIGHT2.html#6'.
  760. PHP
  761. The license used for PHP, `http://www.php.net/license/'.
  762. public domain
  763. The non-license that is being in the public domain,
  764. `http://www.gnu.org/licenses/license-list.html#PublicDomain'.
  765. Python
  766. The license for Python, `http://www.python.org/2.0.1/license.html'.
  767. RBSD
  768. The revised (3-clause) BSD, compatible with the GNU GPL,
  769. `http://www.xfree86.org/3.3.6/COPYRIGHT2.html#5'.
  770. X11
  771. The simple non-copyleft license used for most versions of the X
  772. Window System, `http://www.xfree86.org/3.3.6/COPYRIGHT2.html#3'.
  773. Zlib
  774. The license for Zlib, `http://www.gzip.org/zlib/zlib_license.html'.
  775. More information about these licenses and many more are on the GNU
  776. licensing web pages, `http://www.gnu.org/licenses/license-list.html'.
  777. 
  778. File: standards.info, Node: --help, Prev: --version, Up: Command-Line Interfaces
  779. 4.7.2 `--help'
  780. --------------
  781. The standard `--help' option should output brief documentation for how
  782. to invoke the program, on standard output, then exit successfully.
  783. Other options and arguments should be ignored once this is seen, and
  784. the program should not perform its normal function.
  785. Near the end of the `--help' option's output, please place lines
  786. giving the email address for bug reports, the package's home page
  787. (normally <http://www.gnu.org/software/PKG>, and the general page for
  788. help using GNU programs. The format should be like this:
  789. Report bugs to: MAILING-ADDRESS
  790. PKG home page: <http://www.gnu.org/software/PKG/>
  791. General help using GNU software: <http://www.gnu.org/gethelp/>
  792. It is ok to mention other appropriate mailing lists and web pages.
  793. 
  794. File: standards.info, Node: Dynamic Plug-In Interfaces, Next: Option Table, Prev: Command-Line Interfaces, Up: Program Behavior
  795. 4.8 Standards for Dynamic Plug-in Interfaces
  796. ============================================
  797. Another aspect of keeping free programs free is encouraging development
  798. of free plug-ins, and discouraging development of proprietary plug-ins.
  799. Many GNU programs will not have anything like plug-ins at all, but
  800. those that do should follow these practices.
  801. First, the general plug-in architecture design should closely tie the
  802. plug-in to the original code, such that the plug-in and the base
  803. program are parts of one extended program. For GCC, for example,
  804. plug-ins receive and modify GCC's internal data structures, and so
  805. clearly form an extended program with the base GCC.
  806. Second, you should require plug-in developers to affirm that their
  807. plug-ins are released under an appropriate license. This should be
  808. enforced with a simple programmatic check. For GCC, again for example,
  809. a plug-in must define the global symbol `plugin_is_GPL_compatible',
  810. thus asserting that the plug-in is released under a GPL-compatible
  811. license (*note Plugins: (gccint)Plugins.).
  812. By adding this check to your program you are not creating a new legal
  813. requirement. The GPL itself requires plug-ins to be free software,
  814. licensed compatibly. As long as you have followed the first rule above
  815. to keep plug-ins closely tied to your original program, the GPL and AGPL
  816. already require those plug-ins to be released under a compatible
  817. license. The symbol definition in the plug-in--or whatever equivalent
  818. works best in your program--makes it harder for anyone who might
  819. distribute proprietary plug-ins to legally defend themselves. If a case
  820. about this got to court, we can point to that symbol as evidence that
  821. the plug-in developer understood that the license had this requirement.
  822. 
  823. File: standards.info, Node: Option Table, Next: OID Allocations, Prev: Dynamic Plug-In Interfaces, Up: Program Behavior
  824. 4.9 Table of Long Options
  825. =========================
  826. Here is a table of long options used by GNU programs. It is surely
  827. incomplete, but we aim to list all the options that a new program might
  828. want to be compatible with. If you use names not already in the table,
  829. please send <bug-standards@gnu.org> a list of them, with their
  830. meanings, so we can update the table.
  831. `after-date'
  832. `-N' in `tar'.
  833. `all'
  834. `-a' in `du', `ls', `nm', `stty', `uname', and `unexpand'.
  835. `all-text'
  836. `-a' in `diff'.
  837. `almost-all'
  838. `-A' in `ls'.
  839. `append'
  840. `-a' in `etags', `tee', `time'; `-r' in `tar'.
  841. `archive'
  842. `-a' in `cp'.
  843. `archive-name'
  844. `-n' in `shar'.
  845. `arglength'
  846. `-l' in `m4'.
  847. `ascii'
  848. `-a' in `diff'.
  849. `assign'
  850. `-v' in `gawk'.
  851. `assume-new'
  852. `-W' in `make'.
  853. `assume-old'
  854. `-o' in `make'.
  855. `auto-check'
  856. `-a' in `recode'.
  857. `auto-pager'
  858. `-a' in `wdiff'.
  859. `auto-reference'
  860. `-A' in `ptx'.
  861. `avoid-wraps'
  862. `-n' in `wdiff'.
  863. `background'
  864. For server programs, run in the background.
  865. `backward-search'
  866. `-B' in `ctags'.
  867. `basename'
  868. `-f' in `shar'.
  869. `batch'
  870. Used in GDB.
  871. `baud'
  872. Used in GDB.
  873. `before'
  874. `-b' in `tac'.
  875. `binary'
  876. `-b' in `cpio' and `diff'.
  877. `bits-per-code'
  878. `-b' in `shar'.
  879. `block-size'
  880. Used in `cpio' and `tar'.
  881. `blocks'
  882. `-b' in `head' and `tail'.
  883. `break-file'
  884. `-b' in `ptx'.
  885. `brief'
  886. Used in various programs to make output shorter.
  887. `bytes'
  888. `-c' in `head', `split', and `tail'.
  889. `c++'
  890. `-C' in `etags'.
  891. `catenate'
  892. `-A' in `tar'.
  893. `cd'
  894. Used in various programs to specify the directory to use.
  895. `changes'
  896. `-c' in `chgrp' and `chown'.
  897. `classify'
  898. `-F' in `ls'.
  899. `colons'
  900. `-c' in `recode'.
  901. `command'
  902. `-c' in `su'; `-x' in GDB.
  903. `compare'
  904. `-d' in `tar'.
  905. `compat'
  906. Used in `gawk'.
  907. `compress'
  908. `-Z' in `tar' and `shar'.
  909. `concatenate'
  910. `-A' in `tar'.
  911. `confirmation'
  912. `-w' in `tar'.
  913. `context'
  914. Used in `diff'.
  915. `copyleft'
  916. `-W copyleft' in `gawk'.
  917. `copyright'
  918. `-C' in `ptx', `recode', and `wdiff'; `-W copyright' in `gawk'.
  919. `core'
  920. Used in GDB.
  921. `count'
  922. `-q' in `who'.
  923. `count-links'
  924. `-l' in `du'.
  925. `create'
  926. Used in `tar' and `cpio'.
  927. `cut-mark'
  928. `-c' in `shar'.
  929. `cxref'
  930. `-x' in `ctags'.
  931. `date'
  932. `-d' in `touch'.
  933. `debug'
  934. `-d' in `make' and `m4'; `-t' in Bison.
  935. `define'
  936. `-D' in `m4'.
  937. `defines'
  938. `-d' in Bison and `ctags'.
  939. `delete'
  940. `-D' in `tar'.
  941. `dereference'
  942. `-L' in `chgrp', `chown', `cpio', `du', `ls', and `tar'.
  943. `dereference-args'
  944. `-D' in `du'.
  945. `device'
  946. Specify an I/O device (special file name).
  947. `diacritics'
  948. `-d' in `recode'.
  949. `dictionary-order'
  950. `-d' in `look'.
  951. `diff'
  952. `-d' in `tar'.
  953. `digits'
  954. `-n' in `csplit'.
  955. `directory'
  956. Specify the directory to use, in various programs. In `ls', it
  957. means to show directories themselves rather than their contents.
  958. In `rm' and `ln', it means to not treat links to directories
  959. specially.
  960. `discard-all'
  961. `-x' in `strip'.
  962. `discard-locals'
  963. `-X' in `strip'.
  964. `dry-run'
  965. `-n' in `make'.
  966. `ed'
  967. `-e' in `diff'.
  968. `elide-empty-files'
  969. `-z' in `csplit'.
  970. `end-delete'
  971. `-x' in `wdiff'.
  972. `end-insert'
  973. `-z' in `wdiff'.
  974. `entire-new-file'
  975. `-N' in `diff'.
  976. `environment-overrides'
  977. `-e' in `make'.
  978. `eof'
  979. `-e' in `xargs'.
  980. `epoch'
  981. Used in GDB.
  982. `error-limit'
  983. Used in `makeinfo'.
  984. `error-output'
  985. `-o' in `m4'.
  986. `escape'
  987. `-b' in `ls'.
  988. `exclude-from'
  989. `-X' in `tar'.
  990. `exec'
  991. Used in GDB.
  992. `exit'
  993. `-x' in `xargs'.
  994. `exit-0'
  995. `-e' in `unshar'.
  996. `expand-tabs'
  997. `-t' in `diff'.
  998. `expression'
  999. `-e' in `sed'.
  1000. `extern-only'
  1001. `-g' in `nm'.
  1002. `extract'
  1003. `-i' in `cpio'; `-x' in `tar'.
  1004. `faces'
  1005. `-f' in `finger'.
  1006. `fast'
  1007. `-f' in `su'.
  1008. `fatal-warnings'
  1009. `-E' in `m4'.
  1010. `file'
  1011. `-f' in `gawk', `info', `make', `mt', `sed', and `tar'.
  1012. `field-separator'
  1013. `-F' in `gawk'.
  1014. `file-prefix'
  1015. `-b' in Bison.
  1016. `file-type'
  1017. `-F' in `ls'.
  1018. `files-from'
  1019. `-T' in `tar'.
  1020. `fill-column'
  1021. Used in `makeinfo'.
  1022. `flag-truncation'
  1023. `-F' in `ptx'.
  1024. `fixed-output-files'
  1025. `-y' in Bison.
  1026. `follow'
  1027. `-f' in `tail'.
  1028. `footnote-style'
  1029. Used in `makeinfo'.
  1030. `force'
  1031. `-f' in `cp', `ln', `mv', and `rm'.
  1032. `force-prefix'
  1033. `-F' in `shar'.
  1034. `foreground'
  1035. For server programs, run in the foreground; in other words, don't
  1036. do anything special to run the server in the background.
  1037. `format'
  1038. Used in `ls', `time', and `ptx'.
  1039. `freeze-state'
  1040. `-F' in `m4'.
  1041. `fullname'
  1042. Used in GDB.
  1043. `gap-size'
  1044. `-g' in `ptx'.
  1045. `get'
  1046. `-x' in `tar'.
  1047. `graphic'
  1048. `-i' in `ul'.
  1049. `graphics'
  1050. `-g' in `recode'.
  1051. `group'
  1052. `-g' in `install'.
  1053. `gzip'
  1054. `-z' in `tar' and `shar'.
  1055. `hashsize'
  1056. `-H' in `m4'.
  1057. `header'
  1058. `-h' in `objdump' and `recode'
  1059. `heading'
  1060. `-H' in `who'.
  1061. `help'
  1062. Used to ask for brief usage information.
  1063. `here-delimiter'
  1064. `-d' in `shar'.
  1065. `hide-control-chars'
  1066. `-q' in `ls'.
  1067. `html'
  1068. In `makeinfo', output HTML.
  1069. `idle'
  1070. `-u' in `who'.
  1071. `ifdef'
  1072. `-D' in `diff'.
  1073. `ignore'
  1074. `-I' in `ls'; `-x' in `recode'.
  1075. `ignore-all-space'
  1076. `-w' in `diff'.
  1077. `ignore-backups'
  1078. `-B' in `ls'.
  1079. `ignore-blank-lines'
  1080. `-B' in `diff'.
  1081. `ignore-case'
  1082. `-f' in `look' and `ptx'; `-i' in `diff' and `wdiff'.
  1083. `ignore-errors'
  1084. `-i' in `make'.
  1085. `ignore-file'
  1086. `-i' in `ptx'.
  1087. `ignore-indentation'
  1088. `-I' in `etags'.
  1089. `ignore-init-file'
  1090. `-f' in Oleo.
  1091. `ignore-interrupts'
  1092. `-i' in `tee'.
  1093. `ignore-matching-lines'
  1094. `-I' in `diff'.
  1095. `ignore-space-change'
  1096. `-b' in `diff'.
  1097. `ignore-zeros'
  1098. `-i' in `tar'.
  1099. `include'
  1100. `-i' in `etags'; `-I' in `m4'.
  1101. `include-dir'
  1102. `-I' in `make'.
  1103. `incremental'
  1104. `-G' in `tar'.
  1105. `info'
  1106. `-i', `-l', and `-m' in Finger.
  1107. `init-file'
  1108. In some programs, specify the name of the file to read as the
  1109. user's init file.
  1110. `initial'
  1111. `-i' in `expand'.
  1112. `initial-tab'
  1113. `-T' in `diff'.
  1114. `inode'
  1115. `-i' in `ls'.
  1116. `interactive'
  1117. `-i' in `cp', `ln', `mv', `rm'; `-e' in `m4'; `-p' in `xargs';
  1118. `-w' in `tar'.
  1119. `intermix-type'
  1120. `-p' in `shar'.
  1121. `iso-8601'
  1122. Used in `date'
  1123. `jobs'
  1124. `-j' in `make'.
  1125. `just-print'
  1126. `-n' in `make'.
  1127. `keep-going'
  1128. `-k' in `make'.
  1129. `keep-files'
  1130. `-k' in `csplit'.
  1131. `kilobytes'
  1132. `-k' in `du' and `ls'.
  1133. `language'
  1134. `-l' in `etags'.
  1135. `less-mode'
  1136. `-l' in `wdiff'.
  1137. `level-for-gzip'
  1138. `-g' in `shar'.
  1139. `line-bytes'
  1140. `-C' in `split'.
  1141. `lines'
  1142. Used in `split', `head', and `tail'.
  1143. `link'
  1144. `-l' in `cpio'.
  1145. `lint'
  1146. `lint-old'
  1147. Used in `gawk'.
  1148. `list'
  1149. `-t' in `cpio'; `-l' in `recode'.
  1150. `list'
  1151. `-t' in `tar'.
  1152. `literal'
  1153. `-N' in `ls'.
  1154. `load-average'
  1155. `-l' in `make'.
  1156. `login'
  1157. Used in `su'.
  1158. `machine'
  1159. Used in `uname'.
  1160. `macro-name'
  1161. `-M' in `ptx'.
  1162. `mail'
  1163. `-m' in `hello' and `uname'.
  1164. `make-directories'
  1165. `-d' in `cpio'.
  1166. `makefile'
  1167. `-f' in `make'.
  1168. `mapped'
  1169. Used in GDB.
  1170. `max-args'
  1171. `-n' in `xargs'.
  1172. `max-chars'
  1173. `-n' in `xargs'.
  1174. `max-lines'
  1175. `-l' in `xargs'.
  1176. `max-load'
  1177. `-l' in `make'.
  1178. `max-procs'
  1179. `-P' in `xargs'.
  1180. `mesg'
  1181. `-T' in `who'.
  1182. `message'
  1183. `-T' in `who'.
  1184. `minimal'
  1185. `-d' in `diff'.
  1186. `mixed-uuencode'
  1187. `-M' in `shar'.
  1188. `mode'
  1189. `-m' in `install', `mkdir', and `mkfifo'.
  1190. `modification-time'
  1191. `-m' in `tar'.
  1192. `multi-volume'
  1193. `-M' in `tar'.
  1194. `name-prefix'
  1195. `-a' in Bison.
  1196. `nesting-limit'
  1197. `-L' in `m4'.
  1198. `net-headers'
  1199. `-a' in `shar'.
  1200. `new-file'
  1201. `-W' in `make'.
  1202. `no-builtin-rules'
  1203. `-r' in `make'.
  1204. `no-character-count'
  1205. `-w' in `shar'.
  1206. `no-check-existing'
  1207. `-x' in `shar'.
  1208. `no-common'
  1209. `-3' in `wdiff'.
  1210. `no-create'
  1211. `-c' in `touch'.
  1212. `no-defines'
  1213. `-D' in `etags'.
  1214. `no-deleted'
  1215. `-1' in `wdiff'.
  1216. `no-dereference'
  1217. `-d' in `cp'.
  1218. `no-inserted'
  1219. `-2' in `wdiff'.
  1220. `no-keep-going'
  1221. `-S' in `make'.
  1222. `no-lines'
  1223. `-l' in Bison.
  1224. `no-piping'
  1225. `-P' in `shar'.
  1226. `no-prof'
  1227. `-e' in `gprof'.
  1228. `no-regex'
  1229. `-R' in `etags'.
  1230. `no-sort'
  1231. `-p' in `nm'.
  1232. `no-splash'
  1233. Don't print a startup splash screen.
  1234. `no-split'
  1235. Used in `makeinfo'.
  1236. `no-static'
  1237. `-a' in `gprof'.
  1238. `no-time'
  1239. `-E' in `gprof'.
  1240. `no-timestamp'
  1241. `-m' in `shar'.
  1242. `no-validate'
  1243. Used in `makeinfo'.
  1244. `no-wait'
  1245. Used in `emacsclient'.
  1246. `no-warn'
  1247. Used in various programs to inhibit warnings.
  1248. `node'
  1249. `-n' in `info'.
  1250. `nodename'
  1251. `-n' in `uname'.
  1252. `nonmatching'
  1253. `-f' in `cpio'.
  1254. `nstuff'
  1255. `-n' in `objdump'.
  1256. `null'
  1257. `-0' in `xargs'.
  1258. `number'
  1259. `-n' in `cat'.
  1260. `number-nonblank'
  1261. `-b' in `cat'.
  1262. `numeric-sort'
  1263. `-n' in `nm'.
  1264. `numeric-uid-gid'
  1265. `-n' in `cpio' and `ls'.
  1266. `nx'
  1267. Used in GDB.
  1268. `old-archive'
  1269. `-o' in `tar'.
  1270. `old-file'
  1271. `-o' in `make'.
  1272. `one-file-system'
  1273. `-l' in `tar', `cp', and `du'.
  1274. `only-file'
  1275. `-o' in `ptx'.
  1276. `only-prof'
  1277. `-f' in `gprof'.
  1278. `only-time'
  1279. `-F' in `gprof'.
  1280. `options'
  1281. `-o' in `getopt', `fdlist', `fdmount', `fdmountd', and `fdumount'.
  1282. `output'
  1283. In various programs, specify the output file name.
  1284. `output-prefix'
  1285. `-o' in `shar'.
  1286. `override'
  1287. `-o' in `rm'.
  1288. `overwrite'
  1289. `-c' in `unshar'.
  1290. `owner'
  1291. `-o' in `install'.
  1292. `paginate'
  1293. `-l' in `diff'.
  1294. `paragraph-indent'
  1295. Used in `makeinfo'.
  1296. `parents'
  1297. `-p' in `mkdir' and `rmdir'.
  1298. `pass-all'
  1299. `-p' in `ul'.
  1300. `pass-through'
  1301. `-p' in `cpio'.
  1302. `port'
  1303. `-P' in `finger'.
  1304. `portability'
  1305. `-c' in `cpio' and `tar'.
  1306. `posix'
  1307. Used in `gawk'.
  1308. `prefix-builtins'
  1309. `-P' in `m4'.
  1310. `prefix'
  1311. `-f' in `csplit'.
  1312. `preserve'
  1313. Used in `tar' and `cp'.
  1314. `preserve-environment'
  1315. `-p' in `su'.
  1316. `preserve-modification-time'
  1317. `-m' in `cpio'.
  1318. `preserve-order'
  1319. `-s' in `tar'.
  1320. `preserve-permissions'
  1321. `-p' in `tar'.
  1322. `print'
  1323. `-l' in `diff'.
  1324. `print-chars'
  1325. `-L' in `cmp'.
  1326. `print-data-base'
  1327. `-p' in `make'.
  1328. `print-directory'
  1329. `-w' in `make'.
  1330. `print-file-name'
  1331. `-o' in `nm'.
  1332. `print-symdefs'
  1333. `-s' in `nm'.
  1334. `printer'
  1335. `-p' in `wdiff'.
  1336. `prompt'
  1337. `-p' in `ed'.
  1338. `proxy'
  1339. Specify an HTTP proxy.
  1340. `query-user'
  1341. `-X' in `shar'.
  1342. `question'
  1343. `-q' in `make'.
  1344. `quiet'
  1345. Used in many programs to inhibit the usual output. Every program
  1346. accepting `--quiet' should accept `--silent' as a synonym.
  1347. `quiet-unshar'
  1348. `-Q' in `shar'
  1349. `quote-name'
  1350. `-Q' in `ls'.
  1351. `rcs'
  1352. `-n' in `diff'.
  1353. `re-interval'
  1354. Used in `gawk'.
  1355. `read-full-blocks'
  1356. `-B' in `tar'.
  1357. `readnow'
  1358. Used in GDB.
  1359. `recon'
  1360. `-n' in `make'.
  1361. `record-number'
  1362. `-R' in `tar'.
  1363. `recursive'
  1364. Used in `chgrp', `chown', `cp', `ls', `diff', and `rm'.
  1365. `reference'
  1366. `-r' in `touch'.
  1367. `references'
  1368. `-r' in `ptx'.
  1369. `regex'
  1370. `-r' in `tac' and `etags'.
  1371. `release'
  1372. `-r' in `uname'.
  1373. `reload-state'
  1374. `-R' in `m4'.
  1375. `relocation'
  1376. `-r' in `objdump'.
  1377. `rename'
  1378. `-r' in `cpio'.
  1379. `replace'
  1380. `-i' in `xargs'.
  1381. `report-identical-files'
  1382. `-s' in `diff'.
  1383. `reset-access-time'
  1384. `-a' in `cpio'.
  1385. `reverse'
  1386. `-r' in `ls' and `nm'.
  1387. `reversed-ed'
  1388. `-f' in `diff'.
  1389. `right-side-defs'
  1390. `-R' in `ptx'.
  1391. `same-order'
  1392. `-s' in `tar'.
  1393. `same-permissions'
  1394. `-p' in `tar'.
  1395. `save'
  1396. `-g' in `stty'.
  1397. `se'
  1398. Used in GDB.
  1399. `sentence-regexp'
  1400. `-S' in `ptx'.
  1401. `separate-dirs'
  1402. `-S' in `du'.
  1403. `separator'
  1404. `-s' in `tac'.
  1405. `sequence'
  1406. Used by `recode' to chose files or pipes for sequencing passes.
  1407. `shell'
  1408. `-s' in `su'.
  1409. `show-all'
  1410. `-A' in `cat'.
  1411. `show-c-function'
  1412. `-p' in `diff'.
  1413. `show-ends'
  1414. `-E' in `cat'.
  1415. `show-function-line'
  1416. `-F' in `diff'.
  1417. `show-tabs'
  1418. `-T' in `cat'.
  1419. `silent'
  1420. Used in many programs to inhibit the usual output. Every program
  1421. accepting `--silent' should accept `--quiet' as a synonym.
  1422. `size'
  1423. `-s' in `ls'.
  1424. `socket'
  1425. Specify a file descriptor for a network server to use for its
  1426. socket, instead of opening and binding a new socket. This
  1427. provides a way to run, in a non-privileged process, a server that
  1428. normally needs a reserved port number.
  1429. `sort'
  1430. Used in `ls'.
  1431. `source'
  1432. `-W source' in `gawk'.
  1433. `sparse'
  1434. `-S' in `tar'.
  1435. `speed-large-files'
  1436. `-H' in `diff'.
  1437. `split-at'
  1438. `-E' in `unshar'.
  1439. `split-size-limit'
  1440. `-L' in `shar'.
  1441. `squeeze-blank'
  1442. `-s' in `cat'.
  1443. `start-delete'
  1444. `-w' in `wdiff'.
  1445. `start-insert'
  1446. `-y' in `wdiff'.
  1447. `starting-file'
  1448. Used in `tar' and `diff' to specify which file within a directory
  1449. to start processing with.
  1450. `statistics'
  1451. `-s' in `wdiff'.
  1452. `stdin-file-list'
  1453. `-S' in `shar'.
  1454. `stop'
  1455. `-S' in `make'.
  1456. `strict'
  1457. `-s' in `recode'.
  1458. `strip'
  1459. `-s' in `install'.
  1460. `strip-all'
  1461. `-s' in `strip'.
  1462. `strip-debug'
  1463. `-S' in `strip'.
  1464. `submitter'
  1465. `-s' in `shar'.
  1466. `suffix'
  1467. `-S' in `cp', `ln', `mv'.
  1468. `suffix-format'
  1469. `-b' in `csplit'.
  1470. `sum'
  1471. `-s' in `gprof'.
  1472. `summarize'
  1473. `-s' in `du'.
  1474. `symbolic'
  1475. `-s' in `ln'.
  1476. `symbols'
  1477. Used in GDB and `objdump'.
  1478. `synclines'
  1479. `-s' in `m4'.
  1480. `sysname'
  1481. `-s' in `uname'.
  1482. `tabs'
  1483. `-t' in `expand' and `unexpand'.
  1484. `tabsize'
  1485. `-T' in `ls'.
  1486. `terminal'
  1487. `-T' in `tput' and `ul'. `-t' in `wdiff'.
  1488. `text'
  1489. `-a' in `diff'.
  1490. `text-files'
  1491. `-T' in `shar'.
  1492. `time'
  1493. Used in `ls' and `touch'.
  1494. `timeout'
  1495. Specify how long to wait before giving up on some operation.
  1496. `to-stdout'
  1497. `-O' in `tar'.
  1498. `total'
  1499. `-c' in `du'.
  1500. `touch'
  1501. `-t' in `make', `ranlib', and `recode'.
  1502. `trace'
  1503. `-t' in `m4'.
  1504. `traditional'
  1505. `-t' in `hello'; `-W traditional' in `gawk'; `-G' in `ed', `m4',
  1506. and `ptx'.
  1507. `tty'
  1508. Used in GDB.
  1509. `typedefs'
  1510. `-t' in `ctags'.
  1511. `typedefs-and-c++'
  1512. `-T' in `ctags'.
  1513. `typeset-mode'
  1514. `-t' in `ptx'.
  1515. `uncompress'
  1516. `-z' in `tar'.
  1517. `unconditional'
  1518. `-u' in `cpio'.
  1519. `undefine'
  1520. `-U' in `m4'.
  1521. `undefined-only'
  1522. `-u' in `nm'.
  1523. `update'
  1524. `-u' in `cp', `ctags', `mv', `tar'.
  1525. `usage'
  1526. Used in `gawk'; same as `--help'.
  1527. `uuencode'
  1528. `-B' in `shar'.
  1529. `vanilla-operation'
  1530. `-V' in `shar'.
  1531. `verbose'
  1532. Print more information about progress. Many programs support this.
  1533. `verify'
  1534. `-W' in `tar'.
  1535. `version'
  1536. Print the version number.
  1537. `version-control'
  1538. `-V' in `cp', `ln', `mv'.
  1539. `vgrind'
  1540. `-v' in `ctags'.
  1541. `volume'
  1542. `-V' in `tar'.
  1543. `what-if'
  1544. `-W' in `make'.
  1545. `whole-size-limit'
  1546. `-l' in `shar'.
  1547. `width'
  1548. `-w' in `ls' and `ptx'.
  1549. `word-regexp'
  1550. `-W' in `ptx'.
  1551. `writable'
  1552. `-T' in `who'.
  1553. `zeros'
  1554. `-z' in `gprof'.
  1555. 
  1556. File: standards.info, Node: OID Allocations, Next: Memory Usage, Prev: Option Table, Up: Program Behavior
  1557. 4.10 OID Allocations
  1558. ====================
  1559. The OID (object identifier) 1.3.6.1.4.1.11591 has been assigned to the
  1560. GNU Project (thanks to Werner Koch). These are used for SNMP, LDAP,
  1561. X.509 certificates, and so on. The web site
  1562. `http://www.alvestrand.no/objectid' has a (voluntary) listing of many
  1563. OID assignments.
  1564. If you need a new slot for your GNU package, write
  1565. <maintainers@gnu.org>. Here is a list of arcs currently assigned:
  1566. 1.3.6.1.4.1.11591 GNU
  1567. 1.3.6.1.4.1.11591.1 GNU Radius
  1568. 1.3.6.1.4.1.11591.2 GnuPG
  1569. 1.3.6.1.4.1.11591.2.1 notation
  1570. 1.3.6.1.4.1.11591.2.1.1 pkaAddress
  1571. 1.3.6.1.4.1.11591.3 GNU Radar
  1572. 1.3.6.1.4.1.11591.4 GNU GSS
  1573. 1.3.6.1.4.1.11591.5 GNU Mailutils
  1574. 1.3.6.1.4.1.11591.6 GNU Shishi
  1575. 1.3.6.1.4.1.11591.7 GNU Radio
  1576. 1.3.6.1.4.1.11591.8 GNU Dico
  1577. 1.3.6.1.4.1.11591.12 digestAlgorithm
  1578. 1.3.6.1.4.1.11591.12.2 TIGER/192
  1579. 1.3.6.1.4.1.11591.13 encryptionAlgorithm
  1580. 1.3.6.1.4.1.11591.13.2 Serpent
  1581. 1.3.6.1.4.1.11591.13.2.1 Serpent-128-ECB
  1582. 1.3.6.1.4.1.11591.13.2.2 Serpent-128-CBC
  1583. 1.3.6.1.4.1.11591.13.2.3 Serpent-128-OFB
  1584. 1.3.6.1.4.1.11591.13.2.4 Serpent-128-CFB
  1585. 1.3.6.1.4.1.11591.13.2.21 Serpent-192-ECB
  1586. 1.3.6.1.4.1.11591.13.2.22 Serpent-192-CBC
  1587. 1.3.6.1.4.1.11591.13.2.23 Serpent-192-OFB
  1588. 1.3.6.1.4.1.11591.13.2.24 Serpent-192-CFB
  1589. 1.3.6.1.4.1.11591.13.2.41 Serpent-256-ECB
  1590. 1.3.6.1.4.1.11591.13.2.42 Serpent-256-CBC
  1591. 1.3.6.1.4.1.11591.13.2.43 Serpent-256-OFB
  1592. 1.3.6.1.4.1.11591.13.2.44 Serpent-256-CFB
  1593. 1.3.6.1.4.1.11591.14 CRC algorithms
  1594. 1.3.6.1.4.1.11591.14.1 CRC 32
  1595. 
  1596. File: standards.info, Node: Memory Usage, Next: File Usage, Prev: OID Allocations, Up: Program Behavior
  1597. 4.11 Memory Usage
  1598. =================
  1599. If a program typically uses just a few meg of memory, don't bother
  1600. making any effort to reduce memory usage. For example, if it is
  1601. impractical for other reasons to operate on files more than a few meg
  1602. long, it is reasonable to read entire input files into memory to
  1603. operate on them.
  1604. However, for programs such as `cat' or `tail', that can usefully
  1605. operate on very large files, it is important to avoid using a technique
  1606. that would artificially limit the size of files it can handle. If a
  1607. program works by lines and could be applied to arbitrary user-supplied
  1608. input files, it should keep only a line in memory, because this is not
  1609. very hard and users will want to be able to operate on input files that
  1610. are bigger than will fit in memory all at once.
  1611. If your program creates complicated data structures, just make them
  1612. in memory and give a fatal error if `malloc' returns zero.
  1613. Memory analysis tools such as `valgrind' can be useful, but don't
  1614. complicate a program merely to avoid their false alarms. For example,
  1615. if memory is used until just before a process exits, don't free it
  1616. simply to silence such a tool.
  1617. 
  1618. File: standards.info, Node: File Usage, Prev: Memory Usage, Up: Program Behavior
  1619. 4.12 File Usage
  1620. ===============
  1621. Programs should be prepared to operate when `/usr' and `/etc' are
  1622. read-only file systems. Thus, if the program manages log files, lock
  1623. files, backup files, score files, or any other files which are modified
  1624. for internal purposes, these files should not be stored in `/usr' or
  1625. `/etc'.
  1626. There are two exceptions. `/etc' is used to store system
  1627. configuration information; it is reasonable for a program to modify
  1628. files in `/etc' when its job is to update the system configuration.
  1629. Also, if the user explicitly asks to modify one file in a directory, it
  1630. is reasonable for the program to store other files in the same
  1631. directory.
  1632. 
  1633. File: standards.info, Node: Writing C, Next: Documentation, Prev: Program Behavior, Up: Top
  1634. 5 Making The Best Use of C
  1635. **************************
  1636. This chapter provides advice on how best to use the C language when
  1637. writing GNU software.
  1638. * Menu:
  1639. * Formatting:: Formatting your source code.
  1640. * Comments:: Commenting your work.
  1641. * Syntactic Conventions:: Clean use of C constructs.
  1642. * Names:: Naming variables, functions, and files.
  1643. * System Portability:: Portability among different operating systems.
  1644. * CPU Portability:: Supporting the range of CPU types.
  1645. * System Functions:: Portability and ``standard'' library functions.
  1646. * Internationalization:: Techniques for internationalization.
  1647. * Character Set:: Use ASCII by default.
  1648. * Quote Characters:: Use "..." or '...' in the C locale.
  1649. * Mmap:: How you can safely use `mmap'.
  1650. 
  1651. File: standards.info, Node: Formatting, Next: Comments, Up: Writing C
  1652. 5.1 Formatting Your Source Code
  1653. ===============================
  1654. It is important to put the open-brace that starts the body of a C
  1655. function in column one, so that they will start a defun. Several tools
  1656. look for open-braces in column one to find the beginnings of C
  1657. functions. These tools will not work on code not formatted that way.
  1658. Avoid putting open-brace, open-parenthesis or open-bracket in column
  1659. one when they are inside a function, so that they won't start a defun.
  1660. The open-brace that starts a `struct' body can go in column one if you
  1661. find it useful to treat that definition as a defun.
  1662. It is also important for function definitions to start the name of
  1663. the function in column one. This helps people to search for function
  1664. definitions, and may also help certain tools recognize them. Thus,
  1665. using Standard C syntax, the format is this:
  1666. static char *
  1667. concat (char *s1, char *s2)
  1668. {
  1669. ...
  1670. }
  1671. or, if you want to use traditional C syntax, format the definition like
  1672. this:
  1673. static char *
  1674. concat (s1, s2) /* Name starts in column one here */
  1675. char *s1, *s2;
  1676. { /* Open brace in column one here */
  1677. ...
  1678. }
  1679. In Standard C, if the arguments don't fit nicely on one line, split
  1680. it like this:
  1681. int
  1682. lots_of_args (int an_integer, long a_long, short a_short,
  1683. double a_double, float a_float)
  1684. ...
  1685. For `struct' and `enum' types, likewise put the braces in column
  1686. one, unless the whole contents fits on one line:
  1687. struct foo
  1688. {
  1689. int a, b;
  1690. }
  1691. or
  1692. struct foo { int a, b; }
  1693. The rest of this section gives our recommendations for other aspects
  1694. of C formatting style, which is also the default style of the `indent'
  1695. program in version 1.2 and newer. It corresponds to the options
  1696. -nbad -bap -nbc -bbo -bl -bli2 -bls -ncdb -nce -cp1 -cs -di2
  1697. -ndj -nfc1 -nfca -hnl -i2 -ip5 -lp -pcs -psl -nsc -nsob
  1698. We don't think of these recommendations as requirements, because it
  1699. causes no problems for users if two different programs have different
  1700. formatting styles.
  1701. But whatever style you use, please use it consistently, since a
  1702. mixture of styles within one program tends to look ugly. If you are
  1703. contributing changes to an existing program, please follow the style of
  1704. that program.
  1705. For the body of the function, our recommended style looks like this:
  1706. if (x < foo (y, z))
  1707. haha = bar[4] + 5;
  1708. else
  1709. {
  1710. while (z)
  1711. {
  1712. haha += foo (z, z);
  1713. z--;
  1714. }
  1715. return ++x + bar ();
  1716. }
  1717. We find it easier to read a program when it has spaces before the
  1718. open-parentheses and after the commas. Especially after the commas.
  1719. When you split an expression into multiple lines, split it before an
  1720. operator, not after one. Here is the right way:
  1721. if (foo_this_is_long && bar > win (x, y, z)
  1722. && remaining_condition)
  1723. Try to avoid having two operators of different precedence at the same
  1724. level of indentation. For example, don't write this:
  1725. mode = (inmode[j] == VOIDmode
  1726. || GET_MODE_SIZE (outmode[j]) > GET_MODE_SIZE (inmode[j])
  1727. ? outmode[j] : inmode[j]);
  1728. Instead, use extra parentheses so that the indentation shows the
  1729. nesting:
  1730. mode = ((inmode[j] == VOIDmode
  1731. || (GET_MODE_SIZE (outmode[j]) > GET_MODE_SIZE (inmode[j])))
  1732. ? outmode[j] : inmode[j]);
  1733. Insert extra parentheses so that Emacs will indent the code properly.
  1734. For example, the following indentation looks nice if you do it by hand,
  1735. v = rup->ru_utime.tv_sec*1000 + rup->ru_utime.tv_usec/1000
  1736. + rup->ru_stime.tv_sec*1000 + rup->ru_stime.tv_usec/1000;
  1737. but Emacs would alter it. Adding a set of parentheses produces
  1738. something that looks equally nice, and which Emacs will preserve:
  1739. v = (rup->ru_utime.tv_sec*1000 + rup->ru_utime.tv_usec/1000
  1740. + rup->ru_stime.tv_sec*1000 + rup->ru_stime.tv_usec/1000);
  1741. Format do-while statements like this:
  1742. do
  1743. {
  1744. a = foo (a);
  1745. }
  1746. while (a > 0);
  1747. Please use formfeed characters (control-L) to divide the program into
  1748. pages at logical places (but not within a function). It does not matter
  1749. just how long the pages are, since they do not have to fit on a printed
  1750. page. The formfeeds should appear alone on lines by themselves.
  1751. 
  1752. File: standards.info, Node: Comments, Next: Syntactic Conventions, Prev: Formatting, Up: Writing C
  1753. 5.2 Commenting Your Work
  1754. ========================
  1755. Every program should start with a comment saying briefly what it is for.
  1756. Example: `fmt - filter for simple filling of text'. This comment
  1757. should be at the top of the source file containing the `main' function
  1758. of the program.
  1759. Also, please write a brief comment at the start of each source file,
  1760. with the file name and a line or two about the overall purpose of the
  1761. file.
  1762. Please write the comments in a GNU program in English, because
  1763. English is the one language that nearly all programmers in all
  1764. countries can read. If you do not write English well, please write
  1765. comments in English as well as you can, then ask other people to help
  1766. rewrite them. If you can't write comments in English, please find
  1767. someone to work with you and translate your comments into English.
  1768. Please put a comment on each function saying what the function does,
  1769. what sorts of arguments it gets, and what the possible values of
  1770. arguments mean and are used for. It is not necessary to duplicate in
  1771. words the meaning of the C argument declarations, if a C type is being
  1772. used in its customary fashion. If there is anything nonstandard about
  1773. its use (such as an argument of type `char *' which is really the
  1774. address of the second character of a string, not the first), or any
  1775. possible values that would not work the way one would expect (such as,
  1776. that strings containing newlines are not guaranteed to work), be sure
  1777. to say so.
  1778. Also explain the significance of the return value, if there is one.
  1779. Please put two spaces after the end of a sentence in your comments,
  1780. so that the Emacs sentence commands will work. Also, please write
  1781. complete sentences and capitalize the first word. If a lower-case
  1782. identifier comes at the beginning of a sentence, don't capitalize it!
  1783. Changing the spelling makes it a different identifier. If you don't
  1784. like starting a sentence with a lower case letter, write the sentence
  1785. differently (e.g., "The identifier lower-case is ...").
  1786. The comment on a function is much clearer if you use the argument
  1787. names to speak about the argument values. The variable name itself
  1788. should be lower case, but write it in upper case when you are speaking
  1789. about the value rather than the variable itself. Thus, "the inode
  1790. number NODE_NUM" rather than "an inode".
  1791. There is usually no purpose in restating the name of the function in
  1792. the comment before it, because readers can see that for themselves.
  1793. There might be an exception when the comment is so long that the
  1794. function itself would be off the bottom of the screen.
  1795. There should be a comment on each static variable as well, like this:
  1796. /* Nonzero means truncate lines in the display;
  1797. zero means continue them. */
  1798. int truncate_lines;
  1799. Every `#endif' should have a comment, except in the case of short
  1800. conditionals (just a few lines) that are not nested. The comment should
  1801. state the condition of the conditional that is ending, _including its
  1802. sense_. `#else' should have a comment describing the condition _and
  1803. sense_ of the code that follows. For example:
  1804. #ifdef foo
  1805. ...
  1806. #else /* not foo */
  1807. ...
  1808. #endif /* not foo */
  1809. #ifdef foo
  1810. ...
  1811. #endif /* foo */
  1812. but, by contrast, write the comments this way for a `#ifndef':
  1813. #ifndef foo
  1814. ...
  1815. #else /* foo */
  1816. ...
  1817. #endif /* foo */
  1818. #ifndef foo
  1819. ...
  1820. #endif /* not foo */
  1821. 
  1822. File: standards.info, Node: Syntactic Conventions, Next: Names, Prev: Comments, Up: Writing C
  1823. 5.3 Clean Use of C Constructs
  1824. =============================
  1825. Please explicitly declare the types of all objects. For example, you
  1826. should explicitly declare all arguments to functions, and you should
  1827. declare functions to return `int' rather than omitting the `int'.
  1828. Some programmers like to use the GCC `-Wall' option, and change the
  1829. code whenever it issues a warning. If you want to do this, then do.
  1830. Other programmers prefer not to use `-Wall', because it gives warnings
  1831. for valid and legitimate code which they do not want to change. If you
  1832. want to do this, then do. The compiler should be your servant, not
  1833. your master.
  1834. Don't make the program ugly just to placate static analysis tools
  1835. such as `lint', `clang', and GCC with extra warnings options such as
  1836. `-Wconversion' and `-Wundef'. These tools can help find bugs and
  1837. unclear code, but they can also generate so many false alarms that it
  1838. hurts readability to silence them with unnecessary casts, wrappers, and
  1839. other complications. For example, please don't insert casts to `void'
  1840. or calls to do-nothing functions merely to pacify a lint checker.
  1841. Declarations of external functions and functions to appear later in
  1842. the source file should all go in one place near the beginning of the
  1843. file (somewhere before the first function definition in the file), or
  1844. else should go in a header file. Don't put `extern' declarations inside
  1845. functions.
  1846. It used to be common practice to use the same local variables (with
  1847. names like `tem') over and over for different values within one
  1848. function. Instead of doing this, it is better to declare a separate
  1849. local variable for each distinct purpose, and give it a name which is
  1850. meaningful. This not only makes programs easier to understand, it also
  1851. facilitates optimization by good compilers. You can also move the
  1852. declaration of each local variable into the smallest scope that includes
  1853. all its uses. This makes the program even cleaner.
  1854. Don't use local variables or parameters that shadow global
  1855. identifiers. GCC's `-Wshadow' option can detect this problem.
  1856. Don't declare multiple variables in one declaration that spans lines.
  1857. Start a new declaration on each line, instead. For example, instead of
  1858. this:
  1859. int foo,
  1860. bar;
  1861. write either this:
  1862. int foo, bar;
  1863. or this:
  1864. int foo;
  1865. int bar;
  1866. (If they are global variables, each should have a comment preceding it
  1867. anyway.)
  1868. When you have an `if'-`else' statement nested in another `if'
  1869. statement, always put braces around the `if'-`else'. Thus, never write
  1870. like this:
  1871. if (foo)
  1872. if (bar)
  1873. win ();
  1874. else
  1875. lose ();
  1876. always like this:
  1877. if (foo)
  1878. {
  1879. if (bar)
  1880. win ();
  1881. else
  1882. lose ();
  1883. }
  1884. If you have an `if' statement nested inside of an `else' statement,
  1885. either write `else if' on one line, like this,
  1886. if (foo)
  1887. ...
  1888. else if (bar)
  1889. ...
  1890. with its `then'-part indented like the preceding `then'-part, or write
  1891. the nested `if' within braces like this:
  1892. if (foo)
  1893. ...
  1894. else
  1895. {
  1896. if (bar)
  1897. ...
  1898. }
  1899. Don't declare both a structure tag and variables or typedefs in the
  1900. same declaration. Instead, declare the structure tag separately and
  1901. then use it to declare the variables or typedefs.
  1902. Try to avoid assignments inside `if'-conditions (assignments inside
  1903. `while'-conditions are ok). For example, don't write this:
  1904. if ((foo = (char *) malloc (sizeof *foo)) == 0)
  1905. fatal ("virtual memory exhausted");
  1906. instead, write this:
  1907. foo = (char *) malloc (sizeof *foo);
  1908. if (foo == 0)
  1909. fatal ("virtual memory exhausted");
  1910. This example uses zero without a cast as a null pointer constant.
  1911. This is perfectly fine, except that a cast is needed when calling a
  1912. varargs function or when using `sizeof'.
  1913. 
  1914. File: standards.info, Node: Names, Next: System Portability, Prev: Syntactic Conventions, Up: Writing C
  1915. 5.4 Naming Variables, Functions, and Files
  1916. ==========================================
  1917. The names of global variables and functions in a program serve as
  1918. comments of a sort. So don't choose terse names--instead, look for
  1919. names that give useful information about the meaning of the variable or
  1920. function. In a GNU program, names should be English, like other
  1921. comments.
  1922. Local variable names can be shorter, because they are used only
  1923. within one context, where (presumably) comments explain their purpose.
  1924. Try to limit your use of abbreviations in symbol names. It is ok to
  1925. make a few abbreviations, explain what they mean, and then use them
  1926. frequently, but don't use lots of obscure abbreviations.
  1927. Please use underscores to separate words in a name, so that the Emacs
  1928. word commands can be useful within them. Stick to lower case; reserve
  1929. upper case for macros and `enum' constants, and for name-prefixes that
  1930. follow a uniform convention.
  1931. For example, you should use names like `ignore_space_change_flag';
  1932. don't use names like `iCantReadThis'.
  1933. Variables that indicate whether command-line options have been
  1934. specified should be named after the meaning of the option, not after
  1935. the option-letter. A comment should state both the exact meaning of
  1936. the option and its letter. For example,
  1937. /* Ignore changes in horizontal whitespace (-b). */
  1938. int ignore_space_change_flag;
  1939. When you want to define names with constant integer values, use
  1940. `enum' rather than `#define'. GDB knows about enumeration constants.
  1941. You might want to make sure that none of the file names would
  1942. conflict if the files were loaded onto an MS-DOS file system which
  1943. shortens the names. You can use the program `doschk' to test for this.
  1944. Some GNU programs were designed to limit themselves to file names of
  1945. 14 characters or less, to avoid file name conflicts if they are read
  1946. into older System V systems. Please preserve this feature in the
  1947. existing GNU programs that have it, but there is no need to do this in
  1948. new GNU programs. `doschk' also reports file names longer than 14
  1949. characters.
  1950. 
  1951. File: standards.info, Node: System Portability, Next: CPU Portability, Prev: Names, Up: Writing C
  1952. 5.5 Portability between System Types
  1953. ====================================
  1954. In the Unix world, "portability" refers to porting to different Unix
  1955. versions. For a GNU program, this kind of portability is desirable, but
  1956. not paramount.
  1957. The primary purpose of GNU software is to run on top of the GNU
  1958. kernel, compiled with the GNU C compiler, on various types of CPU. So
  1959. the kinds of portability that are absolutely necessary are quite
  1960. limited. But it is important to support Linux-based GNU systems, since
  1961. they are the form of GNU that is popular.
  1962. Beyond that, it is good to support the other free operating systems
  1963. (*BSD), and it is nice to support other Unix-like systems if you want
  1964. to. Supporting a variety of Unix-like systems is desirable, although
  1965. not paramount. It is usually not too hard, so you may as well do it.
  1966. But you don't have to consider it an obligation, if it does turn out to
  1967. be hard.
  1968. The easiest way to achieve portability to most Unix-like systems is
  1969. to use Autoconf. It's unlikely that your program needs to know more
  1970. information about the host platform than Autoconf can provide, simply
  1971. because most of the programs that need such knowledge have already been
  1972. written.
  1973. Avoid using the format of semi-internal data bases (e.g.,
  1974. directories) when there is a higher-level alternative (`readdir').
  1975. As for systems that are not like Unix, such as MSDOS, Windows, VMS,
  1976. MVS, and older Macintosh systems, supporting them is often a lot of
  1977. work. When that is the case, it is better to spend your time adding
  1978. features that will be useful on GNU and GNU/Linux, rather than on
  1979. supporting other incompatible systems.
  1980. If you do support Windows, please do not abbreviate it as "win". In
  1981. hacker terminology, calling something a "win" is a form of praise.
  1982. You're free to praise Microsoft Windows on your own if you want, but
  1983. please don't do this in GNU packages. Instead of abbreviating
  1984. "Windows" to "win", you can write it in full or abbreviate it to "woe"
  1985. or "w". In GNU Emacs, for instance, we use `w32' in file names of
  1986. Windows-specific files, but the macro for Windows conditionals is
  1987. called `WINDOWSNT'.
  1988. It is a good idea to define the "feature test macro" `_GNU_SOURCE'
  1989. when compiling your C files. When you compile on GNU or GNU/Linux,
  1990. this will enable the declarations of GNU library extension functions,
  1991. and that will usually give you a compiler error message if you define
  1992. the same function names in some other way in your program. (You don't
  1993. have to actually _use_ these functions, if you prefer to make the
  1994. program more portable to other systems.)
  1995. But whether or not you use these GNU extensions, you should avoid
  1996. using their names for any other meanings. Doing so would make it hard
  1997. to move your code into other GNU programs.
  1998. 
  1999. File: standards.info, Node: CPU Portability, Next: System Functions, Prev: System Portability, Up: Writing C
  2000. 5.6 Portability between CPUs
  2001. ============================
  2002. Even GNU systems will differ because of differences among CPU
  2003. types--for example, difference in byte ordering and alignment
  2004. requirements. It is absolutely essential to handle these differences.
  2005. However, don't make any effort to cater to the possibility that an
  2006. `int' will be less than 32 bits. We don't support 16-bit machines in
  2007. GNU.
  2008. Similarly, don't make any effort to cater to the possibility that
  2009. `long' will be smaller than predefined types like `size_t'. For
  2010. example, the following code is ok:
  2011. printf ("size = %lu\n", (unsigned long) sizeof array);
  2012. printf ("diff = %ld\n", (long) (pointer2 - pointer1));
  2013. 1989 Standard C requires this to work, and we know of only one
  2014. counterexample: 64-bit programs on Microsoft Windows. We will leave it
  2015. to those who want to port GNU programs to that environment to figure
  2016. out how to do it.
  2017. Predefined file-size types like `off_t' are an exception: they are
  2018. longer than `long' on many platforms, so code like the above won't work
  2019. with them. One way to print an `off_t' value portably is to print its
  2020. digits yourself, one by one.
  2021. Don't assume that the address of an `int' object is also the address
  2022. of its least-significant byte. This is false on big-endian machines.
  2023. Thus, don't make the following mistake:
  2024. int c;
  2025. ...
  2026. while ((c = getchar ()) != EOF)
  2027. write (file_descriptor, &c, 1);
  2028. Instead, use `unsigned char' as follows. (The `unsigned' is for
  2029. portability to unusual systems where `char' is signed and where there
  2030. is integer overflow checking.)
  2031. int c;
  2032. while ((c = getchar ()) != EOF)
  2033. {
  2034. unsigned char u = c;
  2035. write (file_descriptor, &u, 1);
  2036. }
  2037. Avoid casting pointers to integers if you can. Such casts greatly
  2038. reduce portability, and in most programs they are easy to avoid. In the
  2039. cases where casting pointers to integers is essential--such as, a Lisp
  2040. interpreter which stores type information as well as an address in one
  2041. word--you'll have to make explicit provisions to handle different word
  2042. sizes. You will also need to make provision for systems in which the
  2043. normal range of addresses you can get from `malloc' starts far away
  2044. from zero.
  2045. 
  2046. File: standards.info, Node: System Functions, Next: Internationalization, Prev: CPU Portability, Up: Writing C
  2047. 5.7 Calling System Functions
  2048. ============================
  2049. Historically, C implementations differed substantially, and many
  2050. systems lacked a full implementation of ANSI/ISO C89. Nowadays,
  2051. however, very few systems lack a C89 compiler and GNU C supports almost
  2052. all of C99. Similarly, most systems implement POSIX.1-1993 libraries
  2053. and tools, and many have POSIX.1-2001.
  2054. Hence, there is little reason to support old C or non-POSIX systems,
  2055. and you may want to take advantage of C99 and POSIX-1.2001 to write
  2056. clearer, more portable, or faster code. You should use standard
  2057. interfaces where possible; but if GNU extensions make your program more
  2058. maintainable, powerful, or otherwise better, don't hesitate to use
  2059. them. In any case, don't make your own declaration of system
  2060. functions; that's a recipe for conflict.
  2061. Despite the standards, nearly every library function has some sort of
  2062. portability issue on some system or another. Here are some examples:
  2063. `open'
  2064. Names with trailing `/''s are mishandled on many platforms.
  2065. `printf'
  2066. `long double' may be unimplemented; floating values Infinity and
  2067. NaN are often mishandled; output for large precisions may be
  2068. incorrect.
  2069. `readlink'
  2070. May return `int' instead of `ssize_t'.
  2071. `scanf'
  2072. On Windows, `errno' is not set on failure.
  2073. Gnulib (http://www.gnu.org/software/gnulib/) is a big help in this
  2074. regard. Gnulib provides implementations of standard interfaces on many
  2075. of the systems that lack them, including portable implementations of
  2076. enhanced GNU interfaces, thereby making their use portable, and of
  2077. POSIX-1.2008 interfaces, some of which are missing even on up-to-date
  2078. GNU systems.
  2079. Gnulib also provides many useful non-standard interfaces; for
  2080. example, C implementations of standard data structures (hash tables,
  2081. binary trees), error-checking type-safe wrappers for memory allocation
  2082. functions (`xmalloc', `xrealloc'), and output of error messages.
  2083. Gnulib integrates with GNU Autoconf and Automake to remove much of
  2084. the burden of writing portable code from the programmer: Gnulib makes
  2085. your configure script automatically determine what features are missing
  2086. and use the Gnulib code to supply the missing pieces.
  2087. The Gnulib and Autoconf manuals have extensive sections on
  2088. portability: *note Introduction: (gnulib)Top. and *note Portable C and
  2089. C++: (autoconf)Portable C and C++. Please consult them for many more
  2090. details.
  2091. 
  2092. File: standards.info, Node: Internationalization, Next: Character Set, Prev: System Functions, Up: Writing C
  2093. 5.8 Internationalization
  2094. ========================
  2095. GNU has a library called GNU gettext that makes it easy to translate the
  2096. messages in a program into various languages. You should use this
  2097. library in every program. Use English for the messages as they appear
  2098. in the program, and let gettext provide the way to translate them into
  2099. other languages.
  2100. Using GNU gettext involves putting a call to the `gettext' macro
  2101. around each string that might need translation--like this:
  2102. printf (gettext ("Processing file '%s'..."), file);
  2103. This permits GNU gettext to replace the string `"Processing file
  2104. '%s'..."' with a translated version.
  2105. Once a program uses gettext, please make a point of writing calls to
  2106. `gettext' when you add new strings that call for translation.
  2107. Using GNU gettext in a package involves specifying a "text domain
  2108. name" for the package. The text domain name is used to separate the
  2109. translations for this package from the translations for other packages.
  2110. Normally, the text domain name should be the same as the name of the
  2111. package--for example, `coreutils' for the GNU core utilities.
  2112. To enable gettext to work well, avoid writing code that makes
  2113. assumptions about the structure of words or sentences. When you want
  2114. the precise text of a sentence to vary depending on the data, use two or
  2115. more alternative string constants each containing a complete sentences,
  2116. rather than inserting conditionalized words or phrases into a single
  2117. sentence framework.
  2118. Here is an example of what not to do:
  2119. printf ("%s is full", capacity > 5000000 ? "disk" : "floppy disk");
  2120. If you apply gettext to all strings, like this,
  2121. printf (gettext ("%s is full"),
  2122. capacity > 5000000 ? gettext ("disk") : gettext ("floppy disk"));
  2123. the translator will hardly know that "disk" and "floppy disk" are meant
  2124. to be substituted in the other string. Worse, in some languages (like
  2125. French) the construction will not work: the translation of the word
  2126. "full" depends on the gender of the first part of the sentence; it
  2127. happens to be not the same for "disk" as for "floppy disk".
  2128. Complete sentences can be translated without problems:
  2129. printf (capacity > 5000000 ? gettext ("disk is full")
  2130. : gettext ("floppy disk is full"));
  2131. A similar problem appears at the level of sentence structure with
  2132. this code:
  2133. printf ("# Implicit rule search has%s been done.\n",
  2134. f->tried_implicit ? "" : " not");
  2135. Adding `gettext' calls to this code cannot give correct results for all
  2136. languages, because negation in some languages requires adding words at
  2137. more than one place in the sentence. By contrast, adding `gettext'
  2138. calls does the job straightforwardly if the code starts out like this:
  2139. printf (f->tried_implicit
  2140. ? "# Implicit rule search has been done.\n",
  2141. : "# Implicit rule search has not been done.\n");
  2142. Another example is this one:
  2143. printf ("%d file%s processed", nfiles,
  2144. nfiles != 1 ? "s" : "");
  2145. The problem with this example is that it assumes that plurals are made
  2146. by adding `s'. If you apply gettext to the format string, like this,
  2147. printf (gettext ("%d file%s processed"), nfiles,
  2148. nfiles != 1 ? "s" : "");
  2149. the message can use different words, but it will still be forced to use
  2150. `s' for the plural. Here is a better way, with gettext being applied to
  2151. the two strings independently:
  2152. printf ((nfiles != 1 ? gettext ("%d files processed")
  2153. : gettext ("%d file processed")),
  2154. nfiles);
  2155. But this still doesn't work for languages like Polish, which has three
  2156. plural forms: one for nfiles == 1, one for nfiles == 2, 3, 4, 22, 23,
  2157. 24, ... and one for the rest. The GNU `ngettext' function solves this
  2158. problem:
  2159. printf (ngettext ("%d files processed", "%d file processed", nfiles),
  2160. nfiles);
  2161. 
  2162. File: standards.info, Node: Character Set, Next: Quote Characters, Prev: Internationalization, Up: Writing C
  2163. 5.9 Character Set
  2164. =================
  2165. Sticking to the ASCII character set (plain text, 7-bit characters) is
  2166. preferred in GNU source code comments, text documents, and other
  2167. contexts, unless there is good reason to do something else because of
  2168. the application domain. For example, if source code deals with the
  2169. French Revolutionary calendar, it is OK if its literal strings contain
  2170. accented characters in month names like "Flore'al". Also, it is OK
  2171. (but not required) to use non-ASCII characters to represent proper
  2172. names of contributors in change logs (*note Change Logs::).
  2173. If you need to use non-ASCII characters, you should normally stick
  2174. with one encoding, certainly within a single file. UTF-8 is likely to
  2175. be the best choice.
  2176. 
  2177. File: standards.info, Node: Quote Characters, Next: Mmap, Prev: Character Set, Up: Writing C
  2178. 5.10 Quote Characters
  2179. =====================
  2180. In the C locale, the output of GNU programs should stick to plain ASCII
  2181. for quotation characters in messages to users: preferably 0x22 (`"') or
  2182. 0x27 (`'') for both opening and closing quotes. Although GNU programs
  2183. traditionally used 0x60 (``') for opening and 0x27 (`'') for closing
  2184. quotes, nowadays quotes ``like this'' are typically rendered
  2185. asymmetrically, so quoting `"like this"' or `'like this'' typically
  2186. looks better.
  2187. It is ok, but not required, for GNU programs to generate
  2188. locale-specific quotes in non-C locales. For example:
  2189. printf (gettext ("Processing file '%s'..."), file);
  2190. Here, a French translation might cause `gettext' to return the string
  2191. `"Traitement de fichier < %s >..."', yielding quotes more appropriate
  2192. for a French locale.
  2193. Sometimes a program may need to use opening and closing quotes
  2194. directly. By convention, `gettext' translates the string `"`"' to the
  2195. opening quote and the string `"'"' to the closing quote, and a program
  2196. can use these translations. Generally, though, it is better to
  2197. translate quote characters in the context of longer strings.
  2198. If the output of your program is ever likely to be parsed by another
  2199. program, it is good to provide an option that makes this parsing
  2200. reliable. For example, you could escape special characters using
  2201. conventions from the C language or the Bourne shell. See for example
  2202. the option `--quoting-style' of GNU `ls'.
  2203. 
  2204. File: standards.info, Node: Mmap, Prev: Quote Characters, Up: Writing C
  2205. 5.11 Mmap
  2206. =========
  2207. Don't assume that `mmap' either works on all files or fails for all
  2208. files. It may work on some files and fail on others.
  2209. The proper way to use `mmap' is to try it on the specific file for
  2210. which you want to use it--and if `mmap' doesn't work, fall back on
  2211. doing the job in another way using `read' and `write'.
  2212. The reason this precaution is needed is that the GNU kernel (the
  2213. HURD) provides a user-extensible file system, in which there can be many
  2214. different kinds of "ordinary files". Many of them support `mmap', but
  2215. some do not. It is important to make programs handle all these kinds
  2216. of files.
  2217. 
  2218. File: standards.info, Node: Documentation, Next: Managing Releases, Prev: Writing C, Up: Top
  2219. 6 Documenting Programs
  2220. **********************
  2221. A GNU program should ideally come with full free documentation, adequate
  2222. for both reference and tutorial purposes. If the package can be
  2223. programmed or extended, the documentation should cover programming or
  2224. extending it, as well as just using it.
  2225. * Menu:
  2226. * GNU Manuals:: Writing proper manuals.
  2227. * Doc Strings and Manuals:: Compiling doc strings doesn't make a manual.
  2228. * Manual Structure Details:: Specific structure conventions.
  2229. * License for Manuals:: Writing the distribution terms for a manual.
  2230. * Manual Credits:: Giving credit to documentation contributors.
  2231. * Printed Manuals:: Mentioning the printed manual.
  2232. * NEWS File:: NEWS files supplement manuals.
  2233. * Change Logs:: Recording changes.
  2234. * Man Pages:: Man pages are secondary.
  2235. * Reading other Manuals:: How far you can go in learning
  2236. from other manuals.
  2237. 
  2238. File: standards.info, Node: GNU Manuals, Next: Doc Strings and Manuals, Up: Documentation
  2239. 6.1 GNU Manuals
  2240. ===============
  2241. The preferred document format for the GNU system is the Texinfo
  2242. formatting language. Every GNU package should (ideally) have
  2243. documentation in Texinfo both for reference and for learners. Texinfo
  2244. makes it possible to produce a good quality formatted book, using TeX,
  2245. and to generate an Info file. It is also possible to generate HTML
  2246. output from Texinfo source. See the Texinfo manual, either the
  2247. hardcopy, or the on-line version available through `info' or the Emacs
  2248. Info subsystem (`C-h i').
  2249. Nowadays some other formats such as Docbook and Sgmltexi can be
  2250. converted automatically into Texinfo. It is ok to produce the Texinfo
  2251. documentation by conversion this way, as long as it gives good results.
  2252. Make sure your manual is clear to a reader who knows nothing about
  2253. the topic and reads it straight through. This means covering basic
  2254. topics at the beginning, and advanced topics only later. This also
  2255. means defining every specialized term when it is first used.
  2256. Programmers tend to carry over the structure of the program as the
  2257. structure for its documentation. But this structure is not necessarily
  2258. good for explaining how to use the program; it may be irrelevant and
  2259. confusing for a user.
  2260. Instead, the right way to structure documentation is according to the
  2261. concepts and questions that a user will have in mind when reading it.
  2262. This principle applies at every level, from the lowest (ordering
  2263. sentences in a paragraph) to the highest (ordering of chapter topics
  2264. within the manual). Sometimes this structure of ideas matches the
  2265. structure of the implementation of the software being documented--but
  2266. often they are different. An important part of learning to write good
  2267. documentation is to learn to notice when you have unthinkingly
  2268. structured the documentation like the implementation, stop yourself,
  2269. and look for better alternatives.
  2270. For example, each program in the GNU system probably ought to be
  2271. documented in one manual; but this does not mean each program should
  2272. have its own manual. That would be following the structure of the
  2273. implementation, rather than the structure that helps the user
  2274. understand.
  2275. Instead, each manual should cover a coherent _topic_. For example,
  2276. instead of a manual for `diff' and a manual for `diff3', we have one
  2277. manual for "comparison of files" which covers both of those programs,
  2278. as well as `cmp'. By documenting these programs together, we can make
  2279. the whole subject clearer.
  2280. The manual which discusses a program should certainly document all of
  2281. the program's command-line options and all of its commands. It should
  2282. give examples of their use. But don't organize the manual as a list of
  2283. features. Instead, organize it logically, by subtopics. Address the
  2284. questions that a user will ask when thinking about the job that the
  2285. program does. Don't just tell the reader what each feature can do--say
  2286. what jobs it is good for, and show how to use it for those jobs.
  2287. Explain what is recommended usage, and what kinds of usage users should
  2288. avoid.
  2289. In general, a GNU manual should serve both as tutorial and reference.
  2290. It should be set up for convenient access to each topic through Info,
  2291. and for reading straight through (appendixes aside). A GNU manual
  2292. should give a good introduction to a beginner reading through from the
  2293. start, and should also provide all the details that hackers want. The
  2294. Bison manual is a good example of this--please take a look at it to see
  2295. what we mean.
  2296. That is not as hard as it first sounds. Arrange each chapter as a
  2297. logical breakdown of its topic, but order the sections, and write their
  2298. text, so that reading the chapter straight through makes sense. Do
  2299. likewise when structuring the book into chapters, and when structuring a
  2300. section into paragraphs. The watchword is, _at each point, address the
  2301. most fundamental and important issue raised by the preceding text._
  2302. If necessary, add extra chapters at the beginning of the manual which
  2303. are purely tutorial and cover the basics of the subject. These provide
  2304. the framework for a beginner to understand the rest of the manual. The
  2305. Bison manual provides a good example of how to do this.
  2306. To serve as a reference, a manual should have an Index that list all
  2307. the functions, variables, options, and important concepts that are part
  2308. of the program. One combined Index should do for a short manual, but
  2309. sometimes for a complex package it is better to use multiple indices.
  2310. The Texinfo manual includes advice on preparing good index entries, see
  2311. *note Making Index Entries: (texinfo)Index Entries, and see *note
  2312. Defining the Entries of an Index: (texinfo)Indexing Commands.
  2313. Don't use Unix man pages as a model for how to write GNU
  2314. documentation; most of them are terse, badly structured, and give
  2315. inadequate explanation of the underlying concepts. (There are, of
  2316. course, some exceptions.) Also, Unix man pages use a particular format
  2317. which is different from what we use in GNU manuals.
  2318. Please include an email address in the manual for where to report
  2319. bugs _in the text of the manual_.
  2320. Please do not use the term "pathname" that is used in Unix
  2321. documentation; use "file name" (two words) instead. We use the term
  2322. "path" only for search paths, which are lists of directory names.
  2323. Please do not use the term "illegal" to refer to erroneous input to
  2324. a computer program. Please use "invalid" for this, and reserve the
  2325. term "illegal" for activities prohibited by law.
  2326. Please do not write `()' after a function name just to indicate it
  2327. is a function. `foo ()' is not a function, it is a function call with
  2328. no arguments.
  2329. 
  2330. File: standards.info, Node: Doc Strings and Manuals, Next: Manual Structure Details, Prev: GNU Manuals, Up: Documentation
  2331. 6.2 Doc Strings and Manuals
  2332. ===========================
  2333. Some programming systems, such as Emacs, provide a documentation string
  2334. for each function, command or variable. You may be tempted to write a
  2335. reference manual by compiling the documentation strings and writing a
  2336. little additional text to go around them--but you must not do it. That
  2337. approach is a fundamental mistake. The text of well-written
  2338. documentation strings will be entirely wrong for a manual.
  2339. A documentation string needs to stand alone--when it appears on the
  2340. screen, there will be no other text to introduce or explain it.
  2341. Meanwhile, it can be rather informal in style.
  2342. The text describing a function or variable in a manual must not stand
  2343. alone; it appears in the context of a section or subsection. Other text
  2344. at the beginning of the section should explain some of the concepts, and
  2345. should often make some general points that apply to several functions or
  2346. variables. The previous descriptions of functions and variables in the
  2347. section will also have given information about the topic. A description
  2348. written to stand alone would repeat some of that information; this
  2349. redundancy looks bad. Meanwhile, the informality that is acceptable in
  2350. a documentation string is totally unacceptable in a manual.
  2351. The only good way to use documentation strings in writing a good
  2352. manual is to use them as a source of information for writing good text.
  2353. 
  2354. File: standards.info, Node: Manual Structure Details, Next: License for Manuals, Prev: Doc Strings and Manuals, Up: Documentation
  2355. 6.3 Manual Structure Details
  2356. ============================
  2357. The title page of the manual should state the version of the programs or
  2358. packages documented in the manual. The Top node of the manual should
  2359. also contain this information. If the manual is changing more
  2360. frequently than or independent of the program, also state a version
  2361. number for the manual in both of these places.
  2362. Each program documented in the manual should have a node named
  2363. `PROGRAM Invocation' or `Invoking PROGRAM'. This node (together with
  2364. its subnodes, if any) should describe the program's command line
  2365. arguments and how to run it (the sort of information people would look
  2366. for in a man page). Start with an `@example' containing a template for
  2367. all the options and arguments that the program uses.
  2368. Alternatively, put a menu item in some menu whose item name fits one
  2369. of the above patterns. This identifies the node which that item points
  2370. to as the node for this purpose, regardless of the node's actual name.
  2371. The `--usage' feature of the Info reader looks for such a node or
  2372. menu item in order to find the relevant text, so it is essential for
  2373. every Texinfo file to have one.
  2374. If one manual describes several programs, it should have such a node
  2375. for each program described in the manual.
  2376. 
  2377. File: standards.info, Node: License for Manuals, Next: Manual Credits, Prev: Manual Structure Details, Up: Documentation
  2378. 6.4 License for Manuals
  2379. =======================
  2380. Please use the GNU Free Documentation License for all GNU manuals that
  2381. are more than a few pages long. Likewise for a collection of short
  2382. documents--you only need one copy of the GNU FDL for the whole
  2383. collection. For a single short document, you can use a very permissive
  2384. non-copyleft license, to avoid taking up space with a long license.
  2385. See `http://www.gnu.org/copyleft/fdl-howto.html' for more explanation
  2386. of how to employ the GFDL.
  2387. Note that it is not obligatory to include a copy of the GNU GPL or
  2388. GNU LGPL in a manual whose license is neither the GPL nor the LGPL. It
  2389. can be a good idea to include the program's license in a large manual;
  2390. in a short manual, whose size would be increased considerably by
  2391. including the program's license, it is probably better not to include
  2392. it.
  2393. 
  2394. File: standards.info, Node: Manual Credits, Next: Printed Manuals, Prev: License for Manuals, Up: Documentation
  2395. 6.5 Manual Credits
  2396. ==================
  2397. Please credit the principal human writers of the manual as the authors,
  2398. on the title page of the manual. If a company sponsored the work, thank
  2399. the company in a suitable place in the manual, but do not cite the
  2400. company as an author.
  2401. 
  2402. File: standards.info, Node: Printed Manuals, Next: NEWS File, Prev: Manual Credits, Up: Documentation
  2403. 6.6 Printed Manuals
  2404. ===================
  2405. The FSF publishes some GNU manuals in printed form. To encourage sales
  2406. of these manuals, the on-line versions of the manual should mention at
  2407. the very start that the printed manual is available and should point at
  2408. information for getting it--for instance, with a link to the page
  2409. `http://www.gnu.org/order/order.html'. This should not be included in
  2410. the printed manual, though, because there it is redundant.
  2411. It is also useful to explain in the on-line forms of the manual how
  2412. the user can print out the manual from the sources.
  2413. 
  2414. File: standards.info, Node: NEWS File, Next: Change Logs, Prev: Printed Manuals, Up: Documentation
  2415. 6.7 The NEWS File
  2416. =================
  2417. In addition to its manual, the package should have a file named `NEWS'
  2418. which contains a list of user-visible changes worth mentioning. In
  2419. each new release, add items to the front of the file and identify the
  2420. version they pertain to. Don't discard old items; leave them in the
  2421. file after the newer items. This way, a user upgrading from any
  2422. previous version can see what is new.
  2423. If the `NEWS' file gets very long, move some of the older items into
  2424. a file named `ONEWS' and put a note at the end referring the user to
  2425. that file.
  2426. 
  2427. File: standards.info, Node: Change Logs, Next: Man Pages, Prev: NEWS File, Up: Documentation
  2428. 6.8 Change Logs
  2429. ===============
  2430. Keep a change log to describe all the changes made to program source
  2431. files. The purpose of this is so that people investigating bugs in the
  2432. future will know about the changes that might have introduced the bug.
  2433. Often a new bug can be found by looking at what was recently changed.
  2434. More importantly, change logs can help you eliminate conceptual
  2435. inconsistencies between different parts of a program, by giving you a
  2436. history of how the conflicting concepts arose and who they came from.
  2437. * Menu:
  2438. * Change Log Concepts::
  2439. * Style of Change Logs::
  2440. * Simple Changes::
  2441. * Conditional Changes::
  2442. * Indicating the Part Changed::
  2443. 
  2444. File: standards.info, Node: Change Log Concepts, Next: Style of Change Logs, Up: Change Logs
  2445. 6.8.1 Change Log Concepts
  2446. -------------------------
  2447. You can think of the change log as a conceptual "undo list" which
  2448. explains how earlier versions were different from the current version.
  2449. People can see the current version; they don't need the change log to
  2450. tell them what is in it. What they want from a change log is a clear
  2451. explanation of how the earlier version differed.
  2452. The change log file is normally called `ChangeLog' and covers an
  2453. entire directory. Each directory can have its own change log, or a
  2454. directory can use the change log of its parent directory--it's up to
  2455. you.
  2456. Another alternative is to record change log information with a
  2457. version control system such as RCS or CVS. This can be converted
  2458. automatically to a `ChangeLog' file using `rcs2log'; in Emacs, the
  2459. command `C-x v a' (`vc-update-change-log') does the job.
  2460. There's no need to describe the full purpose of the changes or how
  2461. they work together. However, sometimes it is useful to write one line
  2462. to describe the overall purpose of a change or a batch of changes. If
  2463. you think that a change calls for explanation, you're probably right.
  2464. Please do explain it--but please put the full explanation in comments
  2465. in the code, where people will see it whenever they see the code. For
  2466. example, "New function" is enough for the change log when you add a
  2467. function, because there should be a comment before the function
  2468. definition to explain what it does.
  2469. In the past, we recommended not mentioning changes in non-software
  2470. files (manuals, help files, etc.) in change logs. However, we've been
  2471. advised that it is a good idea to include them, for the sake of
  2472. copyright records.
  2473. The easiest way to add an entry to `ChangeLog' is with the Emacs
  2474. command `M-x add-change-log-entry'. An entry should have an asterisk,
  2475. the name of the changed file, and then in parentheses the name of the
  2476. changed functions, variables or whatever, followed by a colon. Then
  2477. describe the changes you made to that function or variable.
  2478. 
  2479. File: standards.info, Node: Style of Change Logs, Next: Simple Changes, Prev: Change Log Concepts, Up: Change Logs
  2480. 6.8.2 Style of Change Logs
  2481. --------------------------
  2482. Here are some simple examples of change log entries, starting with the
  2483. header line that says who made the change and when it was installed,
  2484. followed by descriptions of specific changes. (These examples are
  2485. drawn from Emacs and GCC.)
  2486. 1998-08-17 Richard Stallman <rms@gnu.org>
  2487. * register.el (insert-register): Return nil.
  2488. (jump-to-register): Likewise.
  2489. * sort.el (sort-subr): Return nil.
  2490. * tex-mode.el (tex-bibtex-file, tex-file, tex-region):
  2491. Restart the tex shell if process is gone or stopped.
  2492. (tex-shell-running): New function.
  2493. * expr.c (store_one_arg): Round size up for move_block_to_reg.
  2494. (expand_call): Round up when emitting USE insns.
  2495. * stmt.c (assign_parms): Round size up for move_block_from_reg.
  2496. It's important to name the changed function or variable in full.
  2497. Don't abbreviate function or variable names, and don't combine them.
  2498. Subsequent maintainers will often search for a function name to find all
  2499. the change log entries that pertain to it; if you abbreviate the name,
  2500. they won't find it when they search.
  2501. For example, some people are tempted to abbreviate groups of function
  2502. names by writing `* register.el ({insert,jump-to}-register)'; this is
  2503. not a good idea, since searching for `jump-to-register' or
  2504. `insert-register' would not find that entry.
  2505. Separate unrelated change log entries with blank lines. When two
  2506. entries represent parts of the same change, so that they work together,
  2507. then don't put blank lines between them. Then you can omit the file
  2508. name and the asterisk when successive entries are in the same file.
  2509. Break long lists of function names by closing continued lines with
  2510. `)', rather than `,', and opening the continuation with `(' as in this
  2511. example:
  2512. * keyboard.c (menu_bar_items, tool_bar_items)
  2513. (Fexecute_extended_command): Deal with 'keymap' property.
  2514. When you install someone else's changes, put the contributor's name
  2515. in the change log entry rather than in the text of the entry. In other
  2516. words, write this:
  2517. 2002-07-14 John Doe <jdoe@gnu.org>
  2518. * sewing.c: Make it sew.
  2519. rather than this:
  2520. 2002-07-14 Usual Maintainer <usual@gnu.org>
  2521. * sewing.c: Make it sew. Patch by jdoe@gnu.org.
  2522. As for the date, that should be the date you applied the change.
  2523. 
  2524. File: standards.info, Node: Simple Changes, Next: Conditional Changes, Prev: Style of Change Logs, Up: Change Logs
  2525. 6.8.3 Simple Changes
  2526. --------------------
  2527. Certain simple kinds of changes don't need much detail in the change
  2528. log.
  2529. When you change the calling sequence of a function in a simple
  2530. fashion, and you change all the callers of the function to use the new
  2531. calling sequence, there is no need to make individual entries for all
  2532. the callers that you changed. Just write in the entry for the function
  2533. being called, "All callers changed"--like this:
  2534. * keyboard.c (Fcommand_execute): New arg SPECIAL.
  2535. All callers changed.
  2536. When you change just comments or doc strings, it is enough to write
  2537. an entry for the file, without mentioning the functions. Just "Doc
  2538. fixes" is enough for the change log.
  2539. There's no technical need to make change log entries for
  2540. documentation files. This is because documentation is not susceptible
  2541. to bugs that are hard to fix. Documentation does not consist of parts
  2542. that must interact in a precisely engineered fashion. To correct an
  2543. error, you need not know the history of the erroneous passage; it is
  2544. enough to compare what the documentation says with the way the program
  2545. actually works.
  2546. However, you should keep change logs for documentation files when the
  2547. project gets copyright assignments from its contributors, so as to make
  2548. the records of authorship more accurate.
  2549. 
  2550. File: standards.info, Node: Conditional Changes, Next: Indicating the Part Changed, Prev: Simple Changes, Up: Change Logs
  2551. 6.8.4 Conditional Changes
  2552. -------------------------
  2553. Source files can often contain code that is conditional to build-time
  2554. or static conditions. For example, C programs can contain compile-time
  2555. `#if' conditionals; programs implemented in interpreted languages can
  2556. contain module imports of function definitions that are only performed
  2557. for certain versions of the interpreter; and Automake `Makefile.am'
  2558. files can contain variable definitions or target declarations that are
  2559. only to be considered if a configure-time Automake conditional is true.
  2560. Many changes are conditional as well: sometimes you add a new
  2561. variable, or function, or even a new program or library, which is
  2562. entirely dependent on a build-time condition. It is useful to indicate
  2563. in the change log the conditions for which a change applies.
  2564. Our convention for indicating conditional changes is to use _square
  2565. brackets around the name of the condition_.
  2566. Conditional changes can happen in numerous scenarios and with many
  2567. variations, so here are some examples to help clarify. This first
  2568. example describes changes in C, Perl, and Python files which are
  2569. conditional but do not have an associated function or entity name:
  2570. * xterm.c [SOLARIS2]: Include <string.h>.
  2571. * FilePath.pm [$^O eq 'VMS']: Import the VMS::Feature module.
  2572. * framework.py [sys.version_info < (2, 6)]: Make "with" statement
  2573. available by importing it from __future__,
  2574. to support also python 2.5.
  2575. Our other examples will for simplicity be limited to C, as the minor
  2576. changes necessary to adapt them to other languages should be
  2577. self-evident.
  2578. Next, here is an entry describing a new definition which is entirely
  2579. conditional: the C macro `FRAME_WINDOW_P' is defined (and used) only
  2580. when the macro `HAVE_X_WINDOWS' is defined:
  2581. * frame.h [HAVE_X_WINDOWS] (FRAME_WINDOW_P): Macro defined.
  2582. Next, an entry for a change within the function `init_display',
  2583. whose definition as a whole is unconditional, but the changes
  2584. themselves are contained in a `#ifdef HAVE_LIBNCURSES' conditional:
  2585. * dispnew.c (init_display) [HAVE_LIBNCURSES]: If X, call tgetent.
  2586. Finally, here is an entry for a change that takes effect only when a
  2587. certain macro is _not_ defined:
  2588. (gethostname) [!HAVE_SOCKETS]: Replace with winsock version.
  2589. 
  2590. File: standards.info, Node: Indicating the Part Changed, Prev: Conditional Changes, Up: Change Logs
  2591. 6.8.5 Indicating the Part Changed
  2592. ---------------------------------
  2593. Indicate the part of a function which changed by using angle brackets
  2594. enclosing an indication of what the changed part does. Here is an entry
  2595. for a change in the part of the function `sh-while-getopts' that deals
  2596. with `sh' commands:
  2597. * progmodes/sh-script.el (sh-while-getopts) <sh>: Handle case that
  2598. user-specified option string is empty.
  2599. 
  2600. File: standards.info, Node: Man Pages, Next: Reading other Manuals, Prev: Change Logs, Up: Documentation
  2601. 6.9 Man Pages
  2602. =============
  2603. In the GNU project, man pages are secondary. It is not necessary or
  2604. expected for every GNU program to have a man page, but some of them do.
  2605. It's your choice whether to include a man page in your program.
  2606. When you make this decision, consider that supporting a man page
  2607. requires continual effort each time the program is changed. The time
  2608. you spend on the man page is time taken away from more useful work.
  2609. For a simple program which changes little, updating the man page may
  2610. be a small job. Then there is little reason not to include a man page,
  2611. if you have one.
  2612. For a large program that changes a great deal, updating a man page
  2613. may be a substantial burden. If a user offers to donate a man page,
  2614. you may find this gift costly to accept. It may be better to refuse
  2615. the man page unless the same person agrees to take full responsibility
  2616. for maintaining it--so that you can wash your hands of it entirely. If
  2617. this volunteer later ceases to do the job, then don't feel obliged to
  2618. pick it up yourself; it may be better to withdraw the man page from the
  2619. distribution until someone else agrees to update it.
  2620. When a program changes only a little, you may feel that the
  2621. discrepancies are small enough that the man page remains useful without
  2622. updating. If so, put a prominent note near the beginning of the man
  2623. page explaining that you don't maintain it and that the Texinfo manual
  2624. is more authoritative. The note should say how to access the Texinfo
  2625. documentation.
  2626. Be sure that man pages include a copyright statement and free
  2627. license. The simple all-permissive license is appropriate for simple
  2628. man pages (*note License Notices for Other Files: (maintain)License
  2629. Notices for Other Files.).
  2630. For long man pages, with enough explanation and documentation that
  2631. they can be considered true manuals, use the GFDL (*note License for
  2632. Manuals::).
  2633. Finally, the GNU help2man program
  2634. (`http://www.gnu.org/software/help2man/') is one way to automate
  2635. generation of a man page, in this case from `--help' output. This is
  2636. sufficient in many cases.
  2637. 
  2638. File: standards.info, Node: Reading other Manuals, Prev: Man Pages, Up: Documentation
  2639. 6.10 Reading other Manuals
  2640. ==========================
  2641. There may be non-free books or documentation files that describe the
  2642. program you are documenting.
  2643. It is ok to use these documents for reference, just as the author of
  2644. a new algebra textbook can read other books on algebra. A large portion
  2645. of any non-fiction book consists of facts, in this case facts about how
  2646. a certain program works, and these facts are necessarily the same for
  2647. everyone who writes about the subject. But be careful not to copy your
  2648. outline structure, wording, tables or examples from preexisting non-free
  2649. documentation. Copying from free documentation may be ok; please check
  2650. with the FSF about the individual case.
  2651. 
  2652. File: standards.info, Node: Managing Releases, Next: References, Prev: Documentation, Up: Top
  2653. 7 The Release Process
  2654. *********************
  2655. Making a release is more than just bundling up your source files in a
  2656. tar file and putting it up for FTP. You should set up your software so
  2657. that it can be configured to run on a variety of systems. Your Makefile
  2658. should conform to the GNU standards described below, and your directory
  2659. layout should also conform to the standards discussed below. Doing so
  2660. makes it easy to include your package into the larger framework of all
  2661. GNU software.
  2662. * Menu:
  2663. * Configuration:: How configuration of GNU packages should work.
  2664. * Makefile Conventions:: Makefile conventions.
  2665. * Releases:: Making releases
  2666. 
  2667. File: standards.info, Node: Configuration, Next: Makefile Conventions, Up: Managing Releases
  2668. 7.1 How Configuration Should Work
  2669. =================================
  2670. Each GNU distribution should come with a shell script named
  2671. `configure'. This script is given arguments which describe the kind of
  2672. machine and system you want to compile the program for. The
  2673. `configure' script must record the configuration options so that they
  2674. affect compilation.
  2675. The description here is the specification of the interface for the
  2676. `configure' script in GNU packages. Many packages implement it using
  2677. GNU Autoconf (*note Introduction: (autoconf)Top.) and/or GNU Automake
  2678. (*note Introduction: (automake)Top.), but you do not have to use these
  2679. tools. You can implement it any way you like; for instance, by making
  2680. `configure' be a wrapper around a completely different configuration
  2681. system.
  2682. Another way for the `configure' script to operate is to make a link
  2683. from a standard name such as `config.h' to the proper configuration
  2684. file for the chosen system. If you use this technique, the
  2685. distribution should _not_ contain a file named `config.h'. This is so
  2686. that people won't be able to build the program without configuring it
  2687. first.
  2688. Another thing that `configure' can do is to edit the Makefile. If
  2689. you do this, the distribution should _not_ contain a file named
  2690. `Makefile'. Instead, it should include a file `Makefile.in' which
  2691. contains the input used for editing. Once again, this is so that people
  2692. won't be able to build the program without configuring it first.
  2693. If `configure' does write the `Makefile', then `Makefile' should
  2694. have a target named `Makefile' which causes `configure' to be rerun,
  2695. setting up the same configuration that was set up last time. The files
  2696. that `configure' reads should be listed as dependencies of `Makefile'.
  2697. All the files which are output from the `configure' script should
  2698. have comments at the beginning explaining that they were generated
  2699. automatically using `configure'. This is so that users won't think of
  2700. trying to edit them by hand.
  2701. The `configure' script should write a file named `config.status'
  2702. which describes which configuration options were specified when the
  2703. program was last configured. This file should be a shell script which,
  2704. if run, will recreate the same configuration.
  2705. The `configure' script should accept an option of the form
  2706. `--srcdir=DIRNAME' to specify the directory where sources are found (if
  2707. it is not the current directory). This makes it possible to build the
  2708. program in a separate directory, so that the actual source directory is
  2709. not modified.
  2710. If the user does not specify `--srcdir', then `configure' should
  2711. check both `.' and `..' to see if it can find the sources. If it finds
  2712. the sources in one of these places, it should use them from there.
  2713. Otherwise, it should report that it cannot find the sources, and should
  2714. exit with nonzero status.
  2715. Usually the easy way to support `--srcdir' is by editing a
  2716. definition of `VPATH' into the Makefile. Some rules may need to refer
  2717. explicitly to the specified source directory. To make this possible,
  2718. `configure' can add to the Makefile a variable named `srcdir' whose
  2719. value is precisely the specified directory.
  2720. In addition, the `configure' script should take options
  2721. corresponding to most of the standard directory variables (*note
  2722. Directory Variables::). Here is the list:
  2723. --prefix --exec-prefix --bindir --sbindir --libexecdir --sysconfdir
  2724. --sharedstatedir --localstatedir --libdir --includedir --oldincludedir
  2725. --datarootdir --datadir --infodir --localedir --mandir --docdir
  2726. --htmldir --dvidir --pdfdir --psdir
  2727. The `configure' script should also take an argument which specifies
  2728. the type of system to build the program for. This argument should look
  2729. like this:
  2730. CPU-COMPANY-SYSTEM
  2731. For example, an Athlon-based GNU/Linux system might be
  2732. `i686-pc-linux-gnu'.
  2733. The `configure' script needs to be able to decode all plausible
  2734. alternatives for how to describe a machine. Thus,
  2735. `athlon-pc-gnu/linux' would be a valid alias. There is a shell script
  2736. called `config.sub'
  2737. (http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD)
  2738. that you can use as a subroutine to validate system types and
  2739. canonicalize aliases.
  2740. The `configure' script should also take the option
  2741. `--build=BUILDTYPE', which should be equivalent to a plain BUILDTYPE
  2742. argument. For example, `configure --build=i686-pc-linux-gnu' is
  2743. equivalent to `configure i686-pc-linux-gnu'. When the build type is
  2744. not specified by an option or argument, the `configure' script should
  2745. normally guess it using the shell script `config.guess'
  2746. (http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD).
  2747. Other options are permitted to specify in more detail the software
  2748. or hardware present on the machine, to include or exclude optional parts
  2749. of the package, or to adjust the name of some tools or arguments to
  2750. them:
  2751. `--enable-FEATURE[=PARAMETER]'
  2752. Configure the package to build and install an optional user-level
  2753. facility called FEATURE. This allows users to choose which
  2754. optional features to include. Giving an optional PARAMETER of
  2755. `no' should omit FEATURE, if it is built by default.
  2756. No `--enable' option should *ever* cause one feature to replace
  2757. another. No `--enable' option should ever substitute one useful
  2758. behavior for another useful behavior. The only proper use for
  2759. `--enable' is for questions of whether to build part of the program
  2760. or exclude it.
  2761. `--with-PACKAGE'
  2762. The package PACKAGE will be installed, so configure this package
  2763. to work with PACKAGE.
  2764. Possible values of PACKAGE include `gnu-as' (or `gas'), `gnu-ld',
  2765. `gnu-libc', `gdb', `x', and `x-toolkit'.
  2766. Do not use a `--with' option to specify the file name to use to
  2767. find certain files. That is outside the scope of what `--with'
  2768. options are for.
  2769. `VARIABLE=VALUE'
  2770. Set the value of the variable VARIABLE to VALUE. This is used to
  2771. override the default values of commands or arguments in the build
  2772. process. For example, the user could issue `configure CFLAGS=-g
  2773. CXXFLAGS=-g' to build with debugging information and without the
  2774. default optimization.
  2775. Specifying variables as arguments to `configure', like this:
  2776. ./configure CC=gcc
  2777. is preferable to setting them in environment variables:
  2778. CC=gcc ./configure
  2779. as it helps to recreate the same configuration later with
  2780. `config.status'. However, both methods should be supported.
  2781. All `configure' scripts should accept all of the "detail" options
  2782. and the variable settings, whether or not they make any difference to
  2783. the particular package at hand. In particular, they should accept any
  2784. option that starts with `--with-' or `--enable-'. This is so users
  2785. will be able to configure an entire GNU source tree at once with a
  2786. single set of options.
  2787. You will note that the categories `--with-' and `--enable-' are
  2788. narrow: they *do not* provide a place for any sort of option you might
  2789. think of. That is deliberate. We want to limit the possible
  2790. configuration options in GNU software. We do not want GNU programs to
  2791. have idiosyncratic configuration options.
  2792. Packages that perform part of the compilation process may support
  2793. cross-compilation. In such a case, the host and target machines for the
  2794. program may be different.
  2795. The `configure' script should normally treat the specified type of
  2796. system as both the host and the target, thus producing a program which
  2797. works for the same type of machine that it runs on.
  2798. To compile a program to run on a host type that differs from the
  2799. build type, use the configure option `--host=HOSTTYPE', where HOSTTYPE
  2800. uses the same syntax as BUILDTYPE. The host type normally defaults to
  2801. the build type.
  2802. To configure a cross-compiler, cross-assembler, or what have you, you
  2803. should specify a target different from the host, using the configure
  2804. option `--target=TARGETTYPE'. The syntax for TARGETTYPE is the same as
  2805. for the host type. So the command would look like this:
  2806. ./configure --host=HOSTTYPE --target=TARGETTYPE
  2807. The target type normally defaults to the host type. Programs for
  2808. which cross-operation is not meaningful need not accept the `--target'
  2809. option, because configuring an entire operating system for
  2810. cross-operation is not a meaningful operation.
  2811. Some programs have ways of configuring themselves automatically. If
  2812. your program is set up to do this, your `configure' script can simply
  2813. ignore most of its arguments.
  2814. 
  2815. File: standards.info, Node: Makefile Conventions, Next: Releases, Prev: Configuration, Up: Managing Releases
  2816. 7.2 Makefile Conventions
  2817. ========================
  2818. This node describes conventions for writing the Makefiles for GNU
  2819. programs. Using Automake will help you write a Makefile that follows
  2820. these conventions. For more information on portable Makefiles, see
  2821. POSIX and *note Portable Make Programming: (autoconf)Portable Make.
  2822. * Menu:
  2823. * Makefile Basics:: General conventions for Makefiles.
  2824. * Utilities in Makefiles:: Utilities to be used in Makefiles.
  2825. * Command Variables:: Variables for specifying commands.
  2826. * DESTDIR:: Supporting staged installs.
  2827. * Directory Variables:: Variables for installation directories.
  2828. * Standard Targets:: Standard targets for users.
  2829. * Install Command Categories:: Three categories of commands in the `install'
  2830. rule: normal, pre-install and post-install.
  2831. 
  2832. File: standards.info, Node: Makefile Basics, Next: Utilities in Makefiles, Up: Makefile Conventions
  2833. 7.2.1 General Conventions for Makefiles
  2834. ---------------------------------------
  2835. Every Makefile should contain this line:
  2836. SHELL = /bin/sh
  2837. to avoid trouble on systems where the `SHELL' variable might be
  2838. inherited from the environment. (This is never a problem with GNU
  2839. `make'.)
  2840. Different `make' programs have incompatible suffix lists and
  2841. implicit rules, and this sometimes creates confusion or misbehavior. So
  2842. it is a good idea to set the suffix list explicitly using only the
  2843. suffixes you need in the particular Makefile, like this:
  2844. .SUFFIXES:
  2845. .SUFFIXES: .c .o
  2846. The first line clears out the suffix list, the second introduces all
  2847. suffixes which may be subject to implicit rules in this Makefile.
  2848. Don't assume that `.' is in the path for command execution. When
  2849. you need to run programs that are a part of your package during the
  2850. make, please make sure that it uses `./' if the program is built as
  2851. part of the make or `$(srcdir)/' if the file is an unchanging part of
  2852. the source code. Without one of these prefixes, the current search
  2853. path is used.
  2854. The distinction between `./' (the "build directory") and
  2855. `$(srcdir)/' (the "source directory") is important because users can
  2856. build in a separate directory using the `--srcdir' option to
  2857. `configure'. A rule of the form:
  2858. foo.1 : foo.man sedscript
  2859. sed -f sedscript foo.man > foo.1
  2860. will fail when the build directory is not the source directory, because
  2861. `foo.man' and `sedscript' are in the source directory.
  2862. When using GNU `make', relying on `VPATH' to find the source file
  2863. will work in the case where there is a single dependency file, since
  2864. the `make' automatic variable `$<' will represent the source file
  2865. wherever it is. (Many versions of `make' set `$<' only in implicit
  2866. rules.) A Makefile target like
  2867. foo.o : bar.c
  2868. $(CC) -I. -I$(srcdir) $(CFLAGS) -c bar.c -o foo.o
  2869. should instead be written as
  2870. foo.o : bar.c
  2871. $(CC) -I. -I$(srcdir) $(CFLAGS) -c $< -o $@
  2872. in order to allow `VPATH' to work correctly. When the target has
  2873. multiple dependencies, using an explicit `$(srcdir)' is the easiest way
  2874. to make the rule work well. For example, the target above for `foo.1'
  2875. is best written as:
  2876. foo.1 : foo.man sedscript
  2877. sed -f $(srcdir)/sedscript $(srcdir)/foo.man > $@
  2878. GNU distributions usually contain some files which are not source
  2879. files--for example, Info files, and the output from Autoconf, Automake,
  2880. Bison or Flex. Since these files normally appear in the source
  2881. directory, they should always appear in the source directory, not in the
  2882. build directory. So Makefile rules to update them should put the
  2883. updated files in the source directory.
  2884. However, if a file does not appear in the distribution, then the
  2885. Makefile should not put it in the source directory, because building a
  2886. program in ordinary circumstances should not modify the source directory
  2887. in any way.
  2888. Try to make the build and installation targets, at least (and all
  2889. their subtargets) work correctly with a parallel `make'.
  2890. 
  2891. File: standards.info, Node: Utilities in Makefiles, Next: Command Variables, Prev: Makefile Basics, Up: Makefile Conventions
  2892. 7.2.2 Utilities in Makefiles
  2893. ----------------------------
  2894. Write the Makefile commands (and any shell scripts, such as
  2895. `configure') to run under `sh' (both the traditional Bourne shell and
  2896. the POSIX shell), not `csh'. Don't use any special features of `ksh'
  2897. or `bash', or POSIX features not widely supported in traditional Bourne
  2898. `sh'.
  2899. The `configure' script and the Makefile rules for building and
  2900. installation should not use any utilities directly except these:
  2901. awk cat cmp cp diff echo egrep expr false grep install-info ln ls
  2902. mkdir mv printf pwd rm rmdir sed sleep sort tar test touch tr true
  2903. Compression programs such as `gzip' can be used in the `dist' rule.
  2904. Generally, stick to the widely-supported (usually POSIX-specified)
  2905. options and features of these programs. For example, don't use `mkdir
  2906. -p', convenient as it may be, because a few systems don't support it at
  2907. all and with others, it is not safe for parallel execution. For a list
  2908. of known incompatibilities, see *note Portable Shell Programming:
  2909. (autoconf)Portable Shell.
  2910. It is a good idea to avoid creating symbolic links in makefiles,
  2911. since a few file systems don't support them.
  2912. The Makefile rules for building and installation can also use
  2913. compilers and related programs, but should do so via `make' variables
  2914. so that the user can substitute alternatives. Here are some of the
  2915. programs we mean:
  2916. ar bison cc flex install ld ldconfig lex
  2917. make makeinfo ranlib texi2dvi yacc
  2918. Use the following `make' variables to run those programs:
  2919. $(AR) $(BISON) $(CC) $(FLEX) $(INSTALL) $(LD) $(LDCONFIG) $(LEX)
  2920. $(MAKE) $(MAKEINFO) $(RANLIB) $(TEXI2DVI) $(YACC)
  2921. When you use `ranlib' or `ldconfig', you should make sure nothing
  2922. bad happens if the system does not have the program in question.
  2923. Arrange to ignore an error from that command, and print a message before
  2924. the command to tell the user that failure of this command does not mean
  2925. a problem. (The Autoconf `AC_PROG_RANLIB' macro can help with this.)
  2926. If you use symbolic links, you should implement a fallback for
  2927. systems that don't have symbolic links.
  2928. Additional utilities that can be used via Make variables are:
  2929. chgrp chmod chown mknod
  2930. It is ok to use other utilities in Makefile portions (or scripts)
  2931. intended only for particular systems where you know those utilities
  2932. exist.
  2933. 
  2934. File: standards.info, Node: Command Variables, Next: DESTDIR, Prev: Utilities in Makefiles, Up: Makefile Conventions
  2935. 7.2.3 Variables for Specifying Commands
  2936. ---------------------------------------
  2937. Makefiles should provide variables for overriding certain commands,
  2938. options, and so on.
  2939. In particular, you should run most utility programs via variables.
  2940. Thus, if you use Bison, have a variable named `BISON' whose default
  2941. value is set with `BISON = bison', and refer to it with `$(BISON)'
  2942. whenever you need to use Bison.
  2943. File management utilities such as `ln', `rm', `mv', and so on, need
  2944. not be referred to through variables in this way, since users don't
  2945. need to replace them with other programs.
  2946. Each program-name variable should come with an options variable that
  2947. is used to supply options to the program. Append `FLAGS' to the
  2948. program-name variable name to get the options variable name--for
  2949. example, `BISONFLAGS'. (The names `CFLAGS' for the C compiler,
  2950. `YFLAGS' for yacc, and `LFLAGS' for lex, are exceptions to this rule,
  2951. but we keep them because they are standard.) Use `CPPFLAGS' in any
  2952. compilation command that runs the preprocessor, and use `LDFLAGS' in
  2953. any compilation command that does linking as well as in any direct use
  2954. of `ld'.
  2955. If there are C compiler options that _must_ be used for proper
  2956. compilation of certain files, do not include them in `CFLAGS'. Users
  2957. expect to be able to specify `CFLAGS' freely themselves. Instead,
  2958. arrange to pass the necessary options to the C compiler independently
  2959. of `CFLAGS', by writing them explicitly in the compilation commands or
  2960. by defining an implicit rule, like this:
  2961. CFLAGS = -g
  2962. ALL_CFLAGS = -I. $(CFLAGS)
  2963. .c.o:
  2964. $(CC) -c $(CPPFLAGS) $(ALL_CFLAGS) $<
  2965. Do include the `-g' option in `CFLAGS', because that is not
  2966. _required_ for proper compilation. You can consider it a default that
  2967. is only recommended. If the package is set up so that it is compiled
  2968. with GCC by default, then you might as well include `-O' in the default
  2969. value of `CFLAGS' as well.
  2970. Put `CFLAGS' last in the compilation command, after other variables
  2971. containing compiler options, so the user can use `CFLAGS' to override
  2972. the others.
  2973. `CFLAGS' should be used in every invocation of the C compiler, both
  2974. those which do compilation and those which do linking.
  2975. Every Makefile should define the variable `INSTALL', which is the
  2976. basic command for installing a file into the system.
  2977. Every Makefile should also define the variables `INSTALL_PROGRAM'
  2978. and `INSTALL_DATA'. (The default for `INSTALL_PROGRAM' should be
  2979. `$(INSTALL)'; the default for `INSTALL_DATA' should be `${INSTALL} -m
  2980. 644'.) Then it should use those variables as the commands for actual
  2981. installation, for executables and non-executables respectively.
  2982. Minimal use of these variables is as follows:
  2983. $(INSTALL_PROGRAM) foo $(bindir)/foo
  2984. $(INSTALL_DATA) libfoo.a $(libdir)/libfoo.a
  2985. However, it is preferable to support a `DESTDIR' prefix on the
  2986. target files, as explained in the next section.
  2987. It is acceptable, but not required, to install multiple files in one
  2988. command, with the final argument being a directory, as in:
  2989. $(INSTALL_PROGRAM) foo bar baz $(bindir)
  2990. 
  2991. File: standards.info, Node: DESTDIR, Next: Directory Variables, Prev: Command Variables, Up: Makefile Conventions
  2992. 7.2.4 `DESTDIR': Support for Staged Installs
  2993. --------------------------------------------
  2994. `DESTDIR' is a variable prepended to each installed target file, like
  2995. this:
  2996. $(INSTALL_PROGRAM) foo $(DESTDIR)$(bindir)/foo
  2997. $(INSTALL_DATA) libfoo.a $(DESTDIR)$(libdir)/libfoo.a
  2998. The `DESTDIR' variable is specified by the user on the `make'
  2999. command line as an absolute file name. For example:
  3000. make DESTDIR=/tmp/stage install
  3001. `DESTDIR' should be supported only in the `install*' and `uninstall*'
  3002. targets, as those are the only targets where it is useful.
  3003. If your installation step would normally install
  3004. `/usr/local/bin/foo' and `/usr/local/lib/libfoo.a', then an
  3005. installation invoked as in the example above would install
  3006. `/tmp/stage/usr/local/bin/foo' and `/tmp/stage/usr/local/lib/libfoo.a'
  3007. instead.
  3008. Prepending the variable `DESTDIR' to each target in this way
  3009. provides for "staged installs", where the installed files are not
  3010. placed directly into their expected location but are instead copied
  3011. into a temporary location (`DESTDIR'). However, installed files
  3012. maintain their relative directory structure and any embedded file names
  3013. will not be modified.
  3014. You should not set the value of `DESTDIR' in your `Makefile' at all;
  3015. then the files are installed into their expected locations by default.
  3016. Also, specifying `DESTDIR' should not change the operation of the
  3017. software in any way, so its value should not be included in any file
  3018. contents.
  3019. `DESTDIR' support is commonly used in package creation. It is also
  3020. helpful to users who want to understand what a given package will
  3021. install where, and to allow users who don't normally have permissions
  3022. to install into protected areas to build and install before gaining
  3023. those permissions. Finally, it can be useful with tools such as
  3024. `stow', where code is installed in one place but made to appear to be
  3025. installed somewhere else using symbolic links or special mount
  3026. operations. So, we strongly recommend GNU packages support `DESTDIR',
  3027. though it is not an absolute requirement.
  3028. 
  3029. File: standards.info, Node: Directory Variables, Next: Standard Targets, Prev: DESTDIR, Up: Makefile Conventions
  3030. 7.2.5 Variables for Installation Directories
  3031. --------------------------------------------
  3032. Installation directories should always be named by variables, so it is
  3033. easy to install in a nonstandard place. The standard names for these
  3034. variables and the values they should have in GNU packages are described
  3035. below. They are based on a standard file system layout; variants of it
  3036. are used in GNU/Linux and other modern operating systems.
  3037. Installers are expected to override these values when calling `make'
  3038. (e.g., `make prefix=/usr install' or `configure' (e.g., `configure
  3039. --prefix=/usr'). GNU packages should not try to guess which value
  3040. should be appropriate for these variables on the system they are being
  3041. installed onto: use the default settings specified here so that all GNU
  3042. packages behave identically, allowing the installer to achieve any
  3043. desired layout.
  3044. All installation directories, and their parent directories, should be
  3045. created (if necessary) before they are installed into.
  3046. These first two variables set the root for the installation. All the
  3047. other installation directories should be subdirectories of one of these
  3048. two, and nothing should be directly installed into these two
  3049. directories.
  3050. `prefix'
  3051. A prefix used in constructing the default values of the variables
  3052. listed below. The default value of `prefix' should be
  3053. `/usr/local'. When building the complete GNU system, the prefix
  3054. will be empty and `/usr' will be a symbolic link to `/'. (If you
  3055. are using Autoconf, write it as `@prefix@'.)
  3056. Running `make install' with a different value of `prefix' from the
  3057. one used to build the program should _not_ recompile the program.
  3058. `exec_prefix'
  3059. A prefix used in constructing the default values of some of the
  3060. variables listed below. The default value of `exec_prefix' should
  3061. be `$(prefix)'. (If you are using Autoconf, write it as
  3062. `@exec_prefix@'.)
  3063. Generally, `$(exec_prefix)' is used for directories that contain
  3064. machine-specific files (such as executables and subroutine
  3065. libraries), while `$(prefix)' is used directly for other
  3066. directories.
  3067. Running `make install' with a different value of `exec_prefix'
  3068. from the one used to build the program should _not_ recompile the
  3069. program.
  3070. Executable programs are installed in one of the following
  3071. directories.
  3072. `bindir'
  3073. The directory for installing executable programs that users can
  3074. run. This should normally be `/usr/local/bin', but write it as
  3075. `$(exec_prefix)/bin'. (If you are using Autoconf, write it as
  3076. `@bindir@'.)
  3077. `sbindir'
  3078. The directory for installing executable programs that can be run
  3079. from the shell, but are only generally useful to system
  3080. administrators. This should normally be `/usr/local/sbin', but
  3081. write it as `$(exec_prefix)/sbin'. (If you are using Autoconf,
  3082. write it as `@sbindir@'.)
  3083. `libexecdir'
  3084. The directory for installing executable programs to be run by other
  3085. programs rather than by users. This directory should normally be
  3086. `/usr/local/libexec', but write it as `$(exec_prefix)/libexec'.
  3087. (If you are using Autoconf, write it as `@libexecdir@'.)
  3088. The definition of `libexecdir' is the same for all packages, so
  3089. you should install your data in a subdirectory thereof. Most
  3090. packages install their data under `$(libexecdir)/PACKAGE-NAME/',
  3091. possibly within additional subdirectories thereof, such as
  3092. `$(libexecdir)/PACKAGE-NAME/MACHINE/VERSION'.
  3093. Data files used by the program during its execution are divided into
  3094. categories in two ways.
  3095. * Some files are normally modified by programs; others are never
  3096. normally modified (though users may edit some of these).
  3097. * Some files are architecture-independent and can be shared by all
  3098. machines at a site; some are architecture-dependent and can be
  3099. shared only by machines of the same kind and operating system;
  3100. others may never be shared between two machines.
  3101. This makes for six different possibilities. However, we want to
  3102. discourage the use of architecture-dependent files, aside from object
  3103. files and libraries. It is much cleaner to make other data files
  3104. architecture-independent, and it is generally not hard.
  3105. Here are the variables Makefiles should use to specify directories
  3106. to put these various kinds of files in:
  3107. `datarootdir'
  3108. The root of the directory tree for read-only
  3109. architecture-independent data files. This should normally be
  3110. `/usr/local/share', but write it as `$(prefix)/share'. (If you
  3111. are using Autoconf, write it as `@datarootdir@'.) `datadir''s
  3112. default value is based on this variable; so are `infodir',
  3113. `mandir', and others.
  3114. `datadir'
  3115. The directory for installing idiosyncratic read-only
  3116. architecture-independent data files for this program. This is
  3117. usually the same place as `datarootdir', but we use the two
  3118. separate variables so that you can move these program-specific
  3119. files without altering the location for Info files, man pages, etc.
  3120. This should normally be `/usr/local/share', but write it as
  3121. `$(datarootdir)'. (If you are using Autoconf, write it as
  3122. `@datadir@'.)
  3123. The definition of `datadir' is the same for all packages, so you
  3124. should install your data in a subdirectory thereof. Most packages
  3125. install their data under `$(datadir)/PACKAGE-NAME/'.
  3126. `sysconfdir'
  3127. The directory for installing read-only data files that pertain to a
  3128. single machine-that is to say, files for configuring a host.
  3129. Mailer and network configuration files, `/etc/passwd', and so
  3130. forth belong here. All the files in this directory should be
  3131. ordinary ASCII text files. This directory should normally be
  3132. `/usr/local/etc', but write it as `$(prefix)/etc'. (If you are
  3133. using Autoconf, write it as `@sysconfdir@'.)
  3134. Do not install executables here in this directory (they probably
  3135. belong in `$(libexecdir)' or `$(sbindir)'). Also do not install
  3136. files that are modified in the normal course of their use (programs
  3137. whose purpose is to change the configuration of the system
  3138. excluded). Those probably belong in `$(localstatedir)'.
  3139. `sharedstatedir'
  3140. The directory for installing architecture-independent data files
  3141. which the programs modify while they run. This should normally be
  3142. `/usr/local/com', but write it as `$(prefix)/com'. (If you are
  3143. using Autoconf, write it as `@sharedstatedir@'.)
  3144. `localstatedir'
  3145. The directory for installing data files which the programs modify
  3146. while they run, and that pertain to one specific machine. Users
  3147. should never need to modify files in this directory to configure
  3148. the package's operation; put such configuration information in
  3149. separate files that go in `$(datadir)' or `$(sysconfdir)'.
  3150. `$(localstatedir)' should normally be `/usr/local/var', but write
  3151. it as `$(prefix)/var'. (If you are using Autoconf, write it as
  3152. `@localstatedir@'.)
  3153. These variables specify the directory for installing certain specific
  3154. types of files, if your program has them. Every GNU package should
  3155. have Info files, so every program needs `infodir', but not all need
  3156. `libdir' or `lispdir'.
  3157. `includedir'
  3158. The directory for installing header files to be included by user
  3159. programs with the C `#include' preprocessor directive. This
  3160. should normally be `/usr/local/include', but write it as
  3161. `$(prefix)/include'. (If you are using Autoconf, write it as
  3162. `@includedir@'.)
  3163. Most compilers other than GCC do not look for header files in
  3164. directory `/usr/local/include'. So installing the header files
  3165. this way is only useful with GCC. Sometimes this is not a problem
  3166. because some libraries are only really intended to work with GCC.
  3167. But some libraries are intended to work with other compilers.
  3168. They should install their header files in two places, one
  3169. specified by `includedir' and one specified by `oldincludedir'.
  3170. `oldincludedir'
  3171. The directory for installing `#include' header files for use with
  3172. compilers other than GCC. This should normally be `/usr/include'.
  3173. (If you are using Autoconf, you can write it as `@oldincludedir@'.)
  3174. The Makefile commands should check whether the value of
  3175. `oldincludedir' is empty. If it is, they should not try to use
  3176. it; they should cancel the second installation of the header files.
  3177. A package should not replace an existing header in this directory
  3178. unless the header came from the same package. Thus, if your Foo
  3179. package provides a header file `foo.h', then it should install the
  3180. header file in the `oldincludedir' directory if either (1) there
  3181. is no `foo.h' there or (2) the `foo.h' that exists came from the
  3182. Foo package.
  3183. To tell whether `foo.h' came from the Foo package, put a magic
  3184. string in the file--part of a comment--and `grep' for that string.
  3185. `docdir'
  3186. The directory for installing documentation files (other than Info)
  3187. for this package. By default, it should be
  3188. `/usr/local/share/doc/YOURPKG', but it should be written as
  3189. `$(datarootdir)/doc/YOURPKG'. (If you are using Autoconf, write
  3190. it as `@docdir@'.) The YOURPKG subdirectory, which may include a
  3191. version number, prevents collisions among files with common names,
  3192. such as `README'.
  3193. `infodir'
  3194. The directory for installing the Info files for this package. By
  3195. default, it should be `/usr/local/share/info', but it should be
  3196. written as `$(datarootdir)/info'. (If you are using Autoconf,
  3197. write it as `@infodir@'.) `infodir' is separate from `docdir' for
  3198. compatibility with existing practice.
  3199. `htmldir'
  3200. `dvidir'
  3201. `pdfdir'
  3202. `psdir'
  3203. Directories for installing documentation files in the particular
  3204. format. They should all be set to `$(docdir)' by default. (If
  3205. you are using Autoconf, write them as `@htmldir@', `@dvidir@',
  3206. etc.) Packages which supply several translations of their
  3207. documentation should install them in `$(htmldir)/'LL,
  3208. `$(pdfdir)/'LL, etc. where LL is a locale abbreviation such as
  3209. `en' or `pt_BR'.
  3210. `libdir'
  3211. The directory for object files and libraries of object code. Do
  3212. not install executables here, they probably ought to go in
  3213. `$(libexecdir)' instead. The value of `libdir' should normally be
  3214. `/usr/local/lib', but write it as `$(exec_prefix)/lib'. (If you
  3215. are using Autoconf, write it as `@libdir@'.)
  3216. `lispdir'
  3217. The directory for installing any Emacs Lisp files in this package.
  3218. By default, it should be `/usr/local/share/emacs/site-lisp', but it
  3219. should be written as `$(datarootdir)/emacs/site-lisp'.
  3220. If you are using Autoconf, write the default as `@lispdir@'. In
  3221. order to make `@lispdir@' work, you need the following lines in
  3222. your `configure.in' file:
  3223. lispdir='${datarootdir}/emacs/site-lisp'
  3224. AC_SUBST(lispdir)
  3225. `localedir'
  3226. The directory for installing locale-specific message catalogs for
  3227. this package. By default, it should be `/usr/local/share/locale',
  3228. but it should be written as `$(datarootdir)/locale'. (If you are
  3229. using Autoconf, write it as `@localedir@'.) This directory
  3230. usually has a subdirectory per locale.
  3231. Unix-style man pages are installed in one of the following:
  3232. `mandir'
  3233. The top-level directory for installing the man pages (if any) for
  3234. this package. It will normally be `/usr/local/share/man', but you
  3235. should write it as `$(datarootdir)/man'. (If you are using
  3236. Autoconf, write it as `@mandir@'.)
  3237. `man1dir'
  3238. The directory for installing section 1 man pages. Write it as
  3239. `$(mandir)/man1'.
  3240. `man2dir'
  3241. The directory for installing section 2 man pages. Write it as
  3242. `$(mandir)/man2'
  3243. `...'
  3244. *Don't make the primary documentation for any GNU software be a
  3245. man page. Write a manual in Texinfo instead. Man pages are just
  3246. for the sake of people running GNU software on Unix, which is a
  3247. secondary application only.*
  3248. `manext'
  3249. The file name extension for the installed man page. This should
  3250. contain a period followed by the appropriate digit; it should
  3251. normally be `.1'.
  3252. `man1ext'
  3253. The file name extension for installed section 1 man pages.
  3254. `man2ext'
  3255. The file name extension for installed section 2 man pages.
  3256. `...'
  3257. Use these names instead of `manext' if the package needs to
  3258. install man pages in more than one section of the manual.
  3259. And finally, you should set the following variable:
  3260. `srcdir'
  3261. The directory for the sources being compiled. The value of this
  3262. variable is normally inserted by the `configure' shell script.
  3263. (If you are using Autoconf, use `srcdir = @srcdir@'.)
  3264. For example:
  3265. # Common prefix for installation directories.
  3266. # NOTE: This directory must exist when you start the install.
  3267. prefix = /usr/local
  3268. datarootdir = $(prefix)/share
  3269. datadir = $(datarootdir)
  3270. exec_prefix = $(prefix)
  3271. # Where to put the executable for the command `gcc'.
  3272. bindir = $(exec_prefix)/bin
  3273. # Where to put the directories used by the compiler.
  3274. libexecdir = $(exec_prefix)/libexec
  3275. # Where to put the Info files.
  3276. infodir = $(datarootdir)/info
  3277. If your program installs a large number of files into one of the
  3278. standard user-specified directories, it might be useful to group them
  3279. into a subdirectory particular to that program. If you do this, you
  3280. should write the `install' rule to create these subdirectories.
  3281. Do not expect the user to include the subdirectory name in the value
  3282. of any of the variables listed above. The idea of having a uniform set
  3283. of variable names for installation directories is to enable the user to
  3284. specify the exact same values for several different GNU packages. In
  3285. order for this to be useful, all the packages must be designed so that
  3286. they will work sensibly when the user does so.
  3287. At times, not all of these variables may be implemented in the
  3288. current release of Autoconf and/or Automake; but as of Autoconf 2.60, we
  3289. believe all of them are. When any are missing, the descriptions here
  3290. serve as specifications for what Autoconf will implement. As a
  3291. programmer, you can either use a development version of Autoconf or
  3292. avoid using these variables until a stable release is made which
  3293. supports them.
  3294. 
  3295. File: standards.info, Node: Standard Targets, Next: Install Command Categories, Prev: Directory Variables, Up: Makefile Conventions
  3296. 7.2.6 Standard Targets for Users
  3297. --------------------------------
  3298. All GNU programs should have the following targets in their Makefiles:
  3299. `all'
  3300. Compile the entire program. This should be the default target.
  3301. This target need not rebuild any documentation files; Info files
  3302. should normally be included in the distribution, and DVI (and other
  3303. documentation format) files should be made only when explicitly
  3304. asked for.
  3305. By default, the Make rules should compile and link with `-g', so
  3306. that executable programs have debugging symbols. Otherwise, you
  3307. are essentially helpless in the face of a crash, and it is often
  3308. far from easy to reproduce with a fresh build.
  3309. `install'
  3310. Compile the program and copy the executables, libraries, and so on
  3311. to the file names where they should reside for actual use. If
  3312. there is a simple test to verify that a program is properly
  3313. installed, this target should run that test.
  3314. Do not strip executables when installing them. This helps eventual
  3315. debugging that may be needed later, and nowadays disk space is
  3316. cheap and dynamic loaders typically ensure debug sections are not
  3317. loaded during normal execution. Users that need stripped binaries
  3318. may invoke the `install-strip' target to do that.
  3319. If possible, write the `install' target rule so that it does not
  3320. modify anything in the directory where the program was built,
  3321. provided `make all' has just been done. This is convenient for
  3322. building the program under one user name and installing it under
  3323. another.
  3324. The commands should create all the directories in which files are
  3325. to be installed, if they don't already exist. This includes the
  3326. directories specified as the values of the variables `prefix' and
  3327. `exec_prefix', as well as all subdirectories that are needed. One
  3328. way to do this is by means of an `installdirs' target as described
  3329. below.
  3330. Use `-' before any command for installing a man page, so that
  3331. `make' will ignore any errors. This is in case there are systems
  3332. that don't have the Unix man page documentation system installed.
  3333. The way to install Info files is to copy them into `$(infodir)'
  3334. with `$(INSTALL_DATA)' (*note Command Variables::), and then run
  3335. the `install-info' program if it is present. `install-info' is a
  3336. program that edits the Info `dir' file to add or update the menu
  3337. entry for the given Info file; it is part of the Texinfo package.
  3338. Here is a sample rule to install an Info file that also tries to
  3339. handle some additional situations, such as `install-info' not
  3340. being present.
  3341. do-install-info: foo.info installdirs
  3342. $(NORMAL_INSTALL)
  3343. # Prefer an info file in . to one in srcdir.
  3344. if test -f foo.info; then d=.; \
  3345. else d="$(srcdir)"; fi; \
  3346. $(INSTALL_DATA) $$d/foo.info \
  3347. "$(DESTDIR)$(infodir)/foo.info"
  3348. # Run install-info only if it exists.
  3349. # Use `if' instead of just prepending `-' to the
  3350. # line so we notice real errors from install-info.
  3351. # Use `$(SHELL) -c' because some shells do not
  3352. # fail gracefully when there is an unknown command.
  3353. $(POST_INSTALL)
  3354. if $(SHELL) -c 'install-info --version' \
  3355. >/dev/null 2>&1; then \
  3356. install-info --dir-file="$(DESTDIR)$(infodir)/dir" \
  3357. "$(DESTDIR)$(infodir)/foo.info"; \
  3358. else true; fi
  3359. When writing the `install' target, you must classify all the
  3360. commands into three categories: normal ones, "pre-installation"
  3361. commands and "post-installation" commands. *Note Install Command
  3362. Categories::.
  3363. `install-html'
  3364. `install-dvi'
  3365. `install-pdf'
  3366. `install-ps'
  3367. These targets install documentation in formats other than Info;
  3368. they're intended to be called explicitly by the person installing
  3369. the package, if that format is desired. GNU prefers Info files,
  3370. so these must be installed by the `install' target.
  3371. When you have many documentation files to install, we recommend
  3372. that you avoid collisions and clutter by arranging for these
  3373. targets to install in subdirectories of the appropriate
  3374. installation directory, such as `htmldir'. As one example, if
  3375. your package has multiple manuals, and you wish to install HTML
  3376. documentation with many files (such as the "split" mode output by
  3377. `makeinfo --html'), you'll certainly want to use subdirectories,
  3378. or two nodes with the same name in different manuals will
  3379. overwrite each other.
  3380. Please make these `install-FORMAT' targets invoke the commands for
  3381. the FORMAT target, for example, by making FORMAT a dependency.
  3382. `uninstall'
  3383. Delete all the installed files--the copies that the `install' and
  3384. `install-*' targets create.
  3385. This rule should not modify the directories where compilation is
  3386. done, only the directories where files are installed.
  3387. The uninstallation commands are divided into three categories,
  3388. just like the installation commands. *Note Install Command
  3389. Categories::.
  3390. `install-strip'
  3391. Like `install', but strip the executable files while installing
  3392. them. In simple cases, this target can use the `install' target in
  3393. a simple way:
  3394. install-strip:
  3395. $(MAKE) INSTALL_PROGRAM='$(INSTALL_PROGRAM) -s' \
  3396. install
  3397. But if the package installs scripts as well as real executables,
  3398. the `install-strip' target can't just refer to the `install'
  3399. target; it has to strip the executables but not the scripts.
  3400. `install-strip' should not strip the executables in the build
  3401. directory which are being copied for installation. It should only
  3402. strip the copies that are installed.
  3403. Normally we do not recommend stripping an executable unless you
  3404. are sure the program has no bugs. However, it can be reasonable
  3405. to install a stripped executable for actual execution while saving
  3406. the unstripped executable elsewhere in case there is a bug.
  3407. `clean'
  3408. Delete all files in the current directory that are normally
  3409. created by building the program. Also delete files in other
  3410. directories if they are created by this makefile. However, don't
  3411. delete the files that record the configuration. Also preserve
  3412. files that could be made by building, but normally aren't because
  3413. the distribution comes with them. There is no need to delete
  3414. parent directories that were created with `mkdir -p', since they
  3415. could have existed anyway.
  3416. Delete `.dvi' files here if they are not part of the distribution.
  3417. `distclean'
  3418. Delete all files in the current directory (or created by this
  3419. makefile) that are created by configuring or building the program.
  3420. If you have unpacked the source and built the program without
  3421. creating any other files, `make distclean' should leave only the
  3422. files that were in the distribution. However, there is no need to
  3423. delete parent directories that were created with `mkdir -p', since
  3424. they could have existed anyway.
  3425. `mostlyclean'
  3426. Like `clean', but may refrain from deleting a few files that people
  3427. normally don't want to recompile. For example, the `mostlyclean'
  3428. target for GCC does not delete `libgcc.a', because recompiling it
  3429. is rarely necessary and takes a lot of time.
  3430. `maintainer-clean'
  3431. Delete almost everything that can be reconstructed with this
  3432. Makefile. This typically includes everything deleted by
  3433. `distclean', plus more: C source files produced by Bison, tags
  3434. tables, Info files, and so on.
  3435. The reason we say "almost everything" is that running the command
  3436. `make maintainer-clean' should not delete `configure' even if
  3437. `configure' can be remade using a rule in the Makefile. More
  3438. generally, `make maintainer-clean' should not delete anything that
  3439. needs to exist in order to run `configure' and then begin to build
  3440. the program. Also, there is no need to delete parent directories
  3441. that were created with `mkdir -p', since they could have existed
  3442. anyway. These are the only exceptions; `maintainer-clean' should
  3443. delete everything else that can be rebuilt.
  3444. The `maintainer-clean' target is intended to be used by a
  3445. maintainer of the package, not by ordinary users. You may need
  3446. special tools to reconstruct some of the files that `make
  3447. maintainer-clean' deletes. Since these files are normally
  3448. included in the distribution, we don't take care to make them easy
  3449. to reconstruct. If you find you need to unpack the full
  3450. distribution again, don't blame us.
  3451. To help make users aware of this, the commands for the special
  3452. `maintainer-clean' target should start with these two:
  3453. @echo 'This command is intended for maintainers to use; it'
  3454. @echo 'deletes files that may need special tools to rebuild.'
  3455. `TAGS'
  3456. Update a tags table for this program.
  3457. `info'
  3458. Generate any Info files needed. The best way to write the rules
  3459. is as follows:
  3460. info: foo.info
  3461. foo.info: foo.texi chap1.texi chap2.texi
  3462. $(MAKEINFO) $(srcdir)/foo.texi
  3463. You must define the variable `MAKEINFO' in the Makefile. It should
  3464. run the `makeinfo' program, which is part of the Texinfo
  3465. distribution.
  3466. Normally a GNU distribution comes with Info files, and that means
  3467. the Info files are present in the source directory. Therefore,
  3468. the Make rule for an info file should update it in the source
  3469. directory. When users build the package, ordinarily Make will not
  3470. update the Info files because they will already be up to date.
  3471. `dvi'
  3472. `html'
  3473. `pdf'
  3474. `ps'
  3475. Generate documentation files in the given format. These targets
  3476. should always exist, but any or all can be a no-op if the given
  3477. output format cannot be generated. These targets should not be
  3478. dependencies of the `all' target; the user must manually invoke
  3479. them.
  3480. Here's an example rule for generating DVI files from Texinfo:
  3481. dvi: foo.dvi
  3482. foo.dvi: foo.texi chap1.texi chap2.texi
  3483. $(TEXI2DVI) $(srcdir)/foo.texi
  3484. You must define the variable `TEXI2DVI' in the Makefile. It
  3485. should run the program `texi2dvi', which is part of the Texinfo
  3486. distribution. (`texi2dvi' uses TeX to do the real work of
  3487. formatting. TeX is not distributed with Texinfo.) Alternatively,
  3488. write only the dependencies, and allow GNU `make' to provide the
  3489. command.
  3490. Here's another example, this one for generating HTML from Texinfo:
  3491. html: foo.html
  3492. foo.html: foo.texi chap1.texi chap2.texi
  3493. $(TEXI2HTML) $(srcdir)/foo.texi
  3494. Again, you would define the variable `TEXI2HTML' in the Makefile;
  3495. for example, it might run `makeinfo --no-split --html' (`makeinfo'
  3496. is part of the Texinfo distribution).
  3497. `dist'
  3498. Create a distribution tar file for this program. The tar file
  3499. should be set up so that the file names in the tar file start with
  3500. a subdirectory name which is the name of the package it is a
  3501. distribution for. This name can include the version number.
  3502. For example, the distribution tar file of GCC version 1.40 unpacks
  3503. into a subdirectory named `gcc-1.40'.
  3504. The easiest way to do this is to create a subdirectory
  3505. appropriately named, use `ln' or `cp' to install the proper files
  3506. in it, and then `tar' that subdirectory.
  3507. Compress the tar file with `gzip'. For example, the actual
  3508. distribution file for GCC version 1.40 is called `gcc-1.40.tar.gz'.
  3509. It is ok to support other free compression formats as well.
  3510. The `dist' target should explicitly depend on all non-source files
  3511. that are in the distribution, to make sure they are up to date in
  3512. the distribution. *Note Making Releases: Releases.
  3513. `check'
  3514. Perform self-tests (if any). The user must build the program
  3515. before running the tests, but need not install the program; you
  3516. should write the self-tests so that they work when the program is
  3517. built but not installed.
  3518. The following targets are suggested as conventional names, for
  3519. programs in which they are useful.
  3520. `installcheck'
  3521. Perform installation tests (if any). The user must build and
  3522. install the program before running the tests. You should not
  3523. assume that `$(bindir)' is in the search path.
  3524. `installdirs'
  3525. It's useful to add a target named `installdirs' to create the
  3526. directories where files are installed, and their parent
  3527. directories. There is a script called `mkinstalldirs' which is
  3528. convenient for this; you can find it in the Gnulib package. You
  3529. can use a rule like this:
  3530. # Make sure all installation directories (e.g. $(bindir))
  3531. # actually exist by making them if necessary.
  3532. installdirs: mkinstalldirs
  3533. $(srcdir)/mkinstalldirs $(bindir) $(datadir) \
  3534. $(libdir) $(infodir) \
  3535. $(mandir)
  3536. or, if you wish to support `DESTDIR' (strongly encouraged),
  3537. # Make sure all installation directories (e.g. $(bindir))
  3538. # actually exist by making them if necessary.
  3539. installdirs: mkinstalldirs
  3540. $(srcdir)/mkinstalldirs \
  3541. $(DESTDIR)$(bindir) $(DESTDIR)$(datadir) \
  3542. $(DESTDIR)$(libdir) $(DESTDIR)$(infodir) \
  3543. $(DESTDIR)$(mandir)
  3544. This rule should not modify the directories where compilation is
  3545. done. It should do nothing but create installation directories.
  3546. 
  3547. File: standards.info, Node: Install Command Categories, Prev: Standard Targets, Up: Makefile Conventions
  3548. 7.2.7 Install Command Categories
  3549. --------------------------------
  3550. When writing the `install' target, you must classify all the commands
  3551. into three categories: normal ones, "pre-installation" commands and
  3552. "post-installation" commands.
  3553. Normal commands move files into their proper places, and set their
  3554. modes. They may not alter any files except the ones that come entirely
  3555. from the package they belong to.
  3556. Pre-installation and post-installation commands may alter other
  3557. files; in particular, they can edit global configuration files or data
  3558. bases.
  3559. Pre-installation commands are typically executed before the normal
  3560. commands, and post-installation commands are typically run after the
  3561. normal commands.
  3562. The most common use for a post-installation command is to run
  3563. `install-info'. This cannot be done with a normal command, since it
  3564. alters a file (the Info directory) which does not come entirely and
  3565. solely from the package being installed. It is a post-installation
  3566. command because it needs to be done after the normal command which
  3567. installs the package's Info files.
  3568. Most programs don't need any pre-installation commands, but we have
  3569. the feature just in case it is needed.
  3570. To classify the commands in the `install' rule into these three
  3571. categories, insert "category lines" among them. A category line
  3572. specifies the category for the commands that follow.
  3573. A category line consists of a tab and a reference to a special Make
  3574. variable, plus an optional comment at the end. There are three
  3575. variables you can use, one for each category; the variable name
  3576. specifies the category. Category lines are no-ops in ordinary execution
  3577. because these three Make variables are normally undefined (and you
  3578. _should not_ define them in the makefile).
  3579. Here are the three possible category lines, each with a comment that
  3580. explains what it means:
  3581. $(PRE_INSTALL) # Pre-install commands follow.
  3582. $(POST_INSTALL) # Post-install commands follow.
  3583. $(NORMAL_INSTALL) # Normal commands follow.
  3584. If you don't use a category line at the beginning of the `install'
  3585. rule, all the commands are classified as normal until the first category
  3586. line. If you don't use any category lines, all the commands are
  3587. classified as normal.
  3588. These are the category lines for `uninstall':
  3589. $(PRE_UNINSTALL) # Pre-uninstall commands follow.
  3590. $(POST_UNINSTALL) # Post-uninstall commands follow.
  3591. $(NORMAL_UNINSTALL) # Normal commands follow.
  3592. Typically, a pre-uninstall command would be used for deleting entries
  3593. from the Info directory.
  3594. If the `install' or `uninstall' target has any dependencies which
  3595. act as subroutines of installation, then you should start _each_
  3596. dependency's commands with a category line, and start the main target's
  3597. commands with a category line also. This way, you can ensure that each
  3598. command is placed in the right category regardless of which of the
  3599. dependencies actually run.
  3600. Pre-installation and post-installation commands should not run any
  3601. programs except for these:
  3602. [ basename bash cat chgrp chmod chown cmp cp dd diff echo
  3603. egrep expand expr false fgrep find getopt grep gunzip gzip
  3604. hostname install install-info kill ldconfig ln ls md5sum
  3605. mkdir mkfifo mknod mv printenv pwd rm rmdir sed sort tee
  3606. test touch true uname xargs yes
  3607. The reason for distinguishing the commands in this way is for the
  3608. sake of making binary packages. Typically a binary package contains
  3609. all the executables and other files that need to be installed, and has
  3610. its own method of installing them--so it does not need to run the normal
  3611. installation commands. But installing the binary package does need to
  3612. execute the pre-installation and post-installation commands.
  3613. Programs to build binary packages work by extracting the
  3614. pre-installation and post-installation commands. Here is one way of
  3615. extracting the pre-installation commands (the `-s' option to `make' is
  3616. needed to silence messages about entering subdirectories):
  3617. make -s -n install -o all \
  3618. PRE_INSTALL=pre-install \
  3619. POST_INSTALL=post-install \
  3620. NORMAL_INSTALL=normal-install \
  3621. | gawk -f pre-install.awk
  3622. where the file `pre-install.awk' could contain this:
  3623. $0 ~ /^(normal-install|post-install)[ \t]*$/ {on = 0}
  3624. on {print $0}
  3625. $0 ~ /^pre-install[ \t]*$/ {on = 1}
  3626. 
  3627. File: standards.info, Node: Releases, Prev: Makefile Conventions, Up: Managing Releases
  3628. 7.3 Making Releases
  3629. ===================
  3630. You should identify each release with a pair of version numbers, a
  3631. major version and a minor. We have no objection to using more than two
  3632. numbers, but it is very unlikely that you really need them.
  3633. Package the distribution of `Foo version 69.96' up in a gzipped tar
  3634. file with the name `foo-69.96.tar.gz'. It should unpack into a
  3635. subdirectory named `foo-69.96'.
  3636. Building and installing the program should never modify any of the
  3637. files contained in the distribution. This means that all the files
  3638. that form part of the program in any way must be classified into "source
  3639. files" and "non-source files". Source files are written by humans and
  3640. never changed automatically; non-source files are produced from source
  3641. files by programs under the control of the Makefile.
  3642. The distribution should contain a file named `README' which gives
  3643. the name of the package, and a general description of what it does. It
  3644. is also good to explain the purpose of each of the first-level
  3645. subdirectories in the package, if there are any. The `README' file
  3646. should either state the version number of the package, or refer to where
  3647. in the package it can be found.
  3648. The `README' file should refer to the file `INSTALL', which should
  3649. contain an explanation of the installation procedure.
  3650. The `README' file should also refer to the file which contains the
  3651. copying conditions. The GNU GPL, if used, should be in a file called
  3652. `COPYING'. If the GNU LGPL is used, it should be in a file called
  3653. `COPYING.LESSER'.
  3654. Naturally, all the source files must be in the distribution. It is
  3655. okay to include non-source files in the distribution along with the
  3656. source files they are generated from, provided they are up-to-date with
  3657. the source they are made from, and machine-independent, so that normal
  3658. building of the distribution will never modify them. We commonly
  3659. include non-source files produced by Autoconf, Automake, Bison, `lex',
  3660. TeX, and `makeinfo'; this helps avoid unnecessary dependencies between
  3661. our distributions, so that users can install whichever packages they
  3662. want to install.
  3663. Non-source files that might actually be modified by building and
  3664. installing the program should *never* be included in the distribution.
  3665. So if you do distribute non-source files, always make sure they are up
  3666. to date when you make a new distribution.
  3667. Make sure that all the files in the distribution are world-readable,
  3668. and that directories are world-readable and world-searchable (octal
  3669. mode 755). We used to recommend that all directories in the
  3670. distribution also be world-writable (octal mode 777), because ancient
  3671. versions of `tar' would otherwise not cope when extracting the archive
  3672. as an unprivileged user. That can easily lead to security issues when
  3673. creating the archive, however, so now we recommend against that.
  3674. Don't include any symbolic links in the distribution itself. If the
  3675. tar file contains symbolic links, then people cannot even unpack it on
  3676. systems that don't support symbolic links. Also, don't use multiple
  3677. names for one file in different directories, because certain file
  3678. systems cannot handle this and that prevents unpacking the distribution.
  3679. Try to make sure that all the file names will be unique on MS-DOS. A
  3680. name on MS-DOS consists of up to 8 characters, optionally followed by a
  3681. period and up to three characters. MS-DOS will truncate extra
  3682. characters both before and after the period. Thus, `foobarhacker.c'
  3683. and `foobarhacker.o' are not ambiguous; they are truncated to
  3684. `foobarha.c' and `foobarha.o', which are distinct.
  3685. Include in your distribution a copy of the `texinfo.tex' you used to
  3686. test print any `*.texinfo' or `*.texi' files.
  3687. Likewise, if your program uses small GNU software packages like
  3688. regex, getopt, obstack, or termcap, include them in the distribution
  3689. file. Leaving them out would make the distribution file a little
  3690. smaller at the expense of possible inconvenience to a user who doesn't
  3691. know what other files to get.
  3692. 
  3693. File: standards.info, Node: References, Next: GNU Free Documentation License, Prev: Managing Releases, Up: Top
  3694. 8 References to Non-Free Software and Documentation
  3695. ***************************************************
  3696. A GNU program should not recommend, promote, or grant legitimacy to the
  3697. use of any non-free program. Proprietary software is a social and
  3698. ethical problem, and our aim is to put an end to that problem. We
  3699. can't stop some people from writing proprietary programs, or stop other
  3700. people from using them, but we can and should refuse to advertise them
  3701. to new potential customers, or to give the public the idea that their
  3702. existence is ethical.
  3703. The GNU definition of free software is found on the GNU web site at
  3704. `http://www.gnu.org/philosophy/free-sw.html', and the definition of
  3705. free documentation is found at
  3706. `http://www.gnu.org/philosophy/free-doc.html'. The terms "free" and
  3707. "non-free", used in this document, refer to those definitions.
  3708. A list of important licenses and whether they qualify as free is in
  3709. `http://www.gnu.org/licenses/license-list.html'. If it is not clear
  3710. whether a license qualifies as free, please ask the GNU Project by
  3711. writing to <licensing@gnu.org>. We will answer, and if the license is
  3712. an important one, we will add it to the list.
  3713. When a non-free program or system is well known, you can mention it
  3714. in passing--that is harmless, since users who might want to use it
  3715. probably already know about it. For instance, it is fine to explain
  3716. how to build your package on top of some widely used non-free operating
  3717. system, or how to use it together with some widely used non-free
  3718. program.
  3719. However, you should give only the necessary information to help those
  3720. who already use the non-free program to use your program with it--don't
  3721. give, or refer to, any further information about the proprietary
  3722. program, and don't imply that the proprietary program enhances your
  3723. program, or that its existence is in any way a good thing. The goal
  3724. should be that people already using the proprietary program will get
  3725. the advice they need about how to use your free program with it, while
  3726. people who don't already use the proprietary program will not see
  3727. anything likely to lead them to take an interest in it.
  3728. If a non-free program or system is obscure in your program's domain,
  3729. your program should not mention or support it at all, since doing so
  3730. would tend to popularize the non-free program more than it popularizes
  3731. your program. (You cannot hope to find many additional users for your
  3732. program among the users of Foobar, if the existence of Foobar is not
  3733. generally known among people who might want to use your program.)
  3734. Sometimes a program is free software in itself but depends on a
  3735. non-free platform in order to run. For instance, many Java programs
  3736. depend on some non-free Java libraries. To recommend or promote such a
  3737. program is to promote the other programs it needs. This is why we are
  3738. careful about listing Java programs in the Free Software Directory: we
  3739. don't want to promote the non-free Java libraries.
  3740. We hope this particular problem with Java will be gone by and by, as
  3741. we replace the remaining non-free standard Java libraries with free
  3742. software, but the general principle will remain the same: don't
  3743. recommend, promote or legitimize programs that depend on non-free
  3744. software to run.
  3745. Some free programs strongly encourage the use of non-free software.
  3746. A typical example is `mplayer'. It is free software in itself, and the
  3747. free code can handle some kinds of files. However, `mplayer'
  3748. recommends use of non-free codecs for other kinds of files, and users
  3749. that install `mplayer' are very likely to install those codecs along
  3750. with it. To recommend `mplayer' is, in effect, to promote use of the
  3751. non-free codecs.
  3752. Thus, you should not recommend programs that strongly encourage the
  3753. use of non-free software. This is why we do not list `mplayer' in the
  3754. Free Software Directory.
  3755. A GNU package should not refer the user to any non-free documentation
  3756. for free software. Free documentation that can be included in free
  3757. operating systems is essential for completing the GNU system, or any
  3758. free operating system, so encouraging it is a priority; to recommend
  3759. use of documentation that we are not allowed to include undermines the
  3760. impetus for the community to produce documentation that we can include.
  3761. So GNU packages should never recommend non-free documentation.
  3762. By contrast, it is ok to refer to journal articles and textbooks in
  3763. the comments of a program for explanation of how it functions, even
  3764. though they are non-free. This is because we don't include such things
  3765. in the GNU system even if they are free--they are outside the scope of
  3766. what a software distribution needs to include.
  3767. Referring to a web site that describes or recommends a non-free
  3768. program is promoting that program, so please do not make links to (or
  3769. mention by name) web sites that contain such material. This policy is
  3770. relevant particularly for the web pages for a GNU package.
  3771. Following links from nearly any web site can lead eventually to
  3772. non-free software; this is inherent in the nature of the web. So it
  3773. makes no sense to criticize a site for having such links. As long as
  3774. the site does not itself recommend a non-free program, there is no need
  3775. to consider the question of the sites that it links to for other
  3776. reasons.
  3777. Thus, for example, you should not refer to AT&T's web site if that
  3778. recommends AT&T's non-free software packages; you should not refer to a
  3779. site that links to AT&T's site presenting it as a place to get some
  3780. non-free program, because that link recommends and legitimizes the
  3781. non-free program. However, that a site contains a link to AT&T's web
  3782. site for some other purpose (such as long-distance telephone service)
  3783. is not an objection against it.
  3784. 
  3785. File: standards.info, Node: GNU Free Documentation License, Next: Index, Prev: References, Up: Top
  3786. Appendix A GNU Free Documentation License
  3787. *****************************************
  3788. Version 1.3, 3 November 2008
  3789. Copyright (C) 2000, 2001, 2002, 2007, 2008 Free Software Foundation, Inc.
  3790. `http://fsf.org/'
  3791. Everyone is permitted to copy and distribute verbatim copies
  3792. of this license document, but changing it is not allowed.
  3793. 0. PREAMBLE
  3794. The purpose of this License is to make a manual, textbook, or other
  3795. functional and useful document "free" in the sense of freedom: to
  3796. assure everyone the effective freedom to copy and redistribute it,
  3797. with or without modifying it, either commercially or
  3798. noncommercially. Secondarily, this License preserves for the
  3799. author and publisher a way to get credit for their work, while not
  3800. being considered responsible for modifications made by others.
  3801. This License is a kind of "copyleft", which means that derivative
  3802. works of the document must themselves be free in the same sense.
  3803. It complements the GNU General Public License, which is a copyleft
  3804. license designed for free software.
  3805. We have designed this License in order to use it for manuals for
  3806. free software, because free software needs free documentation: a
  3807. free program should come with manuals providing the same freedoms
  3808. that the software does. But this License is not limited to
  3809. software manuals; it can be used for any textual work, regardless
  3810. of subject matter or whether it is published as a printed book.
  3811. We recommend this License principally for works whose purpose is
  3812. instruction or reference.
  3813. 1. APPLICABILITY AND DEFINITIONS
  3814. This License applies to any manual or other work, in any medium,
  3815. that contains a notice placed by the copyright holder saying it
  3816. can be distributed under the terms of this License. Such a notice
  3817. grants a world-wide, royalty-free license, unlimited in duration,
  3818. to use that work under the conditions stated herein. The
  3819. "Document", below, refers to any such manual or work. Any member
  3820. of the public is a licensee, and is addressed as "you". You
  3821. accept the license if you copy, modify or distribute the work in a
  3822. way requiring permission under copyright law.
  3823. A "Modified Version" of the Document means any work containing the
  3824. Document or a portion of it, either copied verbatim, or with
  3825. modifications and/or translated into another language.
  3826. A "Secondary Section" is a named appendix or a front-matter section
  3827. of the Document that deals exclusively with the relationship of the
  3828. publishers or authors of the Document to the Document's overall
  3829. subject (or to related matters) and contains nothing that could
  3830. fall directly within that overall subject. (Thus, if the Document
  3831. is in part a textbook of mathematics, a Secondary Section may not
  3832. explain any mathematics.) The relationship could be a matter of
  3833. historical connection with the subject or with related matters, or
  3834. of legal, commercial, philosophical, ethical or political position
  3835. regarding them.
  3836. The "Invariant Sections" are certain Secondary Sections whose
  3837. titles are designated, as being those of Invariant Sections, in
  3838. the notice that says that the Document is released under this
  3839. License. If a section does not fit the above definition of
  3840. Secondary then it is not allowed to be designated as Invariant.
  3841. The Document may contain zero Invariant Sections. If the Document
  3842. does not identify any Invariant Sections then there are none.
  3843. The "Cover Texts" are certain short passages of text that are
  3844. listed, as Front-Cover Texts or Back-Cover Texts, in the notice
  3845. that says that the Document is released under this License. A
  3846. Front-Cover Text may be at most 5 words, and a Back-Cover Text may
  3847. be at most 25 words.
  3848. A "Transparent" copy of the Document means a machine-readable copy,
  3849. represented in a format whose specification is available to the
  3850. general public, that is suitable for revising the document
  3851. straightforwardly with generic text editors or (for images
  3852. composed of pixels) generic paint programs or (for drawings) some
  3853. widely available drawing editor, and that is suitable for input to
  3854. text formatters or for automatic translation to a variety of
  3855. formats suitable for input to text formatters. A copy made in an
  3856. otherwise Transparent file format whose markup, or absence of
  3857. markup, has been arranged to thwart or discourage subsequent
  3858. modification by readers is not Transparent. An image format is
  3859. not Transparent if used for any substantial amount of text. A
  3860. copy that is not "Transparent" is called "Opaque".
  3861. Examples of suitable formats for Transparent copies include plain
  3862. ASCII without markup, Texinfo input format, LaTeX input format,
  3863. SGML or XML using a publicly available DTD, and
  3864. standard-conforming simple HTML, PostScript or PDF designed for
  3865. human modification. Examples of transparent image formats include
  3866. PNG, XCF and JPG. Opaque formats include proprietary formats that
  3867. can be read and edited only by proprietary word processors, SGML or
  3868. XML for which the DTD and/or processing tools are not generally
  3869. available, and the machine-generated HTML, PostScript or PDF
  3870. produced by some word processors for output purposes only.
  3871. The "Title Page" means, for a printed book, the title page itself,
  3872. plus such following pages as are needed to hold, legibly, the
  3873. material this License requires to appear in the title page. For
  3874. works in formats which do not have any title page as such, "Title
  3875. Page" means the text near the most prominent appearance of the
  3876. work's title, preceding the beginning of the body of the text.
  3877. The "publisher" means any person or entity that distributes copies
  3878. of the Document to the public.
  3879. A section "Entitled XYZ" means a named subunit of the Document
  3880. whose title either is precisely XYZ or contains XYZ in parentheses
  3881. following text that translates XYZ in another language. (Here XYZ
  3882. stands for a specific section name mentioned below, such as
  3883. "Acknowledgements", "Dedications", "Endorsements", or "History".)
  3884. To "Preserve the Title" of such a section when you modify the
  3885. Document means that it remains a section "Entitled XYZ" according
  3886. to this definition.
  3887. The Document may include Warranty Disclaimers next to the notice
  3888. which states that this License applies to the Document. These
  3889. Warranty Disclaimers are considered to be included by reference in
  3890. this License, but only as regards disclaiming warranties: any other
  3891. implication that these Warranty Disclaimers may have is void and
  3892. has no effect on the meaning of this License.
  3893. 2. VERBATIM COPYING
  3894. You may copy and distribute the Document in any medium, either
  3895. commercially or noncommercially, provided that this License, the
  3896. copyright notices, and the license notice saying this License
  3897. applies to the Document are reproduced in all copies, and that you
  3898. add no other conditions whatsoever to those of this License. You
  3899. may not use technical measures to obstruct or control the reading
  3900. or further copying of the copies you make or distribute. However,
  3901. you may accept compensation in exchange for copies. If you
  3902. distribute a large enough number of copies you must also follow
  3903. the conditions in section 3.
  3904. You may also lend copies, under the same conditions stated above,
  3905. and you may publicly display copies.
  3906. 3. COPYING IN QUANTITY
  3907. If you publish printed copies (or copies in media that commonly
  3908. have printed covers) of the Document, numbering more than 100, and
  3909. the Document's license notice requires Cover Texts, you must
  3910. enclose the copies in covers that carry, clearly and legibly, all
  3911. these Cover Texts: Front-Cover Texts on the front cover, and
  3912. Back-Cover Texts on the back cover. Both covers must also clearly
  3913. and legibly identify you as the publisher of these copies. The
  3914. front cover must present the full title with all words of the
  3915. title equally prominent and visible. You may add other material
  3916. on the covers in addition. Copying with changes limited to the
  3917. covers, as long as they preserve the title of the Document and
  3918. satisfy these conditions, can be treated as verbatim copying in
  3919. other respects.
  3920. If the required texts for either cover are too voluminous to fit
  3921. legibly, you should put the first ones listed (as many as fit
  3922. reasonably) on the actual cover, and continue the rest onto
  3923. adjacent pages.
  3924. If you publish or distribute Opaque copies of the Document
  3925. numbering more than 100, you must either include a
  3926. machine-readable Transparent copy along with each Opaque copy, or
  3927. state in or with each Opaque copy a computer-network location from
  3928. which the general network-using public has access to download
  3929. using public-standard network protocols a complete Transparent
  3930. copy of the Document, free of added material. If you use the
  3931. latter option, you must take reasonably prudent steps, when you
  3932. begin distribution of Opaque copies in quantity, to ensure that
  3933. this Transparent copy will remain thus accessible at the stated
  3934. location until at least one year after the last time you
  3935. distribute an Opaque copy (directly or through your agents or
  3936. retailers) of that edition to the public.
  3937. It is requested, but not required, that you contact the authors of
  3938. the Document well before redistributing any large number of
  3939. copies, to give them a chance to provide you with an updated
  3940. version of the Document.
  3941. 4. MODIFICATIONS
  3942. You may copy and distribute a Modified Version of the Document
  3943. under the conditions of sections 2 and 3 above, provided that you
  3944. release the Modified Version under precisely this License, with
  3945. the Modified Version filling the role of the Document, thus
  3946. licensing distribution and modification of the Modified Version to
  3947. whoever possesses a copy of it. In addition, you must do these
  3948. things in the Modified Version:
  3949. A. Use in the Title Page (and on the covers, if any) a title
  3950. distinct from that of the Document, and from those of
  3951. previous versions (which should, if there were any, be listed
  3952. in the History section of the Document). You may use the
  3953. same title as a previous version if the original publisher of
  3954. that version gives permission.
  3955. B. List on the Title Page, as authors, one or more persons or
  3956. entities responsible for authorship of the modifications in
  3957. the Modified Version, together with at least five of the
  3958. principal authors of the Document (all of its principal
  3959. authors, if it has fewer than five), unless they release you
  3960. from this requirement.
  3961. C. State on the Title page the name of the publisher of the
  3962. Modified Version, as the publisher.
  3963. D. Preserve all the copyright notices of the Document.
  3964. E. Add an appropriate copyright notice for your modifications
  3965. adjacent to the other copyright notices.
  3966. F. Include, immediately after the copyright notices, a license
  3967. notice giving the public permission to use the Modified
  3968. Version under the terms of this License, in the form shown in
  3969. the Addendum below.
  3970. G. Preserve in that license notice the full lists of Invariant
  3971. Sections and required Cover Texts given in the Document's
  3972. license notice.
  3973. H. Include an unaltered copy of this License.
  3974. I. Preserve the section Entitled "History", Preserve its Title,
  3975. and add to it an item stating at least the title, year, new
  3976. authors, and publisher of the Modified Version as given on
  3977. the Title Page. If there is no section Entitled "History" in
  3978. the Document, create one stating the title, year, authors,
  3979. and publisher of the Document as given on its Title Page,
  3980. then add an item describing the Modified Version as stated in
  3981. the previous sentence.
  3982. J. Preserve the network location, if any, given in the Document
  3983. for public access to a Transparent copy of the Document, and
  3984. likewise the network locations given in the Document for
  3985. previous versions it was based on. These may be placed in
  3986. the "History" section. You may omit a network location for a
  3987. work that was published at least four years before the
  3988. Document itself, or if the original publisher of the version
  3989. it refers to gives permission.
  3990. K. For any section Entitled "Acknowledgements" or "Dedications",
  3991. Preserve the Title of the section, and preserve in the
  3992. section all the substance and tone of each of the contributor
  3993. acknowledgements and/or dedications given therein.
  3994. L. Preserve all the Invariant Sections of the Document,
  3995. unaltered in their text and in their titles. Section numbers
  3996. or the equivalent are not considered part of the section
  3997. titles.
  3998. M. Delete any section Entitled "Endorsements". Such a section
  3999. may not be included in the Modified Version.
  4000. N. Do not retitle any existing section to be Entitled
  4001. "Endorsements" or to conflict in title with any Invariant
  4002. Section.
  4003. O. Preserve any Warranty Disclaimers.
  4004. If the Modified Version includes new front-matter sections or
  4005. appendices that qualify as Secondary Sections and contain no
  4006. material copied from the Document, you may at your option
  4007. designate some or all of these sections as invariant. To do this,
  4008. add their titles to the list of Invariant Sections in the Modified
  4009. Version's license notice. These titles must be distinct from any
  4010. other section titles.
  4011. You may add a section Entitled "Endorsements", provided it contains
  4012. nothing but endorsements of your Modified Version by various
  4013. parties--for example, statements of peer review or that the text
  4014. has been approved by an organization as the authoritative
  4015. definition of a standard.
  4016. You may add a passage of up to five words as a Front-Cover Text,
  4017. and a passage of up to 25 words as a Back-Cover Text, to the end
  4018. of the list of Cover Texts in the Modified Version. Only one
  4019. passage of Front-Cover Text and one of Back-Cover Text may be
  4020. added by (or through arrangements made by) any one entity. If the
  4021. Document already includes a cover text for the same cover,
  4022. previously added by you or by arrangement made by the same entity
  4023. you are acting on behalf of, you may not add another; but you may
  4024. replace the old one, on explicit permission from the previous
  4025. publisher that added the old one.
  4026. The author(s) and publisher(s) of the Document do not by this
  4027. License give permission to use their names for publicity for or to
  4028. assert or imply endorsement of any Modified Version.
  4029. 5. COMBINING DOCUMENTS
  4030. You may combine the Document with other documents released under
  4031. this License, under the terms defined in section 4 above for
  4032. modified versions, provided that you include in the combination
  4033. all of the Invariant Sections of all of the original documents,
  4034. unmodified, and list them all as Invariant Sections of your
  4035. combined work in its license notice, and that you preserve all
  4036. their Warranty Disclaimers.
  4037. The combined work need only contain one copy of this License, and
  4038. multiple identical Invariant Sections may be replaced with a single
  4039. copy. If there are multiple Invariant Sections with the same name
  4040. but different contents, make the title of each such section unique
  4041. by adding at the end of it, in parentheses, the name of the
  4042. original author or publisher of that section if known, or else a
  4043. unique number. Make the same adjustment to the section titles in
  4044. the list of Invariant Sections in the license notice of the
  4045. combined work.
  4046. In the combination, you must combine any sections Entitled
  4047. "History" in the various original documents, forming one section
  4048. Entitled "History"; likewise combine any sections Entitled
  4049. "Acknowledgements", and any sections Entitled "Dedications". You
  4050. must delete all sections Entitled "Endorsements."
  4051. 6. COLLECTIONS OF DOCUMENTS
  4052. You may make a collection consisting of the Document and other
  4053. documents released under this License, and replace the individual
  4054. copies of this License in the various documents with a single copy
  4055. that is included in the collection, provided that you follow the
  4056. rules of this License for verbatim copying of each of the
  4057. documents in all other respects.
  4058. You may extract a single document from such a collection, and
  4059. distribute it individually under this License, provided you insert
  4060. a copy of this License into the extracted document, and follow
  4061. this License in all other respects regarding verbatim copying of
  4062. that document.
  4063. 7. AGGREGATION WITH INDEPENDENT WORKS
  4064. A compilation of the Document or its derivatives with other
  4065. separate and independent documents or works, in or on a volume of
  4066. a storage or distribution medium, is called an "aggregate" if the
  4067. copyright resulting from the compilation is not used to limit the
  4068. legal rights of the compilation's users beyond what the individual
  4069. works permit. When the Document is included in an aggregate, this
  4070. License does not apply to the other works in the aggregate which
  4071. are not themselves derivative works of the Document.
  4072. If the Cover Text requirement of section 3 is applicable to these
  4073. copies of the Document, then if the Document is less than one half
  4074. of the entire aggregate, the Document's Cover Texts may be placed
  4075. on covers that bracket the Document within the aggregate, or the
  4076. electronic equivalent of covers if the Document is in electronic
  4077. form. Otherwise they must appear on printed covers that bracket
  4078. the whole aggregate.
  4079. 8. TRANSLATION
  4080. Translation is considered a kind of modification, so you may
  4081. distribute translations of the Document under the terms of section
  4082. 4. Replacing Invariant Sections with translations requires special
  4083. permission from their copyright holders, but you may include
  4084. translations of some or all Invariant Sections in addition to the
  4085. original versions of these Invariant Sections. You may include a
  4086. translation of this License, and all the license notices in the
  4087. Document, and any Warranty Disclaimers, provided that you also
  4088. include the original English version of this License and the
  4089. original versions of those notices and disclaimers. In case of a
  4090. disagreement between the translation and the original version of
  4091. this License or a notice or disclaimer, the original version will
  4092. prevail.
  4093. If a section in the Document is Entitled "Acknowledgements",
  4094. "Dedications", or "History", the requirement (section 4) to
  4095. Preserve its Title (section 1) will typically require changing the
  4096. actual title.
  4097. 9. TERMINATION
  4098. You may not copy, modify, sublicense, or distribute the Document
  4099. except as expressly provided under this License. Any attempt
  4100. otherwise to copy, modify, sublicense, or distribute it is void,
  4101. and will automatically terminate your rights under this License.
  4102. However, if you cease all violation of this License, then your
  4103. license from a particular copyright holder is reinstated (a)
  4104. provisionally, unless and until the copyright holder explicitly
  4105. and finally terminates your license, and (b) permanently, if the
  4106. copyright holder fails to notify you of the violation by some
  4107. reasonable means prior to 60 days after the cessation.
  4108. Moreover, your license from a particular copyright holder is
  4109. reinstated permanently if the copyright holder notifies you of the
  4110. violation by some reasonable means, this is the first time you have
  4111. received notice of violation of this License (for any work) from
  4112. that copyright holder, and you cure the violation prior to 30 days
  4113. after your receipt of the notice.
  4114. Termination of your rights under this section does not terminate
  4115. the licenses of parties who have received copies or rights from
  4116. you under this License. If your rights have been terminated and
  4117. not permanently reinstated, receipt of a copy of some or all of
  4118. the same material does not give you any rights to use it.
  4119. 10. FUTURE REVISIONS OF THIS LICENSE
  4120. The Free Software Foundation may publish new, revised versions of
  4121. the GNU Free Documentation License from time to time. Such new
  4122. versions will be similar in spirit to the present version, but may
  4123. differ in detail to address new problems or concerns. See
  4124. `http://www.gnu.org/copyleft/'.
  4125. Each version of the License is given a distinguishing version
  4126. number. If the Document specifies that a particular numbered
  4127. version of this License "or any later version" applies to it, you
  4128. have the option of following the terms and conditions either of
  4129. that specified version or of any later version that has been
  4130. published (not as a draft) by the Free Software Foundation. If
  4131. the Document does not specify a version number of this License,
  4132. you may choose any version ever published (not as a draft) by the
  4133. Free Software Foundation. If the Document specifies that a proxy
  4134. can decide which future versions of this License can be used, that
  4135. proxy's public statement of acceptance of a version permanently
  4136. authorizes you to choose that version for the Document.
  4137. 11. RELICENSING
  4138. "Massive Multiauthor Collaboration Site" (or "MMC Site") means any
  4139. World Wide Web server that publishes copyrightable works and also
  4140. provides prominent facilities for anybody to edit those works. A
  4141. public wiki that anybody can edit is an example of such a server.
  4142. A "Massive Multiauthor Collaboration" (or "MMC") contained in the
  4143. site means any set of copyrightable works thus published on the MMC
  4144. site.
  4145. "CC-BY-SA" means the Creative Commons Attribution-Share Alike 3.0
  4146. license published by Creative Commons Corporation, a not-for-profit
  4147. corporation with a principal place of business in San Francisco,
  4148. California, as well as future copyleft versions of that license
  4149. published by that same organization.
  4150. "Incorporate" means to publish or republish a Document, in whole or
  4151. in part, as part of another Document.
  4152. An MMC is "eligible for relicensing" if it is licensed under this
  4153. License, and if all works that were first published under this
  4154. License somewhere other than this MMC, and subsequently
  4155. incorporated in whole or in part into the MMC, (1) had no cover
  4156. texts or invariant sections, and (2) were thus incorporated prior
  4157. to November 1, 2008.
  4158. The operator of an MMC Site may republish an MMC contained in the
  4159. site under CC-BY-SA on the same site at any time before August 1,
  4160. 2009, provided the MMC is eligible for relicensing.
  4161. ADDENDUM: How to use this License for your documents
  4162. ====================================================
  4163. To use this License in a document you have written, include a copy of
  4164. the License in the document and put the following copyright and license
  4165. notices just after the title page:
  4166. Copyright (C) YEAR YOUR NAME.
  4167. Permission is granted to copy, distribute and/or modify this document
  4168. under the terms of the GNU Free Documentation License, Version 1.3
  4169. or any later version published by the Free Software Foundation;
  4170. with no Invariant Sections, no Front-Cover Texts, and no Back-Cover
  4171. Texts. A copy of the license is included in the section entitled ``GNU
  4172. Free Documentation License''.
  4173. If you have Invariant Sections, Front-Cover Texts and Back-Cover
  4174. Texts, replace the "with...Texts." line with this:
  4175. with the Invariant Sections being LIST THEIR TITLES, with
  4176. the Front-Cover Texts being LIST, and with the Back-Cover Texts
  4177. being LIST.
  4178. If you have Invariant Sections without Cover Texts, or some other
  4179. combination of the three, merge those two alternatives to suit the
  4180. situation.
  4181. If your document contains nontrivial examples of program code, we
  4182. recommend releasing these examples in parallel under your choice of
  4183. free software license, such as the GNU General Public License, to
  4184. permit their use in free software.
  4185. 
  4186. File: standards.info, Node: Index, Prev: GNU Free Documentation License, Up: Top
  4187. Index
  4188. *****
  4189. �[index�]
  4190. * Menu:
  4191. * #endif, commenting: Comments. (line 60)
  4192. * --help output: --help. (line 6)
  4193. * --version output: --version. (line 6)
  4194. * -Wall compiler option: Syntactic Conventions.
  4195. (line 10)
  4196. * accepting contributions: Contributions. (line 6)
  4197. * address for bug reports: --help. (line 11)
  4198. * ANSI C standard: Standard C. (line 6)
  4199. * arbitrary limits on data: Semantics. (line 6)
  4200. * ASCII characters: Character Set. (line 6)
  4201. * autoconf: System Portability. (line 23)
  4202. * avoiding proprietary code: Reading Non-Free Code.
  4203. (line 6)
  4204. * behavior, dependent on program's name: User Interfaces. (line 6)
  4205. * binary packages: Install Command Categories.
  4206. (line 80)
  4207. * bindir: Directory Variables. (line 57)
  4208. * braces, in C source: Formatting. (line 6)
  4209. * bug reports: --help. (line 11)
  4210. * bug-standards@gnu.org email address: Preface. (line 30)
  4211. * C library functions, and portability: System Functions. (line 6)
  4212. * canonical name of a program: --version. (line 12)
  4213. * casting pointers to integers: CPU Portability. (line 50)
  4214. * CGI programs, standard options for: Command-Line Interfaces.
  4215. (line 31)
  4216. * change logs: Change Logs. (line 6)
  4217. * change logs, conditional changes: Conditional Changes. (line 6)
  4218. * change logs, style: Style of Change Logs.
  4219. (line 6)
  4220. * character set: Character Set. (line 6)
  4221. * clang: Syntactic Conventions.
  4222. (line 17)
  4223. * command-line arguments, decoding: Semantics. (line 47)
  4224. * command-line interface: Command-Line Interfaces.
  4225. (line 6)
  4226. * commenting: Comments. (line 6)
  4227. * compatibility with C and POSIX standards: Compatibility. (line 6)
  4228. * compiler warnings: Syntactic Conventions.
  4229. (line 10)
  4230. * conditional changes, and change logs: Conditional Changes. (line 6)
  4231. * conditionals, comments for: Comments. (line 60)
  4232. * configure: Configuration. (line 6)
  4233. * control-L: Formatting. (line 128)
  4234. * conventions for makefiles: Makefile Conventions.
  4235. (line 6)
  4236. * CORBA: Graphical Interfaces.
  4237. (line 16)
  4238. * credits for manuals: Manual Credits. (line 6)
  4239. * D-bus: Graphical Interfaces.
  4240. (line 16)
  4241. * data structures, in Gnulib: System Functions. (line 44)
  4242. * data types, and portability: CPU Portability. (line 6)
  4243. * DESTDIR: DESTDIR. (line 6)
  4244. * directories, creating installation: Directory Variables. (line 20)
  4245. * documentation: Documentation. (line 6)
  4246. * doschk: Names. (line 38)
  4247. * double quote: Quote Characters. (line 6)
  4248. * downloading this manual: Preface. (line 14)
  4249. * dynamic plug-ins: Dynamic Plug-In Interfaces.
  4250. (line 6)
  4251. * encodings: Character Set. (line 6)
  4252. * enum types, formatting: Formatting. (line 45)
  4253. * error messages: Semantics. (line 19)
  4254. * error messages, formatting: Errors. (line 6)
  4255. * error messages, in Gnulib: System Functions. (line 44)
  4256. * exec_prefix: Directory Variables. (line 39)
  4257. * expressions, splitting: Formatting. (line 91)
  4258. * FDL, GNU Free Documentation License: GNU Free Documentation License.
  4259. (line 6)
  4260. * file usage: File Usage. (line 6)
  4261. * file-name limitations: Names. (line 38)
  4262. * formatting error messages: Errors. (line 6)
  4263. * formatting source code: Formatting. (line 6)
  4264. * formfeed: Formatting. (line 128)
  4265. * function argument, declaring: Syntactic Conventions.
  4266. (line 6)
  4267. * function definitions, formatting: Formatting. (line 6)
  4268. * function prototypes: Standard C. (line 17)
  4269. * getopt: Command-Line Interfaces.
  4270. (line 6)
  4271. * gettext: Internationalization.
  4272. (line 6)
  4273. * GNOME: Graphical Interfaces.
  4274. (line 16)
  4275. * GNOME and Guile: Source Language. (line 38)
  4276. * Gnulib: System Functions. (line 37)
  4277. * gnustandards project repository: Preface. (line 30)
  4278. * gnustandards-commit@gnu.org mailing list: Preface. (line 24)
  4279. * graphical user interface: Graphical Interfaces.
  4280. (line 6)
  4281. * grave accent: Quote Characters. (line 6)
  4282. * GTK+: Graphical Interfaces.
  4283. (line 6)
  4284. * Guile: Source Language. (line 38)
  4285. * implicit int: Syntactic Conventions.
  4286. (line 6)
  4287. * impossible conditions: Semantics. (line 71)
  4288. * installation directories, creating: Directory Variables. (line 20)
  4289. * installations, staged: DESTDIR. (line 6)
  4290. * interface styles: Graphical Interfaces.
  4291. (line 6)
  4292. * internationalization: Internationalization.
  4293. (line 6)
  4294. * keyboard interface: Graphical Interfaces.
  4295. (line 16)
  4296. * LDAP: OID Allocations. (line 6)
  4297. * left quote: Quote Characters. (line 6)
  4298. * legal aspects: Legal Issues. (line 6)
  4299. * legal papers: Contributions. (line 6)
  4300. * libexecdir: Directory Variables. (line 70)
  4301. * libiconv: Semantics. (line 11)
  4302. * libraries: Libraries. (line 6)
  4303. * library functions, and portability: System Functions. (line 6)
  4304. * library interface: Graphical Interfaces.
  4305. (line 16)
  4306. * license for manuals: License for Manuals. (line 6)
  4307. * lint: Syntactic Conventions.
  4308. (line 17)
  4309. * locale-specific quote characters: Quote Characters. (line 6)
  4310. * long option names: Option Table. (line 6)
  4311. * long-named options: Command-Line Interfaces.
  4312. (line 12)
  4313. * makefile, conventions for: Makefile Conventions.
  4314. (line 6)
  4315. * malloc return value: Semantics. (line 26)
  4316. * man pages: Man Pages. (line 6)
  4317. * manual structure: Manual Structure Details.
  4318. (line 6)
  4319. * memory allocation failure: Semantics. (line 26)
  4320. * memory leak: Memory Usage. (line 23)
  4321. * memory usage: Memory Usage. (line 6)
  4322. * message text, and internationalization: Internationalization.
  4323. (line 29)
  4324. * mmap: Mmap. (line 6)
  4325. * multiple variables in a line: Syntactic Conventions.
  4326. (line 43)
  4327. * names of variables, functions, and files: Names. (line 6)
  4328. * NEWS file: NEWS File. (line 6)
  4329. * non-ASCII characters: Character Set. (line 6)
  4330. * non-POSIX systems, and portability: System Portability. (line 32)
  4331. * non-standard extensions: Using Extensions. (line 6)
  4332. * NUL characters: Semantics. (line 11)
  4333. * OID allocations for GNU: OID Allocations. (line 6)
  4334. * open brace: Formatting. (line 6)
  4335. * opening quote: Quote Characters. (line 6)
  4336. * optional features, configure-time: Configuration. (line 100)
  4337. * options for compatibility: Compatibility. (line 14)
  4338. * options, standard command-line: Command-Line Interfaces.
  4339. (line 31)
  4340. * output device and program's behavior: User Interfaces. (line 13)
  4341. * packaging: Releases. (line 6)
  4342. * PATH_INFO, specifying standard options as: Command-Line Interfaces.
  4343. (line 31)
  4344. * plug-ins: Dynamic Plug-In Interfaces.
  4345. (line 6)
  4346. * plugin_is_GPL_compatible: Dynamic Plug-In Interfaces.
  4347. (line 17)
  4348. * portability, and data types: CPU Portability. (line 6)
  4349. * portability, and library functions: System Functions. (line 6)
  4350. * portability, between system types: System Portability. (line 6)
  4351. * POSIX compatibility: Compatibility. (line 6)
  4352. * POSIX functions, and portability: System Functions. (line 6)
  4353. * POSIXLY_CORRECT, environment variable: Compatibility. (line 21)
  4354. * post-installation commands: Install Command Categories.
  4355. (line 6)
  4356. * pre-installation commands: Install Command Categories.
  4357. (line 6)
  4358. * prefix: Directory Variables. (line 29)
  4359. * program configuration: Configuration. (line 6)
  4360. * program design: Design Advice. (line 6)
  4361. * program name and its behavior: User Interfaces. (line 6)
  4362. * program's canonical name: --version. (line 12)
  4363. * programming languages: Source Language. (line 6)
  4364. * proprietary programs: Reading Non-Free Code.
  4365. (line 6)
  4366. * quote characters: Quote Characters. (line 6)
  4367. * README file: Releases. (line 21)
  4368. * references to non-free material: References. (line 6)
  4369. * releasing: Managing Releases. (line 6)
  4370. * right quote: Quote Characters. (line 6)
  4371. * Savannah repository for gnustandards: Preface. (line 30)
  4372. * sbindir: Directory Variables. (line 63)
  4373. * signal handling: Semantics. (line 60)
  4374. * single quote: Quote Characters. (line 6)
  4375. * SNMP: OID Allocations. (line 6)
  4376. * spaces before open-paren: Formatting. (line 85)
  4377. * staged installs: DESTDIR. (line 6)
  4378. * standard command-line options: Command-Line Interfaces.
  4379. (line 31)
  4380. * standards for makefiles: Makefile Conventions.
  4381. (line 6)
  4382. * struct types, formatting: Formatting. (line 45)
  4383. * syntactic conventions: Syntactic Conventions.
  4384. (line 6)
  4385. * table of long options: Option Table. (line 6)
  4386. * temporary files: Semantics. (line 85)
  4387. * temporary variables: Syntactic Conventions.
  4388. (line 31)
  4389. * texinfo.tex, in a distribution: Releases. (line 72)
  4390. * TMPDIR environment variable: Semantics. (line 85)
  4391. * trademarks: Trademarks. (line 6)
  4392. * user interface styles: Graphical Interfaces.
  4393. (line 6)
  4394. * valgrind: Memory Usage. (line 23)
  4395. * where to obtain standards.texi: Preface. (line 14)
  4396. * X.509: OID Allocations. (line 6)
  4397. * xmalloc, in Gnulib: System Functions. (line 44)
  4398. 
  4399. Tag Table:
  4400. Node: Top824
  4401. Node: Preface2122
  4402. Node: Legal Issues4834
  4403. Node: Reading Non-Free Code5304
  4404. Node: Contributions7034
  4405. Node: Trademarks9220
  4406. Node: Design Advice10855
  4407. Node: Source Language11447
  4408. Node: Compatibility13573
  4409. Node: Using Extensions15201
  4410. Node: Standard C16777
  4411. Node: Conditional Compilation19180
  4412. Node: Program Behavior20578
  4413. Node: Non-GNU Standards21768
  4414. Node: Semantics24049
  4415. Node: Libraries28993
  4416. Node: Errors30238
  4417. Node: User Interfaces32807
  4418. Node: Graphical Interfaces34412
  4419. Node: Command-Line Interfaces35596
  4420. Node: --version37642
  4421. Node: --help43380
  4422. Node: Dynamic Plug-In Interfaces44253
  4423. Node: Option Table46152
  4424. Node: OID Allocations61110
  4425. Node: Memory Usage62944
  4426. Node: File Usage64219
  4427. Node: Writing C64969
  4428. Node: Formatting65950
  4429. Node: Comments70438
  4430. Node: Syntactic Conventions73990
  4431. Node: Names77965
  4432. Node: System Portability80177
  4433. Node: CPU Portability83068
  4434. Node: System Functions85434
  4435. Node: Internationalization87976
  4436. Node: Character Set91976
  4437. Node: Quote Characters92831
  4438. Node: Mmap94390
  4439. Node: Documentation95098
  4440. Node: GNU Manuals96204
  4441. Node: Doc Strings and Manuals101942
  4442. Node: Manual Structure Details103495
  4443. Node: License for Manuals104913
  4444. Node: Manual Credits105887
  4445. Node: Printed Manuals106280
  4446. Node: NEWS File106966
  4447. Node: Change Logs107644
  4448. Node: Change Log Concepts108398
  4449. Node: Style of Change Logs110501
  4450. Node: Simple Changes113001
  4451. Node: Conditional Changes114443
  4452. Node: Indicating the Part Changed116884
  4453. Node: Man Pages117411
  4454. Node: Reading other Manuals119617
  4455. Node: Managing Releases120408
  4456. Node: Configuration121189
  4457. Node: Makefile Conventions129854
  4458. Node: Makefile Basics130853
  4459. Node: Utilities in Makefiles134027
  4460. Node: Command Variables136532
  4461. Node: DESTDIR139778
  4462. Node: Directory Variables141952
  4463. Node: Standard Targets156574
  4464. Node: Install Command Categories170675
  4465. Node: Releases175208
  4466. Node: References179322
  4467. Node: GNU Free Documentation License185175
  4468. Node: Index210342
  4469. 
  4470. End Tag Table