* Author: AMANDA core development group.
*/
/*
- * $Id: file.c,v 1.40 2006/07/19 17:41:15 martinea Exp $
+ * $Id: file.c,v 1.40.2.1 2006/11/24 18:05:05 martinea Exp $
*
* file and directory bashing routines
*/
return buf;
}
+/* duplicate '_' */
+char *
+old_sanitise_filename(
+ char * inp)
+{
+ char *buf;
+ size_t buf_size;
+ char *s, *d;
+ int ch;
+
+ buf_size = 2*strlen(inp) + 1; /* worst case */
+ buf = alloc(buf_size);
+ d = buf;
+ s = inp;
+ while((ch = *s++) != '\0') {
+ if(ch == '_') {
+ *d++ = (char)ch;
+ }
+ if(ch == '/') {
+ ch = '_'; /* convert "bad" to "_" */
+ }
+ *d++ = (char)ch;
+ }
+ assert(d < buf + buf_size);
+ *d = '\0';
+
+ return buf;
+}
+
/*
*=====================================================================
* Get the next line of input from a stdio file.