getarg_.c 592 B

123456789101112131415161718192021222324252627282930313233343536
  1. #include "f2c.h"
  2. #ifdef __cplusplus
  3. extern "C" {
  4. #endif
  5. /*
  6. * subroutine getarg(k, c)
  7. * returns the kth unix command argument in fortran character
  8. * variable argument c
  9. */
  10. #ifdef KR_headers
  11. VOID getarg_(n, s, ls) ftnint *n; char *s; ftnlen ls;
  12. #define Const /*nothing*/
  13. #else
  14. #define Const const
  15. void getarg_(ftnint *n, char *s, ftnlen ls)
  16. #endif
  17. {
  18. extern int xargc;
  19. extern char **xargv;
  20. Const char *t;
  21. int i;
  22. if(*n>=0 && *n<xargc)
  23. t = xargv[*n];
  24. else
  25. t = "";
  26. for(i = 0; i<ls && *t!='\0' ; ++i)
  27. *s++ = *t++;
  28. for( ; i<ls ; ++i)
  29. *s++ = ' ';
  30. }
  31. #ifdef __cplusplus
  32. }
  33. #endif