]> Nishi Git Mirror - dataworks.git/commitdiff
adding stuff
authornishi <nishi@d4a5a174-5a4a-5b4b-b672-37683c10d7d5>
Thu, 13 Jun 2024 02:26:33 +0000 (02:26 +0000)
committernishi <nishi@d4a5a174-5a4a-5b4b-b672-37683c10d7d5>
Thu, 13 Jun 2024 02:26:33 +0000 (02:26 +0000)
git-svn-id: file:///raid/svn-main/nishi-dataworks/trunk@288 d4a5a174-5a4a-5b4b-b672-37683c10d7d5

21 files changed:
Client/client.c
Grammar/dw.l
Grammar/dw.y
Library/database.c
Library/database_db.c
Library/database_record.c
Library/database_table.c
Library/dataworks.c
Library/dataworks.h
Library/dw_database.h
Library/dw_parser.h
Library/dw_util.h
Library/exec.c
Library/parser.c
Library/util.c
RemoteClient/hayes.c
RemoteClient/rcli.c
RemoteClient/tcpip.c
Server/hayes.c
Server/server.c
Server/tcpip.c

index fd4455ca11f170463ec361f457a6d232116c05ec..b0bb6695db8b0b6ae5b529e05b3ed3ccdc648aca 100644 (file)
@@ -1,6 +1,8 @@
 /* $Id$ */
 /* --- START LICENSE --- */
 /* -------------------------------------------------------------------------- */
+/*                                                   DataWorks - Simple DBMS  */
+/* -------------------------------------------------------------------------- */
 /* Copyright (c) 2024 Crabware.                                               */
 /* Redistribution and use in source and binary forms, with or without modific */
 /* ation, are permitted provided that the following conditions are met:       */
index 98055cc16e2c3c23ae5e7b26e7d90a579c53c345..c34c73bd13d2d4f1b4eb610580ebccc750c540c5 100644 (file)
@@ -1,6 +1,8 @@
 /* $Id$ */
 /* --- START LICENSE --- */
 /* -------------------------------------------------------------------------- */
+/*                                                   DataWorks - Simple DBMS  */
+/* -------------------------------------------------------------------------- */
 /* Copyright (c) 2024 Crabware.                                               */
 /* Redistribution and use in source and binary forms, with or without modific */
 /* ation, are permitted provided that the following conditions are met:       */
index 6a6e528de6337f634a88e51ee284c41b7e21aa66..508c7d9bb5d9d3948411a0d16b66c8a64d81fde7 100644 (file)
@@ -1,6 +1,8 @@
 /* $Id$ */
 /* --- START LICENSE --- */
 /* -------------------------------------------------------------------------- */
+/*                                                   DataWorks - Simple DBMS  */
+/* -------------------------------------------------------------------------- */
 /* Copyright (c) 2024 Crabware.                                               */
 /* Redistribution and use in source and binary forms, with or without modific */
 /* ation, are permitted provided that the following conditions are met:       */
index b0770a4f0607fbe02c39d89b1ef6a6622551b7e1..3f6a24c107a18ec660727ebf09423d9b68c9b48b 100644 (file)
@@ -1,6 +1,8 @@
 /* $Id$ */
 /* --- START LICENSE --- */
 /* -------------------------------------------------------------------------- */
+/*                                                   DataWorks - Simple DBMS  */
+/* -------------------------------------------------------------------------- */
 /* Copyright (c) 2024 Crabware.                                               */
 /* Redistribution and use in source and binary forms, with or without modific */
 /* ation, are permitted provided that the following conditions are met:       */
index 6ade2f55024b13bde758a1860dca9915389ebd79..bf588a64e5899f321c868f16fcc199d753a1a329 100644 (file)
@@ -1,6 +1,8 @@
 /* $Id$ */
 /* --- START LICENSE --- */
 /* -------------------------------------------------------------------------- */
+/*                                                   DataWorks - Simple DBMS  */
+/* -------------------------------------------------------------------------- */
 /* Copyright (c) 2024 Crabware.                                               */
 /* Redistribution and use in source and binary forms, with or without modific */
 /* ation, are permitted provided that the following conditions are met:       */
index 6efe8308c2fcd35a46ca858e8c174140c110fb78..be89ba07248e82a53dfe72678ab5870010e141e4 100644 (file)
@@ -1,6 +1,8 @@
 /* $Id$ */
 /* --- START LICENSE --- */
 /* -------------------------------------------------------------------------- */
