Workaround for bsd bug incorporated from dawn_6

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@4817 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Richard Frith-MacDonald 1999-09-04 05:04:45 +00:00
parent a8572e001e
commit e7e9407307

View file

@ -19,7 +19,7 @@
You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA.
*/
/*************************************************************************
@ -160,6 +160,7 @@ _gnu_process_args(int argc, char *argv[], char *env[])
_gnu_processName = [[NSString stringWithCString: argv[0]] lastPathComponent];
RETAIN(_gnu_processName);
/* Copy the argument list */
{
NSMutableSet *mySet;
@ -268,6 +269,7 @@ static char **_gnu_noobjc_env;
int length;
int position;
int env_terms;
BOOL stripTrailingNewline = NO;
#ifdef HAVE_PROGRAM_INVOCATION_NAME
extern char *program_invocation_name;
#endif /* HAVE_PROGRAM_INVOCATION_NAME */
@ -360,6 +362,16 @@ static char **_gnu_noobjc_env;
c = getc(ifp);
if ((c == EOF) || (c == 0)) // End of a parameter
{
if (argument == 0 && position > 0
&& _gnu_noobjc_argv[argument][position-1] == '\n')
{
stripTrailingNewline = YES;
}
if (stripTrailingNewline == YES && position > 0
&& _gnu_noobjc_argv[argument][position-1] == '\n')
{
position--;
}
_gnu_noobjc_argv[argument][position] = '\0';
argument++;
if (c == EOF) // End of command line
@ -554,10 +566,8 @@ int main(int argc, char *argv[], char *env[])
// $$$ The format of the string is not specified by the OpenStep
// specification. It could be useful to change this format after
// NeXTSTEP release 4.0 comes out.
return [NSString stringWithFormat: @"%s: %d: [%s]",
[[self hostName] cString],
pid,
[[[NSDate date] description] cString]];
return [NSString stringWithFormat: @"%@:%d:[%@]",
[self hostName], pid, [NSDate date]];
}
/*************************************************************************