Example #1
0
// demultiplexer
void
xcmdapi::commit()
{
    x_obj_attr_t *hints;
    gobee::__x_object *obj2;
    gobee::__x_object *busobj;
    const char *node;
    const char *id;
    ENTER;

    busobj = this->get_bus();
    node = (*this)["node"];
    id = this->__getattr("#id");

    if (node)
    {
        obj2 = busobj->get_object_at_path("__proc/commands/");
        if (obj2)
            obj2 = obj2->get_child(node);

        hints = new x_obj_attr_t;
        attr_list_init(hints);

        setattr((KEY) "#type", (VAL) "result", hints);
        setattr((KEY) "#id", (VAL) id, hints);

        this->tx(((xcmdapi *) obj2)->get_response(this, this->get_action()),
                 hints);
    }

    EXIT;
}
Example #2
0
File: vga.c Project: enkiv2/ix
void shadowbox(int x, int y, int width, int height, char* text, int fg, int bg) {
	int i, j, k, col, linegoing;
	col=color;
	k=0;
	linegoing=0;
	for(i=y; i<y+height+1; i++) {
		for(j=x; j<x+width+1; j++) {
			locate(j, i);
			if(j==x+width || i==y+height) {
				setattr(bg);
				puts("+");
			} else {
				setattr(fg);
				if(k<strlen(text)&&!linegoing) {
					if(text[k]=='\n' || text[k]=='\r') {
						linegoing=1;
						putch(' ');
						putch(' ');
					} else	putch(text[k]);
				} else {
					putch(' ');
					if(k<strlen(text)) k--;
				}
				k++;
			}
		}
		linegoing=0;
	}
}
Example #3
0
File: main.c Project: outsky/tetris
static void draw_blockrecord(void)
{
    cursor_to(BR_LEFT, BR_TOP);
    setcolor(F_WHITE, B_BLACK);
    setattr(T_BOLD);
    printf("  BLOCKS  ");
    restore();

    cursor_to(BR_LEFT, BR_TOP+1);
    setcolor(F_WHITE, B_RED);
    printf(" (I) %4d ", GAME->i);
    cursor_to(BR_LEFT, BR_TOP+2);
    setcolor(F_WHITE, B_GREEN);
    printf(" #J# %4d ", GAME->j);
    cursor_to(BR_LEFT, BR_TOP+3);
    setcolor(F_WHITE, B_YELLOW);
    printf(" $L$ %4d ", GAME->l);
    cursor_to(BR_LEFT, BR_TOP+4);
    setcolor(F_WHITE, B_BLUE);
    printf(" {O} %4d ", GAME->o);
    cursor_to(BR_LEFT, BR_TOP+5);
    setcolor(F_WHITE, B_MAGENTA);
    printf(" <S> %4d ", GAME->s);
    cursor_to(BR_LEFT, BR_TOP+6);
    setcolor(F_WHITE, B_CYAN);
    printf(" &T& %4d ", GAME->t);
    cursor_to(BR_LEFT, BR_TOP+7);
    setcolor(F_YELLOW, B_WHITE);
    printf(" [Z] %4d ", GAME->z);
    cursor_to(BR_LEFT, BR_TOP+8);
    setcolor(F_WHITE, B_BLACK);
    setattr(T_UNDERSCORE);
    printf(" sum %4d ", GAME->i+GAME->j+GAME->l+GAME->o+GAME->s+GAME->t+GAME->z);
    restore();
}
Example #4
0
static VALUE
ttymode(VALUE io, VALUE (*func)(VALUE), void (*setter)(conmode *, void *), void *arg)
{
    rb_io_t *fptr;
    int status = -1;
    int error = 0;
    int fd[FD_PER_IO];
    conmode t[FD_PER_IO];
    VALUE result = Qnil;

    GetOpenFile(io, fptr);
    fd[0] = GetReadFD(fptr);
    if (fd[0] != -1) {
	if (set_ttymode(fd[0], t+0, setter, arg)) {
	    status = 0;
	}
	else {
	    error = errno;
	    fd[0] = -1;
	}
    }
    fd[1] = GetWriteFD(fptr);
    if (fd[1] != -1 && fd[1] != fd[0]) {
	if (set_ttymode(fd[1], t+1, setter, arg)) {
	    status = 0;
	}
	else {
	    error = errno;
	    fd[1] = -1;
	}
    }
    if (status == 0) {
	result = rb_protect(func, io, &status);
    }
    GetOpenFile(io, fptr);
    if (fd[0] != -1 && fd[0] == GetReadFD(fptr)) {
	if (!setattr(fd[0], t+0)) {
	    error = errno;
	    status = -1;
	}
    }
    if (fd[1] != -1 && fd[1] != fd[0] && fd[1] == GetWriteFD(fptr)) {
	if (!setattr(fd[1], t+1)) {
	    error = errno;
	    status = -1;
	}
    }
    if (status) {
	if (status == -1) {
	    errno = error;
	    rb_sys_fail(0);
	}
	rb_jump_tag(status);
    }
    return result;
}
Example #5
0
Glyph::Glyph( const FT_Face& face, const FT_Glyph& glyph, size_t ind) :
  glyphInd(ind) {
  _VERBOSE("Glyph::Glyph");
  
  FT_BBox bbox;
  FT_Glyph_Get_CBox( glyph, ft_glyph_bbox_subpixels, &bbox );
  
  setattr("width",        Py::Int( face->glyph->metrics.width) );
  setattr("height",       Py::Int( face->glyph->metrics.height) );
  setattr("horiBearingX", Py::Int( face->glyph->metrics.horiBearingX) );
  setattr("horiBearingY", Py::Int( face->glyph->metrics.horiBearingY) );
  setattr("horiAdvance",  Py::Int( face->glyph->metrics.horiAdvance) );
  setattr("vertBearingX", Py::Int( face->glyph->metrics.vertBearingX) );
  
  setattr("vertBearingY", Py::Int( face->glyph->metrics.vertBearingY) );
  setattr("vertAdvance",  Py::Int( face->glyph->metrics.vertAdvance) );
  
  Py::Tuple abbox(4);

  abbox[0] = Py::Int(bbox.xMin);
  abbox[1] = Py::Int(bbox.yMin);
  abbox[2] = Py::Int(bbox.xMax);
  abbox[3] = Py::Int(bbox.yMax);
  setattr("bbox", abbox);
}
Example #6
0
static void propertyDocCopy(BoxedProperty* prop, Box* fget) {
    assert(prop);
    assert(fget);
    Box* get_doc;

    static BoxedString* doc_str = static_cast<BoxedString*>(PyString_InternFromString("__doc__"));
    try {
        get_doc = getattrInternal(fget, doc_str, NULL);
    } catch (ExcInfo e) {
        if (!e.matches(Exception)) {
            throw e;
        }
        get_doc = NULL;
    }

    if (get_doc) {
        if (prop->cls == property_cls) {
            prop->prop_doc = get_doc;
        } else {
            /* If this is a property subclass, put __doc__
            in dict of the subclass instance instead,
            otherwise it gets shadowed by __doc__ in the
            class's dict. */
            setattr(prop, doc_str, get_doc);
        }
        prop->getter_doc = true;
    }
}
Example #7
0
static void propertyDocCopy(BoxedProperty* prop, Box* fget) {
    assert(prop);
    assert(fget);
    Box* get_doc;

    static BoxedString* doc_str = getStaticString("__doc__");
    try {
        get_doc = getattrInternal<ExceptionStyle::CXX>(fget, doc_str);
    } catch (ExcInfo e) {
        if (!e.matches(Exception)) {
            throw e;
        }
        e.clear();
        get_doc = NULL;
    }

    if (get_doc) {
        if (prop->cls == property_cls) {
            Py_XDECREF(prop->prop_doc);
            prop->prop_doc = get_doc;
        } else {
            /* If this is a property subclass, put __doc__
            in dict of the subclass instance instead,
            otherwise it gets shadowed by __doc__ in the
            class's dict. */
            setattr(prop, doc_str, get_doc);
        }
        prop->getter_doc = true;
    }
}
Example #8
0
File: ibod.c Project: ewon/efive
main(int argc, char *argv[])
{
    openlog("ibod", LOG_PID, LOG_DAEMON);

    channels_last = -1;

    /* Setup initial attributes */
    if (setattr() == -1) {
        closelog();
        exit(1);
    }

    setinterval();

    /* Setup handlig of signal SIGHUP and SIGPIPE */
    signal(SIGHUP, reread);
    signal(SIGPIPE, pipehndl);

    do {
        setinterval();

	usleep(timeout.tv_usec);

        /* Gate state of interface */
        get_if_state();

    } while (1);
}
Example #9
0
/*
 *  return only the attr/value pairs in t maching the filter, f.
 *  others are freed.  line structure is preserved.
 */
