OSF DCE Application Development Guide--Introduction and Style Guide
OSF DCE Application Development Guide—Introduction and Style Guide
/******
*
* do_command_line -- Get and interpret arguments and options from the
* command line, and do other setup related to the
* command line’s contents.
*
* Returns 0 if normal invocation, 1 if setup.
*
* Called from main().
*
******/
int do_command_line(
int argc,
char *argv[],
unsigned_char_t **server_principal_name,
entryname_vector_t *entryname_vector
)
{
dce_error_string_t error_string;
int print_status;
unsigned32 status;
/* Note that the code expects you to type as the second argument */
/* a slash-terminated full CDS directory name, to which it will */
/* then concatenate the entryname. It is this name that is then */
/* passed to the server_export_objects() routine later on. */
/* Check the command line... */
if ( (argc == 2) && (( strcmp(argv[1], "setup") == 0) || \
( strcmp(argv[1], "unsetup") == 0)) )
return 1;
else if (argc < 3)
{
fprintf(stdout, "0sage:0);
fprintf(stdout, " %s <principal_name> <CDS_dir_name>/0, argv[0]);
exit(1);
}
/* Get the server’s principal name from the command line... */
*server_principal_name = (unsigned_char_p_t)malloc(strlen(argv[1]));
strcpy((char *)*server_principal_name, (char *)argv[1]);
/* Get the list of server entry names from the command line... */
entryname_vector->count = 1;
entryname_vector->name[0] = (unsigned_char_p_t)malloc(strlen(argv[2]) + NAMELEN);
strcpy((char *)entryname_vector->name[0], argv[2]);
strcat((char *)entryname_vector->name[0], DEFNAME);
A− 20 Tandem Computers Incorporated 124246










