aboutsummaryrefslogtreecommitdiffstats
path: root/swall/scomm.c
diff options
context:
space:
mode:
authornathansmith117 <nathansmith117@sdf.org>2024-05-22 04:51:55 +0000
committernathansmith117 <nathansmith117@sdf.org>2024-05-22 04:51:55 +0000
commitbdd8d563ff3f0eec41cc45d07f6c00622a531a72 (patch)
treeceb9cac325b893b20b5d0303e988252136680e03 /swall/scomm.c
downloadforgorttonProjects-main.tar.gz
forgorttonProjects-main.tar.bz2
forgorttonProjects-main.zip
first commitHEADmain
Diffstat (limited to 'swall/scomm.c')
-rw-r--r--swall/scomm.c55
1 files changed, 55 insertions, 0 deletions
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;
+}