static Ndbtuple*
filter(Ndb *db, Ndbtuple *t, Ndbtuple *f)
{
	Ndbtuple *nt, *nf, *next;

	/* filter out what we don't want */
	for(nt = t; nt; nt = next){
		next = nt->entry;

		/* look through filter */
		for(nf = f; nf != nil; nf = nf->entry){
			if(!(nf->ptr&Fignore) && strcmp(nt->attr, nf->attr) == 0)
				break;
		}
		if(nf == nil){
			/* remove nt from t */
			t = ndbdiscard(t, nt);
		} else {
			if(nf->ptr & Faddr)
				t = ndbsubstitute(t, nt, setattr(ndbgetipaddr(db, nt->val), nt->attr));
			nf->ptr |= Ffound;
		}
	}

	/* remember filter etnries that matched */
	for(nf = f; nf != nil; nf = nf->entry)
		if(nf->ptr & Ffound)
			nf->ptr = (nf->ptr & ~Ffound) | Fignore;

	ndbsetmalloctag(t, getcallerpc(&db));
	return t;
}
Example #10
0
void
flush(void)
{
	int i;
	Char c, a;

	nanchors = 0;
	for(i=0; i<nchars; i++){
		c = chars[i];
		if(c == Estring){
			/* next word is string to print */
			iputs(&bout, (char*)chars[++i]);
			continue;
		}
		if(c == Epp){
			iputrune(&bout, '\n');
			iputs(&bout, TABLE "<tr height=5><td></table>");
			iputrune(&bout, '\n');
			continue;
		}
		a = c & ~0xFFFF;
		c &= 0xFFFF;
		/*
		 * If we're going to something off after a space,
		 * let's just turn it off before.
		 */
		if(c == ' ' && i<nchars-1 && (chars[i+1]&0xFFFF) >= 32)
			a ^= a & ~chars[i+1];
		setattr(a);
		iputrune(&bout, c & 0xFFFF);
	}
}
Example #11
0
// Pops an obj from the Tarjan stack and sets it to WHITE, with a ptr to its
// SCC group.
static upb_refcounted *pop(tarjan *t) {
  upb_refcounted *r = upb_value_getptr(upb_inttable_pop(&t->stack));
  assert(color(t, r) == GREEN);
  // This defines the attr layout for nodes in the WHITE state.
  // Top of group stack is [group, NULL]; we point at group.
  setattr(t, r, WHITE | (upb_inttable_count(&t->groups) - 2) << 8);
  return r;
}
Example #12
0
File: ibod.c Project: ewon/efive
static void reread(int sig)
{
    (void) setattr();

    setinterval();

    signal(SIGHUP, reread);
}
Example #13
0
static int
set_ttymode(int fd, conmode *t, void (*setter)(conmode *, void *), void *arg)
{
    conmode r;
    if (!getattr(fd, t)) return 0;
    r = *t;
    setter(&r, arg);
    return setattr(fd, &r);
}
Example #14
0
int XvGrabber::command(int argc, const char*const* argv)
{
	Tcl& tcl = Tcl::instance();
	if (argc == 3) {
		if (strcmp(argv[1], "decimate") == 0) {
			int dec = atoi(argv[2]);
			Tcl& tcl = Tcl::instance();
			if (dec <= 0) {
				tcl.resultf("%s: divide by zero", argv[0]);
				return (TCL_ERROR);
			}
			if (dec != decimate_) {
				decimate_ = dec;
				setsize();
			}
			return (TCL_OK);
		} else if (strcmp(argv[1], "port") == 0) {
			setport(argv[2]);
			return (TCL_OK);
		} else if (strcmp(argv[1], "contrast") == 0) {
			setattr(XAcontrast, atoi(argv[2]));
			return (TCL_OK);
		} else if (strcmp(argv[1], "brightness") == 0) {
			setattr(XAbrightness, atoi(argv[2]));
			return (TCL_OK);
		} else if (strcmp(argv[1], "hue") == 0) {
			setattr(XAhue, atoi(argv[2]));
			return (TCL_OK);
		} else if (strcmp(argv[1], "saturation") == 0) {
			setattr(XAsaturation, atoi(argv[2]));
			return (TCL_OK);
		} else if (strcmp(argv[1], "create-capwin") == 0) {
			capwin_ = new XvWindow(argv[2], &vinfo_, grabID_);
			tcl.result(capwin_->name());
			return (TCL_OK);
		}
	} else if (argc == 2) {
		if (strcmp(argv[1], "need-capwin") == 0) {
			tcl.result("1");
			return (TCL_OK);
		}
	}
	return (Grabber::command(argc, argv));
}
Example #15
0
directory_entry makeEntry(const char* nama, poi_attr_t atribut, JAM waktu, TANGGAL tanggal, uint16_t idx, uint32_t size){
	directory_entry retval;
	setNama(&retval,nama);
	setattr(&retval,atribut);
	setLastModifTime(&retval,waktu);
	setLastModifDate(&retval,tanggal);
	setFirstDataBlockIdx(&retval,idx);
	setFileSize(&retval,size);
	return retval;
}
Example #16
0
// Pushes an obj onto the Tarjan stack and sets it to GREEN.
static void push(tarjan *t, const upb_refcounted *r) {
  assert(color(t, r) == BLACK || color(t, r) == GRAY);
  // This defines the attr layout for the GREEN state.  "index" and "lowlink"
  // get 31 bits, which is plenty (limit of 2B objects frozen at a time).
  setattr(t, r, GREEN | (t->index << 2) | (t->index << 33));
  if (++t->index == 0x80000000) {
    upb_status_seterrmsg(t->status, "too many objects to freeze");
    err(t);
  }
  upb_inttable_push(&t->stack, upb_value_ptr((void*)r));
}
Example #17
0
	/*! \brief initialize the SPI port */
	int init(int bitrate = 2000000,
			int pin_assign = 0,
			uint8_t mode = SPI_ATTR_MODE0,
			uint8_t master = SPI_ATTR_MASTER,
			uint8_t format = SPI_ATTR_FORMAT_SPI,
			uint8_t width = 8){
		if( open() < 0 ){
			return -1;
		}
		return setattr(bitrate, pin_assign, mode, master, format, width);
	}
