This commit is contained in:
2022-12-01 01:21:47 -05:00
parent f85bb632e2
commit d8fa412f3b
3 changed files with 27 additions and 28 deletions
+8 -17
View File
@@ -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;
}