| iMatix home page
| << | < | > | >>
SFL Logo SFL
Version 2.11

 

process_esc

#include "sflproc.h"
char *
process_esc (char *dest, const char *src)

Synopsis

Escapes a directory string so that process create() can handle it correctly. If you pass a command to process_create with a directory name that contains spaces, it will assume that the spaces delimit the command from its arguments. For instance, under Windows 95, the filename "C:\Program Files\Myprog.exe" will be incorrectly treated as a program called "C:\Program" with arguments "Files\Myprog.exe". This function replaces spaces by the escape character (0x1B). You cannot use this value in a filename and expect process create() to work correctly. On an EBCDIC system, the escape character (0x27) is also used. If the dest argument is NULL, allocates a string using mem_alloc() and returns that. Otherwise copies into the dest string and returns that. If the src string is NULL, returns an empty string.

Source Code - (sflproc.c)

{
#if (defined (__EBCDIC__))
#   define ESC_CHAR   0x27
#else
#   define ESC_CHAR   0x1B
#endif
    /*  Copy to dest, allocate if necessary                                  */
    if (dest != src)
      {
        xstrcpy_debug ();
        dest = xstrcpy (dest, src, NULL);
      }
    strconvch (dest, ' ', ESC_CHAR);
    return (dest);
}

| << | < | > | >> iMatix Copyright © 1996-2000 iMatix Corporation