Path: utzoo!utgpu!news-server.csri.toronto.edu!mailrus!wuarchive!zaphod.mps.ohio-state.edu!usc!cs.utexas.edu!asuvax!mcdphx!udc!paul From: paul@urbana.mcd.mot.com (Paul Jones) Newsgroups: comp.sys.m68k Subject: Re: GNU CC on Delta Boxes! Message-ID: <1275@urbana.mcd.mot.com> Date: 7 Jun 90 10:31:28 GMT References: <286@demott.COM> Organization: Motorola Microcomputer Division, Urbana, IL Lines: 31 In article <286@demott.COM> kdq@demott.COM (Kevin D. Quitt) writes: > ... >which are still seriously broken. Does anybody have any idea why the >following program core dumps after the "ints are" line? It'll crash >after that line no matter where you put it, except the last line. [stuff deleted] >void main() >{ > int i,j; > j = sizeof( i ); > printf( "Ints are %d bytes\n", j); > printf( "Terminal ID is: %s\n", ctermid() ); > printf( "User ID is: %s\n", cuserid() ); > ... The problem is that ctermid and cuserid take either a pointer to a string where they are to store their results or 0, 0 causing them to store the string internally. As the program is now, whatever garbage is on the stack gets passed as the place to store the string, which is usually an illegal location. -- ------ Paul Jones, Motorola MCD-UDC paul@urbana.mcd.mot.com 1101 E. University Ave. ...!uiucuxc!udc!paul Urbana, IL 61801, USA (217) 384-8529