learning-cc4e

Solution to https://cc4e.com/. If you copy these you're not right in the head.
git clone https://kaka.farm/~git/learning-cc4e
Log | Files | Refs

solution.c (574B)


      1 void py_rstrip_quote(inp)
      2 char inp[];
      3 {
      4   if (inp[0] == '\0') {
      5     if (inp[-1] == ' '
      6           || inp[-1] == '\t'
      7           || inp[-1] == '\n') {
      8       printf("%c\n", inp[-1]);
      9       inp[-1] = '\0';
     10     }
     11   } else {
     12     py_rstrip_quote(inp + 1);
     13   }
     14 }
     15 
     16 void py_rstrip(inp)
     17     char inp[];
     18 {
     19   /*
     20   if (inp[0] == '\0') {
     21     return;
     22   }
     23   py_rstrip_quote(inp + 1);
     24   */
     25   char *last_non_space_location;
     26   for (last_non_space_location = inp; *inp != '\0'; ++inp) {
     27     if (*inp != ' ') {
     28       last_non_space_location = inp;
     29     }
     30   }
     31   last_non_space_location[1] = '\0';
     32 }