+/*                                                   DataWorks - Simple DBMS  */
+/* -------------------------------------------------------------------------- */
 /* Copyright (c) 2024 Crabware.                                               */
 /* Redistribution and use in source and binary forms, with or without modific */
 /* ation, are permitted provided that the following conditions are met:       */
index 6aa70be98bacc90f71b870427ae5bb4d69f7c650..8288d42f5c6f96ecd262138ece5be86e27b25b86 100644 (file)
@@ -1,6 +1,8 @@
 /* $Id$ */
 /* --- START LICENSE --- */
 /* -------------------------------------------------------------------------- */
+/*                                                   DataWorks - Simple DBMS  */
+/* -------------------------------------------------------------------------- */
 /* Copyright (c) 2024 Crabware.                                               */
 /* Redistribution and use in source and binary forms, with or without modific */
 /* ation, are permitted provided that the following conditions are met:       */
index b6677cfd3ee77b60cb3319cdd3d1c38f5db83ac3..904d6bc9729b1ee92a6a62f533f1b6dfbe7d58fa 100644 (file)
@@ -1,6 +1,8 @@
 /* $Id$ */
 /* --- START LICENSE --- */
 /* -------------------------------------------------------------------------- */
+/*                                                   DataWorks - Simple DBMS  */
+/* -------------------------------------------------------------------------- */
 /* Copyright (c) 2024 Crabware.                                               */
 /* Redistribution and use in source and binary forms, with or without modific */
 /* ation, are permitted provided that the following conditions are met:       */
index 673e5958ce026a9fc67278141cc1cc9d23ded77b..b684303b86b9ecc5471b9858efdfd152ee732c14 100644 (file)
@@ -1,6 +1,8 @@
 /* $Id$ */
 /* --- START LICENSE --- */
 /* -------------------------------------------------------------------------- */
+/*                                                   DataWorks - Simple DBMS  */
+/* -------------------------------------------------------------------------- */
 /* Copyright (c) 2024 Crabware.                                               */
 /* Redistribution and use in source and binary forms, with or without modific */
 /* ation, are permitted provided that the following conditions are met:       */
index 906436bf799d071f6a83b4bdfa7660f09a5edb29..66b1ced9ea7ed5597b4c43c37acbc3970e0c85d9 100644 (file)
@@ -1,6 +1,8 @@
 /* $Id$ */
 /* --- START LICENSE --- */
 /* -------------------------------------------------------------------------- */
+/*                                                   DataWorks - Simple DBMS  */
+/* -------------------------------------------------------------------------- */
 /* Copyright (c) 2024 Crabware.                                               */
 /* Redistribution and use in source and binary forms, with or without modific */
 /* ation, are permitted provided that the following conditions are met:       */
index aa1c21ba74b76415efa6200593bf4787c1323925..cbf0f5c01acc0e22bfcc4039aca2063e6b6697a0 100644 (file)
@@ -1,6 +1,8 @@
 /* $Id$ */
 /* --- START LICENSE --- */
 /* -------------------------------------------------------------------------- */
+/*                                                   DataWorks - Simple DBMS  */
+/* -------------------------------------------------------------------------- */
 /* Copyright (c) 2024 Crabware.                                               */
 /* Redistribution and use in source and binary forms, with or without modific */
 /* ation, are permitted provided that the following conditions are met:       */
index 736c19d1800f9af56c1133d6f5b896f58d1c4af2..6ae6c5db7c2f05273aece125ffde994f2dc9b5ed 100644 (file)
@@ -1,6 +1,8 @@
 /* $Id$ */
 /* --- START LICENSE --- */
 /* -------------------------------------------------------------------------- */
+/*                                                   DataWorks - Simple DBMS  */
+/* -------------------------------------------------------------------------- */
 /* Copyright (c) 2024 Crabware.                                               */
 /* Redistribution and use in source and binary forms, with or without modific */
 /* ation, are permitted provided that the following conditions are met:       */
index fa629e569e73d6f4c9b2bd944703c37198235ab7..0d3d58af6d2db16a385eaee535f438f3ead7a6a6 100644 (file)
@@ -1,6 +1,8 @@
 /* $Id$ */
 /* --- START LICENSE --- */
 /* -------------------------------------------------------------------------- */