Example #18
0
File: main.c Project: outsky/tetris
static void draw_linerecord(void)
{
    cursor_to(LR_LEFT, LR_TOP);
    setcolor(F_WHITE, B_BLACK);
    setattr(T_BOLD);
    printf("   LINE   ");
    restore();
    setcolor(F_BLACK, B_WHITE);
    cursor_to(LR_LEFT, LR_TOP+1);
    printf(" 1> %5d ", GAME->one);
    cursor_to(LR_LEFT, LR_TOP+2);
    printf(" 2> %5d ", GAME->two);
    cursor_to(LR_LEFT, LR_TOP+3);
    printf(" 3> %5d ", GAME->three);
    cursor_to(LR_LEFT, LR_TOP+4);
    printf(" 4> %5d ", GAME->four);
    cursor_to(LR_LEFT, LR_TOP+5);
    setattr(T_UNDERSCORE);
    printf(" sum %4d ", GAME->one+GAME->two+GAME->three+GAME->four);
    restore();
}
Example #19
0
File: main.c Project: outsky/tetris
static void draw_status(void)
{
    cursor_to(ST_LEFT, ST_TOP);
    setcolor(F_WHITE, B_BLACK);
    setattr(T_BOLD);
    printf("  LEVEL  ");
    restore();
    setcolor(F_BLACK, B_WHITE);
    cursor_to(ST_LEFT, ST_TOP+1);
    printf("%8d ", GAME->level+1);

    cursor_to(ST_LEFT, ST_TOP+3);
    setcolor(F_WHITE, B_BLACK);
    setattr(T_BOLD);
    printf("  SCORE  ");
    restore();
    setcolor(F_BLACK, B_WHITE);
    cursor_to(ST_LEFT, ST_TOP+4);
    printf("%8d ", GAME->score);

    cursor_to(ST_LEFT, ST_TOP+6);
    setcolor(F_WHITE, B_BLACK);
    setattr(T_BOLD);
    printf("  SPEED  ");
    restore();
    setcolor(F_BLACK, B_WHITE);
    cursor_to(ST_LEFT, ST_TOP+7);
    printf(" %7.2f ", 1000.0f/speeds[GAME->level]);

    cursor_to(ST_LEFT, ST_TOP+9);
    setcolor(F_WHITE, B_BLACK);
    setattr(T_BOLD);
    printf("NEXTLEVEL");
    restore();
    setcolor(F_BLACK, B_WHITE);
    cursor_to(ST_LEFT, ST_TOP+10);
    printf("%8d ", levels[GAME->level]-GAME->score);

    restore();
}
Example #20
0
static void color_link(LINK far *link, int color)
   {
   textcbase = SCREEN_INDENT;
   textrbase = TEXT_START_ROW;

   if (text_type == 1)   /* if 640x200x2 mode */
      display_text(link->r, link->c, color, buffer+link->offset, link->width);
   else
      setattr(link->r, link->c, color, link->width);

   textcbase = 0;
   textrbase = 0;
   }
