IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 13555


Ignore:
Timestamp:
May 30, 2007, 12:43:58 PM (19 years ago)
Author:
jhoblitt
Message:

add psArgumentHelpSimple()

Location:
trunk/psLib/src/types
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/psLib/src/types/psArguments.c

    r13521 r13555  
    77 *  @author David Robbins, MHPCC
    88 *
    9  *  @version $Revision: 1.26 $ $Name: not supported by cvs2svn $
    10  *  @date $Date: 2007-05-25 04:15:46 $
     9 *  @version $Revision: 1.27 $ $Name: not supported by cvs2svn $
     10 *  @date $Date: 2007-05-30 22:43:58 $
    1111 *
    1212 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    506506}
    507507
     508void psArgumentHelpSimple(psMetadata *arguments)
     509{
     510    PS_ASSERT_PTR_NON_NULL(arguments, );
     511
     512    printf("Optional arguments:\n");
     513    int maxName = 4;   // Maximum length of a name
     514    int maxValue = 4;   // Maximum length of a value
     515
     516    // First pass to get the sizes
     517    maxLength(&maxName, &maxValue, arguments);
     518
     519    // Second pass to print
     520    psMetadataIterator *iter = psMetadataIteratorAlloc(arguments, PS_LIST_HEAD, NULL);
     521    psMetadataItem *item = NULL; // Item from iterator
     522    while ((item = psMetadataGetAndIncrement(iter))) {
     523        // Initial indent + name + indent + comment
     524        printf("%*s%*s%*s%s\n",
     525                NUM_SPACES, " ",
     526                maxName, argItem->name,
     527                NUM_SPACES, " ",
     528                argItem->comment);
     529    }
     530
     531    psFree(iter);
     532}
     533
  • trunk/psLib/src/types/psArguments.h

    r11248 r13555  
    55 *  @author David Robbins, MHPCC
    66 *
    7  *  @version $Revision: 1.4 $ $Name: not supported by cvs2svn $
    8  *  @date $Date: 2007-01-23 22:47:23 $
     7 *  @version $Revision: 1.5 $ $Name: not supported by cvs2svn $
     8 *  @date $Date: 2007-05-30 22:43:58 $
    99 *
    1010 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    7272);
    7373
     74/** Prints to stdout a simplifed guide to the command-line arguments.      */
     75void psArgumentHelpSimple(
     76    psMetadata *arguments              ///< metadata container for arguments
     77);
     78
    7479/// @}
    7580#endif // #ifndef PS_ARGUMENTS_H
Note: See TracChangeset for help on using the changeset viewer.