4 * Little function to change the name of a process
6 * Originally from C. S. Ananian's pptpclient
8 * $Id: inststr.c,v 1.2 2004/04/22 10:48:16 quozl Exp $
15 #ifndef HAVE_SETPROCTITLE
20 void inststr(int argc
, char **argv
, char *src
)
22 if (strlen(src
) <= strlen(argv
[0])) {
25 for (ptr
= argv
[0]; *ptr
; *(ptr
++) = '\0')
28 for (pptr
= argv
+ 1; *pptr
; pptr
++)
29 for (ptr
= *pptr
; *ptr
; *(ptr
++) = '\0')
32 /* Originally from the source to perl 4.036 (assigning to $0) */
36 ptr
= argv
[0] + strlen(argv
[0]);
37 for (count
= 1; count
< argc
; count
++) {
38 if (argv
[count
] == ptr
+ 1) {
44 for (ptr2
= argv
[0]; ptr2
<= ptr
; ptr2
++) {
48 strlcpy(argv
[0], src
, count
);
51 #endif /* !HAVE_SETPROCTITLE */