TCU

A reimplementation of the BSD core utilities written in C.
Log | Files | Refs | README | LICENSE

echo.c (434B)


      1 /* Terrible implmentation of the core utility 'Echo' */
      2 /* For licnese information see the LICENSE file included in the repo */
      3 #include<stdio.h>
      4 #include<string.h>
      5 
      6 int main(int argc, char *argv[])
      7 {
      8     if (argc == 1)
      9     {
     10         printf("\t\n");
     11         return 0;
     12     }
     13     int value = strcmp(argv[1], "-n");
     14     if (value == 0) {
     15         printf("%s", argv[2]);
     16     } else {
     17         printf("%s\n", argv[1]);
     18     }
     19     return 0;
     20 }