+/*                                                   DataWorks - Simple DBMS  */
+/* -------------------------------------------------------------------------- */
 /* Copyright (c) 2024 Crabware.                                               */
 /* Redistribution and use in source and binary forms, with or without modific */
 /* ation, are permitted provided that the following conditions are met:       */
index 70bdbfa6f34242e093bcda323d8558c0b62729ec..d8b018e56395c462d842ac398d70f69167ea1c3b 100644 (file)
@@ -1,6 +1,8 @@
 /* $Id$ */
 /* --- START LICENSE --- */
 /* -------------------------------------------------------------------------- */
+/*                                                   DataWorks - Simple DBMS  */
+/* -------------------------------------------------------------------------- */
 /* Copyright (c) 2024 Crabware.                                               */
 /* Redistribution and use in source and binary forms, with or without modific */
 /* ation, are permitted provided that the following conditions are met:       */
index 1ef6b46e7aa9949207fc0935554cc93acdcf0b8e..14d3fba6b9fa930beda08058318f3e1c4878487b 100644 (file)
@@ -1,6 +1,8 @@
 /* $Id$ */
 /* --- START LICENSE --- */
 /* -------------------------------------------------------------------------- */
+/*                                                   DataWorks - Simple DBMS  */
+/* -------------------------------------------------------------------------- */
 /* Copyright (c) 2024 Crabware.                                               */
 /* Redistribution and use in source and binary forms, with or without modific */
 /* ation, are permitted provided that the following conditions are met:       */
index a2b35fc8b569d44a054d648eebdadba61a9ca5bc..16308277a65536a653f71954d779abf69363ea2e 100644 (file)
@@ -1,6 +1,8 @@
 /* $Id$ */
 /* --- START LICENSE --- */
 /* -------------------------------------------------------------------------- */
+/*                                                   DataWorks - Simple DBMS  */
+/* -------------------------------------------------------------------------- */
 /* Copyright (c) 2024 Crabware.                                               */
 /* Redistribution and use in source and binary forms, with or without modific */
 /* ation, are permitted provided that the following conditions are met:       */
@@ -25,3 +27,8 @@
 /* OF SUCH DAMAGE.                                                            */
 /* -------------------------------------------------------------------------- */
 /* --- END LICENSE --- */
+
+extern int argc;
+extern char** argv;
+
+int rcli_init(void) {}
index ab24a2facce52941f615706277d9b11cc8afbb61..7efbe4db1225f450a0108c9ee6854add4f394a2f 100644 (file)
@@ -1,5 +1,58 @@
 /* $Id$ */
-/* --- START LICNESE --- */
-/* --- END LICNESE --- */
+/* --- START LICENSE --- */
+/* -------------------------------------------------------------------------- */
+/*                                                   DataWorks - Simple DBMS  */
+/* -------------------------------------------------------------------------- */
+/* Copyright (c) 2024 Crabware.                                               */
+/* Redistribution and use in source and binary forms, with or without modific */
+/* ation, are permitted provided that the following conditions are met:       */
+/*     1. Redistributions of source code must retain the above copyright noti */
+/* ce, this list of conditions and the following disclaimer.                  */
+/*     2. Redistributions in binary form must reproduce the above copyright n */
+/* otice, this list of conditions and the following disclaimer in the documen */
+/* tation and/or other materials provided with the distribution.              */
+/*     3. Neither the name of the copyright holder nor the names of its contr */
+/* ibutors may be used to endorse or promote products derived from this softw */
+/* are without specific prior written permission.                             */
+/* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS */
+/* " AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, TH */
+/* E IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPO */
+/* SE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS  */
+/* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CON */
+/* SEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITU */
+/* TE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPT */
+/* ION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, S */
+/* TRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN AN */
+/* Y WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY  */
+/* OF SUCH DAMAGE.                                                            */
+/* -------------------------------------------------------------------------- */
+/* --- END LICENSE --- */
 
