Browse Source

🎉 init

master
lillian rose winter 10 months ago
commit
06b39a1d6f
3 changed files with 65 additions and 0 deletions
  1. +1
    -0
      .gitignore
  2. +18
    -0
      Makefile
  3. +46
    -0
      owo.c

+ 1
- 0
.gitignore View File

@ -0,0 +1 @@
owo

+ 18
- 0
Makefile View File

@ -0,0 +1,18 @@
# the compiler: gcc for C program, define as g++ for C++
CC = gcc
# compiler flags:
# -g adds debugging information to the executable file
# -Wall turns on most, but not all, compiler warnings
CFLAGS = -g -Wall
# the build target executable:
TARGET = owo
all: $(TARGET)
$(TARGET): $(TARGET).c
$(CC) $(CFLAG) -o $(TARGET) $(TARGET).c
clean:
$(RM) $(TARGET)

+ 46
- 0
owo.c View File

@ -0,0 +1,46 @@
#include <stdio.h>
#include <getopt.h>
#include <stdlib.h>
static void help() {
printf("usage: owo [-h] \n");
exit(EXIT_SUCCESS);
}
static void version() {
printf("v0.1 \n");
exit(EXIT_SUCCESS);
}
int main(int argc, char *argv[]) {
int opt;
while ((opt = getopt(argc, argv, "hv")) != -1) {
switch (opt) {
case 'h':
help();
break;
case 'v':
version();
break;
default:
help();
break;
}
}
if (optind == argc) {
char c;
char d = 0;
while ((c = getchar()) != EOF) {
if (c == 'r' || c == 'l') c = 'w';
if (c == 'R' || c == 'L') c = 'W';
if (d == 'n' && c == 'a') putchar('y');
if (d == 'N' && c == 'A') putchar('Y');
putchar(c);
d = c;
}
}
}

Loading…
Cancel
Save