Example #21
0
/*
 * call-seq:
 *   io.cooked!
 *
 * Enables cooked mode.
 *
 * If the terminal mode needs to be back, use io.cooked { ... }.
 *
 * You must require 'io/console' to use this method.
 */
static VALUE
console_set_cooked(VALUE io)
{
    conmode t;
    rb_io_t *fptr;
    int fd;

    GetOpenFile(io, fptr);
    fd = GetReadFD(fptr);
    if (!getattr(fd, &t)) rb_sys_fail(0);
    set_cookedmode(&t, NULL);
    if (!setattr(fd, &t)) rb_sys_fail(0);
    return io;
}
Example #22
0
/** assignment handler */
static x_object *
msg_on_assign(x_object *o, x_obj_attr_t *attrs)
{
  x_obj_attr_t hints =
    { NULL, NULL, NULL, };
  x_string_t from = NULL;
  x_object *_chan_;
  struct msg_object *msgo = (struct msg_object *) (void *) o;
  ENTER;

  x_object_default_assign_cb(o, attrs);
  TRACE("message from2=%s\n", x_object_getattr(o, "from"));

  if (msgo->regs.state != MSG_STATE_HAS_SESSION)
    {
      TRACE("Creating session\n");

      from = x_object_getattr(o, "from");
      BUG_ON(!from);
      if (from)
        {
          TRACE("Setting system env.\n");
          msgo->iosession = X_OBJECT(x_session_open(from, o, &hints, X_CREAT));
          msgo->regs.state = MSG_STATE_HAS_SESSION;
          attr_list_clear(&hints);

          _SBSCRB(msgo->iosession,o);

          /* set channel profiles */
          _chan_ = x_session_channel_open2(X_OBJECT(msgo->iosession), "msg");

          setattr("mtype", "message", &hints);
          _ASGN(X_OBJECT(_chan_), &hints);
          attr_list_clear(&hints);

          x_session_channel_set_transport_profile_ns(X_OBJECT(_chan_),
              _XS("__ibshell_t_profile"), _XS("gobee:media"), &hints);
          x_session_channel_set_media_profile_ns(X_OBJECT(_chan_),
              _XS("__ibshell_m_profile"), _XS("gobee:media"));

          // subsribe for tranport messages
          _SBSCRB(_CHLD(_chan_,"transport"),o);

        }
    }

  EXIT;
  return o;
}
Example #23
0
int32_t
omrdump_startup(struct OMRPortLibrary *portLibrary)
{

#if defined(AIXPPC)
	uintptr_t handle;

	portLibrary->error_set_last_error(portLibrary, 0, 0);
	portLibrary->portGlobals->control.aix_proc_attr = 1;

	if (0 == portLibrary->sl_open_shared_library(portLibrary, NULL, &handle, 0)) {
		int (*setattr)(pid_t pid, procattr_t * attr, uint32_t size);

		if (0 == portLibrary->sl_lookup_name(portLibrary, handle, "proc_setattr", (uintptr_t *)&setattr, "IPLj")) {
			procattr_t attr;
			int rc;

			memset(&attr, PA_IGNORE, sizeof(procattr_t));
			/* enable the flags that are required for including non-anonymous mmap regions and shared memory in core file */
			attr.core_naming = PA_ENABLE;
			attr.core_mmap = PA_ENABLE;
			attr.core_shm = PA_ENABLE;

			rc = setattr(-1, &attr, sizeof(procattr_t));
			if (rc != 0) {
				if (ENOSYS == errno) {
					/* CMVC 176613: we can get here if the machine was updated from 6100-04 to 6100-05 without a subsequent reboot,
					 * in which case, behave the same as if we're running on an AIX version which does not support proc_setattr() */
				} else {
					int32_t error = errno; /* Save errno for past closing the shared library. */
					portLibrary->sl_close_shared_library(portLibrary, handle);
					portLibrary->error_set_last_error(portLibrary, error, OMRPORT_ERROR_STARTUP_AIX_PROC_ATTR);
					return OMRPORT_ERROR_STARTUP_AIX_PROC_ATTR;
				}
			} else {
				/* successfully set the process attributes */
				portLibrary->portGlobals->control.aix_proc_attr = 0;
			}
		} else {
			/* do not return error as we may be running on an AIX version which does not support proc_setattr() */
		}
		portLibrary->sl_close_shared_library(portLibrary, handle);
	}
#endif

	/* We can only get here omrdump_startup completed successfully */

	return 0;
}
Example #24
0
/*
 * call-seq:
 *   io.raw!(min: nil, time: nil)
 *
 * Enables raw mode.
 *
 * If the terminal mode needs to be back, use io.raw { ... }.
 *
 * You must require 'io/console' to use this method.
 */
