MCPcopy Create free account
hub / github.com/SimHacker/micropolis / Tk_SelectionCmd

Function Tk_SelectionCmd

micropolis-activity/src/tk/tkselect.c:558–670  ·  view source on GitHub ↗
(clientData, interp, argc, argv)

Source from the content-addressed store, hash-verified

556 * Side effects:
557 * See the user documentation.
558 *
559 *--------------------------------------------------------------
560 */
561
562int
563Tk_SelectionCmd(clientData, interp, argc, argv)
564 ClientData clientData; /* Main window associated with
565 * interpreter. */
566 Tcl_Interp *interp; /* Current interpreter. */
567 int argc; /* Number of arguments. */
568 char **argv; /* Argument strings. */
569{
570 Tk_Window tkwin = (Tk_Window) clientData;
571 int length;
572 char *cmd = argv[0];
573 char c;
574
575 if (argc < 2) {
576 sprintf(interp->result,
577 "wrong # args: should be \"%.50s [-window win] option ?arg arg ...?\"",
578 cmd);
579 return TCL_ERROR;
580 }
581
582 argc--; argv++;
583 c = argv[0][0];
584 length = strlen(argv[0]);
585
586 if ((c == '-') && (strncmp(argv[0], "-window", length) == 0)) {
587 if ((argc < 2) ||
588 ((tkwin = Tk_NameToWindow(interp, argv[1], tkwin)) == NULL)) {
589 sprintf(interp->result, "bad arg to %s -window", cmd);
590 return TCL_ERROR;
591 }
592 argc -= 2; argv += 2;
593
594 if (argc == 0) {
595 sprintf(interp->result, "not enough args to %s", cmd);
596 return TCL_ERROR;
597 }
598
599 c = argv[0][0];
600 length = strlen(argv[0]);
601 }
602
603 if ((c == 'g') && (strncmp(argv[0], "get", length) == 0)) {
604 Atom target;
605 GetInfo getInfo;
606 int result;
607
608 argc--; argv++;
609
610 if (argc > 1) {
611 sprintf(interp->result,
612 "too may args: should be \"%.50s get ?type?\"",
613 cmd);
614 return TCL_ERROR;
615 }

Callers

nothing calls this directly

Calls 6

Tk_NameToWindowFunction · 0.85
Tk_InternAtomFunction · 0.85
Tk_GetSelectionFunction · 0.85
Tcl_SetResultFunction · 0.85
Tcl_AppendResultFunction · 0.85
Tk_CreateSelHandlerFunction · 0.85

Tested by

no test coverage detected