summaryrefslogtreecommitdiff
path: root/PG/PGTest.c
diff options
context:
space:
mode:
authorg8bpq <john.wiseman@cantab.net>2023-06-21 08:21:04 +0100
committerg8bpq <john.wiseman@cantab.net>2023-06-21 08:21:04 +0100
commit75b5bcc9a97b38c6c0c210bf14fabad9cadf704a (patch)
tree913d37a3946a40e9694833ed36fd5a8e02a23d42 /PG/PGTest.c
parenta21121fbfce48307740e6ade5f4f16531501b053 (diff)
6.0.23.7623.77
Diffstat (limited to 'PG/PGTest.c')
-rw-r--r--PG/PGTest.c53
1 files changed, 53 insertions, 0 deletions
diff --git a/PG/PGTest.c b/PG/PGTest.c
new file mode 100644
index 0000000..4d3742d
--- /dev/null
+++ b/PG/PGTest.c
@@ -0,0 +1,53 @@
+#include <stdio.h>
+
+/*
+ * TST_PG.C
+ *
+ * Little test program of "PG" command for FBB BBS software.
+ *
+ * (C) F6FBB 1991.
+ *
+ * FBB software 5.14 and up.
+ *
+ *
+ * This program echoes to the user what he types
+ * or executes a BBS command preceded by "CMD"
+ * until "BYE" is received
+ */
+
+
+main(int argc, char **argv)
+{
+ int i;
+ int level = atoi(argv[2]); /* Get level from argument list */
+
+ /* and transform it to integer */
+ if (level == 0) { /* Is level equal to 0 ? */
+ /* This is the first call */
+ printf("Hello %s, type BYE when you want to stop !\n", argv[1]);
+ return(1); /* program will be called again */
+ }
+ else {
+ strupr(argv[5]); /* Capitalise the first word */
+ if (strcmp(argv[5], "BYE") == 0) { /* is BYE received ? */
+ printf("Ok, bye-bye\n");
+ return(0); /* Yes, go on BBS */
+ }
+ else if (strcmp(argv[5], "CMD") == 0) { /* is CMD received ? */
+ for (i = 6 ; i < argc ; i++) /* List line arguments */
+ printf("%s ", argv[i]); /* sent by user */
+ putchar('\n');
+ for (i = 6 ; i < argc ; i++) /* List line arguments */
+ printf("%s ", argv[i]); /* sent by user */
+ putchar('\n');
+ return(4); /* Yes, send command */
+ }
+ else {
+ printf("You told me : "); /* These are other lines */
+ for (i = 5 ; i < argc ; i++) /* List line arguments */
+ printf("%s ", argv[i]); /* sent by user */
+ putchar('\n');
+ return(1); /* No, call again program */
+ }
+ }
+} \ No newline at end of file