• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re(2): MoreSCF
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re(2): MoreSCF


  • Subject: Re(2): MoreSCF
  • From: Jens Bauer <email@hidden>
  • Date: Fri, 24 May 2002 19:05:54 +0200

Hi Quinn and Morgan,

On Fri, 24 May, 2002, Quinn <email@hidden> wrote:

>At 14:02 -0700 23/5/02, Morgan Redman wrote:
>>If you use MoreSCMakeNewDialupSet and pass a userVisibleName that is
>>already in use, what happens?
>>
>>Does it return in error, or replace with the new configuration?
>
>Neither. It creates another configuration with the same user visible
>name. User visible names are not required to be unique for SCF to
>work, although you're going to confuse the user if you create two
>sets with same name. To avoid that you can use
>MoreSCFindSetByUserVisibleNameAndCopyID to check if the name already
>exists.

I modified one of your routines, to check if the name already exists.
Please note: This source may be outdated, for best results, you should
have a look at TestSetEnumerationAndSwitch from the current MoreSCF.

/* A modified copy of Quinn's TestSetEnumerationAndSwitch from
MoreSCFTest.c */

/* userVisibleName : the name of the set to search for
* foundSetID : the found setID (remember to CFRelease this)
* result : standard MacOS error code
*/

OSStatus MoreSCFSetFind(CFStringRef userVisibleName, CFStringRef *foundSetID)
{
OSStatus err;
ItemCount setCount;
ItemCount setIndex;
CFArrayRef setIDs;
ItemCount indexOfCurrentSet;

#ifdef _JB_DEBUG
fprintf(stderr, "MoreSCFSetFind\n");
#endif

setIDs = nil;
*foundSetID = nil;

// Enumeration

err = MoreSCCopySetIDs(&setIDs, &indexOfCurrentSet);
if (err == noErr) {
setCount = CFArrayGetCount(setIDs);
for (setIndex = 0; setIndex < setCount; setIndex++) {
CFStringRef userVis;

userVis = nil;
err = MoreSCCopyUserVisibleNameOfSet(CFArrayGetValueAtIndex(setIDs,
setIndex), &userVis);
if (err == noErr) {
if(CFEqual(userVis, userVisibleName))
{
*foundSetID = CFStringCreateCopy(nil, CFArrayGetValueAtIndex(setIDs,
setIndex));
break;
}
}
CFQRelease(userVis);

if (err != noErr) {
break;
}
}
}
CFQRelease(setIDs);

if (err != noErr) {
#ifdef _JB_DEBUG
fprintf(stderr, "777 Failed with error %ld!\n", err);
#endif
}
return(err);
}

If it works, give credit to Quinn. If there are any problems, blame me. :)


Love,
Jens

--
Jens Bauer, Faster Software.
-Let's make the World better, shall we ?
_______________________________________________
macnetworkprog mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/macnetworkprog
Do not post admin requests to the list. They will be ignored.

References: 
 >Re: MoreSCF (From: Quinn <email@hidden>)

  • Prev by Date: Re: MoreSCF
  • Next by Date: Re: Re(2): Authentication for MoreSCF
  • Previous by thread: Re: MoreSCF
  • Next by thread: Disconnected Ethernet Port
  • Index(es):
    • Date
    • Thread