Example #1
0
LISP lrmdir(LISP p)
{long iflag;
 iflag = no_interrupt(1);
 if (rmdir(get_c_string(p)))
   return(err("rmdir",llast_c_errmsg(-1)));
 no_interrupt(iflag);
 return(NIL);}
Example #2
0
LISP lrename(LISP p1,LISP p2)
{long iflag;
 iflag = no_interrupt(1);
 if (rename(get_c_string(p1),get_c_string(p2)))
   return(err("rename",llast_c_errmsg(-1)));
 no_interrupt(iflag);
 return(NIL);}
Example #3
0
LISP llink(LISP p1,LISP p2)
{long iflag;
 iflag = no_interrupt(1);
 if (link(get_c_string(p1),get_c_string(p2)))
   return(err("link",llast_c_errmsg(-1)));
 no_interrupt(iflag);
 return(NIL);}
Example #4
0
LISP lunlink(LISP p)
{long iflag;
 iflag = no_interrupt(1);
 if (unlink(get_c_string(p)))
   return(err("unlink",llast_c_errmsg(-1)));
 no_interrupt(iflag);
 return(NIL);}
Example #5
0
LISP lgetfsent(void)
{long iflag;
 LISP result;
 iflag = no_interrupt(1);
 result = decode_fstab(getfsent());
 no_interrupt(iflag);
 return(result);}
Example #6
0
LISP laccess_problem(LISP lfname,LISP lacc)
{char *fname = get_c_string(lfname);
 char *acc = get_c_string(lacc),*p;
 int amode = 0,iflag = no_interrupt(1),retval;
 for(p=acc;*p;++p)
   switch(*p)
     {case 'r':
	amode |= R_OK;
	break;
      case 'w':
	amode |= W_OK;
	break;
      case 'x':
	amode |= X_OK;
	break;
      case 'f':
	amode |= F_OK;
	break;
      default:
	err("bad access mode",lacc);}
 retval = access(fname,amode);
 no_interrupt(iflag);
 if (retval < 0)
   return(llast_c_errmsg(-1));
 else
   return(NIL);}
Example #7
0
LISP lsetfsent(void)
{long iflag;
 LISP result;
 iflag = no_interrupt(1);
 result = flocons(setfsent());
 no_interrupt(iflag);
 return(result);}
Example #8
0
LISP lmkdir(LISP p,LISP m)
{long iflag;
 iflag = no_interrupt(1);
 if (mkdir(get_c_string(p),get_c_long(m)))
   return(err("mkdir",llast_c_errmsg(-1)));
 no_interrupt(iflag);
 return(NIL);}
Example #9
0
LISP lputpwent(LISP alist,LISP file)
{int iflag = no_interrupt(1);
 int status;
 struct passwd p;
 lencode_pwent(alist,&p);
 status = putpwent(&p,get_c_file(file,NULL));
 no_interrupt(iflag);
 return(NIL);}
Example #10
0
LISP lnice(LISP val)
{int iflag,n;
 n = get_c_long(val);
 iflag = no_interrupt(1);
 n = nice(n);
 if (n == -1)
   err("nice",llast_c_errmsg(-1));
 no_interrupt(iflag);
 return(flocons(n));}
Example #11
0
LISP lreadlink(LISP p)
{long iflag;
 char buff[PATH_MAX+1];
 int size;
 iflag = no_interrupt(1);
 if ((size = readlink(get_c_string(p),buff,sizeof(buff))) < 0)
   return(err("readlink",llast_c_errmsg(-1)));
 no_interrupt(iflag);
 return(strcons(size,buff));}
Example #12
0
LISP lkill(LISP pid,LISP sig)
{long iflag;
 iflag = no_interrupt(1);
 if (kill(get_c_long(pid),
	  NULLP(sig) ? SIGKILL : get_c_long(sig)))
   err("kill",llast_c_errmsg(-1));
 else
   no_interrupt(iflag);
 return(NIL);}
Example #13
0
LISP lgetpwent(void)
{int iflag;
 LISP result = NIL;
 struct passwd *p;
 iflag = no_interrupt(1);
 if ((p = getpwent()))
   result = ldecode_pwent(p);
 no_interrupt(iflag);
 return(result);}
Example #14
0
LISP lgetpwnam(LISP nam)
{int iflag;
 struct passwd *p;
 LISP result = NIL;
 iflag = no_interrupt(1);
 if ((p = getpwnam(get_c_string(nam))))
   result = ldecode_pwent(p);
 no_interrupt(iflag);
 return(result);}
Example #15
0
LISP lsystem(LISP args)
{int retval;
 long iflag;
 iflag = no_interrupt(1);
 retval = system(get_c_string(string_append(args)));
 no_interrupt(iflag);
 if (retval < 0)
   return(cons(flocons(retval),llast_c_errmsg(-1)));
 else
   return(flocons(retval));}
Example #16
0
LISP lgetpwuid(LISP luid)
{int iflag;
 uid_t uid;
 struct passwd *p;
 LISP result = NIL;
 uid = get_c_long(luid);
 iflag = no_interrupt(1);
 if ((p = getpwuid(uid)))
   result = ldecode_pwent(p);
 no_interrupt(iflag);
 return(result);}
