if (!ds_is_empty (&file) && !ISSLASH (ds_last (&file)))
ds_put_char (&file, '/');
ds_put_cstr (&file, base_name);
+ ds_relocate (&file);
/* Check whether file exists. */
if (fn_exists (ds_cstr (&file)))
#include <libpspp/message.h>
#include <libpspp/pool.h>
+#include <relocatable.h>
#include "minmax.h"
#include "xalloc.h"
#include "xsize.h"
{
memset (ds_put_uninit (st, cnt), ch, cnt);
}
+
+
+/* If relocation has been enabled, replace ST,
+ with its relocated version */
+void
+ds_relocate (struct string *st)
+{
+ const char *orig = ds_cstr (st);
+ const char *rel = relocate (orig);
+
+ if ( orig != rel)
+ {
+ ds_clear (st);
+ ds_put_cstr (st, rel);
+ free ((char *) rel);
+ }
+}
/* PSPP - a program for statistical analysis.
- Copyright (C) 1997-9, 2000 Free Software Foundation, Inc.
+ Copyright (C) 1997-9, 2000, 2009 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
PRINTF_FORMAT (2, 3);
char *ds_put_uninit (struct string *st, size_t incr);
+/* Other */
+/* calls relocate from gnulib on ST */
+void ds_relocate (struct string *st);
+
#endif /* str_h */