home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1992 March / Source_Code_CD-ROM_Walnut_Creek_March_1992.iso / usenet / altsrcs / 0 / 0987 / argv.c next >
Encoding:
C/C++ Source or Header  |  1990-12-28  |  619 b   |  29 lines

  1. #include <stdio.h>
  2. #include "tcl.h"
  3. /*
  4.  * MOVE_ARGV(argv, argc, srcArray, dstArray, len);
  5.  *
  6.  * Moves an argv pointing into portions of the source string, into the
  7.  * (presumably larger) destination string. It does this by copying
  8.  * the contents of the array, then adjusting each element of the argv.
  9.  * since the two strings may not be in contiguous memory, we have to
  10.  * work with offsets.
  11.  */
  12.  
  13. move_argv(argv, argc, src, dst, len)
  14. char **argv;
  15. int argc;
  16. char *src;
  17. char *dst;
  18. int len;
  19. {
  20.     int i;
  21.     unsigned off;
  22.  
  23.     bcopy(src, dst, len);
  24.     for(i = 0; i <= argc; i++) {
  25.         off = argv[i] - src;
  26.         argv[i] = dst + off;
  27.     }
  28. }
  29.