home *** CD-ROM | disk | FTP | other *** search
/ vsiftp.vmssoftware.com / VSIPUBLIC@vsiftp.vmssoftware.com.tar / FREEWARE / FREEWARE40.ZIP / flistfrontend / src / argvdcl.c < prev    next >
Encoding:
C/C++ Source or Header  |  1995-05-29  |  1.3 KB  |  57 lines

  1. #ifndef NO_IDENT
  2. static char *Id = "$Id: argvdcl.c,v 1.5 1995/05/29 00:26:38 tom Exp $";
  3. #endif
  4.  
  5. /*
  6.  * Title:    argvdcl.c
  7.  * Author:    Thomas E. Dickey
  8.  * Created:    28 May 1984
  9.  * Last update:
  10.  *        18 Mar 1995, prototypes
  11.  *        15 Dec 1984, added 'cpy_dft' argument to DCLARG.  Corrected
  12.  *                 use of argc-count.
  13.  *        24 Jul 1984, added 'cmd_arg' parameter to DCLARG.
  14.  *        26 Jun 1984
  15.  *
  16.  * Function:    This procedure translates C-type argc,argv module-arguments
  17.  *        into a character string, calls 'dclarg' to process the
  18.  *        resulting list, and returns the DCLARG-pointer to the caller.
  19.  *
  20.  * Parameters:    argc, argv - Passed from module via VMS call.
  21.  *        dft_    => string specifying defaults for file specifications.
  22.  *        cmd_arg    =  TRUE if command-token appears (first) on the line.
  23.  *
  24.  * Note:    This should not be used as a general replacement for the
  25.  *        VAX/VMS DCL interface.
  26.  */
  27.  
  28. #include    <stdlib.h>
  29. #include    <stdio.h>
  30. #include    <string.h>
  31.  
  32. #include    "bool.h"
  33. #include    "dclarg.h"
  34.  
  35. #include    "strutils.h"
  36.  
  37. DCLARG * argvdcl (int argc, char *argv[], char *dft_, int cmd_arg)
  38. {
  39.     DCLARG    *arg_    = 0;
  40.     int    len    = 0;
  41.     int    j;
  42.     char    *c_;
  43.  
  44.     if (argc > 1)
  45.     {
  46.         for (j = 1; j < argc; j++)
  47.             len += 3 + strlen(argv[j]);
  48.         c_ = calloc(1, len);
  49.  
  50.         for (j = 1; j < argc; j++)
  51.             sprintf (strnull(c_), " %s", argv[j]);
  52.         arg_ = dclarg(c_, dft_, cmd_arg, FALSE);
  53.         cfree (c_);
  54.     }
  55.     return (arg_);
  56. }
  57.