Linux-Development-Sys Digest #739, Volume #7 Tue, 4 Apr 00 17:13:21 EDT
Contents:
Re: Parallel port programming... pins 12 and 13 not working ("David E. Kindred")
Re: To core or not to core - You tell me (Erik Max Francis)
Re: To core or not to core - You tell me (Erik Max Francis)
Re: To core or not to core - You tell me (Gabor)
Re: To core or not to core - You tell me (Joe Pfeiffer)
Re: To core or not to core - You tell me (John Gluck)
Re: How compatible is Linux with .. Linux (Michael Martin)
Re: To core or not to core - You tell me (John Gluck)
Re: To core or not to core - You tell me (Barry Margolin)
HDD Identify command problem (Sang Yong Lee)
Re: To core or not to core - You tell me (Alexander Viro)
Re: To core or not to core - You tell me (Ron Natalie)
Re: Finding virtual memory information in a kernel module (Julien.Soula)
Re: To core or not to core - You tell me (Juergen Heinzl)
Re: How compatible is Linux with .. Linux ("Peter T. Breuer")
Re: Zero padding in sprintf() doesn't work for strings - HELP ! (Juergen Heinzl)
struct passwd * ([EMAIL PROTECTED])
----------------------------------------------------------------------------
From: "David E. Kindred" <[EMAIL PROTECTED]>
Subject: Re: Parallel port programming... pins 12 and 13 not working
Date: Tue, 04 Apr 2000 19:16:12 GMT
You might try checking to make sure they are both in the same mode:
standard, ECP, SPP, or whatever etc. I had some problems with this on a
project I was working on.
Good luck.
Dave K.
Stuart Hall wrote:
> Hello all!
>
> I have a 486-33 Gateway 2000 that I am programming a custom slot-car
> timer for, using Phototransistors and the parallel port. My program
> works perfectly on my newer homebuilt dual pentium machine using pins
> 10,12,13 and 15. However it is not working for pins 12 and 13 on my
> Gateway machine.
>
> Pins 12 and 13 are for Paper Empty and Select. Is my parallel port
> bad? Or is it possible that pins 12 and 13 are not used in the IBM
> parallel port standard way on a GW computer?
>
> Any thoughts on using COM2 w/ a female-female 25 pin connector?
>
> thanks!
> Stuart
> --
> Stuart Hall
> Connecticut, USA
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
------------------------------
From: Erik Max Francis <[EMAIL PROTECTED]>
Crossposted-To: comp.lang.c,comp.unix.solaris,comp.lang.c++,comp.unix.programmer
Subject: Re: To core or not to core - You tell me
Date: Tue, 04 Apr 2000 12:10:47 -0700
Harish K Chandraia wrote:
> From all that you know about programming what do you think should
> happen when I try to compile and execute the above program. I have
> executed
> this piece of code on the following four machines(posting about my
> results will follow). I am not trying to be a smart ass here but I am
> only interested in knowing what you people think would happen because
> what I thought would happen didn't happen on two of the four machines.
You are dereferencing a null pointer, and thus are invoking undefined
behavior. The most common behavior on modern machines is for the
program to crash, but for all intents and purposes it could use the
modem to crank call you.
Undefined behavior means undefined, not how you expect it to misbehave.
--
Erik Max Francis | email [EMAIL PROTECTED] | icq 16063900
Alcyone Systems | web http://www.alcyone.com/max/ | q3a Product
San Jose, CA | languages en, eo | icbm 37 20 07 N 121 53 38 W
USA | 968.994 Ms p.L. | 272 days left | &tSftDotIotE
------------------------------
From: Erik Max Francis <[EMAIL PROTECTED]>
Crossposted-To: comp.lang.c,comp.unix.solaris,comp.lang.c++,comp.unix.programmer
Subject: Re: To core or not to core - You tell me
Date: Tue, 04 Apr 2000 12:13:26 -0700
John Gluck wrote:
> > ptr = NULL;
> >
> > printf("%d\n", ptr->a);
...
> Some implementations of printf check the parameters for a NULL
> pointer.
> They will usually print something like "(null)" for the parameter that
> was NULL or they will just ignore the parameter.
This is true, but is immaterial here. He's not trying to print a null
pointer with the %s modifier; he's dereferencing a null pointer and
trying to print data that's contained on the other side.
--
Erik Max Francis | email [EMAIL PROTECTED] | icq 16063900
Alcyone Systems | web http://www.alcyone.com/max/ | q3a Product
San Jose, CA | languages en, eo | icbm 37 20 07 N 121 53 38 W
USA | 968.994 Ms p.L. | 272 days left | &tSftDotIotE
------------------------------
From: [EMAIL PROTECTED] (Gabor)
Crossposted-To: comp.lang.c,comp.unix.solaris,comp.lang.c++,comp.unix.programmer
Subject: Re: To core or not to core - You tell me
Date: 4 Apr 2000 15:29:40 -0400
In comp.unix.programmer, John Gluck <[EMAIL PROTECTED]> wrote:
# [snip]
# > ptr = NULL;
# >
# > printf("%d\n", ptr->a);
# > }
# >
# [snip]
#
# > what I thought would happen didn't happen on two of the four machines.
# >
# [snip]
# >
# > Thank you
# > Harish
#
# Some implementations of printf check the parameters for a NULL pointer.
# They will usually print something like "(null)" for the parameter that
# was NULL or they will just ignore the parameter.
That doesn't apply here. He is already dreferencing ptr.
ptr->a == (*ptr).a
# There are sometimes development and production versions of libs as well.
# The devel version will check params and the production version, in the
# interest of speed, will not check params.
#
# Of course, thee OS has its role to play as well.
# --
# John Gluck (Passport Kernel Design Group)
#
# (613) 765-8392 ESN 395-8392
#
# Unless otherwise stated, any opinions expressed here are strictly my own
# and do not reflect any official position of Nortel Networks.
------------------------------
From: Joe Pfeiffer <[EMAIL PROTECTED]>
Crossposted-To: comp.lang.c,comp.unix.solaris,comp.lang.c++,comp.unix.programmer
Subject: Re: To core or not to core - You tell me
Date: 04 Apr 2000 13:33:23 -0600
John Gluck <[EMAIL PROTECTED]> writes:
> [snip]
> > ptr = NULL;
> >
> > printf("%d\n", ptr->a);
> > }
>
> Some implementations of printf check the parameters for a NULL pointer.
> They will usually print something like "(null)" for the parameter that
> was NULL or they will just ignore the parameter.
Note that the null pointer is dereferenced before printf is called.
--
Joseph J. Pfeiffer, Jr., Ph.D. Phone -- (505) 646-1605
Department of Computer Science FAX -- (505) 646-1002
New Mexico State University http://www.cs.nmsu.edu/~pfeiffer
VL 2000 Homepage: http://www.cs.orst.edu/~burnett/vl2000/
------------------------------
From: John Gluck <[EMAIL PROTECTED]>
Crossposted-To: comp.lang.c,comp.unix.solaris,comp.lang.c++,comp.unix.programmer
Subject: Re: To core or not to core - You tell me
Date: Tue, 04 Apr 2000 15:39:58 -0400
Erik Max Francis wrote:
>
> John Gluck wrote:
>
> > > ptr = NULL;
> > >
> > > printf("%d\n", ptr->a);
> ...
> > Some implementations of printf check the parameters for a NULL
> > pointer.
> > They will usually print something like "(null)" for the parameter that
> > was NULL or they will just ignore the parameter.
>
> This is true, but is immaterial here. He's not trying to print a null
> pointer with the %s modifier; he's dereferencing a null pointer and
> trying to print data that's contained on the other side.
>
> --
> Erik Max Francis | email [EMAIL PROTECTED] | icq 16063900
> Alcyone Systems | web http://www.alcyone.com/max/ | q3a Product
> San Jose, CA | languages en, eo | icbm 37 20 07 N 121 53 38 W
> USA | 968.994 Ms p.L. | 272 days left | &tSftDotIotE
--
John Gluck (Passport Kernel Design Group)
(613) 765-8392 ESN 395-8392
Unless otherwise stated, any opinions expressed here are strictly my own
and do not reflect any official position of Nortel Networks.
------------------------------
From: Michael Martin <[EMAIL PROTECTED]>
Crossposted-To: comp.os.linux.development.apps
Subject: Re: How compatible is Linux with .. Linux
Date: Tue, 04 Apr 2000 15:05:07 -0500
"Peter T. Breuer" wrote:
>
> In comp.os.linux.development.system The Wogster <[EMAIL PROTECTED]> wrote:
>
> :>I am talking to an equal, not a client. That's left to the oily people
> :>up front.
>
> : uh, anyone in an organization, can and does deal with clients, in my current
>
> Quite possibly (GHT). But I wasn't.
>
> : multimedia engineer book-keeper and salesforce all rolled into one. A good
> : estimate is now, close to 50% of the people who work in the computer
>
> You are including the 50% of webpage makers and graphic artists!
>
> :>: not technically proficient, that we were all there once. There are also
> :>: people who are technically excellent, that have not previously worked with
> :>: Linux, who would ask this very question. Beleive me, there are tonnes of
> :>: them out there.
> :>
> :>Then they don't deserve any respect in software engineering terms. They
> :>haven't gone to a college course, even. The question was naive and
> :>ig'rant.
>
> : Not always, here is a scenario, take a guy who has a Comp. Sci. PhD, his
> : college had received a nice donation from Sun, the workstations were Sun,
>
> Perfectly normal situation, and one which trains you quickly in the
> meaning of shared libraries, configuration file placements, and
> incompatibilities between OS revisions IF you are administering your
> own machine. Please bring back SunOS. I liked it.
>
> : the servers were Sun, his PC runs Solaris on Intel. He now works for a
> : company that produces Unix software, they want to get on the Linux
> : bandwagon, and have assigned him to research it. The question how
>
> Yes, I can see your model. You are talking about someone who has a lot
> of theoretical knowledge, but not a lot of practical knowledge. Such a
> person will learn very, very fast. It's a possible explanation. And
> indeed it would account for the naivity and ignorance that I commented
> on.
>
> : compatable are OpenLinux, Red Hat, Debian, Corel, Mandrake et al, is a very
>
> It is an appropriate question ...
>
> : appropriate one. Same goes for someone who comes from a Windows, Netware,
>
> ... and one that is easily answered by reading the distro's faqs, and
> the linux faq too!
>
> : VMS, HPUX, AIX, Irix, MVS, VSE or other environment. Heck, three years
> : ago, I could have asked the same question!
>
> OK, what IS the difference between VMS and MVS, then! Apart from the
> first letter (of their manufacturer).
Sorry, but I really can't resist this opening. Only a very naive,
ignorant
person would have to ask this question!
>
> : Wogster
>
> Peter
--
================================
Michael Martin
[EMAIL PROTECTED]
(713) 918-2631
================================
------------------------------
From: John Gluck <[EMAIL PROTECTED]>
Crossposted-To: comp.lang.c,comp.unix.solaris,comp.lang.c++,comp.unix.programmer
Subject: Re: To core or not to core - You tell me
Date: Tue, 04 Apr 2000 15:51:29 -0400
Erik Max Francis wrote:
>
> John Gluck wrote:
>
> > > ptr = NULL;
> > >
> > > printf("%d\n", ptr->a);
> ...
> > Some implementations of printf check the parameters for a NULL
> > pointer.
> > They will usually print something like "(null)" for the parameter that
> > was NULL or they will just ignore the parameter.
>
> This is true, but is immaterial here. He's not trying to print a null
> pointer with the %s modifier; he's dereferencing a null pointer and
> trying to print data that's contained on the other side.
>
> --
> Erik Max Francis | email [EMAIL PROTECTED] | icq 16063900
> Alcyone Systems | web http://www.alcyone.com/max/ | q3a Product
> San Jose, CA | languages en, eo | icbm 37 20 07 N 121 53 38 W
> USA | 968.994 Ms p.L. | 272 days left | &tSftDotIotE
You are partly right and partly wrong.
Perhaps I wasn't clear in what I meant...
The pointer that is passed to printf will be NULL. Some implementations
of printf will check the parameters passed. If it finds that one of the
parameters (a pointer) is NULL, rather than try to print what NULL
points to, it will simply print (null) in the output where the value
pointed to would otherwise go.
Taking the example above, the line printf("%d\n", ptr->a);
would print the same result as if it had been coded printf("(null)\n");
Hope that clears it up.
BTW the DEC C compiler on DEC Unix for Alphas has this behaviour. Your
code won't crash. You'll just get (null) in your output where ever null
pointers are passed as args to printf.
--
John Gluck (Passport Kernel Design Group)
(613) 765-8392 ESN 395-8392
Unless otherwise stated, any opinions expressed here are strictly my own
and do not reflect any official position of Nortel Networks.
------------------------------
From: Barry Margolin <[EMAIL PROTECTED]>
Crossposted-To: comp.lang.c,comp.unix.solaris,comp.lang.c++,comp.unix.programmer
Subject: Re: To core or not to core - You tell me
Date: Tue, 04 Apr 2000 20:12:11 GMT
In article <[EMAIL PROTECTED]>,
John Gluck <[EMAIL PROTECTED]> wrote:
>Erik Max Francis wrote:
>>
>> John Gluck wrote:
>>
>> > > ptr = NULL;
>> > >
>> > > printf("%d\n", ptr->a);
>> ...
>> > Some implementations of printf check the parameters for a NULL
>> > pointer.
>> > They will usually print something like "(null)" for the parameter that
>> > was NULL or they will just ignore the parameter.
>>
>> This is true, but is immaterial here. He's not trying to print a null
>> pointer with the %s modifier; he's dereferencing a null pointer and
>> trying to print data that's contained on the other side.
>
>You are partly right and partly wrong.
>
>Perhaps I wasn't clear in what I meant...
>
>The pointer that is passed to printf will be NULL.
But no pointer is being passed to printf! The dereferencing happens before
the call. The integer that the pointer points to is being passed. The
result depends on what the system does when you try to dererence a null
pointer, and has nothing to do with what printf() does.
--
Barry Margolin, [EMAIL PROTECTED]
GTE Internetworking, Powered by BBN, Burlington, MA
*** DON'T SEND TECHNICAL QUESTIONS DIRECTLY TO ME, post them to newsgroups.
Please DON'T copy followups to me -- I'll assume it wasn't posted to the group.
------------------------------
From: Sang Yong Lee <[EMAIL PROTECTED]>
Subject: HDD Identify command problem
Date: Fri, 31 Mar 2000 15:59:54 +0900
Reply-To: [EMAIL PROTECTED]
Hell All,
I am using PPC405Gp and VIA chip for PCI-ISA Bridge. Into this bridge
bus master E-IDE Controller is integrated, I think.
For reading and writing HDD I/O register in source I have(this is from
ISI corporation), intput/output command is macros like the following..
#define inb(x) *(volatile unsigned shor *)(x)
#define inw(x) *(volatile short *)(x)
#define outb(x) WriteIOReg8((x), (y))
WriteIOReg8 is define in assembly:
.global WriteIOReg8
WriteIOReg8
stb
eieio
blr
When I inb and outb one byte register, it has no problem.. But when I
want
the drive info(in loop iteration. each loop iteration reads info 16bit
value)by
'identify' command, it didn't report data corretly. The code is like
this:
unsigned short buf[1000];
unsigned short *ip;
unsigned short data;
outb(IDE_COMMAND_REG, IDE_CMD_IDENTIFY);
for(i=0;i<256;i++) {
data = inw(IDE_DATA_REG);
*ip++ = BRD_CPU2DEV_SHORT(data);
}
BRD_CPU2DEV_SHORT do the byte swapping since power pc uses big endian
addressing. but when I read, upper byte and lower byte is the same value
all the time.. In other PPC system, this code worked fine.
Could anybody give a clue about this??
In linux-2.3.99-pre3 powerpc code, hard disk register input/output are
all coded
in asm/io.h as a 'inline assmbely" which uses 'eieio' instruction...
Thanks.
------------------------------
From: [EMAIL PROTECTED] (Alexander Viro)
Crossposted-To: comp.lang.c,comp.unix.solaris,comp.lang.c++,comp.unix.programmer
Subject: Re: To core or not to core - You tell me
Date: 4 Apr 2000 16:13:00 -0400
In article <[EMAIL PROTECTED]>,
John Gluck <[EMAIL PROTECTED]> wrote:
>> > > printf("%d\n", ptr->a);
>
>The pointer that is passed to printf will be NULL. Some implementations
He does not pass a pointer. If it would be &ptr->a - yes, text below would
apply. However, he passes ptr->a, aka. *(&ptr->a). And that's dereferencing
NULL, not passing it.
>of printf will check the parameters passed. If it finds that one of the
>parameters (a pointer) is NULL, rather than try to print what NULL
>points to, it will simply print (null) in the output where the value
>pointed to would otherwise go.
>
>Taking the example above, the line printf("%d\n", ptr->a);
>would print the same result as if it had been coded printf("(null)\n");
>
>Hope that clears it up.
It doesn't, simply because it doesn't apply.
--
"You're one of those condescending Unix computer users!"
"Here's a nickel, kid. Get yourself a better computer" - Dilbert.
------------------------------
From: Ron Natalie <[EMAIL PROTECTED]>
Crossposted-To: comp.lang.c,comp.unix.solaris,comp.lang.c++,comp.unix.programmer
Subject: Re: To core or not to core - You tell me
Date: Tue, 04 Apr 2000 16:23:17 -0400
John Gluck wrote:
>
> > > > ptr = NULL;
> > > >
> > > > printf("%d\n", ptr->a);
>
> The pointer that is passed to printf will be NULL.
No pointer, null or otherwise, is passed to printf.
> Some implementations of printf will check the parameters passed.
It's not finding a pointer. The expression (ptr->a) is evaluated completely
before printf gets called. If it gets past the derefernce of ptr in the
-> operator, the passed value will most likely be an int. You are confusing
the case where printf expects a pointer like:
printf("%s\n", (char*) 0);
which it can safely and practically check for.
>
> Taking the example above, the line printf("%d\n", ptr->a);
> would print the same result as if it had been coded printf("(null)\n");
>
> Hope that clears it up.
Yes, it's clear you haven't a clue what is happening.
>
> BTW the DEC C compiler on DEC Unix for Alphas has this behaviour. Your
> code won't crash. You'll just get (null) in your output where ever null
> pointers are passed as args to printf.
Why don't you get off your horse and type in that program to your DEC C
compiler. I've got a lot of experience on that platform, too. It'll segv
prior to the printf call.
------------------------------
From: [EMAIL PROTECTED] (Julien.Soula)
Subject: Re: Finding virtual memory information in a kernel module
Date: 04 Apr 2000 22:39:18 +0200
Doug Schulz <[EMAIL PROTECTED]> writes:
> I am writing a kernel module that locates a process and outputs
> information about that proces's virtual memory. One piece of info that
> I need to find is the virtual memory page that the process's program
> counter is pointing to. I am not sure where to look for this
> information and would appreciate any help.
I suppose that "locates a process" inside kernel means getting its
"task_struct". So the member ".tss.eip" (on x86) give program counter
address and ".mm" give the virtuel memory config.
The function "find_vma" will then return the memory area
(vm_area_struct) where the address is.
> A couple of other pieces of info I need and don't know how to find are
> if the virtual memory page is dirty and if the page is in physical
> memory. Any help on these matters would be appreciated.
Well... Seem more complex!!!
In "vm_area_struct", you can look at ".vm_ops" (operation to do on
read/write/exec)... ????? No more hint :-(
-- Julien
------------------------------
From: [EMAIL PROTECTED] (Juergen Heinzl)
Crossposted-To: comp.lang.c,comp.unix.solaris,comp.lang.c++,comp.unix.programmer
Subject: Re: To core or not to core - You tell me
Date: Tue, 04 Apr 2000 20:42:41 GMT
In article <8cd1d7$vkl$[EMAIL PROTECTED]>, Harish K Chandraia wrote:
>Hi All,
>
> I hope that somebody can tell me what is going on here. I
>have the following C program
>
>#include <stdio.h>
>
>int main()
>{
> struct def
> {
> int a;
> };
>
> struct def *ptr;
>
> ptr = NULL;
>
> printf("%d\n", ptr->a);
>}
>
>
> From all that you know about programming what do you think should
>happen when I try to compile and execute the above program. I have executed
>this piece of code on the following four machines(posting about my
>results will follow). I am not trying to be a smart ass here but I am
>only interested in knowing what you people think would happen because
>what I thought would happen didn't happen on two of the four machines.
[...]
You should think of what the compiler is, probably, going to
generate:
ptr is NULL, so the base address is 0x00000000. a is an integer and
so there are probably no alignment restrictions, so the address of
the 1st byte of a is 0x00000000.
Okay, now 0x00000000 is an invalid address, *but* you are *reading*
from 0x00000000.
Congratiulations, it is system dependent 8-)
Some architecures allow to read from 0x00000000 and will return 0,
some do not and on, e.g., HP the compiler may provide a switch
to generate code which either generates a SEGV or not. Speaking
for aCC only here. In short see the compilers documentation and
use something like purify.
[...]
Cheers,
Juergen
--
\ Real name : J�rgen Heinzl \ no flames /
\ EMail Private : [EMAIL PROTECTED] \ send money instead /
------------------------------
From: "Peter T. Breuer" <[EMAIL PROTECTED]>
Crossposted-To: comp.os.linux.development.apps
Subject: Re: How compatible is Linux with .. Linux
Date: 4 Apr 2000 20:41:23 GMT
In comp.os.linux.development.system Michael Martin <[EMAIL PROTECTED]> wrote:
:> : VMS, HPUX, AIX, Irix, MVS, VSE or other environment. Heck, three years
:> : ago, I could have asked the same question!
:>
:> OK, what IS the difference between VMS and MVS, then! Apart from the
:> first letter (of their manufacturer).
: Sorry, but I really can't resist this opening. Only a very naive, ignorant
: person would have to ask this question!
Oh, I'm ignorant about VMS and MVS alright! Just to prove it, I rather
think that MVS was the multiuser sliced system on the big ibm's back at
uni in the old days, and which I never touched, since I was on JANET
instead - but I got to go to the same room at nights and watch the
history students typing up their theses while Piet Brookes twiddled his
toes! The computer I was on actually had an answer to "help god"
(appeals to the deity must be made directly and not via the XYZ9000).
And "help bus". That one I'll leave to your imagination. I wonder
what computer it was? It wasn't MVS, obviously. Maybe it was unix!
Nah ... it was something else altogether.
I guess that means VMS must be digital's? Gee, I think I'll look it up
in the dictionary of computing ... It's about time I found out. It's
probably in the comp.os faq ... OK OK. The vms faq is at
www.geocities.com/SiliconValley/Lakes/9999/vms.html
and I've read it now. Yes, VMS is digital's. For VAX and Allpha. Wow,
there's OpenVMS and linux on VMS! I didn't get a flavour from a quick
read, however. Which was that system that insisted on making backups
of your file every time you edited it? With colons in. I _think_ that
was MVS. It's been a couple of decades. If so, it's still in use in
backup-conscious places.
I wonder how compatible VMS is with MVS ... ;)
Peter
------------------------------
From: [EMAIL PROTECTED] (Juergen Heinzl)
Crossposted-To: comp.os.linux.development.apps
Subject: Re: Zero padding in sprintf() doesn't work for strings - HELP !
Date: Tue, 04 Apr 2000 20:58:06 GMT
In article <8caudm$uef$[EMAIL PROTECTED]>, bill davidsen wrote:
>
>In article <[EMAIL PROTECTED]>,
>Stephen Harris <[EMAIL PROTECTED]> wrote:
>| Juergen Heinzl ([EMAIL PROTECTED]) wrote:
>| : In article <8briic$ofu$[EMAIL PROTECTED]>, bill davidsen wrote:
>|
>| [ Re 0 padding of strings ]
>|
>| : > Another reason why it should be changed. Both AIX and hp-ux pad with
>| : >zeros as expected, so it would be at minimum acceptable to do it that
>|
>|
>| : ... conversions and the same as far as the Unix98 specification
>| : is concerned, so your installations of AIX and HP-UX are doing it
>| : wrong and you might see whether there is an appropriate patch.
>|
>| Solaris 7 does it with zero's as well, although the manpage doesn't
>| say it should :-)
>|
>| It sort of makes sense - if you want space padding, then the default syntax
>| without a zero does that for you.
>
> I've given up on this one, there are people who blindly assume that
>"anything not required is forbidden." The standard requires zero padding
>on numerics, and the fact that most other operating systems allow it on
>strings, or that this is useful behaviour, does not reach them.
No, it does not reach me writing code that is free to break a./o.
does not work on some other installation is a good idea.
Once upon a time I was using undocumented system calls too. I ceased
to do that when leaving DOS 3.1 behind for something better.
[...]
> And there isn't any overly simple way to do it yourself, you actually
>need a string with the zeros (or a loop, even worse). If I really had to
>have this behaviour I would write a small procedure to accept a string
>and width and return a string with the proper number of leading zeros.
>Not a hard problem, just one more bit of cruft floating through your
>code.
[...]
... which you are going to need even so, as no-one is going to
guarantee the buggy version will work. I prefer to leave work earlier
to sorting out other peoples' `clever' hacks, that is all.
[...]
Happy hacking, for better or worse 8-]
Juergen
--
\ Real name : J�rgen Heinzl \ no flames /
\ EMail Private : [EMAIL PROTECTED] \ send money instead /
------------------------------
From: [EMAIL PROTECTED]
Subject: struct passwd *
Date: Tue, 04 Apr 2000 20:50:53 GMT
hey all,
ok why does this program result in a SEGV? On solaris the exact code
does not. Am I missing something, like the result is protected memory
and when you try to free it, it will not let you? Any assistance would
be appreciated!
tia,
robert
[EMAIL PROTECTED]
#include <stdio.h>
#include <stdlib.h>
#include <pwd.h>
#include <sys/types.h>
int main(void)
{
struct passwd *myp;
myp = getpwuid(1033);
if (myp != (struct passwd *) NULL)
{
printf("User name = %s\nUser password = %s\nUser id = %d\nGroup
id = %d\nReal name = %s\nHome Directory = %s\nShell program = %s\n",
myp->pw_name, myp->pw_passwd, myp->pw_uid, myp->pw_gid, myp->pw_gecos,
myp->pw_dir, myp->pw_shell);
if (myp != (struct passwd *) NULL)
{
free(myp);
}
}
else
{
printf("Unable to find the user.\n");
}
return(0);
}
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
** FOR YOUR REFERENCE **
The service address, to which questions about the list itself and requests
to be added to or deleted from it should be directed, is:
Internet: [EMAIL PROTECTED]
You can send mail to the entire list (and comp.os.linux.development.system) via:
Internet: [EMAIL PROTECTED]
Linux may be obtained via one of these FTP sites:
ftp.funet.fi pub/Linux
tsx-11.mit.edu pub/linux
sunsite.unc.edu pub/Linux
End of Linux-Development-System Digest
******************************