k9core

Unnamed repository
Log | Files | Refs | LICENSE

commit dd949baf1c3400127ec003fb6cbe88016f2863c6
parent 34a3f381adc8e6b06cdfec60b1db13cf2b707ae6
Author: qorg11 <qorg@vxempire.xyz>
Date:   Mon, 30 Nov 2020 11:33:42 +0100

Tabs instead of spaces in indentation lol

Diffstat:
Msrc/cat.c | 38+++++++++++++++++++-------------------
1 file changed, 19 insertions(+), 19 deletions(-)

diff --git a/src/cat.c b/src/cat.c @@ -8,31 +8,31 @@ int cat(int fd, const char *filename) { - int c; - char buf[8192]; - if (filename[0] == '-' && filename[1] != 'u') - fd = 0; - - if(fd != 0) - fd = open(filename, O_RDONLY); + int c; + char buf[8192]; + if (filename[0] == '-' && filename[1] != 'u') + fd = 0; - if (fd == -1) - fprintf(stderr,"error opening %s: %s\n",filename,strerror(errno)); + if(fd != 0) + fd = open(filename, O_RDONLY); + if (fd == -1) + fprintf(stderr,"error opening %s: %s\n",filename,strerror(errno)); - while((c = read(fd,buf,sizeof(buf))) > 0) - write(1,buf,c); - close(fd); - return 0; + + while((c = read(fd,buf,sizeof(buf))) > 0) + write(1,buf,c); + close(fd); + return 0; } int main(int argc, char *argv[]) { - int c = getopt(argc,argv,"u"); - if (argc == optind) - cat(0,"-"); - for(int i = optind; i<argc;i++) - cat(1,argv[i]); + int c = getopt(argc,argv,"u"); + if (argc == optind) + cat(0,"-"); + for(int i = optind; i<argc;i++) + cat(1,argv[i]); - return 0; + return 0; }