IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jul 19, 2006, 10:26:59 AM (20 years ago)
Author:
eugene
Message:

unified the client/standalone command functions

File:
1 edited

Legend:

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

    r7917 r7938  
    55int output (int argc, char **argv) {
    66 
    7   int N;
     7  int N, Noutput;
    88  gpDest dest;
    99  IOBuffer *buffer;
     10  char *output;
    1011
    1112  dest = GP_LOG;
     
    2122  }
    2223   
     24  /* set the output target and dump the current buffer there */
    2325  if ((N = get_argument (argc, argv, "-dump"))) {
     26    buffer = gprintGetBuffer (dest);
     27
     28    /* save the current buffer contents */
     29    Noutput = buffer[0].Nbuffer;
     30    ALLOCATE (output, char, Noutput);
     31    memcpy (output, buffer[0].buffer, Noutput);
     32   
     33    /* set the output target to the specified name */
    2434    remove_argument (N, &argc, argv);
    25     buffer = gprintGetBuffer (dest);
    26     fprintf (STDERR, "buffer contents: \n");
    27     fwrite (buffer[0].buffer, 1, buffer[0].Nbuffer, stderr);
    28     fprintf (STDERR, "\n");
     35    gprintSetFile (dest, argv[N]);
     36    remove_argument (N, &argc, argv);
     37
     38    /* send the output to the appropriate destination */
     39    gwrite (output, 1, Noutput, dest);
    2940    return (TRUE);
    3041  }
    3142   
    3243  if (argc != 2) {
    33     gprint (GP_ERR, "USAGE: output <filename>\n");
     44    gprint (GP_ERR, "USAGE: output <filename> [-err] [-buffer] [-dump filename]\n");
    3445    return (FALSE);
    3546  }
     
    4657  outfile = stdout;
    4758}
    48 
    49 /* we could add the concept of saving the output to a buffer
    50    then dumping to the target of the output stream.  not sure
    51    what the command should look like... */
Note: See TracChangeset for help on using the changeset viewer.