summaryrefslogtreecommitdiff
path: root/src/helper
diff options
context:
space:
mode:
authoroharboe <oharboe@b42882b7-edfa-0310-969c-e2dbd0fdcd60>2008-02-29 11:31:49 +0000
committeroharboe <oharboe@b42882b7-edfa-0310-969c-e2dbd0fdcd60>2008-02-29 11:31:49 +0000
commit3a3fc300141d9e0e6b71729d7fd604aa28447116 (patch)
treef84c50630f0fb8dc2585d5c9635aad70ff312fdb /src/helper
parent0a749feb8e05d41b22a75e5545233b3e400463f8 (diff)
downloadopenocd+libswd-3a3fc300141d9e0e6b71729d7fd604aa28447116.tar.gz
openocd+libswd-3a3fc300141d9e0e6b71729d7fd604aa28447116.tar.bz2
openocd+libswd-3a3fc300141d9e0e6b71729d7fd604aa28447116.tar.xz
openocd+libswd-3a3fc300141d9e0e6b71729d7fd604aa28447116.zip
- clean up target output strings a bit
- open_file_from_path() now uses logging feature - open_file_from_path() no longer uses paths for anything but "r" mode. Fixes bug waiting to happen. git-svn-id: svn://svn.berlios.de/openocd/trunk@389 b42882b7-edfa-0310-969c-e2dbd0fdcd60
Diffstat (limited to 'src/helper')
-rw-r--r--src/helper/configuration.c11
-rw-r--r--src/helper/configuration.h2
-rw-r--r--src/helper/interpreter.c2
-rw-r--r--src/helper/log.c2
4 files changed, 12 insertions, 5 deletions
diff --git a/src/helper/configuration.c b/src/helper/configuration.c
index abbcbfcb..d7255606 100644
--- a/src/helper/configuration.c
+++ b/src/helper/configuration.c
@@ -54,8 +54,14 @@ void add_config_file_name (const char *cfg)
config_file_names[num_config_files] = NULL;
}
-FILE *open_file_from_path (command_context_t *cmd_ctx, char *file, char *mode)
+FILE *open_file_from_path (char *file, char *mode)
{
+ if (mode[0]!='r')
+ {
+ return fopen(file, mode);
+ } else
+ {
+
FILE *fp = NULL;
char **search_dirs = script_search_dirs;
char *dir;
@@ -78,9 +84,10 @@ FILE *open_file_from_path (command_context_t *cmd_ctx, char *file, char *mode)
}
if (fp)
- command_print(cmd_ctx, "opened %s", full_path);
+ DEBUG("opened %s", full_path);
return fp;
+ }
}
int parse_config_file(struct command_context_s *cmd_ctx)
diff --git a/src/helper/configuration.h b/src/helper/configuration.h
index f4aa8c0a..ff802758 100644
--- a/src/helper/configuration.h
+++ b/src/helper/configuration.h
@@ -28,6 +28,6 @@ extern int parse_config_file(struct command_context_s *cmd_ctx);
extern void add_config_file_name (const char *cfg);
extern void add_script_search_dir (const char *dir);
extern int configuration_output_handler(struct command_context_s *context, char* line);
-extern FILE *open_file_from_path (command_context_t *cmd_ctx, char *file, char *mode);
+extern FILE *open_file_from_path (char *file, char *mode);
#endif /* CONFIGURATION_H */
diff --git a/src/helper/interpreter.c b/src/helper/interpreter.c
index abf7b093..186d992e 100644
--- a/src/helper/interpreter.c
+++ b/src/helper/interpreter.c
@@ -221,7 +221,7 @@ int handle_script_command(struct command_context_s *cmd_ctx, char *cmd, char **a
if (argc != 1)
return ERROR_COMMAND_SYNTAX_ERROR;
- script_file = open_file_from_path(cmd_ctx, args[0], "r");
+ script_file = open_file_from_path (args[0], "r");
if (!script_file)
{
diff --git a/src/helper/log.c b/src/helper/log.c
index de74f9d0..85861988 100644
--- a/src/helper/log.c
+++ b/src/helper/log.c
@@ -74,7 +74,7 @@ static void log_puts(enum log_levels level, const char *file, int line, const ch
if (f != NULL)
file = f + 1;
- if (strchr(buffer, '\n')!=NULL)
+ if (strchr(string, '\n')!=NULL)
{
if (debug_level >= LOG_DEBUG)
{