version 1.2.2.4, 2002/03/22 20:42:12 |
version 1.2.2.5, 2002/10/18 02:16:01 |
|
|
and |
and |
.Fn shquotev |
.Fn shquotev |
functions copy strings and transform the copies by adding shell |
functions copy strings and transform the copies by adding shell |
escape and quoting characters. They are used to encapsulate |
escape and quoting characters. |
|
They are used to encapsulate |
arguments to be included in command strings passed to the |
arguments to be included in command strings passed to the |
.Fn system |
.Fn system |
and |
and |
Line 97 function transforms each of the |
|
Line 98 function transforms each of the |
|
.Fa argc |
.Fa argc |
strings specified by the array |
strings specified by the array |
.Fa argv |
.Fa argv |
independently. The transformed strings are |
independently. |
placed in the memory pointed to by |
The transformed strings are placed in the memory pointed to by |
.Fa buf , |
.Fa buf , |
separated by spaces. It does not modify the pointer array |
separated by spaces. |
specified by |
It does not modify the pointer array specified by |
.Fa argv |
.Fa argv |
or the strings pointed to by the pointers in the arrary. |
or the strings pointed to by the pointers in the arrary. |
.Pp |
.Pp |
Line 111 Both functions write up to |
|
Line 112 Both functions write up to |
|
.Fa buf , |
.Fa buf , |
then add a |
then add a |
.Li NUL |
.Li NUL |
character to terminate the output string. If |
character to terminate the output string. |
|
If |
.Fa bufsize |
.Fa bufsize |
is given as zero, the |
is given as zero, the |
.Fa buf |
.Fa buf |
Line 137 The following code fragment demonstrates |
|
Line 139 The following code fragment demonstrates |
|
to construct a command string to be used with |
to construct a command string to be used with |
.Fn system . |
.Fn system . |
The command uses an environment variable (which will be expanded by |
The command uses an environment variable (which will be expanded by |
the shell) to determine the actual program to run. Note that |
the shell) to determine the actual program to run. |
the environment variable may be expanded by the shell into multiple |
Note that the environment variable may be expanded by |
words. The first word of the expansion will be used by the shell |
the shell into multiple words. |
|
The first word of the expansion will be used by the shell |
as the name of the program to run, |
as the name of the program to run, |
and the rest will be passed as arguments to the program. |
and the rest will be passed as arguments to the program. |
.Bd -literal -offset indent |
.Bd -literal -offset indent |
Line 227 cmd[--len] = '\0'; |
|
Line 230 cmd[--len] = '\0'; |
|
.Xr system 3 |
.Xr system 3 |
.Sh BUGS |
.Sh BUGS |
This implementation does not currently handle strings containing multibyte |
This implementation does not currently handle strings containing multibyte |
characters properly. To address this issue, |
characters properly. |
|
To address this issue, |
.Pa /bin/sh |
.Pa /bin/sh |
.Po |
.Po |
the shell used by |
the shell used by |
Line 235 the shell used by |
|
Line 239 the shell used by |
|
and |
and |
.Fn popen |
.Fn popen |
.Pc |
.Pc |
must first be fixed to handle multibyte characters. When that has been |
must first be fixed to handle multibyte characters. |
done, these functions can have multibyte character support enabled. |
When that has been done, |
|
these functions can have multibyte character support enabled. |