static FcBool interpret_builtin (FcFormatContext *c, FcPattern *pat, FcStrBuf *buf) { FcChar8 *new_str = NULL; FcBool ret; if (!expect_char (c, '=') || !read_word (c)) return FcFalse; /* try simple builtins first */ if (0) { } #define BUILTIN(name, func) \ else if (0 == strcmp ((const char *) c->word, name))\ do { new_str = func (pat); ret = FcTrue; } while (0) BUILTIN ("unparse", FcNameUnparse); /* BUILTIN ("verbose", FcPatternPrint); XXX */ #undef BUILTIN else
cap_free(caps); return ret; } #else /* !HAVE_CAP_GET_PROC */ # define bin_cap bin_notavail # define bin_getcap bin_notavail # define bin_setcap bin_notavail #endif /* !HAVE_CAP_GET_PROC */ /* module paraphernalia */ static struct builtin bintab[] = { BUILTIN("cap", 0, bin_cap, 0, 1, 0, NULL, NULL), BUILTIN("getcap", 0, bin_getcap, 1, -1, 0, NULL, NULL), BUILTIN("setcap", 0, bin_setcap, 2, -1, 0, NULL, NULL), }; static struct features module_features = { bintab, sizeof(bintab)/sizeof(*bintab), NULL, 0, NULL, 0, NULL, 0, 0 }; /**/ int setup_(UNUSED(Module m))
* I don't know what I'm doing. */ #if defined(HAVE_GDBM_H) && defined(HAVE_GDBM_OPEN) #include <gdbm.h> static char *backtype = "db/gdbm"; static const struct gsu_scalar gdbm_gsu = { gdbmgetfn, gdbmsetfn, gdbmunsetfn }; /**/ static const struct gsu_hash gdbm_hash_gsu = { hashgetfn, gdbmhashsetfn, gdbmhashunsetfn }; static struct builtin bintab[] = { BUILTIN("ztie", 0, bin_ztie, 1, -1, 0, "d:f:r", NULL), BUILTIN("zuntie", 0, bin_zuntie, 1, -1, 0, "u", NULL), }; /**/ static int bin_ztie(char *nam, char **args, Options ops, UNUSED(int func)) { char *resource_name, *pmname; GDBM_FILE dbf = NULL; int read_write = GDBM_SYNC, pmflags = PM_REMOVABLE; Param tied_param; if(!OPT_ISSET(ops,'d')) { zwarnnam(nam, "you must pass `-d %s'", backtype); return 1;
(void)pm; gettimeofday(&now, &dummy_tz); arr = (char **)zhalloc(3 * sizeof(*arr)); sprintf(buf, "%ld", (long)now.tv_sec); arr[0] = dupstring(buf); sprintf(buf, "%ld", (long)now.tv_usec * 1000); arr[1] = dupstring(buf); arr[2] = NULL; return arr; #endif } static struct builtin bintab[] = { BUILTIN("strftime", 0, bin_strftime, 2, 2, 0, "qrs:", NULL), }; static const struct gsu_integer epochseconds_gsu = { getcurrentsecs, NULL, stdunsetfn }; static const struct gsu_float epochrealtime_gsu = { getcurrentrealtime, NULL, stdunsetfn }; static const struct gsu_array epochtime_gsu = { getcurrenttime, NULL, stdunsetfn }; static struct paramdef patab[] = { SPECIALPMDEF("EPOCHSECONDS", PM_INTEGER|PM_READONLY, &epochseconds_gsu, NULL, NULL), SPECIALPMDEF("EPOCHREALTIME", PM_FFLOAT|PM_READONLY,
/**/ static int bin_zsystem(char *nam, char **args, Options ops, int func) { /* If more commands are implemented, this can be more sophisticated */ if (!strcmp(*args, "flock")) { return bin_zsystem_flock(nam, args+1, ops, func); } else if (!strcmp(*args, "supports")) { return bin_zsystem_supports(nam, args+1, ops, func); } zwarnnam(nam, "unknown subcommand: %s", *args); return 1; } static struct builtin bintab[] = { BUILTIN("syserror", 0, bin_syserror, 0, 1, 0, "e:p:", NULL), BUILTIN("sysread", 0, bin_sysread, 0, 1, 0, "c:i:o:s:t:", NULL), BUILTIN("syswrite", 0, bin_syswrite, 1, 1, 0, "c:o:", NULL), BUILTIN("zsystem", 0, bin_zsystem, 1, -1, 0, NULL, NULL) }; /* Functions for the errnos special parameter. */ /**/ static char ** errnosgetfn(UNUSED(Param pm)) { /* arrdup etc. should really take const pointers as arguments */ return arrdup((char **)sys_errnames); }
else return do_comp_vars(id, -1, cond_str(a, 0, 1), 0, NULL, 0); } return 0; } /**/ static int cond_range(char **a, int id) { return do_comp_vars(CVT_RANGEPAT, 0, cond_str(a, 0, 1), 0, (id ? cond_str(a, 1, 1) : NULL), 0); } static struct builtin bintab[] = { BUILTIN("compadd", 0, bin_compadd, 0, -1, 0, NULL, NULL), BUILTIN("compset", 0, bin_compset, 1, 3, 0, NULL, NULL), }; static struct conddef cotab[] = { CONDDEF("after", 0, cond_range, 1, 1, 0), CONDDEF("between", 0, cond_range, 2, 2, 1), CONDDEF("prefix", 0, cond_psfix, 1, 2, CVT_PREPAT), CONDDEF("suffix", 0, cond_psfix, 1, 2, CVT_SUFPAT), }; static struct funcwrap wrapper[] = { WRAPDEF(comp_wrapper), }; /* The order of the entries in this table has to match the *HOOK
else return do_comp_vars(id, -1, cond_str(a, 0, 1), 0, NULL, 0); } return 0; } /**/ static int cond_range(char **a, int id) { return do_comp_vars(CVT_RANGEPAT, 0, cond_str(a, 0, 1), 0, (id ? cond_str(a, 1, 1) : NULL), 0); } static struct builtin bintab[] = { BUILTIN("compadd", BINF_HANDLES_OPTS, bin_compadd, 0, -1, 0, NULL, NULL), BUILTIN("compset", 0, bin_compset, 1, 3, 0, NULL, NULL), }; static struct conddef cotab[] = { CONDDEF("after", 0, cond_range, 1, 1, 0), CONDDEF("between", 0, cond_range, 2, 2, 1), CONDDEF("prefix", 0, cond_psfix, 1, 2, CVT_PREPAT), CONDDEF("suffix", 0, cond_psfix, 1, 2, CVT_SUFPAT), }; static struct funcwrap wrapper[] = { WRAPDEF(comp_wrapper), }; /* The order of the entries in this table has to match the *HOOK
void neko_init_builtins() { neko_builtins = alloc_root(2); neko_builtins[0] = alloc_object(NULL); neko_builtins[1] = alloc_function(builtin_print,VAR_ARGS,"$print"); BUILTIN(print,VAR_ARGS); BUILTIN(array,VAR_ARGS); BUILTIN(amake,1); BUILTIN(acopy,1); BUILTIN(asize,1); BUILTIN(asub,3); BUILTIN(ablit,5); BUILTIN(aconcat,1); BUILTIN(smake,1); BUILTIN(ssize,1); BUILTIN(scopy,1); BUILTIN(ssub,3); BUILTIN(sget,2); BUILTIN(sset,3); BUILTIN(sblit,5); BUILTIN(sfind,3); BUILTIN(new,1); BUILTIN(objget,2); BUILTIN(objset,3); BUILTIN(objcall,3); BUILTIN(objfield,2); BUILTIN(objremove,2); BUILTIN(objfields,1); BUILTIN(hash,1); BUILTIN(fasthash,1); BUILTIN(field,1); BUILTIN(objsetproto,2); BUILTIN(objgetproto,1); BUILTIN(int,1); BUILTIN(float,1); BUILTIN(string,1); BUILTIN(typeof,1); BUILTIN(closure,VAR_ARGS); BUILTIN(apply,VAR_ARGS); BUILTIN(varargs,1); BUILTIN(compare,2); BUILTIN(pcompare,2); BUILTIN(not,1); BUILTIN(throw,1); BUILTIN(rethrow,1); BUILTIN(nargs,1); BUILTIN(call,3); BUILTIN(isnan,1); BUILTIN(isinfinite,1); BUILTIN(istrue,1); BUILTIN(getkind,1); BUILTIN(iskind,2); BUILTIN(hnew,1); BUILTIN(hget,3); BUILTIN(hmem,3); BUILTIN(hset,4); BUILTIN(hadd,3); BUILTIN(hremove,3); BUILTIN(hresize,2); BUILTIN(hkey,1); BUILTIN(hcount,1); BUILTIN(hsize,1); BUILTIN(hiter,2); BUILTIN(iadd,2); BUILTIN(isub,2); BUILTIN(imult,2); BUILTIN(idiv,2); BUILTIN(excstack,0); BUILTIN(callstack,0); BUILTIN(version,0); BUILTIN(setresolver,1); }
p += strlen(p) + 1; } } zfree(value, val_len+1); } if (val_len < 0 || list_len < 0 || list_len > val_len) { zwarnnam(nam, "%s: %e", metafy(file, slen, META_NOALLOC), errno); ret = 1 + (list_len > val_len || list_len < 0); } return ret; } /* module paraphernalia */ static struct builtin bintab[] = { BUILTIN("zgetattr", 0, bin_getattr, 2, 3, 0, "h", NULL), BUILTIN("zsetattr", 0, bin_setattr, 3, 3, 0, "h", NULL), BUILTIN("zdelattr", 0, bin_delattr, 2, -1, 0, "h", NULL), BUILTIN("zlistattr", 0, bin_listattr, 1, 2, 0, "h", NULL), }; static struct features module_features = { bintab, sizeof(bintab)/sizeof(*bintab), NULL, 0, NULL, 0, NULL, 0, 0 }; /**/ int
if (hashnam) { if (ret) freearray(hash); else { sethparam(hashnam, hash); if (errflag) return 1; } } return ret; } static struct builtin bintab[] = { BUILTIN("stat", 0, bin_stat, 0, -1, 0, NULL, NULL), BUILTIN("zstat", 0, bin_stat, 0, -1, 0, NULL, NULL), }; static struct features module_features = { bintab, sizeof(bintab)/sizeof(*bintab), NULL, 0, NULL, 0, NULL, 0, 0 }; /**/ int setup_(UNUSED(Module m)) {
else pars[arg] = atoi(argv[arg]); } /* output string, through the proper termcap functions */ if (!arg) putp(t); else { putp(tparm(t, pars[0], pars[1], pars[2], pars[3], pars[4], pars[5], pars[6], pars[7], pars[8])); } return 0; } static struct builtin bintab[] = { BUILTIN("echoti", 0, bin_echoti, 1, -1, 0, NULL, NULL), }; /**/ static HashNode getterminfo(UNUSED(HashTable ht), const char *name) { int len, num; char *tistr, *nameu; Param pm = NULL; /* This depends on the termcap stuff in init.c */ if (termflags & TERM_BAD) return NULL; if ((termflags & TERM_UNKNOWN) && (isset(INTERACTIVE) || !init_term())) return NULL;
chrp = va_arg(ap, int *); *chrp = getbyte(do_keytmout, timeout); break; } default: #ifdef DEBUG dputs("Bad command %d in zle_main_entry", cmd); #endif break; } return NULL; } static struct builtin bintab[] = { BUILTIN("bindkey", 0, bin_bindkey, 0, -1, 0, "evaM:ldDANmrsLRp", NULL), BUILTIN("vared", 0, bin_vared, 1, 1, 0, "aAcehM:m:p:r:t:", NULL), BUILTIN("zle", 0, bin_zle, 0, -1, 0, "aAcCDFgGIKlLmMNRU", NULL), }; /* The order of the entries in this table has to match the *HOOK * macros in zle.h */ /**/ mod_export struct hookdef zlehooks[] = { /* LISTMATCHESHOOK */ HOOKDEF("list_matches", NULL, 0), /* COMPLETEHOOK */ HOOKDEF("complete", NULL, 0), /* BEFORECOMPLETEHOOK */ HOOKDEF("before_complete", NULL, 0),
} return 0; } } /**/ static int ptyhook(UNUSED(Hookdef d), UNUSED(void *dummy)) { deleteallptycmds(); return 0; } static struct builtin bintab[] = { BUILTIN("zpty", 0, bin_zpty, 0, -1, 0, "ebdmrwLnt", NULL), }; static struct features module_features = { bintab, sizeof(bintab)/sizeof(*bintab), NULL, 0, NULL, 0, NULL, 0, 0 }; /**/ int setup_(UNUSED(Module m)) {
return 0; } /**/ #else /* !(HAVE_PCRE_COMPILE && HAVE_PCRE_EXEC) */ # define bin_pcre_compile bin_notavail # define bin_pcre_study bin_notavail # define bin_pcre_match bin_notavail # define cond_pcre_match cond_match /**/ #endif /* !(HAVE_PCRE_COMPILE && HAVE_PCRE_EXEC) */ static struct builtin bintab[] = { BUILTIN("pcre_compile", 0, bin_pcre_compile, 1, 1, 0, "aimx", NULL), BUILTIN("pcre_study", 0, bin_pcre_study, 0, 0, 0, NULL, NULL), BUILTIN("pcre_match", 0, bin_pcre_match, 1, 2, 0, "a", NULL) }; static struct conddef cotab[] = { CONDDEF("pcre-match", CONDF_INFIX, cond_pcre_match, 0, 0, CPCRE_PLAIN) }; /**/ int setup_(UNUSED(Module m)) { return 0; }
sprintf(tbuf, "%ld", t); if (sch->flags & SCHEDFLAG_TRASH_ZLE) flagstr = "-o"; else flagstr = ""; *aptr = (char *)zhalloc(5 + strlen(tbuf) + strlen(sch->cmd)); sprintf(*aptr, "%s:%s:%s", tbuf, flagstr, sch->cmd); } *aptr = NULL; return ret; } static struct builtin bintab[] = { BUILTIN("sched", 0, bin_sched, 0, -1, 0, NULL, NULL), }; static const struct gsu_array sched_gsu = { schedgetfn, arrsetfn, stdunsetfn }; static struct paramdef partab[] = { SPECIALPMDEF("zsh_scheduled_events", PM_ARRAY|PM_READONLY, &sched_gsu, NULL, NULL) }; static struct features module_features = { bintab, sizeof(bintab)/sizeof(*bintab), NULL, 0, NULL, 0, partab, sizeof(partab)/sizeof(*partab),
int RunIt( char *cmd, bool ignore_errors, bool *res_nolog ) { int res; #define BUILTIN( b ) \ (strnicmp( cmd, b, sizeof( b ) - 1 ) == 0 && cmd[sizeof(b)-1] == ' ') *res_nolog = false; if( BUILTIN( "CD" ) ) { res = SysChdir( SkipBlanks( cmd + sizeof( "CD" ) ) ); if( res == 0 ) { getcwd( IncludeStk->cwd, sizeof( IncludeStk->cwd ) ); } } else if( BUILTIN( "CDSAY" ) ) { res = SysChdir( SkipBlanks( cmd + sizeof( "CDSAY" ) ) ); if( res == 0 ) { getcwd( IncludeStk->cwd, sizeof( IncludeStk->cwd ) ); LogDir( IncludeStk->cwd ); } } else if( BUILTIN( "SET" ) ) { res = ProcSet( SkipBlanks( cmd + sizeof( "SET" ) ) ); } else if( BUILTIN( "ECHO" ) ) { Log( Quiet, "%s\n", SkipBlanks( cmd + sizeof( "ECHO" ) ) ); res = 0; } else if( BUILTIN( "ERROR" ) ) { Log( Quiet, "%s\n", SkipBlanks( cmd + sizeof( "ERROR" ) ) ); res = 1; } else if( BUILTIN( "COPY" ) ) { res = ProcCopy( SkipBlanks( cmd + sizeof( "COPY" ) ), false, false, ignore_errors ); *res_nolog = true; } else if( BUILTIN( "ACOPY" ) ) { res = ProcCopy( SkipBlanks( cmd + sizeof( "ACOPY" ) ), true, false, ignore_errors ); *res_nolog = true; } else if( BUILTIN( "CCOPY" ) ) { res = ProcCopy( SkipBlanks( cmd + sizeof( "CCOPY" ) ), false, true, ignore_errors ); *res_nolog = true; } else if( BUILTIN( "ACCOPY" ) ) { res = ProcCopy( SkipBlanks( cmd + sizeof( "ACCOPY" ) ), true, true, ignore_errors ); *res_nolog = true; } else if( BUILTIN( "MKDIR" ) ) { res = ProcMkdir( SkipBlanks( cmd + sizeof( "MKDIR" ) ) ); } else if( BUILTIN( "PMAKE" ) ) { res = ProcPMake( SkipBlanks( cmd + sizeof( "PMAKE" ) ), ignore_errors ); *res_nolog = ignore_errors; } else if( BUILTIN( "RM" ) ) { res = ProcRm( SkipBlanks( cmd + sizeof( "RM" ) ) ); } else if( cmd[0] == '!' ) { res = SysRunCommand( SkipBlanks( cmd + 1 ) ); } else { res = SysRunCommand( cmd ); } return( res ); }
unsigned RunIt( char *cmd, bool ignore_errors ) { unsigned res; #define BUILTIN( b ) \ (strnicmp( cmd, b, sizeof( b ) - 1 ) == 0 && cmd[sizeof(b)-1] == ' ') res = 0; if( BUILTIN( "CD" ) ) { res = SysChdir( SkipBlanks( cmd + sizeof( "CD" ) ) ); if( res == 0 ) { getcwd( IncludeStk->cwd, sizeof( IncludeStk->cwd ) ); } } else if( BUILTIN( "CDSAY" ) ) { res = SysChdir( SkipBlanks( cmd + sizeof( "CDSAY" ) ) ); if( res == 0 ) { getcwd( IncludeStk->cwd, sizeof( IncludeStk->cwd ) ); LogDir( IncludeStk->cwd ); } } else if( BUILTIN( "SET" ) ) { res = ProcSet( SkipBlanks( cmd + sizeof( "SET" ) ) ); } else if( BUILTIN( "ECHO" ) ) { Log( Quiet, "%s\n", SkipBlanks( cmd + sizeof( "ECHO" ) ) ); } else if( BUILTIN( "ERROR" ) ) { Log( Quiet, "%s\n", SkipBlanks( cmd + sizeof( "ERROR" ) ) ); res = 1; } else if( BUILTIN( "COPY" ) ) { res = ProcCopy( SkipBlanks( cmd + sizeof( "COPY" ) ), FALSE, FALSE ); } else if( BUILTIN( "ACOPY" ) ) { res = ProcCopy( SkipBlanks( cmd + sizeof( "ACOPY" ) ), TRUE, FALSE ); } else if( BUILTIN( "CCOPY" ) ) { res = ProcCopy( SkipBlanks( cmd + sizeof( "CCOPY" ) ), FALSE, TRUE ); } else if( BUILTIN( "ACCOPY" ) ) { res = ProcCopy( SkipBlanks( cmd + sizeof( "ACCOPY" ) ), TRUE, TRUE ); } else if( BUILTIN( "MKDIR" ) ) { res = ProcMkdir( SkipBlanks( cmd + sizeof( "MKDIR" ) ) ); } else if( BUILTIN( "PMAKE" ) ) { res = ProcPMake( SkipBlanks( cmd + sizeof( "PMAKE" ) ), ignore_errors ); } else { res = SysRunCommand( cmd ); } return( res ); }
"too many arguments"); return 1; } /* output string, through the proper termcap functions */ if (!argct) tputs(t, 1, putraw); else { /* This assumes arguments of <lines> <columns> for cap 'cm' */ num = (argv[1]) ? atoi(argv[1]) : atoi(*argv); tputs(tgoto(t, num, atoi(*argv)), 1, putraw); } return 0; } static struct builtin bintab[] = { BUILTIN("echotc", 0, bin_echotc, 1, -1, 0, NULL, NULL), }; /**/ static HashNode gettermcap(UNUSED(HashTable ht), const char *name) { int len, num; char *tcstr, buf[2048], *u, *nameu; Param pm = NULL; /* This depends on the termcap stuff in init.c */ if (termflags & TERM_BAD) return NULL; if ((termflags & TERM_UNKNOWN) && (isset(INTERACTIVE) || !init_term())) return NULL;
} stack = sf.prev; if (stack) { stack->beg += now - prev; if (a) a->time += now - prev; } } else stack = sf.prev; } return 0; } static struct builtin bintab[] = { BUILTIN("zprof", 0, bin_zprof, 0, 0, 0, "c", NULL), }; static struct funcwrap wrapper[] = { WRAPDEF(zprof_wrapper), }; static struct features module_features = { bintab, sizeof(bintab)/sizeof(*bintab), NULL, 0, NULL, 0, NULL, 0, 0 }; /**/
histline = va_arg(ap, zlong); break; } default: #ifdef DEBUG dputs("Bad command %d in zle_main_entry", cmd); #endif break; } return NULL; } static struct builtin bintab[] = { BUILTIN("bindkey", 0, bin_bindkey, 0, -1, 0, "evaM:ldDANmrsLRp", NULL), BUILTIN("vared", 0, bin_vared, 1, 1, 0, "aAcef:hi:M:m:p:r:t:", NULL), BUILTIN("zle", 0, bin_zle, 0, -1, 0, "aAcCDfFgGIKlLmMNrRTUw", NULL), }; /* The order of the entries in this table has to match the *HOOK * macros in zle.h */ /**/ mod_export struct hookdef zlehooks[] = { /* LISTMATCHESHOOK */ HOOKDEF("list_matches", NULL, 0), /* COMPLETEHOOK */ HOOKDEF("complete", NULL, 0), /* BEFORECOMPLETEHOOK */ HOOKDEF("before_complete", NULL, 0),
setiparam_no_convert("REPLY", (zlong)sess->fd); if (verbose) printf("%s:%d is now on fd %d\n", desthost, destport, sess->fd); } zsfree(desthost); } return 0; } static struct builtin bintab[] = { BUILTIN("ztcp", 0, bin_ztcp, 0, 3, 0, "acd:flLtv", NULL), }; static struct features module_features = { bintab, sizeof(bintab)/sizeof(*bintab), NULL, 0, NULL, 0, NULL, 0, 0 }; /* The load/unload routines required by the zsh library interface */ /**/ int setup_(UNUSED(Module m))
CONDDEF("pcre-match", CONDF_INFIX, cond_pcre_match, 0, 0, CPCRE_PLAIN) /* CONDDEF can register =~ but it won't be found */ }; /**/ #else /* !(HAVE_PCRE_COMPILE && HAVE_PCRE_EXEC) */ # define bin_pcre_compile bin_notavail # define bin_pcre_study bin_notavail # define bin_pcre_match bin_notavail /**/ #endif /* !(HAVE_PCRE_COMPILE && HAVE_PCRE_EXEC) */ static struct builtin bintab[] = { BUILTIN("pcre_compile", 0, bin_pcre_compile, 1, 1, 0, "aimxs", NULL), BUILTIN("pcre_match", 0, bin_pcre_match, 1, 1, 0, "a:v:n:b", NULL), BUILTIN("pcre_study", 0, bin_pcre_study, 0, 0, 0, NULL, NULL) }; static struct features module_features = { bintab, sizeof(bintab)/sizeof(*bintab), #if defined(HAVE_PCRE_COMPILE) && defined(HAVE_PCRE_EXEC) cotab, sizeof(cotab)/sizeof(*cotab), #else /* !(HAVE_PCRE_COMPILE && HAVE_PCRE_EXEC) */ NULL, 0, #endif /* !(HAVE_PCRE_COMPILE && HAVE_PCRE_EXEC) */ NULL, 0, NULL, 0, 0
* (acquire_pgrp() is called from init_io()) */ mypgrp = 0; init_io(); setsparam("TTY", ztrdup(ttystrname)); } close(ttyfd); if (pid < 0) { zerrnam(nam, "fork failed: %e", NULL, errno); return 1; } lastpid = pid; return 0; } static struct builtin bintab[] = { BUILTIN("clone", 0, bin_clone, 1, 1, 0, NULL, NULL), }; /**/ int setup_(UNUSED(Module m)) { return 0; } /**/ int boot_(Module m) { return !addbuiltins(m->nam, bintab, sizeof(bintab)/sizeof(*bintab)); }
#include <openssl/sha.h> /* These two are generated from the rift.mdd file by mkmakemod.sh */ #include "rift.mdh" #include "rift.pro" #define RW_DEFAULT_MANIFEST "cli_rwfpath.xml" extern rift_cmdargs_t rift_cmdargs; static int rift_exec(char *nam, char **argv, Options ops, int func); /* Before executing the command, the rift plugin returns this builtin, so that * we get a callback to execute the command */ static struct builtin rw_command_bn = BUILTIN("rw", BINF_RW_CMD, rift_exec, 0, -1, -1, NULL, NULL); /* * RW.CLI Controller Instance */ rwcli_controller_t rwcli_controller; /** * Initializes the message channel between agent and the CLI. */ static void msg_channel_init(rwcli_msg_channel_t* ch) { ch->in.fd.read = -1; ch->in.fd.write = -1; ch->out.fd.read = -1; ch->out.fd.write = -1;
args + 1, OPT_ISSET(ops, 'h') ? chown_dolchown : chown_dochown, recurse_donothing, OPT_ISSET(ops, 'h') ? chown_dolchown : chown_dochown, &chm); } /* module paraphernalia */ #ifdef HAVE_LSTAT # define LN_OPTS "dfhins" #else # define LN_OPTS "dfi" #endif static struct builtin bintab[] = { /* The names which overlap commands without necessarily being * fully compatible. */ BUILTIN("chgrp", 0, bin_chown, 2, -1, BIN_CHGRP, "hRs", NULL), BUILTIN("chown", 0, bin_chown, 2, -1, BIN_CHOWN, "hRs", NULL), BUILTIN("ln", 0, bin_ln, 1, -1, BIN_LN, LN_OPTS, NULL), BUILTIN("mkdir", 0, bin_mkdir, 1, -1, 0, "pm:", NULL), BUILTIN("mv", 0, bin_ln, 2, -1, BIN_MV, "fi", NULL), BUILTIN("rm", 0, bin_rm, 1, -1, 0, "dfirs", NULL), BUILTIN("rmdir", 0, bin_rmdir, 1, -1, 0, NULL, NULL), BUILTIN("sync", 0, bin_sync, 0, 0, 0, NULL, NULL), /* The "safe" zsh-only names */ BUILTIN("zf_chgrp", 0, bin_chown, 2, -1, BIN_CHGRP, "hRs", NULL), BUILTIN("zf_chown", 0, bin_chown, 2, -1, BIN_CHOWN, "hRs", NULL), BUILTIN("zf_ln", 0, bin_ln, 1, -1, BIN_LN, LN_OPTS, NULL), BUILTIN("zf_mkdir", 0, bin_mkdir, 1, -1, 0, "pm:", NULL), BUILTIN("zf_mv", 0, bin_ln, 2, -1, BIN_MV, "fi", NULL), BUILTIN("zf_rm", 0, bin_rm, 1, -1, 0, "dfirs", NULL), BUILTIN("zf_rmdir", 0, bin_rmdir, 1, -1, 0, NULL, NULL),
sethparam(outhash, outdata); else setaparam(outarray, outdata); freelinklist(fdlist, NULL); return 0; #else /* TODO: use poll */ zerrnam(nam, "your system does not implement the select system call."); return 2; #endif } static struct builtin bintab[] = { BUILTIN("zselect", 0, bin_zselect, 0, -1, 0, NULL, NULL), }; static struct features module_features = { bintab, sizeof(bintab)/sizeof(*bintab), NULL, 0, NULL, 0, NULL, 0, 0 }; /* The load/unload routines required by the zsh library interface */ /**/ int
locallevel > pm->level && is_private(pm)) pm = pm->old; /* Ideally, we'd print the word "private" here instead of "typeset" * when the parameter is in fact a private, but that would require * re-implementing the entirety of printparamnode(). */ if (pm) printparamnode((HashNode)pm, printflags); } /* * Standard module configuration/linkage */ static struct builtin bintab[] = { /* Copied from BUILTIN("local"), "P" added */ BUILTIN("private", BINF_PLUSOPTS | BINF_MAGICEQUALS | BINF_PSPECIAL | BINF_ASSIGN, (HandlerFunc)bin_private, 0, -1, 0, "AE:%F:%HL:%PR:%TUZ:%ahi:%lprtux", "P") }; static struct features module_features = { bintab, sizeof(bintab)/sizeof(*bintab), NULL, 0, NULL, 0, NULL, 0, 0 }; static struct builtin save_local; static struct reswd reswd_private = {{NULL, "private", 0}, TYPESET}; /**/ int