EXPORT_C TInt RMessagingTestUtilityServer::GetDirL(const TDesC& aPath, const TUint aEntryAttMask, const TUint aEntrySortKey, CDir*& aDir) // // Obtain directory information regardless of data caging. // Caller is responsible for deleting CDir object as with RFs::GetDir(). // { TPckgBuf<TUint> entryAttMask(aEntryAttMask); TPckgBuf<TUint> entrySortKey(aEntrySortKey); TIpcArgs args1(&aPath, &entryAttMask, &entrySortKey); TInt ret = SendReceive(EGetDir, args1); //Create CDir object on the server. TPckgBuf<TUint> countBuf; TIpcArgs args2(&countBuf); ret = SendReceive(EGetDirCount, args2); //Get the number of dir entries. TUint count = countBuf(); CDirDerived* dirDerived = CDirDerived::NewL(); //Construct a new CDir from CDirDerived. TPckgBuf<TEntry> entryBuf; for (TUint i=0; i<count; i++) { TPckgBuf<TInt> indexBuf(i); TIpcArgs args3(&indexBuf, &entryBuf); ret = SendReceive(EGetDirEntry, args3); //Get each dir entry from the server. TEntry entry = entryBuf(); dirDerived->AddL(entry); //Add each entry to the client's CDir object. } aDir = dirDerived; //Return pointer to client's CDir object. TInt c2 = aDir->Count(); return KErrNone; }
static int test_argv_quotes (void) { const ACE_TCHAR *argv_const[] = { ACE_TEXT ("first without quotes"), ACE_TEXT ("'second in single quotes'"), ACE_TEXT ("\"third in double quotes\""), 0 }; ACE_TCHAR **argv = const_cast<ACE_TCHAR **> (argv_const); // The convoluted argv definition is to silence warnings from gcc 4.3, which // warns if the string-literals are not assigned to const char* and also // warns if the const char*[] is passed to the ACE_ARGV constructor as in // "args3" below. int argc = 3; // (argc, argv) ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\n*** argv ***\n"))); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("argc: %d\n"), argc)); for (int i = 0; i < argc; ++i) ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("argv[%02d] = %s\n"), i, argv[i])); // args ACE_ARGV args; for (int i = 0; i < argc; ++i) args.add (argv[i]); args.add (ACE_TEXT ("'fourth in single quotes'")); args.add (ACE_TEXT ("\"fifth in double quotes\"")); args.add (ACE_TEXT ("sixth without any quotes")); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\n*** args-1 ***\n"))); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("args.argc (): %d\n"), args.argc ())); for (int i = 0; i < args.argc (); ++i) ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("args[%02d]: %s\n"), i, args[i])); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("args.argc (): %d\n"), args.argc ())); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\n*** args-2 ***\n"))); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("args.argc (): %d\n"), args.argc ())); for (int i = 0; i < args.argc (); ++i) ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("args.argv ()[%02d]: %s\n"), i, args.argv ()[i])); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("args.argc (): %d\n"), args.argc ())); // args2 ACE_ARGV args2; for (int i = 0; i < argc; ++i) args2.add (argv[i], true); args2.add (ACE_TEXT ("'fourth in single quotes'"), true); args2.add (ACE_TEXT ("\"fifth in double quotes\""), true); args2.add (ACE_TEXT ("sixth without any quotes"), true); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\n*** args-3 ***\n"))); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("args.argc (): %d\n"), args2.argc ())); for (int i = 0; i < args2.argc (); ++i) ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("args[%02d]: %s\n"), i, args2[i])); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("args.argc (): %d\n"), args2.argc ())); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\n*** args-4 ***\n"))); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("args.argc (): %d\n"), args2.argc ())); for (int i = 0; i < args2.argc (); ++i) ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("args.argv ()[%02d]: %s\n"), i, args2.argv ()[i])); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("args.argc (): %d\n"), args2.argc ())); // args3 ACE_ARGV args3 (argv); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\n*** args-5 ***\n"))); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("args.argc (): %d\n"), args3.argc ())); for (int i = 0; i < args3.argc (); ++i) ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("args[%02d]: %s\n"), i, args3[i])); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("args.argc (): %d\n"), args3.argc ())); return 0; }