"$Header: lam9.c,v 1.7 85/03/13 17:19:15 sklower Exp $";
/* -[Sat Oct 1 19:44:47 1983 by jkf]-
* (c) copyright 1982, Regents of the University of California
* These routines writen in C will allow use of the termcap file
* by any lisp program. They are very basic routines which initialize
* termcap and allow the lisp to execute any of the termcap functions.
#include <stdio.h> /*add definations for I/O and bandrate */
int putchar(); /* functions used from the termlib */
/* This routine will initialize the termcap for the lisp programs.
/* If the termcap file is not found, or terminal type is undefined,
/* it will print out an error mesg. */
char *cp
= getenv("TERM");
found
= tgetent(bpbuf
,cp
); /* open ther termcap file */
case -1: printf("\nError Termcap File not found \n");break;
case 0 : printf("\nError No Termcap Entry for this terminal \n");
case 1 : { /* everything was ok */
/* This routine will execute any of the termcap functions used by the lisp
/* program. If the feature is not include in the terminal defined it will
/* option : feature to execute
/* line : line if is nessery
/* colum : colum if is nessaery
register struct argent
*mylbot
= lbot
;
error("Wrong number of Arguments to Termcapexecute",FALSE
);
column
= mylbot
[2].val
->i
;
return(inewint(show((char *) mylbot
->val
,&line
,&column
)));
/* the tegetflag doesnot work ? */
clear
= tgetstr(option
,&clbp
);
/*printf("option = %d , %s \n",clear,option);*/
{found
= tgetnum(option
);
if (strcmp(option
, "cm") == 0) { /* if cursor motion, do it */
clear
=tgoto(clear
,*colum
,*line
);
if (clear
) /* execute the feature */
* LIfranzcall :: lisp function int:franz-call
* this function serves many purposes. It provides access to
* those things that are best done in C or which required a
* C access to unix system calls.
* Calls to this routine are not error checked, for the most part
* because this is only called from trusted lisp code.
* The functions in this file may or may not be documented in the manual.
* See the lisp interface to this function for more details. (common2.l)
* the first argument is always a fixnum index, the other arguments
* depend on the function.
if((np
-lbot
) <= 0) argerr("int:franz-call");
switch (lbot
[0].val
->i
) {
* return vector of name, uid, gid, dir
* or nil if doesn't exist.
struct passwd
*pw
, *getpwnam();
lispval
newvec(), inewint();
pw
= getpwnam(verify(lbot
[1].val
,"int:franz-call: invalid name"));
handy
= newvec(4 * sizeof(long));
handy
->v
.vector
[0] = (lispval
) inewstr(pw
->pw_name
);
handy
->v
.vector
[1] = inewint(pw
->pw_uid
);
handy
->v
.vector
[2] = inewint(pw
->pw_gid
);
handy
->v
.vector
[3] = (lispval
) inewstr(pw
->pw_dir
);
(verify(lbot
[1].val
, "i:fc,access: non string"),
(chdir(verify(lbot
[1].val
,"i:fc,chdir: non string"))));
(unlink(verify(lbot
[1].val
,"i:fc,unlink: non string"))));
return(inewint(time(0)));
return(inewint(chmod(verify(lbot
[1].val
,
"i:fc,chmod: non string"),
return(inewint(getpid()));
if(stat(verify(lbot
[1].val
,"ifc:stat bad file name "),
!= 0) return(nil
); /* nil on error */
handy
= newvec(12 * sizeof(long));
handy
->v
.vector
[0] = inewint(statbuf
.st_mode
& 07777);
handy
->v
.vector
[1] = inewint(
(statbuf
.st_mode
& S_IFMT
) >> 12 );
handy
->v
.vector
[2] = inewint(statbuf
.st_nlink
);
handy
->v
.vector
[3] = inewint(statbuf
.st_uid
);
handy
->v
.vector
[4] = inewint(statbuf
.st_gid
);
handy
->v
.vector
[5] = inewint(statbuf
.st_size
);
handy
->v
.vector
[6] = inewint(statbuf
.st_atime
);
handy
->v
.vector
[7] = inewint(statbuf
.st_mtime
);
handy
->v
.vector
[8] = inewint(statbuf
.st_ctime
);
handy
->v
.vector
[9] = inewint(statbuf
.st_dev
);
handy
->v
.vector
[10] = inewint(statbuf
.st_rdev
);
handy
->v
.vector
[11] = inewint(statbuf
.st_ino
);
#if os_4_1a || os_4_1c || os_4_2 || os_4_3
gethostname(hostname
,sizeof(hostname
));
return((lispval
) inewstr(hostname
));
return((lispval
) inewstr(SITE
));
(link(verify(lbot
[1].val
,"i:fc,link: non string"),
verify(lbot
[2].val
,"i:fc,link: non string"))));
/* sleep for the given number of seconds */
return(inewint(sleep(lbot
[1].val
->i
)));
return(inewint(nice(lbot
[1].val
->i
)));