IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 42081


Ignore:
Timestamp:
Feb 28, 2022, 12:15:17 PM (4 years ago)
Author:
eugene
Message:

add getargs function; add option to list -join to start on later word

Location:
trunk/Ohana/src/opihi/cmd.basic
Files:
3 edited
2 copied

Legend:

Unmodified
Added
Removed
  • trunk/Ohana/src/opihi/cmd.basic/Makefile

    r40522 r42081  
    2828$(SRC)/file.$(ARCH).o        \
    2929$(SRC)/getchr.$(ARCH).o     \
     30$(SRC)/getargs.$(ARCH).o     \
    3031$(SRC)/help.$(ARCH).o        \
    3132$(SRC)/input.$(ARCH).o       \
  • trunk/Ohana/src/opihi/cmd.basic/init.c

    r41341 r42081  
    1414int file            PROTO((int, char **));
    1515int getchr_func     PROTO((int, char **));
     16int getargs         PROTO((int, char **));
    1617int help            PROTO((int, char **));
    1718int input           PROTO((int, char **));
     
    6667  {1, "file",          file,               "test file existence"},
    6768  {1, "getchr",        getchr_func,        "find character in string"},
     69  {1, "getargs",       getargs,            "find and remove arguments from the macro argument list"},
    6870  {1, "help",          help,               "get help on a function *"},
    6971  {1, "input",         input,              "read command lines from a file *"},
  • trunk/Ohana/src/opihi/cmd.basic/list.c

    r41341 r42081  
    119119  // return an error if -add is given with no other args
    120120  if ((argc > 2) && (!strcmp (argv[2], "-join"))) {
     121    int start = 0;
     122    if ((N = get_argument (argc, argv, "-start"))) {
     123      remove_argument (N, &argc, argv);
     124      start = atoi (argv[N]);
     125      remove_argument (N, &argc, argv);
     126    }
     127
    121128    if (argc != 4) {
    122129      gprint (GP_ERR, "USAGE: list (root) -join (variable)\n");
     
    137144    memset (output, 0, MAX_LINE_LENGTH);
    138145
    139     for (i = 0; i < nList; i++) {
     146    for (i = start; i < nList; i++) {
    140147      snprintf (line, MAX_LINE_LENGTH, "%s:%d", argv[1], i);
    141148      char *word = get_variable (line);
Note: See TracChangeset for help on using the changeset viewer.