Add miscfuncs.h to files as needed throughout.
* mount.cc: New file. * path.cc: Move mount-specific stuff into mount.cc. Move common stuff into miscfuncs.cc. Remove unneeded includes. * miscfuncs.cc: Move some common path functions here. * miscfuncs.h: New file. * winsup.h: Move miscelleneous functions to miscfuncs.h. * dcrt0.cc: Remove unneeded includes. * Makefile.in (DLL_OFILES): Add mount.o. * include/cygwin/config.h: Fix a minor typo.
This commit is contained in:
@ -10,8 +10,7 @@ Cygwin license. Please consult the file "CYGWIN_LICENSE" for
|
||||
details. */
|
||||
|
||||
#include "winsup.h"
|
||||
#include "cygerrno.h"
|
||||
#include <sys/errno.h>
|
||||
#include "miscfuncs.h"
|
||||
#include <sys/uio.h>
|
||||
#include <assert.h>
|
||||
#include <alloca.h>
|
||||
@ -20,7 +19,6 @@ details. */
|
||||
#include <wingdi.h>
|
||||
#include <winuser.h>
|
||||
#include <winnls.h>
|
||||
#include "cygthread.h"
|
||||
#include "cygtls.h"
|
||||
#include "ntdll.h"
|
||||
|
||||
@ -500,3 +498,51 @@ create_pipe (PHANDLE hr,PHANDLE hw, LPSECURITY_ATTRIBUTES sa, DWORD n)
|
||||
break;
|
||||
return false;
|
||||
}
|
||||
|
||||
/* backslashify: Convert all forward slashes in src path to back slashes
|
||||
in dst path. Add a trailing slash to dst when trailing_slash_p arg
|
||||
is set to 1. */
|
||||
|
||||
void
|
||||
backslashify (const char *src, char *dst, bool trailing_slash_p)
|
||||
{
|
||||
const char *start = src;
|
||||
|
||||
while (*src)
|
||||
{
|
||||
if (*src == '/')
|
||||
*dst++ = '\\';
|
||||
else
|
||||
*dst++ = *src;
|
||||
++src;
|
||||
}
|
||||
if (trailing_slash_p
|
||||
&& src > start
|
||||
&& !isdirsep (src[-1]))
|
||||
*dst++ = '\\';
|
||||
*dst++ = 0;
|
||||
}
|
||||
|
||||
/* slashify: Convert all back slashes in src path to forward slashes
|
||||
in dst path. Add a trailing slash to dst when trailing_slash_p arg
|
||||
is set to 1. */
|
||||
|
||||
void
|
||||
slashify (const char *src, char *dst, bool trailing_slash_p)
|
||||
{
|
||||
const char *start = src;
|
||||
|
||||
while (*src)
|
||||
{
|
||||
if (*src == '\\')
|
||||
*dst++ = '/';
|
||||
else
|
||||
*dst++ = *src;
|
||||
++src;
|
||||
}
|
||||
if (trailing_slash_p
|
||||
&& src > start
|
||||
&& !isdirsep (src[-1]))
|
||||
*dst++ = '/';
|
||||
*dst++ = 0;
|
||||
}
|
||||
|
Reference in New Issue
Block a user