/* $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: */
/* $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: */
/* $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: */
/* $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: */
/* $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: */
/* $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: */
/* $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: */
/* $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: */
/* $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: */
/* $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: */
/* $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: */
/* $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: */
/* $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: */
/* $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: */
/* $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: */
/* $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 --- */
+
+extern int argc;
+extern char** argv;
+
+int rcli_init(void) {}
/* $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;
+}
/* $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;
+}
/* $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: */
/* $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: */
/* $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: */