本文整理汇总了C++中Credential::GetTypeString方法的典型用法代码示例。如果您正苦于以下问题:C++ Credential::GetTypeString方法的具体用法?C++ Credential::GetTypeString怎么用?C++ Credential::GetTypeString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Credential
的用法示例。
在下文中一共展示了Credential::GetTypeString方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main(int argc, char **argv)
{
char * server_address = NULL;
char ** ptr;
const char * myName;
// find our name
myName = strrchr( argv[0], DIR_DELIM_CHAR );
if( !myName ) {
myName = argv[0];
} else {
myName++;
}
// read config file
myDistro->Init (argc, argv);
config ();
for (ptr=argv+1,argc--; argc > 0; argc--,ptr++) {
if ( ptr[0][0] == '-' ) {
switch ( ptr[0][1] ) {
case 'h':
usage(myName);
exit(0);
break;
case 'd':
// dprintf to console
Termlog = 1;
dprintf_config ("TOOL", get_param_functions());
break;
case 'n':
if( !(--argc) || !(*(++ptr)) ) {
fprintf( stderr, "%s: -n requires another argument\n",
myName );
exit(1);
}
server_address = strdup (*ptr);
break;
case 'v':
version(); // this function calls exit(0)
break;
default:
fprintf( stderr, "%s: Unknown option %s\n",
myName, *ptr);
usage(myName);
exit(1);
}
} //fi
} //rof
CondorError errorstack;
int number = 0;
SimpleList <Credential*> result;
DCCredd credd(server_address);
// resolve server address
if ( ! credd.locate() ) {
fprintf (stderr, "%s\n", credd.error() );
return 1;
}
if (!credd.listCredentials (result,
number,
errorstack)) {
fprintf (stderr, "Unable to retrieve credentials (%s)\n",
errorstack.getFullText(true));
return 1;
}
if (number > 0) {
Credential * cred;
result.Rewind();
printf ("Name\tType\n-----\t-----\n");
while (result.Next (cred)) {
printf ("%s\t%s\n", cred->GetName(), cred->GetTypeString());
}
printf ("\nTotal %d\n", number);
} else if (number == 0) {
printf ("No credentials currently stored on this server\n");
} else {
fprintf (stderr, "ERROR\n");
return 1;
}
return 0;
}