static VALUE
console_set_raw(int argc, VALUE *argv, VALUE io)
{
    conmode t;
    rb_io_t *fptr;
    int fd;
    rawmode_arg_t opts, *optp = rawmode_opt(argc, argv, &opts);

    GetOpenFile(io, fptr);
    fd = GetReadFD(fptr);
    if (!getattr(fd, &t)) rb_sys_fail(0);
    set_rawmode(&t, optp);
    if (!setattr(fd, &t)) rb_sys_fail(0);
    return io;
}
Example #25
0
	/*! \brief Set SPI attributes using values specified */
	int setattr(int bitrate = 2000000,
			int pin_assign = 0,
			uint8_t mode = SPI_ATTR_MODE0,
			uint8_t master = SPI_ATTR_MASTER,
			uint8_t format = SPI_ATTR_FORMAT_SPI,
			uint8_t width = 8){
		spi_attr_t attr;
		attr.bitrate = bitrate;
		attr.mode = mode;
		attr.pin_assign = pin_assign;
		attr.format = format;
		attr.width = width;
		attr.master = master;
		return setattr(&attr);
	}
Example #26
0
static int print_doc_msg_func(int pnum, int num_pages)
   {
   char temp[10];
   int  key;

   if ( pnum == -1 )    /* successful completion */
      {
      static FCODE msg[] = {"Done -- Press any key"};
      buzzer(0);
      putstringcenter(7, 0, 80, C_HELP_LINK, msg);
      getakey();
      return (0);
      }

   if ( pnum == -2 )   /* aborted */
      {
      static FCODE msg[] = {"Aborted -- Press any key"};
      buzzer(1);
      putstringcenter(7, 0, 80, C_HELP_LINK, msg);
      getakey();
      return (0);
      }

   if (pnum == 0)   /* initialization */
      {
      static FCODE msg[] = {"Generating FRACTINT.DOC"};
      helptitle();
      printinstr();
      setattr(2, 0, C_HELP_BODY, 80*22);
      putstringcenter(1, 0, 80, C_HELP_HDG, msg);

      putstring(7, 30, C_HELP_BODY, "Completed:");

      movecursor(25,80);   /* hide cursor */
      }

   sprintf(temp, "%d%%", (int)( (100.0 / num_pages) * pnum ) );
   putstring(7, 41, C_HELP_LINK, temp);

   while ( keypressed() )
      {
      key = getakey();
      if ( key == ESC )
         return (0);    /* user abort */
      }

   return (1);   /* AOK -- continue */
   }
