version 1.5, 2005/09/29 20:20:59
|
version 1.6, 2005/11/30 20:56:58
|
|
|
} | } |
| |
// allocate memory for the result | // allocate memory for the result |
char * process_name; |
AutoArrayPtr<char> process_name(new char[close_paren - open_paren]); |
process_name = (char*) malloc(close_paren - open_paren - 1); |
|
| |
// copy the process name into the result | // copy the process name into the result |
strncpy (process_name, open_paren + 1, close_paren - open_paren -1); |
strncpy (process_name.get(), open_paren + 1, close_paren - open_paren -1); |
| |
// strncpy doesn't NULL-terminate the result, so do it here | // strncpy doesn't NULL-terminate the result, so do it here |
process_name[close_paren - open_paren -1] = '\0'; |
process_name.get()[close_paren - open_paren -1] = '\0'; |
| |
if (strcmp(process_name, server_process_name) != 0) |
if (strcmp(process_name.get(), server_process_name) != 0) |
{ | { |
return -1; | return -1; |
} | } |