[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r23147 - monkey/branches/MonkeyBacktracking/monkey/src/path
From: |
gnunet |
Subject: |
[GNUnet-SVN] r23147 - monkey/branches/MonkeyBacktracking/monkey/src/pathologist |
Date: |
Tue, 7 Aug 2012 15:23:52 +0200 |
Author: safey
Date: 2012-08-07 15:23:52 +0200 (Tue, 07 Aug 2012)
New Revision: 23147
Modified:
monkey/branches/MonkeyBacktracking/monkey/src/pathologist/action_api.c
monkey/branches/MonkeyBacktracking/monkey/src/pathologist/pathologist.c
Log:
If no report name is supplied, output will be named after the binary name and
pathologist's PID
Modified: monkey/branches/MonkeyBacktracking/monkey/src/pathologist/action_api.c
===================================================================
--- monkey/branches/MonkeyBacktracking/monkey/src/pathologist/action_api.c
2012-08-07 12:23:05 UTC (rev 23146)
+++ monkey/branches/MonkeyBacktracking/monkey/src/pathologist/action_api.c
2012-08-07 13:23:52 UTC (rev 23147)
@@ -277,32 +277,21 @@
return 1; /* Error */
/* This is done to extract the only the file name from the full path
coming from the Database */
- token = strtok(colValues[0], "/");
- if (NULL == token)
- return 1; /* Error */
- do {
- tokenLength = strlen(token);
- ext = &token[tokenLength - 2];
- if (strcmp(ext, ".c") == 0) {
- fileName = MONKEY_malloc(sizeof(struct FileName));
- fileName->name = MONKEY_strdup(token);
- fileName->next = NULL;
- fileName->prev = NULL;
- MONKEY_CONTAINER_DLL_insert(fileNameListHead, fileNameListTail,
- fileName);
- return 0; /* OK */
- }
- token = strtok(NULL, "/");
+ token = strrchr(colValues[0], '/');
+ if (NULL == token) {
+ token = colValues[0];
+ } else {
+ token++;
}
- while (NULL != token);
-
-
- return 1; /* Error */
+ fileName = MONKEY_malloc(sizeof(struct FileName));
+ fileName->prev = NULL;
+ fileName->next = NULL;
+ fileName->name = MONKEY_strdup(token);
+ MONKEY_CONTAINER_DLL_insert(fileNameListHead, fileNameListTail, fileName);
+ return 0; /* OK */
}
-
-
static int
outerScopesCallback(void *cls, int numColumns, char **colValues,
char **colNames)
Modified:
monkey/branches/MonkeyBacktracking/monkey/src/pathologist/pathologist.c
===================================================================
--- monkey/branches/MonkeyBacktracking/monkey/src/pathologist/pathologist.c
2012-08-07 12:23:05 UTC (rev 23146)
+++ monkey/branches/MonkeyBacktracking/monkey/src/pathologist/pathologist.c
2012-08-07 13:23:52 UTC (rev 23147)
@@ -25,6 +25,7 @@
#include <stdio.h>
#include <string.h>
+#include <unistd.h>
#include <sys/stat.h>
#include "monkey_common.h"
#include "pathologist_action.h"
@@ -121,8 +122,14 @@
if (NULL == dumpFileName)
{
- /* if no file name provided for the output report, use a default one in
the current working directory */
- dumpFileName = "pathologist_output";
+ /* if no file name provided for the output report, the default report
name will be binaryName_PIDpid */
+ const char *bn = strrchr(binaryName, '/');
+ if (NULL == bn) {
+ bn = binaryName;
+ } else {
+ bn++;
+ }
+ MONKEY_asprintf(&dumpFileName, "%s_PID%d", bn, getpid());
}
if (strcasecmp (mode, "email") == 0)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r23147 - monkey/branches/MonkeyBacktracking/monkey/src/pathologist,
gnunet <=