-int main() {}
+#include <stdbool.h>
+#include <stdio.h>
+#include <string.h>
+
+#include <dataworks.h>
+#include <dw_util.h>
+
+int argc;
+char** argv;
+
+int rcli_init(void);
+
+bool option(const char* str, const char* shortopt, const char* longopt) {
+       char* dos_shortopt = __dw_strcat("/", shortopt);
+       char* dos_longopt = __dw_strcat("/", longopt);
+       char* nix_shortopt = __dw_strcat("-", shortopt);
+       char* nix_longopt = __dw_strcat("--", longopt);
+       if(__dw_strcaseequ(str, dos_longopt) || __dw_strcaseequ(str, nix_longopt) || strcmp(str, dos_shortopt) == 0 || strcmp(str, nix_shortopt) == 0) return true;
+       return false;
+}
+
+int main(int _argc, char** _argv) {
+       printf("DataWorks Remote Client  version %s  %s %s\n", dataworks_get_version(), dataworks_get_compile_date(), dataworks_get_platform());
+       argc = _argc;
+       argv = _argv;
+       int st = rcli_init();
+       if(st != 0) return st;
+}
index a2b35fc8b569d44a054d648eebdadba61a9ca5bc..fe0b3765f16c3a3ed45d55d6baf7a333ac3baa71 100644 (file)
@@ -1,6 +1,8 @@
 /* $Id$ */
 /* --- START LICENSE --- */
 /* -------------------------------------------------------------------------- */
+/*                                                   DataWorks - Simple DBMS  */
+/* -------------------------------------------------------------------------- */
 /* Copyright (c) 2024 Crabware.                                               */
 /* Redistribution and use in source and binary forms, with or without modific */
 /* ation, are permitted provided that the following conditions are met:       */
 /* OF SUCH DAMAGE.                                                            */
 /* -------------------------------------------------------------------------- */
 /* --- END LICENSE --- */
+
+#include <stdbool.h>
+#include <stdio.h>
+
+extern int argc;
+extern char** argv;
+
+int port;
+
+bool option(const char* str, const char* shortopt, const char* longopt);
+
+int rcli_init(void) {
+       printf("Using BSD TCP/IP\n");
+       int i;
+       for(i = 1; i < argc; i++) {
+               if(argv[i][0] == '/' || argv[i][0] == '-') {
+                       if(option(argv[i], "p", "port")) {
+                               i++;
+                               port = atoi(argv[i]);
+                       } else if(option(argv[i], "h", "help")) {
+                               printf("\n");
+                               printf("Usage: %s [options] database\n", argv[0]);
+                               printf("You can use double-dash or slash for long-format flag, and single-dash or slash for short-foramt flag.\n");
+                               printf("Options:\n");
+                               printf("\t-p --port [port]   Specify the port to be listened on\n");
+                               exit(0);
+                       } else {
+                               fprintf(stderr, "Invalid option: %s\n", argv[i]);
+                               return 1;
+                       }
+               }
+       }
+       return 0;
+}
index f47612a104ea17199012e2e7f37a40aad9e57c2f..cef27892b5fa5b9a46fa3b60e62dd414f1aec608 100644 (file)
@@ -1,6 +1,8 @@
 /* $Id$ */
 /* --- START LICENSE --- */
 /* -------------------------------------------------------------------------- */
+/*                                                   DataWorks - Simple DBMS  */
+/* -------------------------------------------------------------------------- */
 /* Copyright (c) 2024 Crabware.                                               */
 /* Redistribution and use in source and binary forms, with or without modific */
 /* ation, are permitted provided that the following conditions are met:       */
index f471caee5d0b8c9a0ede4919dc97fd139e18d9f7..efbbf25781758a8d8e51d5e702597f1f82d54591 100644 (file)
@@ -1,6 +1,8 @@
 /* $Id$ */
 /* --- START LICENSE --- */
 /* -------------------------------------------------------------------------- */
+/*                                                   DataWorks - Simple DBMS  */
+/* -------------------------------------------------------------------------- */
 /* Copyright (c) 2024 Crabware.                                               */
 /* Redistribution and use in source and binary forms, with or without modific */
 /* ation, are permitted provided that the following conditions are met:       */
index db4bcb9292d647c26dd3a45486429875969c2ac8..ff25f9e31b7c7920f461807ae83aa6a4b6358707 100644 (file)
@@ -1,6 +1,8 @@
 /* $Id$ */
 /* --- START LICENSE --- */
 /* -------------------------------------------------------------------------- */
+/*                                                   DataWorks - Simple DBMS  */
+/* -------------------------------------------------------------------------- */
 /* Copyright (c) 2024 Crabware.                                               */
 /* Redistribution and use in source and binary forms, with or without modific */
 /* ation, are permitted provided that the following conditions are met:       */