1 /* inststr.c ... stolen from bdupdate.c, which stole it from perl 4.
2 * Theft by C. Scott Ananian <cananian@alumni.princeton.edu>
4 * $Id: inststr.c,v 1.1.1.1 2002/07/25 06:52:39 honor Exp $
10 inststr(int argc
, char **argv
, char **environ
, char *src
)
12 if (strlen(src
) <= strlen(argv
[0]))
16 for (ptr
= argv
[0]; *ptr
; *(ptr
++) = '\0');
21 /* stolen from the source to perl 4.036 (assigning to $0) */
24 ptr
= argv
[0] + strlen(argv
[0]);
25 for (count
= 1; count
< argc
; count
++) {
26 if (argv
[count
] == ptr
+ 1) {
27 int fwd
= strlen(++ptr
);
31 if (environ
[0] == ptr
+ 1) {
32 for (count
= 0; environ
[count
]; count
++)
33 if (environ
[count
] == ptr
+ 1) {
34 int fwd
= strlen(++ptr
);
39 for (ptr2
= argv
[0]; ptr2
<= ptr
; ptr2
++) {
43 strncpy(argv
[0], src
, count
);