From: Po Lu Date: Fri, 9 Sep 2022 01:54:01 +0000 (+0800) Subject: Remove long-broken TESTRM interface X-Git-Tag: emacs-29.0.90~1856^2~651 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=adc8344e759b0aa3c919df9bdff1232d89b2e6b4;p=emacs.git Remove long-broken TESTRM interface * src/xrdb.c: [TESTRM]: (fatal, main): Delete functions and code block. They don't work and rely on XLIB_ILLEGAL_ACCESS. --- diff --git a/src/xrdb.c b/src/xrdb.c index 5ff25dde148..01c9ff5558a 100644 --- a/src/xrdb.c +++ b/src/xrdb.c @@ -511,107 +511,3 @@ x_get_string_resource (void *v_rdb, const char *name, const char *class) return NULL; } - -/* Stand-alone test facilities. */ - -#ifdef TESTRM - -typedef char **List; -#define arg_listify(len, list) (list) -#define car(list) (*(list)) -#define cdr(list) (list + 1) -#define NIL(list) (! *(list)) -#define free_arglist(list) - -static List -member (char *elt, List list) -{ - List p; - - for (p = list; ! NIL (p); p = cdr (p)) - if (! strcmp (elt, car (p))) - return p; - - return p; -} - -static void -fatal (char *msg, char *prog) -{ - fprintf (stderr, msg, prog); - exit (1); -} - -int -main (int argc, char **argv) -{ - Display *display; - char *displayname, *resource_string, *class, *name; - XrmDatabase xdb; - List arg_list, lp; - - arg_list = arg_listify (argc, argv); - - lp = member ("-d", arg_list); - if (!NIL (lp)) - displayname = car (cdr (lp)); - else - displayname = "localhost:0.0"; - - lp = member ("-xrm", arg_list); - resource_string = NIL (lp) ? 0 : car (cdr (lp)); - - lp = member ("-c", arg_list); - if (! NIL (lp)) - class = car (cdr (lp)); - else - class = "Emacs"; - - lp = member ("-n", arg_list); - if (! NIL (lp)) - name = car (cdr (lp)); - else - name = "emacs"; - - free_arglist (arg_list); - - if (!(display = XOpenDisplay (displayname))) - fatal ("Can't open display '%s'\n", XDisplayName (displayname)); - - xdb = x_load_resources (display, resource_string, name, class); - - /* In a real program, you'd want to also do this: */ - display->db = xdb; - - while (true) - { - char query_name[90]; - char query_class[90]; - - printf ("Name: "); - fgets (query_name, 90, stdin); - - if (strlen (query_name)) - { - char *value; - - printf ("Class: "); - fgets (query_class, 90, stdin); - - value = x_get_string_resource (&xdb, query_name, query_class); - - if (value != NULL) - printf ("\t%s(%s): %s\n\n", query_name, query_class, value); - else - printf ("\tNo Value.\n\n"); - } - else - break; - } - printf ("\tExit.\n\n"); - - XCloseDisplay (display); - - return 0; -} -#endif /* TESTRM */