Example #27
0
void    VUTermSuspend(BOOL cls)
{
    setattr(DARKWHITE | BLACK);
    if(cls) {
        cursor(0, 0);
        io_puts(term->term_cls);
    }
    else {
        cursor(rows - 1, 0);
        io_puts(term->term_eol);
    }
    io_escape(term->term_cursor_show);
    io_escape(term->term_shutdown);
    io_flush();
    ioctl(STDIN, TIOCSETN, &old_stty);
}
Example #28
0
/*
 * call-seq:
 *   io.echo = flag
 *
 * Enables/disables echo back.
 * On some platforms, all combinations of this flags and raw/cooked
 * mode may not be valid.
 *
 * You must require 'io/console' to use this method.
 */
static VALUE
console_set_echo(VALUE io, VALUE f)
{
    conmode t;
    rb_io_t *fptr;
    int fd;

    GetOpenFile(io, fptr);
    fd = GetReadFD(fptr);
    if (!getattr(fd, &t)) rb_sys_fail(0);
    if (RTEST(f))
	set_echo(&t, NULL);
    else
	set_noecho(&t, NULL);
    if (!setattr(fd, &t)) rb_sys_fail(0);
    return io;
}
Example #29
0
void    VUTermSuspend(BOOL cls)
{
    setattr(DARKWHITE | BLACK);
    if(cls) {
        cursor(0, 0);
        io_puts(term->term_eop);
    }
    else {
        cursor(rows - 1, 0);
        io_puts(term->term_eol);
    }
    if(cls != 2) {
        io_escape(term->term_cursor_show);
        io_escape(term->term_shutdown);
        io_flush();
        tcsetattr(STDIN, TCSANOW, &old_stty);
    }
    else
        io_flush();
}
Example #30
0
File: tty.c Project: Hooman3/minix
/*===========================================================================*
 *				do_close				     *
 *===========================================================================*/
static int do_close(devminor_t minor)
{
/* A tty line has been closed.  Clean up the line if it is the last close. */
  tty_t *tp;

  if ((tp = line2tty(minor)) == NULL)
	return ENXIO;

  if ((minor != LOG_MINOR || !isconsole(tp)) && --tp->tty_openct == 0) {
	tp->tty_pgrp = 0;
	tty_icancel(tp);
	(*tp->tty_ocancel)(tp, 0);
	(*tp->tty_close)(tp, 0);
	tp->tty_termios = termios_defaults;
	tp->tty_winsize = winsize_defaults;
	setattr(tp);
  }

  return OK;
}