Changeset 7938 for trunk/Ohana/src/opihi/cmd.basic/output.c
- Timestamp:
- Jul 19, 2006, 10:26:59 AM (20 years ago)
- File:
-
- 1 edited
-
trunk/Ohana/src/opihi/cmd.basic/output.c (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Ohana/src/opihi/cmd.basic/output.c
r7917 r7938 5 5 int output (int argc, char **argv) { 6 6 7 int N ;7 int N, Noutput; 8 8 gpDest dest; 9 9 IOBuffer *buffer; 10 char *output; 10 11 11 12 dest = GP_LOG; … … 21 22 } 22 23 24 /* set the output target and dump the current buffer there */ 23 25 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 */ 24 34 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); 29 40 return (TRUE); 30 41 } 31 42 32 43 if (argc != 2) { 33 gprint (GP_ERR, "USAGE: output <filename> \n");44 gprint (GP_ERR, "USAGE: output <filename> [-err] [-buffer] [-dump filename]\n"); 34 45 return (FALSE); 35 46 } … … 46 57 outfile = stdout; 47 58 } 48 49 /* we could add the concept of saving the output to a buffer50 then dumping to the target of the output stream. not sure51 what the command should look like... */
Note:
See TracChangeset
for help on using the changeset viewer.
