amiga.org
     
iconAll times are GMT -6. The time now is 07:40 AM. | Welcome to Forum, please register to access all of our features.

» Amiga.org » The "Not Quite Amiga but still computer related category" » Alternative Operating Systems » Quick question on C string comparison (resolved)

Alternative Operating Systems This forum is dedicated to discussions of alternatives to the Commodore Amiga Platform, such as Linux distributions, FreeBSD, OpenBSD, and others.

Reply
 
Thread Tools Display Modes
Old 12-03-2007, 01:18 AM   #1
LoadWB
Kindred of Babble-on
Points: 13,379, Level: 75 Points: 13,379, Level: 75 Points: 13,379, Level: 75
Activity: 42% Activity: 42% Activity: 42%
 
LoadWB's Avatar
 
Join Date: Jul 2006
Location: Tallahassee, FL
Posts: 2,128
Default Quick question on C string comparison (resolved)

I'm farting around with UW's imap kit, imap-2006i. I want to have the syslog facility set based on the running service.

Here's the call to server_init() from imap.c:

server_init (pgmname,"imap","imaps",clkint,kodint,hupint,trmin t);


Here's the function definition from env_unix.c:

void server_init (char *server,char *service,char *sslservice,
void *clkint,void *kodint,void *hupint,void *trmint)


The line I'm trying to get to make work looks like this:

openlog (myServerName = cpystr (server), LOG_PID, (service=="imap") ? LOG_LOCAL2 : LOG_LOCAL0);


The ternary always returns the false value, LOG_LOCAL0. It's been forever since I did anything useful with C... what am I missing here?
LoadWB is offline   Reply With Quote
Old 12-03-2007, 01:21 AM   #2
Piru
' union select name,pwd--
Points: 30,457, Level: 100 Points: 30,457, Level: 100 Points: 30,457, Level: 100
Activity: 69% Activity: 69% Activity: 69%
 
Piru's Avatar
 
Join Date: Aug 2002
Location: Helsinki, Finland
Posts: 6,946
Default Re: Quick question on C string comparison

service=="imap" does not compare strings, but string pointers.

look into strcmp.
Piru is offline   Reply With Quote
Old 12-03-2007, 01:38 AM   #3
LoadWB
Kindred of Babble-on
Points: 13,379, Level: 75 Points: 13,379, Level: 75 Points: 13,379, Level: 75
Activity: 42% Activity: 42% Activity: 42%
 
LoadWB's Avatar
 
Join Date: Jul 2006
Location: Tallahassee, FL
Posts: 2,128
Default Re: Quick question on C string comparison

Bingo. Darned pointers. I knew I was missing something easy.

Piru, I *knew* you'd have the answer. Thanks!

This did it

openlog (myServerName = cpystr (server), LOG_PID, strcmp(service,"imap") ? LOG_LOCAL0 : LOG_LOCAL2 );

Now this is fixed, I need to get to bed. Tomorrow I get to figure out what Mark changed in dmail between 2004f and 2006i so I can make port my symlink hack :-D
LoadWB is offline   Reply With Quote
Reply

Bookmarks

Tags
comparison , question , quick , resolved , string

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Quick PSU question tonyyeb Amiga Hardware Issues and discussion 3 08-09-2008 06:47 AM
Quick OS3.9 question Everblue Amiga Hardware Issues and discussion 1 01-13-2008 03:58 PM
Quick SFS question Everblue Amiga Software Issues and Discussion 6 01-03-2007 08:18 AM
Quick pc ram question Gav Amiga Hardware Issues and discussion 13 12-08-2006 02:38 PM
Quick question: Please help Bodie Amiga Hardware Issues and discussion 9 01-27-2003 09:08 AM