Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

suckless unix tools

Name: Anonymous 2015-04-02 21:41

Name: Anonymous 2015-04-03 13:40

For comparison, Cudder's echo(1) from anoncoreutils[1]

/* @echo.c */
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
int main(int argc, char **argv) {
int i=1, no_nl=0, ret=0;
if(argc>1 && !strcmp(argv[1],"-n")) {
no_nl=1;
i++;
}
while(i<argc) {
ret|=(fputs(argv[i++], stdout)==EOF);
if(i!=argc)
ret|=(fputc(' ',stdout)==EOF);
}
if(!no_nl)
ret|=(fputc('\n',stdout)==EOF);
return ret;
}


[1] http://rechan.eu.org/misc/anoncoreutils-20080617-2.tar.bz2

Name: Anonymous 2015-04-03 13:41

And here's sbase echo(1) [1]

/* See LICENSE file for copyright and license details. */
#include <stdio.h>
#include <string.h>
#include "util.h"

int
main(int argc, char *argv[])
{
int nflag = 0;

if (*++argv && !strcmp(*argv, "-n")) {
nflag = 1;
argc--, argv++;
}

for (; *argv; argc--, argv++)
putword(*argv);
if (!nflag)
putchar('\n');

return 0;
}


http://git.2f30.org/sbase/tree/echo.c

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List