simplify
This commit is contained in:
+8
-17
@@ -1,25 +1,16 @@
|
||||
#include <stdio.h> /* NULL, fprintf(3), putc(3) */
|
||||
#include <stdlib.h> /* stdout */
|
||||
#include <sysexits.h> /* EX_OK */
|
||||
#include <stddef.h> /* NULL */
|
||||
#include <unistd.h> /* write(2) */
|
||||
|
||||
int main(int argc, char **argv){
|
||||
int i;
|
||||
|
||||
if(*argv == NULL)
|
||||
goto blank;
|
||||
|
||||
++argv;
|
||||
|
||||
while(--argc){
|
||||
for(i = 0; argv[0][i] != '\0'; ++i);
|
||||
write(1, *(argv++), i);
|
||||
if(argc > 1)
|
||||
write(1, " ", 1);
|
||||
if(*argv == NULL || *++argv == NULL){
|
||||
argc = 1;
|
||||
putc('\n', stdout);
|
||||
}
|
||||
|
||||
blank:
|
||||
#ifndef PROMPT
|
||||
write(1, "\n", 1);
|
||||
#endif
|
||||
while(--argc)
|
||||
fprintf(stdout, "%s%c", *(argv++), argc > 1 ? ' ' : '\n');
|
||||
|
||||
return EX_OK;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user