#include <sys/types.h>#include <stdio.h>#include <stddef.h>#include <stdlib.h>#include <unistd.h>#include <fcntl.h>#include <string.h>#include <signal.h>#include <errno.h>#include <ctype.h>#include <assert.h>#include <sys/stat.h>#include <sys/wait.h>Include dependency graph for acd.c:

Go to the source code of this file.
Data Structures | |
| struct | cell |
| struct | program |
| struct | rule |
Defines | |
| #define | nil 0 |
| #define | _POSIX_SOURCE 1 |
| #define | LIB "/usr/lib" |
| #define | arraysize(a) (sizeof(a) / sizeof((a)[0])) |
| #define | arraylimit(a) ((a) + arraysize(a)) |
| #define | value car |
| #define | base cdr |
| #define | suffix cdr |
| #define | flags letter |
| #define | subst car |
| #define | is_unique(type) ((type) >= LETTER) |
| #define | W_SET 0x01 |
| #define | W_RDONLY 0x02 |
| #define | W_LOCAL 0x04 |
| #define | W_TEMP 0x08 |
| #define | W_SUFF 0x10 |
| #define | N_CHARS (1 + (unsigned char) -1) |
| #define | HASHDENSE 0x400 |
| #define | E_BASH 0x01 |
| #define | E_QUOTE 0x02 |
| #define | E_SIMPLE 0x04 |
| #define | match from |
| #define | R_PREFER 0x01 |
| #define | NO_PATH 2000000000 |
Typedefs | |
| typedef cell | cell_t |
| typedef enum type | type_t |
| typedef program | program_t |
| typedef enum how | how_t |
| typedef enum phase | phase_t |
| typedef rule | rule_t |
| typedef enum ruletype | ruletype_t |
| typedef enum exec | exec_t |
Enumerations | |
| enum | type { CELL, STRING, SUBST, LETTER, WORD, EQUALS, OPEN, CLOSE, PLUS, MINUS, STAR, INPUT, OUTPUT, WHITE, COMMENT, SEMI, EOLN, N_TYPES } |
| enum | how { SUPERFICIAL, PARTIAL, FULL, EXPLODE, IMPLODE } |
| enum | phase { INIT, SCAN, COMPILE } |
| enum | ruletype { ARG, PREFER, TRANSFORM, COMBINE } |
| enum | exec { DOIT, DONT } |
Functions | |
| void | report (char *label) |
| void | quit (int exit_code) |
| void | fatal (char *label) |
| void * | allocate (void *mem, size_t size) |
| void | deallocate (void *mem) |
| char * | copystr (const char *s) |
| void | princhar (int c) |
| void | prinstr (char *s) |
| void | prin2 (cell_t *p) |
| void | prin1 (cell_t *p) |
| void | prin1n (cell_t *p) |
| void | prin2n (cell_t *p) |
| cell_t * | newcell (void) |
| unsigned | hashfun (cell_t *p) |
| cell_t * | search (cell_t *p, cell_t ***hook) |
| void | dec (cell_t *p) |
| cell_t * | inc (cell_t *p) |
| cell_t * | go (cell_t *p, cell_t *field) |
| cell_t * | cons (type_t type, cell_t *p) |
| cell_t * | append (type_t type, cell_t *p) |
| cell_t * | findnword (char *name, size_t n) |
| cell_t * | findword (char *name) |
| void | interrupt (int sig) |
| int | extalnum (int c) |
| void | getdesc (void) |
| cell_t * | get_token (void) |
| cell_t * | explode (cell_t *p, how_t how) |
| cell_t * | get_string (cell_t **pp) |
| cell_t * | get_list (cell_t **pp, type_t stop) |
| program_t * | get_line (cell_t *file) |
| program_t * | get_prog (void) |
| void | makenames (cell_t ***ppr, cell_t *s, char **name, size_t i, size_t *n) |
| int | constant (cell_t *p) |
| cell_t * | evaluate (cell_t *p, how_t how) |
| void | modify (cell_t **pp, cell_t *p, type_t mode) |
| int | tainted (cell_t *p) |
| void | newrule (ruletype_t type, cell_t *from, cell_t *to) |
| int | talk (void) |
| void | unix_exec (cell_t *c) |
| void | execute (exec_t how, unsigned indent) |
| int | equal (cell_t *p, cell_t *q) |
| int | wordlist (cell_t **pw, int atom) |
| char * | maketemp (void) |
| void | inittemp (char *tmpdir) |
| void | deltemp (void) |
| cell_t * | splitenv (char *env) |
| void | key_usage (char *how) |
| void | inappropriate (void) |
| int | readonly (cell_t *v) |
| void | complain (cell_t *err) |
| int | keyword (char *name) |
| cell_t * | getvar (cell_t *v) |
| void | argscan (void) |
| void | compile (void) |
| void | transform (rule_t *) |
| void | exec_one (void) |
| int | argmatch (int shift, cell_t *match, cell_t *match1, char *arg1) |
| int | member (cell_t *p, cell_t *l) |
| long | basefind (cell_t *f, cell_t *l) |
| rule_t * | findpath (long depth, int seek, cell_t *file, rule_t *start) |
| cell_t * | predef (char *var, char *val) |
| void | usage (void) |
| int | main (int argc, char **argv) |
Variables | |
| char | version [] = "1.9" |
| char * | program |
| int | verbose = 0 |
| int | action = 2 |
| size_t | heap_chunks = 0 |
| program_t * | pc |
| program_t * | nextpc |
| cell_t * | oldcells |
| cell_t * | oblist [HASHDENSE+N_CHARS+N_TYPES] |
| char * | descr |
| FILE * | dfp |
| int | dch |
| unsigned | lineno |
| unsigned | indent |
| phase_t | phase |
| rule_t * | rules = nil |
| cell_t * | V_star |
| cell_t ** | pV_star |
| cell_t * | L_files |
| cell_t ** | pL_files = &L_files |
| cell_t * | V_in |
| cell_t * | V_out |
| cell_t * | V_stop |
| cell_t * | L_args |
| cell_t * | L_predef |
| char * | template |
| static char * | tp |
| long | shortest |
|
|
|
|
|
|
|
|
|
|
|
Definition at line 110 of file acd.c. Referenced by _doscan(), _format(), ack_get_operand(), add(), bas_get_operand(), basefind(), basename(), complete_bars(), decomp(), delay(), distribute(), do_vm_map(), do_x86_vm(), doformat(), gzfilebuf::fillbuf(), gen_bitlen(), get_mem_chunks(), getpipe(), gnu_get_operand(), inet_aton(), inet_network(), inflate_table(), inflate_table9(), init(), mail(), main(), new_mem(), num(), o_collect(), o_print(), out_num(), outea(), output_base(), gzfilebuf::overflow(), pack_table(), partition(), process(), record_bars_bridge(), record_bars_cardbus(), seg2phys(), split(), test39d(), transform(), traverse(), ttyname(), uInt64_to_double(), and gzfilebuf::underflow(). |
|
|
|
|
|
Definition at line 497 of file acd.c. Referenced by get_token(). |
|
|
Definition at line 498 of file acd.c. Referenced by get_token(). |
|
|
Definition at line 112 of file acd.c. Referenced by _doprnt(), _doscan(), arp_ioctl(), check_header(), compute_rec_conf(), decode_ioctl(), do1(), do_comm(), do_rec_conf(), dumpopts(), eth_checkopt(), eth_restart(), evalcase(), evalcommand(), evalsubshell(), evaltree(), evalvar(), exec_one(), execute(), fdopen(), fopen(), freopen(), get_ipconf(), getifaddrs(), getpipe(), gunpipe(), gzhead(), gzheader(), initopts(), ip_checkopt(), lunpipe(), main(), opentab(), opentrace(), parse(), preadbuffer(), present(), print_conn(), print_one(), putpipe(), reg(), regatom(), regbranch(), regcomp(), regpiece(), restart_write_fd(), saveopts(), sbe_psd(), scsi_cmd(), setflags(), startprocess(), sys_call(), tcp_setconf(), test24a(), test8a(), udp_ip_arrived(), udp_setopt(), w_init(), waitproc(), and zlibCompileFlags(). |
|
|
Definition at line 278 of file acd.c. Referenced by hashfun(). |
|
|
|
|
|
Definition at line 24 of file acd.c. Referenced by get_prog(). |
|
|
Definition at line 1212 of file acd.c. Referenced by amatch(), argmatch(), Cond(), do_line(), execute(), gooddefine(), main(), match(), option(), re_match(), regexec(), ret_to_continue(), search(), selected(), servxcheck(), set_control(), Split(), Strfun(), and substitute(). |
|
|
Definition at line 277 of file acd.c. Referenced by hashfun(). |
|
|
|
|
|
Definition at line 2316 of file acd.c. Referenced by compile(). |
|
|
Definition at line 1222 of file acd.c. Referenced by newrule(). |
|
|
Definition at line 115 of file acd.c. Referenced by cmd_substitute(), and docmd(). |
|
|
Definition at line 111 of file acd.c. Referenced by dyndep(), implmacros(), main(), newfile(), newname(), and process(). |
|
|
Definition at line 109 of file acd.c. Referenced by getexp(). |
|
|
Definition at line 146 of file acd.c. Referenced by argmatch(), exec_one(), predef(), tainted(), and transform(). |
|
|
Definition at line 145 of file acd.c. Referenced by argmatch(), exec_one(), predef(), readonly(), and transform(). |
|
|
Definition at line 144 of file acd.c. Referenced by argmatch(), exec_one(), predef(), and transform(). |
|
|
Definition at line 148 of file acd.c. Referenced by basefind(), exec_one(), and transform(). |
|
|
Definition at line 147 of file acd.c. Referenced by dec(), exec_one(), and transform(). |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
||||||||||||
|
|
|
||||||||||||
|
Definition at line 401 of file acd.c. References cons(), nil, and p. Referenced by callld(), cmd_write(), docmd(), evaluate(), explode(), main(), mkvec(), modify(), parse_old_device_line(), parse_one(), process(), wordlist(), and zipOpen2(). |
|
||||||||||||||||||||
|
Definition at line 2099 of file acd.c. References cell::car, cell::cdr, cons(), dec(), DOIT, execute(), findnword(), i, inc(), L_args, LETTER, m, match, match1(), cell::name, nil, pc, pL_files, prin2(), prin2n(), printf, pV_star, strcmp, STRING, strlen(), SUBST, V_out, V_star, verbose, W_LOCAL, W_RDONLY, W_SET, and WORD. Referenced by argscan(). |
|
|
Definition at line 2235 of file acd.c. References ARG, argmatch(), cell::cdr, dec(), L_args, m, rule::next, nil, pc, pL_files, rule::prog, pV_star, rules, SCAN, rule::type, and V_star. |
|
||||||||||||
|
Definition at line 2281 of file acd.c. References base, cell::car, cell::cdr, dec(), f, findnword(), L, cell::name, nil, strcmp, strlen(), strrchr(), cell::type, and W_SUFF. Referenced by findpath(). |
|
|
Definition at line 2464 of file acd.c. References cell::car, cell::cdr, COMBINE, COMPILE, evaluate(), file, findpath(), fprintf(), go(), IMPLODE, inc(), L, L_files, newcell(), rule::next, nil, NO_PATH, rule::path, rules, shortest, t, transform(), rule::type, rule::wait, and wordlist. Referenced by get_expression(), initkeys(), and main(). |
|
|
Definition at line 1522 of file acd.c. References err, fprintf(), cell::name, and nil. Referenced by exec_one(), and flush(). |
|
||||||||||||
|
Definition at line 391 of file acd.c. References cell::car, newcell(), p, cell::refc, and cell::type. Referenced by append(), argmatch(), cons_echo(), cons_org0(), cons_write(), evaluate(), explode(), get_list(), get_string(), makenames(), modify(), scr_init(), and splitenv(). |
|
|
Definition at line 952 of file acd.c. |
|
|
|
|
|
Definition at line 83 of file acd.c. References free, heap_chunks, and nil. |
|
|
Definition at line 322 of file acd.c. References deallocate, ENOENT, errno, fputc(), heap_chunks, is_unique, nil, oldcells, p, prinstr(), printf, report(), search, stdout, unlink, verbose, W_TEMP, and WORD. Referenced by argmatch(), argscan(), basefind(), equal(), evaluate(), exec_one(), explode(), get_line(), get_list(), get_prog(), get_string(), go(), inc(), inflate_fast(), modify(), newrule(), predef(), and transform(). |
|
|
Definition at line 1463 of file acd.c. References deallocate, ENOENT, errno, printf, report(), rmdir, and verbose. |
|
||||||||||||
|
Definition at line 1368 of file acd.c. References dec(), evaluate(), IMPLODE, inc(), m1, m2, MINUS, newcell(), nil, p, and t. |
|
||||||||||||
|
Definition at line 1087 of file acd.c. References append(), assert, cons(), dec(), EQUALS, explode(), fprintf(), FULL, go(), IMPLODE, inc(), INPUT, LETTER, MINUS, modify(), nil, OUTPUT, p, pc, PLUS, pr(), r, STAR, stderr, STRING, SUBST, t, tainted(), and WORD. Referenced by compile(), equal(), exec_one(), explode(), and transform(). |
|
|
Definition at line 1562 of file acd.c. References allocate(), cell::car, cell::cdr, close, COMPILE, complain(), dec(), doit(), DOIT, DONT, equal, EQUALS, err, evaluate(), execute(), file, flags, fprintf(), fputc(), rule::from, getenv(), getvar(), hash(), IMPLODE, inappropriate(), inc(), key_usage(), keyword(), maketemp(), n, cell::name, newcell(), rule::next, nil, num(), O_RDONLY, open, p, PARTIAL, pc, prin1(), prin1n(), prin2n(), printf, r, read, readonly, rules, SCAN, splitenv(), strcat(), strcpy(), strlen(), strtoul(), t, talk(), tmp, rule::to, TRANSFORM, rule::type, cell::type, V_star, V_stop, W_LOCAL, W_RDONLY, W_SET, W_SUFF, W_TEMP, WORD, and wordlist. Referenced by execute(). |
|
||||||||||||
|
Definition at line 2050 of file acd.c. References DOIT, DONT, exec_one(), firstline, fprintf(), nextpc, nil, pc, and work(). |
|
||||||||||||
|
Definition at line 975 of file acd.c. References allocate(), append(), assert, cons(), constant(), deallocate, dec(), evaluate(), EXPLODE, go(), i, IMPLODE, inc(), makenames(), n, nil, PARTIAL, pr(), r, s, st, stat, STRING, t, and WORD. Referenced by evaluate(). |
|
|
Definition at line 470 of file acd.c. References isalnum. |
|
|
|
|
||||||||||||
|
Definition at line 407 of file acd.c. References allocate(), inc(), memcpy(), cell::name, newcell(), nil, cell::type, and WORD. Referenced by argmatch(), basefind(), findword(), makenames(), and splitenv(). |
|
||||||||||||||||||||
|
Definition at line 2320 of file acd.c. References basefind(), file, rule::from, if(), rule::next, nil, rules, start, TRANSFORM, and rule::type. Referenced by compile(). |
|
|
Definition at line 418 of file acd.c. References findnword(), and strlen(). Referenced by get_prog(), predef(), and splitenv(). |
|
|
Definition at line 817 of file acd.c. References allocate(), dec(), EOLN, file, fputc(), get_list(), get_token(), inc(), indent, lineno, nil, p, pc, prin2n(), printf, SEMI, stdout, verbose, and WHITE. |
|
||||||||||||
|
Definition at line 754 of file acd.c. References assert, CLOSE, COMMENT, cons(), dec(), EOLN, EQUALS, fprintf(), get_string, get_token(), INPUT, LETTER, lineno, MINUS, nil, OPEN, OUTPUT, p, pc, PLUS, SEMI, STAR, stderr, STRING, SUBST, and WHITE. Referenced by get_line(). |
|
|
Definition at line 859 of file acd.c. References allocate(), copystr(), d, deallocate, dec(), dfp, fatal(), fclose(), file, findword(), fopen(), get_line(), getdesc(), indent, LIB, lineno, program::next, nil, prog, sprintf(), stdin, and strlen(). |
|
|
Definition at line 685 of file acd.c. References c, cons(), dec(), EQUALS, get_token(), go(), LETTER, MINUS, nil, p, PLUS, ps, s, STAR, STRING, and SUBST. |
|
|
Definition at line 500 of file acd.c. References E_QUOTE, E_SIMPLE, EOF, escape(), getdesc(), i, inc(), isalnum, isspace, cell::letter, LETTER, n, newcell(), and cell::type. |
|
|
Definition at line 482 of file acd.c. References dfp, EOF, fatal(), ferror, fprintf(), getc, quit, and stderr. Referenced by get_prog(), and get_token(). |
|
|
Definition at line 1550 of file acd.c. References nil, SUBST, cell::type, and WORD. |
|
||||||||||||
|
Definition at line 383 of file acd.c. References dec(), field, inc(), and p. Referenced by compile(), evaluate(), explode(), get_string(), modify(), and wordlist(). |
|
|
Definition at line 282 of file acd.c. References HASHDENSE, LETTER, N_CHARS, p, and WORD. Referenced by search(). |
|
|
Definition at line 1504 of file acd.c. Referenced by exec_one(). |
|
|
Definition at line 358 of file acd.c. References dec(), is_unique, nil, p, cell::refc, and search. Referenced by argmatch(), cmdline(), compile(), equal(), evaluate(), exec_one(), explode(), findnword(), get_line(), get_token(), go(), inflate_fast(), predef(), tempname(), and transform(). |
|
|
Definition at line 1441 of file acd.c. References allocate(), EEXIST, errno, getpid, maketemp(), mkdir, nil, printf, report(), sprintf(), strlen(), and verbose. |
|
|
|
|
|
Definition at line 1497 of file acd.c. Referenced by exec_one(). |
|
|
|
|
||||||||||||
|
Definition at line 2591 of file acd.c. References a, getenv(), i, L_args, nil, prog, strrchr(), and tmpdir. |
|
||||||||||||||||||||||||
|
Definition at line 905 of file acd.c. References allocate(), assert, cell::cdr, cons(), findnword(), LETTER, memcpy(), cell::name, nil, p, s, strlen(), cell::type, and WORD. Referenced by explode(). |
|
|
Definition at line 1418 of file acd.c. References allocate(), getpid, i, nil, sprintf(), and strlen(). Referenced by exec_one(), inittemp(), and transform(). |
|
||||||||||||
|
Definition at line 2271 of file acd.c. References cell::car, cell::cdr, nil, p, and cell::type. |
|
||||||||||||||||
|
Definition at line 1048 of file acd.c. References append(), cell::cdr, cons(), dec(), go(), nil, p, and PLUS. Referenced by command(), evaluate(), and main(). |
|
|
Definition at line 255 of file acd.c. References allocate(), heap_chunks, nil, oldcells, and p. Referenced by compile(), cons(), equal(), exec_one(), findnword(), get_token(), predef(), and transform(). |
|
||||||||||||||||
|
Definition at line 1226 of file acd.c. References allocate(), dec(), rule::from, nil, pc, pr(), PREFER, r, R_PREFER, rules, rule::to, and TRANSFORM. |
|
||||||||||||
|
Definition at line 2557 of file acd.c. References dec(), findword(), inc(), L_predef, newcell(), nil, p, prin1(), prin2n(), printf, t, verbose, W_LOCAL, W_RDONLY, and W_SET. Referenced by inittagdef(). |
|
|
Definition at line 173 of file acd.c. References assert, EQUALS, INPUT, LETTER, MINUS, nil, OUTPUT, p, PLUS, prin2(), princhar(), prinstr(), printf, STAR, STRING, SUBST, verbose, and WORD. Referenced by exec_one(), predef(), prin1n(), and prin2(). |
|
|
Definition at line 237 of file acd.c. References fputc(), p, prin1(), and stdout. Referenced by exec_one(). |
|
|
Definition at line 224 of file acd.c. References fputc(), nil, p, prin1(), stdout, and STRING. Referenced by argmatch(), prin1(), prin2n(), and transform(). |
|
|
Definition at line 239 of file acd.c. References fputc(), p, prin2(), and stdout. Referenced by argmatch(), exec_one(), get_line(), predef(), and unix_exec(). |
|
|
Definition at line 150 of file acd.c. |
|
|
Definition at line 157 of file acd.c. References fputc(), nil, princhar(), stdout, and strchr. |
|
|
|
|
|
Definition at line 1511 of file acd.c. References fprintf(), cell::name, pc, and W_RDONLY. |
|
|
Definition at line 44 of file acd.c. References errno, fprintf(), nil, stderr, and strerror(). |
|
||||||||||||
|
Definition at line 301 of file acd.c. References cmp, hashfun(), nil, oblist, p, sp, strcmp, and WORD. |
|
|
Definition at line 1473 of file acd.c. References cons(), env, findnword(), findword(), isspace, nil, p, pr(), and r. Referenced by exec_one(). |
|
|
Definition at line 1069 of file acd.c. References nil, p, STRING, SUBST, and W_LOCAL. Referenced by evaluate(). |
|
|
Definition at line 1256 of file acd.c. References pc, printf, and verbose. Referenced by exec_one(), main(), and unix_exec(). |
|
|
Definition at line 2391 of file acd.c. References allocate(), base, dec(), DOIT, evaluate(), execute(), file, fprintf(), IMPLODE, in, inc(), program::lineno, maketemp(), cell::name, newcell(), nil, out, rule::path, pc, prin2(), printf, rule::prog, strcat(), strchr, strcpy(), strlen(), rule::to, TRANSFORM, rule::type, V_in, V_out, V_star, verbose, W_LOCAL, W_RDONLY, W_SET, W_SUFF, W_TEMP, rule::wait, WORD, and wordlist. Referenced by compile(). |
|
|
Definition at line 1264 of file acd.c. References a, allocate(), argv, c, cell::car, cell::cdr, i, if(), INPUT, n, nil, OUTPUT, pid, prin2n(), r, status, talk(), and verbose. |
|
|
|
|
||||||||||||
|
Definition at line 1396 of file acd.c. References append(), cell::car, cell::cdr, go(), n, nil, p, and WORD. |
|
|
|
|
|
Definition at line 478 of file acd.c. Referenced by map(). |
|
|
|
|
|
Definition at line 477 of file acd.c. Referenced by get_prog(), and getdesc(). |
|
|
Definition at line 63 of file acd.c. Referenced by allocate(), deallocate(), dec(), and newcell(). |
|
|
|
|
|
Definition at line 1362 of file acd.c. Referenced by argmatch(), argscan(), and main(). |
|
|
Definition at line 1361 of file acd.c. Referenced by compile(). |
|
|
Definition at line 1362 of file acd.c. Referenced by predef(). |
|
|
|
|
|
Definition at line 251 of file acd.c. Referenced by execute(). |
|
|
Definition at line 280 of file acd.c. Referenced by search(). |
|
|
|
|
|
|
|
|
|
|
|
Definition at line 1361 of file acd.c. Referenced by argmatch(), and argscan(). |
|
|
|
|
|
Definition at line 1360 of file acd.c. Referenced by argmatch(), and argscan(). |
|
|
Definition at line 1224 of file acd.c. Referenced by argscan(), compile(), exec_one(), findpath(), make(), newrule(), set_derives(), and setoption(). |
|
|
Definition at line 2318 of file acd.c. Referenced by compile(). |
|
|
|
|
|
|
|
|
Definition at line 1362 of file acd.c. Referenced by transform(). |
|
|
Definition at line 1362 of file acd.c. Referenced by argmatch(), and transform(). |
|
|
Definition at line 1360 of file acd.c. Referenced by argmatch(), argscan(), exec_one(), and transform(). |
|
|
Definition at line 1362 of file acd.c. Referenced by exec_one(). |
|
|
|
|
|
|
1.4.6