aboutsummaryrefslogtreecommitdiffstats
path: root/extension/dl.c
diff options
context:
space:
mode:
authorArnold D. Robbins <arnold@skeeve.com>2012-06-12 21:51:41 +0300
committerArnold D. Robbins <arnold@skeeve.com>2012-06-12 21:51:41 +0300
commitb4a2d75b7d9fd23069a55dc91a42f7fddd0c7570 (patch)
treeb9f29b0ffb9930cf604d4e10c8c53af16062fafa /extension/dl.c
parent21a01e3ad4e2e77dccf73e8fd069370749880757 (diff)
parent5472c2cc2889aab121c32ed4ca6bd831ae520d89 (diff)
downloadegawk-b4a2d75b7d9fd23069a55dc91a42f7fddd0c7570.tar.gz
egawk-b4a2d75b7d9fd23069a55dc91a42f7fddd0c7570.tar.bz2
egawk-b4a2d75b7d9fd23069a55dc91a42f7fddd0c7570.zip
Merge branch 'extgawk' of ssh://git.sv.gnu.org/srv/git/gawk into extgawk
Diffstat (limited to 'extension/dl.c')
-rw-r--r--extension/dl.c92
1 files changed, 0 insertions, 92 deletions
diff --git a/extension/dl.c b/extension/dl.c
deleted file mode 100644
index ee3b08fe..00000000
--- a/extension/dl.c
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
- * dl.c - Example of adding a new builtin function to gawk.
- *
- * Christos Zoulas, Thu Jun 29 17:40:41 EDT 1995
- * Arnold Robbins, update for 3.1, Wed Sep 13 09:38:56 2000
- */
-
-/*
- * Copyright (C) 1995 - 2001, 2011 the Free Software Foundation, Inc.
- *
- * This file is part of GAWK, the GNU implementation of the
- * AWK Programming Language.
- *
- * GAWK is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3 of the License, or
- * (at your option) any later version.
- *
- * GAWK is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
- */
-
-#include "awk.h"
-#include <dlfcn.h>
-
-int plugin_is_GPL_compatible;
-
-static void *sdl = NULL;
-
-static NODE *
-zaxxon(int nargs)
-{
- NODE *obj;
- int i;
- int comma = 0;
-
- /*
- * Print the arguments
- */
- printf("External linkage zaxxon(");
-
- for (i = 0; i < nargs; i++) {
-
- obj = get_scalar_argument(i, true);
-
- if (obj == NULL)
- break;
-
- force_string(obj);
-
- printf(comma ? ", %s" : "%s", obj->stptr);
- comma = 1;
- }
-
- printf(");\n");
-
- /*
- * Do something useful
- */
- obj = get_scalar_argument(0, false);
-
- if (obj != NULL) {
- force_string(obj);
- if (strcmp(obj->stptr, "unload") == 0 && sdl) {
- /*
- * XXX: How to clean up the function?
- * I would like the ability to remove a function...
- */
- dlclose(sdl);
- sdl = NULL;
- }
- }
-
- /* Set the return value */
- return make_number((AWKNUM) 3.14);
-}
-
-NODE *
-dlload(tree, dl)
-NODE *tree;
-void *dl;
-{
- sdl = dl;
- make_builtin("zaxxon", zaxxon, 4);
- return make_number((AWKNUM) 0);
-}