Example #17
0
File: gd.c Project: suprit/stuff
LISP lgdImageCreateFromXbm(LISP f)
{   LISP result;
    long iflag;
    result = cons(NIL,NIL);
    result->type = tc_gdimage;
    iflag = no_interrupt(1);
    result->storage_as.string.data =
        (char *) gdImageCreateFromXbm(get_c_file(f,NULL));
    no_interrupt(iflag);
    return(result);
}
Example #18
0
File: gd.c Project: suprit/stuff
LISP lgdImageCreate(LISP sx,LISP sy)
{   LISP result;
    long iflag;
    result = cons(NIL,NIL);
    result->type = tc_gdimage;
    iflag = no_interrupt(1);
    result->storage_as.string.data = (char *) gdImageCreate(get_c_long(sx),
                                     get_c_long(sy));
    no_interrupt(iflag);
    return(result);
}
Example #19
0
File: gd.c Project: suprit/stuff
LISP lcgdFontCreate(gdFontPtr font)
{   LISP result;
    long iflag;
    result = cons(NIL,NIL);
    result->type = tc_gdfont;
    iflag = no_interrupt(1);
    result->storage_as.string.data = (char *) font;
    result->storage_as.string.dim = 0;
    no_interrupt(iflag);
    return(result);
}
Example #20
0
LISP lfork(void)
{int iflag;
 pid_t pid;
 iflag = no_interrupt(1);
 pid = fork();
 if (pid == 0)
   {no_interrupt(iflag);
    return(NIL);}
 if (pid == -1)
   return(err("fork",llast_c_errmsg(-1)));
 no_interrupt(iflag);
 return(flocons(pid));}
Example #21
0
LISP lgetgrgid(LISP n)
{gid_t gid;
 struct group *gr;
 long iflag,j;
 LISP result = NIL;
 gid = get_c_long(n);
 iflag = no_interrupt(1);
 if ((gr = getgrgid(gid)))
   {result = cons(strcons(strlen(gr->gr_name),gr->gr_name),result);
    for(j=0;gr->gr_mem[j];++j)
      result = cons(strcons(strlen(gr->gr_mem[j]),gr->gr_mem[j]),result);
    result = nreverse(result);}
 no_interrupt(iflag);
 return(result);}
Example #22
0
LISP lexec(LISP path,LISP args,LISP env)
{int iflag;
 char **argv = NULL, **envp = NULL;
 LISP gcsafe=NIL;
 iflag = no_interrupt(1);
 argv = list2char(&gcsafe,args);
 if NNULLP(env)
   envp = list2char(&gcsafe,env);
 if (envp)
   execve(get_c_string(path),argv,envp);
 else
   execv(get_c_string(path),argv);
 no_interrupt(iflag);
 return(err("exec",llast_c_errmsg(-1)));}
Example #23
0
File: gd.c Project: suprit/stuff
LISP lgdPoint(LISP args)
{   LISP result,l;
    long iflag,j,m,n = nlength(args);
    gdPointPtr pt;
    if ((n % 2) || (!n))
        err("must be an even positive length",args);
    m = n / 2;
    result = cons(NIL,NIL);
    result->type = tc_gdpoint;
    iflag = no_interrupt(1);
    pt =  (gdPointPtr) must_malloc(sizeof(gdPoint) * m);
    result->storage_as.string.data = (char *) pt;
    result->storage_as.string.dim = m;
    no_interrupt(iflag);
    for(j=0,l=args; j<m; ++j,l=cddr(l))
    {   pt[j].x = get_c_long(car(l));
        pt[j].y = get_c_long(cadr(l));
    }
    return(result);
}
Example #24
0
LISP lwait(LISP lpid,LISP loptions)
{pid_t pid,ret;
 int iflag,status = 0,options;
 pid = NULLP(lpid) ? -1 : get_c_long(lpid);
 options = assemble_options(loptions,
#ifdef WCONTINUED
			    "WCONTINUED",WCONTINUED,
#endif
#ifdef WNOWAIT
			    "WNOWAIT",WNOWAIT,
#endif
			    "WNOHANG",WNOHANG,
			    "WUNTRACED",WUNTRACED,
			    NULL);
 iflag = no_interrupt(1); 
 ret = waitpid(pid,&status,options);
 no_interrupt(iflag);
 if (ret == 0)
   return(NIL);
 else if (ret == -1)
   return(err("wait",llast_c_errmsg(-1)));
 else
   /* should do more decoding on the status */
   return(cons(flocons(ret),cons(flocons(status),NIL)));}
Example #25
0
LISP lendfsent(void)
{long iflag;
 iflag = no_interrupt(1);
 endfsent();
 no_interrupt(iflag);
 return(NIL);}
Example #26
0
LISP lendpwent(void)
{int iflag = no_interrupt(1);
 endpwent();
 no_interrupt(iflag);
 return(NIL);}
Example #27
0
LISP lsetpwfile(LISP fname)
{int iflag = no_interrupt(1);
 setpwfile(get_c_string(fname));
 no_interrupt(iflag);
 return(NIL);}
Example #28
0
LISP lexit(LISP val)
{int iflag = no_interrupt(1);
 exit(get_c_long(val));
 no_interrupt(iflag);
 return(NIL);}
Example #29
-1
LISP lstatfs(LISP path)
{long iflag;
 struct statfs s;
 iflag = no_interrupt(1);
 if (statfs(get_c_string(path),&s,sizeof(s)))
   return(err("statfs",llast_c_errmsg(-1)));
 no_interrupt(iflag);
 return(symalist("type",(((s.f_type >= 0) && (s.f_type < MNT_NUMTYPES) &&
			  mnt_names[s.f_type])
			 ? rintern(mnt_names[s.f_type])
			 : flocons(s.f_type)),
		 "bsize",flocons(s.f_bsize),
		 "blocks",flocons(s.f_blocks),
		 "bfree",flocons(s.f_bfree),
		 "bavail",flocons(s.f_bavail),
		 "files",flocons(s.f_files),
		 "ffree",flocons(s.f_ffree),
		 "mntonname",strcons(-1,s.f_mntonname),
		 "mntfromname",strcons(-1,s.f_mntfromname),
		 NULL));}