Fixed a bug when using "--" on the command line
This commit is contained in:
parent
7ca743c1dc
commit
70aec3c187
|
@ -1,5 +1,5 @@
|
||||||
/* $Id$ */
|
/* $Id$ */
|
||||||
/* Copyright (c) 2007 Pierre Pronchery <khorben@defora.org> */
|
/* Copyright (c) 2009 Pierre Pronchery <khorben@defora.org> */
|
||||||
/* This file is part of DeforaOS Unix utils */
|
/* This file is part of DeforaOS Unix utils */
|
||||||
/* utils is not free software; you can redistribute it and/or modify it under
|
/* utils is not free software; you can redistribute it and/or modify it under
|
||||||
* the terms of the Creative Commons Attribution-NonCommercial-ShareAlike 3.0
|
* the terms of the Creative Commons Attribution-NonCommercial-ShareAlike 3.0
|
||||||
|
@ -27,11 +27,11 @@ static int _echo(int argc, char * argv[])
|
||||||
|
|
||||||
if(argc != 0)
|
if(argc != 0)
|
||||||
{
|
{
|
||||||
printf("%s", argv[0]);
|
fputs(argv[0], stdout);
|
||||||
for(i = 1; i < argc; i++)
|
for(i = 1; i < argc; i++)
|
||||||
printf(" %s", argv[i]);
|
printf(" %s", argv[i]);
|
||||||
}
|
}
|
||||||
fputc('\n', stdout);
|
putchar('\n');
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -55,5 +55,5 @@ int main(int argc, char * argv[])
|
||||||
default:
|
default:
|
||||||
return _usage();
|
return _usage();
|
||||||
}
|
}
|
||||||
return _echo(argc - 1, &argv[1]);
|
return _echo(argc - optind, &argv[optind]);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user