home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 October / usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso / misc / volume29 / zsh2.2 / part15 < prev    next >
Text File  |  1992-05-13  |  50KB  |  1,832 lines

  1. Newsgroups: comp.sources.misc
  2. From: pfalstad@phoenix.Princeton.EDU (Paul Falstad)
  3. Subject:  v29i111:  zsh2.2 - The Z shell, Part15/17
  4. Message-ID: <1992May13.161013.11116@sparky.imd.sterling.com>
  5. X-Md4-Signature: 6cc677f5bfe86fcb94595945d3ed15f1
  6. Date: Wed, 13 May 1992 16:10:13 GMT
  7. Approved: kent@sparky.imd.sterling.com
  8.  
  9. Submitted-by: pfalstad@phoenix.Princeton.EDU (Paul Falstad)
  10. Posting-number: Volume 29, Issue 111
  11. Archive-name: zsh2.2/part15
  12. Environment: BSD
  13. Supersedes: zsh2.1: Volume 24, Issue 1-19
  14.  
  15. #!/bin/sh
  16. # this is aa.15 (part 15 of zsh2.2)
  17. # do not concatenate these parts, unpack them in order with /bin/sh
  18. # file zsh2.2/src/zle_tricky.c continued
  19. #
  20. if test ! -r _shar_seq_.tmp; then
  21.     echo 'Please unpack part 1 first!'
  22.     exit 1
  23. fi
  24. (read Scheck
  25.  if test "$Scheck" != 15; then
  26.     echo Please unpack part "$Scheck" next!
  27.     exit 1
  28.  else
  29.     exit 0
  30.  fi
  31. ) < _shar_seq_.tmp || exit 1
  32. if test ! -f _shar_wnt_.tmp; then
  33.     echo 'x - still skipping zsh2.2/src/zle_tricky.c'
  34. else
  35. echo 'x - continuing file zsh2.2/src/zle_tricky.c'
  36. sed 's/^X//' << 'SHAR_EOF' >> 'zsh2.2/src/zle_tricky.c' &&
  37. Xstatic Lklist menulist;
  38. Xstatic Lknode menunode;
  39. X
  40. X#define inststr(X) inststrlen((X),-1)
  41. X
  42. Xint usetab() /**/
  43. X{
  44. Xunsigned char *s = line+cs-1;
  45. X
  46. X    for (; s >= line && *s != '\n'; s--)
  47. X        if (*s != '\t' && *s != ' ')
  48. X            return 0;
  49. X    return 1;
  50. X}
  51. X
  52. X#define COMP_COMPLETE 0
  53. X#define COMP_LIST_COMPLETE 1
  54. X#define COMP_SPELL 2
  55. X#define COMP_EXPAND 3
  56. X#define COMP_EXPAND_COMPLETE 4
  57. X#define COMP_LIST_EXPAND 5
  58. X#define COMP_ISEXPAND(X) ((X) >= COMP_EXPAND)
  59. X
  60. Xvoid completeword() /**/
  61. X{
  62. X    usemenu = isset(MENUCOMPLETE) || (useglob = isset(GLOBCOMPLETE));
  63. X    if (c == '\t' && usetab())
  64. X        selfinsert();
  65. X    else
  66. X        docomplete(COMP_COMPLETE);
  67. X}
  68. X
  69. Xvoid menucompleteword() /**/
  70. X{
  71. X    usemenu = 1; useglob = isset(GLOBCOMPLETE);
  72. X    if (c == '\t' && usetab())
  73. X        selfinsert();
  74. X    else
  75. X        docomplete(COMP_COMPLETE);
  76. X}
  77. X
  78. Xvoid listchoices() /**/
  79. X{
  80. X    usemenu = isset(MENUCOMPLETE) || (useglob = isset(GLOBCOMPLETE));
  81. X    docomplete(COMP_LIST_COMPLETE);
  82. X}
  83. X
  84. Xvoid spellword() /**/
  85. X{
  86. X    usemenu = useglob = 0;
  87. X    docomplete(COMP_SPELL);
  88. X}
  89. X
  90. Xvoid deletecharorlist() /**/
  91. X{
  92. X    usemenu = isset(MENUCOMPLETE) || (useglob = isset(GLOBCOMPLETE));
  93. X    if (cs != ll)
  94. X        deletechar();
  95. X    else
  96. X        docomplete(COMP_LIST_COMPLETE);
  97. X}
  98. X
  99. Xvoid expandword() /**/
  100. X{
  101. X    usemenu = useglob = 0;
  102. X    if (c == '\t' && usetab())
  103. X        selfinsert();
  104. X    else
  105. X        docomplete(COMP_EXPAND);
  106. X}
  107. X
  108. Xvoid expandorcomplete() /**/
  109. X{
  110. X    usemenu = isset(MENUCOMPLETE) || (useglob = isset(GLOBCOMPLETE));
  111. X    if (c == '\t' && usetab())
  112. X        selfinsert();
  113. X    else
  114. X        docomplete(COMP_EXPAND_COMPLETE);
  115. X}
  116. X
  117. Xvoid menuexpandorcomplete() /**/
  118. X{
  119. X    usemenu = 1; useglob = isset(GLOBCOMPLETE);
  120. X    if (c == '\t' && usetab())
  121. X        selfinsert();
  122. X    else
  123. X        docomplete(COMP_EXPAND_COMPLETE);
  124. X}
  125. X
  126. Xvoid listexpand() /**/
  127. X{
  128. X    usemenu = isset(MENUCOMPLETE); useglob = isset(GLOBCOMPLETE);
  129. X    docomplete(COMP_LIST_EXPAND);
  130. X}
  131. X
  132. Xvoid reversemenucomplete() /**/
  133. X{
  134. Xchar *s;
  135. X
  136. X    if (!menucmp)
  137. X        menucompleteword();    /* better than just feep'ing, pem */
  138. X    if (!menucmp) return;
  139. X    cs = menub;
  140. X    foredel(menue-menub);
  141. X    if (menunode == firstnode(menulist))
  142. X        menunode = lastnode(menulist);
  143. X    else
  144. X        menunode = prevnode(menunode);
  145. X    inststr(s = menunode->dat);
  146. X    menue = cs;
  147. X}
  148. X
  149. X/*
  150. X * Accepts the current completion and starts a new arg,
  151. X * with the next completions. This gives you a way to accept
  152. X * several selections from the list of matches.
  153. X */
  154. Xvoid acceptandmenucomplete() /**/
  155. X{
  156. Xint t0,t1;
  157. X
  158. X    if (!menucmp) {
  159. X        feep();
  160. X        return;
  161. X    }
  162. X    spaceinline(1);
  163. X    line[cs++] = ' ';
  164. X    spaceinline(menub-menuw);
  165. X    t1 = cs;
  166. X    for (t0 = menuw; t0 != menub; t0++)
  167. X        line[cs++] = line[t0];
  168. X    menue = menub = cs;
  169. X    menuw = t1;
  170. X    menucompleteword();
  171. X}
  172. X
  173. Xstatic char *lastmenu = NULL;
  174. Xstatic int lastmenupos = -1;
  175. Xstatic int lincmd,linredir,lastambig;
  176. Xstatic char *cmdstr;
  177. X
  178. Xvoid docomplete(lst) /**/
  179. Xint lst;
  180. X{
  181. Xchar *s;
  182. X
  183. X    if (isset(AUTOMENU) && !menucmp && c == '\t' &&
  184. X        (lastcmd & ZLE_MENUCMP) && lastambig) usemenu = 1;
  185. X    if (menucmp) { do_menucmp(lst); return; }
  186. X    if (doexpandhist()) return;
  187. X    s = get_comp_string();
  188. X    if (s) {
  189. X        if (lst == COMP_EXPAND_COMPLETE) {
  190. X            char *q = s;
  191. X
  192. X            if (*q == Tilde) q++;
  193. X            else if (*q == Equals) {
  194. X                q = s+1;
  195. X                if (gethnode(q,cmdnamtab) || hashcmd(q,pathchecked))
  196. X                    lst = COMP_EXPAND;
  197. X            } else {
  198. X                for (; *q && *q != String; q++);
  199. X                if (*q == String && q[1] != Inpar) {
  200. X                    if (getsparam(q+1)) lst = COMP_EXPAND;
  201. X                    else lst = COMP_COMPLETE;
  202. X                }
  203. X                q = s;
  204. X            }
  205. X            if (lst == COMP_EXPAND_COMPLETE) {
  206. X                for (; *q; q++)
  207. X                    if (itok(*q))
  208. X                        break;
  209. X                if (!*q)
  210. X                    lst = COMP_COMPLETE;
  211. X            }
  212. X        }
  213. X        if (lst == COMP_SPELL) {
  214. X            char    **x = &s;
  215. X            untokenize(s);
  216. X            cs = wb;
  217. X            foredel(we-wb);
  218. X            /* call the real spell checker, ash@aaii.oz.zu */
  219. X            spckword(x, NULL, NULL, !lincmd, 0);
  220. X            inststr(*x);
  221. X        } else if (COMP_ISEXPAND(lst))
  222. X            doexpansion(s,lst,lincmd);
  223. X        else {
  224. X            docompletion(s,lst,lincmd);
  225. X        }
  226. X        free(s);
  227. X    }
  228. X    popheap();
  229. X    lexrestore();
  230. X}
  231. X
  232. Xvoid do_menucmp(lst) /**/
  233. Xint lst;
  234. X{
  235. Xchar *s;
  236. X
  237. X    if (isset(LASTMENU) && lastmenu) {
  238. X        if (COMP_ISEXPAND(lst) || cs != lastmenupos ||
  239. X                strcmp((char *) line, lastmenu) != 0) {
  240. X            free(lastmenu);
  241. X            lastmenu = NULL;
  242. X            lastmenupos = -1;
  243. X            freemenu();
  244. X        }
  245. X    }
  246. X    if (lst == COMP_LIST_COMPLETE) {
  247. X        listmatches(menulist, NULL);
  248. X        return;
  249. X    }
  250. X    cs = menub;
  251. X    foredel(menue-menub);
  252. X    incnode(menunode);
  253. X    if (!menunode)
  254. X        menunode = firstnode(menulist);
  255. X    s = menunode->dat;
  256. X    if (*s == '~' || *s == '=' || *s == '$') {
  257. X        spaceinline(1);
  258. X        line[cs++] = *s++;
  259. X    }
  260. X    inststr(s = menunode->dat);
  261. X    if (isset(LASTMENU)) {
  262. X        if (lastmenu) free(lastmenu);
  263. X        lastmenu = ztrdup(line);
  264. X        lastmenupos = cs;
  265. X    }
  266. X    menue = cs;
  267. X}
  268. X
  269. Xchar *get_comp_string() /**/
  270. X{
  271. Xint t0;
  272. Xunsigned char *s,*linptr;
  273. X
  274. X    linptr = line;
  275. Xstart:
  276. X    lincmd = incmdpos;
  277. X    linredir = inredir;
  278. X    cmdstr = NULL;
  279. X    zleparse = 1;
  280. X    lexsave();
  281. X    hungets(" "); /* KLUDGE! */
  282. X    hungets(linptr);
  283. X    strinbeg();
  284. X    pushheap();
  285. X    do {
  286. X        lincmd = incmdpos;
  287. X        linredir = inredir;
  288. X        ctxtlex();
  289. X        if (tok == ENDINPUT) break;
  290. X        if (lincmd && tok == STRING) cmdstr = strdup(tokstr);
  291. X    } while (tok != ENDINPUT && zleparse);
  292. X    t0 = tok;
  293. X    if (t0 == ENDINPUT) {
  294. X        s = (unsigned char *)ztrdup("");
  295. X        we = wb = cs;
  296. X        t0 = STRING;
  297. X    } else if (t0 == STRING) {
  298. X        s = (unsigned char *)ztrdup(tokstr);
  299. X    } else if (t0 == ENVSTRING) {
  300. X        for (s = (unsigned char *)tokstr; *s && *s != (unsigned char)'='; s++, wb++);
  301. X        if (*s) { s++; wb++; t0 = STRING; s = (unsigned char *)ztrdup(s); }
  302. X        lincmd = 1;
  303. X    }
  304. X    hflush();
  305. X    strinend();
  306. X    errflag = zleparse = 0;
  307. X    if (we > ll) we = ll;
  308. X    if (t0 == LEXERR && parbegin != -1) {
  309. X        linptr += ll+1-parbegin;
  310. X        popheap();
  311. X        lexrestore();
  312. X        goto start;
  313. X    }
  314. X    if (t0 != STRING) { feep(); return NULL; }
  315. X    return (char *)s;
  316. X}
  317. X
  318. Xvoid doexpansion(s,lst,lincmd) /**/
  319. Xchar *s;int lst;int lincmd;
  320. X{
  321. XLklist vl = newlist();
  322. Xchar *ss;
  323. X
  324. X    pushheap();
  325. X    addnode(vl,s);
  326. X    prefork(vl);
  327. X    if (errflag)
  328. X        goto end;
  329. X    postfork(vl,1);
  330. X    if (errflag)
  331. X        goto end;
  332. X    if (!full(vl) || !*(char *) peekfirst(vl)) {
  333. X        feep();
  334. X        goto end;
  335. X    }
  336. X    if (lst == COMP_LIST_EXPAND) {
  337. X        listmatches(vl,NULL);
  338. X        goto end;
  339. X    } else if (peekfirst(vl) == s) {
  340. X        if (lst == COMP_EXPAND_COMPLETE) {
  341. X            docompletion(s,COMP_COMPLETE,lincmd);
  342. X        } else
  343. X            feep();
  344. X        goto end;
  345. X    }
  346. X    cs = wb;
  347. X    foredel(we-wb);
  348. X    while (ss = ugetnode(vl)) {
  349. X        untokenize(ss);
  350. X        inststr(ss);
  351. X#if 0
  352. X        if (full(vl)) {
  353. X            spaceinline(1);
  354. X            line[cs++] = ' ';
  355. X        }
  356. X#endif
  357. X        spaceinline(1);
  358. X        line[cs++] = ' ';
  359. X    }
  360. Xend:
  361. X    popheap();
  362. X    setterm();
  363. X}
  364. X
  365. Xvoid gotword(s) /**/
  366. Xchar *s;
  367. X{
  368. X    we = ll+1-inbufct;
  369. X    if (cs <= we)
  370. X        {
  371. X        wb = ll-wordbeg;
  372. X        zleparse = 0;
  373. X        /* major hack ahead */
  374. X        if (wb && line[wb] == '!' && line[wb-1] == '\\')
  375. X            wb--;
  376. X        }
  377. X}
  378. X
  379. Xvoid inststrlen(s,l) /**/
  380. Xchar *s;int l;
  381. X{
  382. Xchar *t,*u,*v;
  383. X
  384. X    t = halloc(strlen(s)*2+2);
  385. X    u = s;
  386. X    v = t;
  387. X    for (; *u; u++)
  388. X        {
  389. X        if (l != -1 && !l--)
  390. X            break;
  391. X        if (ispecial(*u))
  392. X            if (*u == '\n')
  393. X                {
  394. X                *v++ = '\'';
  395. X                *v++ = '\n';
  396. X                *v++ = '\'';
  397. X                continue;
  398. X                }
  399. X            else
  400. X                *v++ = '\\';
  401. X        *v++ = *u;
  402. X        }
  403. X    *v = '\0';
  404. X    spaceinline(strlen(t));
  405. X    strncpy((char *) line+cs,t,strlen(t));
  406. X    cs += strlen(t);
  407. X}
  408. X
  409. Xstatic int ambig,haspath,exact;
  410. Xstatic Lklist matches;
  411. Xstatic char *pat,*exactstr;
  412. Xstatic int typechar;
  413. X
  414. Xvoid addmatch(s) /**/
  415. Xchar *s;
  416. X{
  417. X    if (full(matches))
  418. X        {
  419. X        int y = pfxlen(peekfirst(matches),s);
  420. X
  421. X        if (y < ambig)
  422. X            ambig = y;
  423. X        }
  424. X    else
  425. X        ambig = strlen(s);
  426. X    if (!strcmp(pat,s)) { exact = 1; exactstr = pat; }
  427. X    addnodeinorder(matches,strdup(s));
  428. X}
  429. X
  430. X
  431. Xvoid addcmdmatch(s,t) /**/
  432. Xchar *s;char *t;
  433. X{
  434. X    if (strpfx(pat,s)) addmatch(s);
  435. X}
  436. X
  437. Xvoid addcmddirparam(s,t) /**/
  438. Xchar *s;char *t;
  439. X{
  440. XParam pm = (Param) t;
  441. X
  442. X    if (strpfx(pat,s) && pmtype(pm) == PMFLAG_s) {
  443. X        t = pm->gets.cfn(pm);
  444. X        if (t && *t == '/') addmatch(s);
  445. X    }
  446. X}
  447. X
  448. Xvoid addcmdnodis(s,t) /**/
  449. Xchar *s;char *t;
  450. X{
  451. X    if (strpfx(pat,s) && ((Cmdnam) t)->type != DISABLED) addmatch(s);
  452. X}
  453. X
  454. Xvoid maketildelist(s) /**/
  455. Xchar    *s;
  456. X{
  457. X    struct passwd    *pwd;
  458. X    int        len;
  459. X
  460. X    s++;
  461. X    len = strlen(s);
  462. X    if (len < 1) {
  463. X        addmatch(s);
  464. X        *s = 0;
  465. X        return;
  466. X    }
  467. X    while ((pwd = getpwent()) != NULL && !errflag)
  468. X        if (strncmp(pwd->pw_name, s, len) == 0)
  469. X            addmatch(pwd->pw_name);
  470. X    endpwent();
  471. X    *s = 0;
  472. X}
  473. X
  474. X/*
  475. X * opendir that handles '~' and '=' and '$'.
  476. X * orig. by ash@aaii.oz.au, mod. by pf
  477. X */
  478. XDIR *OPENDIR(s)
  479. Xchar    *s;
  480. X{
  481. X    if (*s != '~' && *s != '=' && *s != '$')
  482. X        return(opendir(s));
  483. X    s = strdup(s);
  484. X    *s = (*s == '=') ? Equals : (*s == '~') ? Tilde : String;
  485. X    singsub(&s);
  486. X    return(opendir(s));
  487. X}
  488. Xchar *dirname(s)
  489. Xchar    *s;
  490. X{
  491. X    if (*s == '~' || *s == '=' || *s == '$') {
  492. X      s = strdup(s);
  493. X      *s = (*s == '=') ? Equals : (*s == '~') ? Tilde : String;
  494. X      singsub(&s);
  495. X    }
  496. X    return(s);
  497. X}
  498. X
  499. Xint Isdir(s) /**/
  500. Xchar *s;
  501. X{
  502. Xstruct stat sbuf;
  503. X
  504. X    if (!*s) return 0;
  505. X   if (stat(s,&sbuf) == -1) return 0;
  506. X   return S_ISDIR(sbuf.st_mode);
  507. X}
  508. X
  509. X/* this will work whether s is tokenized or not */
  510. Xint isdir(t,s) /**/
  511. Xchar *t;char *s;
  512. X{
  513. Xchar buf[MAXPATHLEN];
  514. X
  515. X    if (typechar != '$')
  516. X        sprintf(buf,"%s/%s",(s) ? s : ".",t);
  517. X    else
  518. X        sprintf(buf,"$%s",t);
  519. X    s = buf;
  520. X    if (*s != '~' && *s != '=' && *s != Tilde && *s != Equals &&
  521. X         *s != '$' && *s != String)
  522. X        return(Isdir(s));
  523. X    s = strdup(s);
  524. X    if (*s == '~' || *s == '=' || *s == '$')
  525. X        *s = (*s == '=') ? Equals : (*s == '~') ? Tilde : String;
  526. X    singsub(&s);
  527. X    return(Isdir(s));
  528. X}
  529. X
  530. X#define SLASH_YES   0
  531. X#define SLASH_NO    1
  532. X#define SLASH_MAYBE 2
  533. X
  534. Xint slashflag;
  535. Xint addedstar;
  536. Xchar *pathprefix;
  537. X
  538. Xvoid docompletion(s,lst,incmd) /**/
  539. Xchar *s;int lst;int incmd;
  540. X{
  541. Xchar *tokorigs;
  542. Xchar *origs;
  543. XCompctl cc;
  544. Xchar *pfx = s;
  545. X
  546. X    slashflag = SLASH_MAYBE;
  547. X    addedstar = 0;
  548. X    lastambig = 0;
  549. X
  550. X    heapalloc();
  551. X    pushheap();
  552. X    if (useglob)
  553. X        tokorigs = strdup(s);
  554. X    untokenize(s);
  555. X    origs = strdup(s);
  556. X    matches = newlist();
  557. X    if (incmd)
  558. X        cc = &cc_compos;
  559. X    else if (linredir || !(cmdstr && (cc = gethnode(cmdstr,compctltab))))
  560. X        cc = &cc_default;
  561. X    exact = 0;
  562. X    if (cc->mask & CC_COMMPATH) gen_matches_reg(s,1,(cc->mask & CC_FILES));
  563. X    else if (cc->mask & CC_FILES) gen_matches_reg(s,0,1);
  564. X    else {
  565. X        haspath = 0;
  566. X        slashflag = SLASH_NO;
  567. X    }
  568. X    if (cc->mask & (CC_FILES|CC_COMMPATH)) {
  569. X        /* only do "globbed" completion if regular completion fails.
  570. X           pem, 7Oct91 */
  571. X        if ((!full(matches) || errflag) && useglob) {
  572. X            gen_matches_glob(tokorigs,incmd);
  573. X            /*
  574. X             * gen_matches_glob changes the insert line to be correct up
  575. X             * to the match, so the prefix string must be "". ash, 7Oct91
  576. X             */
  577. X            *s = 0;
  578. X        }
  579. X    }
  580. X    pat = s;
  581. X    if ((cc->mask & CC_HOSTS) && !haspath) {
  582. X        char **x;
  583. X        for (x = hosts; *x; x++) addcmdmatch(*x,NULL);
  584. X    }
  585. X    if ((cc->mask & CC_OPTIONS) && !haspath) {
  586. X        struct option *o;
  587. X        for (o = optns; o->name; o++) addcmdmatch(o->name,NULL);
  588. X    }
  589. X    if ((cc->mask & CC_VARS) && !haspath) listhtable(paramtab,addcmdmatch);
  590. X    if ((cc->mask & CC_BINDINGS) && !haspath) {
  591. X        int t0;
  592. X        for (t0 = 0; t0 != ZLECMDCOUNT; t0++)
  593. X            if (*zlecmds[t0].name) addcmdmatch(zlecmds[t0].name,NULL);
  594. X    }
  595. X    if (cc->mask & CC_USRKEYS) {
  596. X        char **usr = get_user_var(cc->keyvar);
  597. X        if (usr) while (*usr) addcmdmatch(*usr++,NULL);
  598. X    }
  599. X    if (lst != COMP_LIST_COMPLETE) do_fignore(origs);
  600. X    if (!full(matches) || errflag) {
  601. X        feep();
  602. X    } else if (lst == COMP_LIST_COMPLETE) {
  603. X        listmatches(matches,
  604. X            unset(LISTTYPES) ? NULL :
  605. X                (haspath) ? pathprefix : "./");
  606. X    } else if (nextnode(firstnode(matches))) {
  607. X        do_ambiguous(pfx);
  608. X    } else {
  609. X        do_single(pfx);
  610. X    }
  611. X    ll = strlen((char *) line);
  612. X    setterm();
  613. X    popheap();
  614. X    permalloc();
  615. X}
  616. X
  617. Xchar **get_user_var(nam) /**/
  618. Xchar *nam;
  619. X{
  620. X    return (nam) ? getaparam(nam) : NULL;
  621. X}
  622. X
  623. Xvoid gen_matches_glob(s,incmd) /**/
  624. Xchar *s;int incmd;
  625. X{
  626. Xchar *pt,*u;
  627. Xint hasp = 0;
  628. XDIR *d;
  629. Xstruct direct *de;
  630. X
  631. X    /*
  632. X     * Find the longest prefix string without any
  633. X     * chars special to glob - ash.
  634. X     */
  635. X    for (pt = s; *pt; pt++) {
  636. X        if (pt == s && (*pt == Tilde || *pt == Equals)) continue;
  637. X        if (ispecial(*pt) || itok(*pt)) break;
  638. X    }
  639. X    for (; pt > s && *pt != '/'; pt--) ;
  640. X    if (*pt == '/') {
  641. X        *pt = 0;
  642. X        u = pt + 1;
  643. X        wb += strlen(s);
  644. X        hasp = 1;
  645. X    } else u = s;
  646. X    if (!hasp && (*s == Tilde || *s == Equals)) {
  647. X        /* string contains only ~xx, so do tilde expansion */
  648. X        maketildelist(s);
  649. X        wb++;
  650. X        pathprefix = s;
  651. X        slashflag = SLASH_YES;
  652. X    } else if (incmd && !hasp) {
  653. X        slashflag = SLASH_NO;
  654. X        pat = s;
  655. X        listhtable(aliastab ,addcmdmatch);
  656. X        if (isset(HASHLISTALL)) fullhash();
  657. X        listhtable(cmdnamtab,addcmdnodis);
  658. X        if (isset(AUTOCD)) listhtable(paramtab ,addcmddirparam);
  659. X        if (d = opendir(".")) {
  660. X            char *q;
  661. X
  662. X            readdir(d); readdir(d);
  663. X            while ((de = readdir(d)) && !errflag)
  664. X                if (strpfx(pat,q = de->d_name) &&
  665. X                            (*q != '.' || *u == '.' || isset(GLOBDOTS)))
  666. X                    addmatch(q);
  667. X            closedir(d);
  668. X        }
  669. X    } else {
  670. X         int     commonprefix = 0;
  671. X         char    *prefix;
  672. X         Lknode    n;
  673. X         int        nonomatch = isset(NONOMATCH);
  674. X
  675. X         opts[NONOMATCH] = 1;
  676. X         if (hasp) {
  677. X            /* Find the longest common prefix string
  678. X             * after globbing the input. All expansions
  679. X             * ~foo/bar/* will turn into something like
  680. X             * /tmp_mnt/hosts/somehost/home/foo/...
  681. X             * We will remove this common prefix from the matches.
  682. X             * ash, 7 May '91
  683. X             */
  684. X            pathprefix = s;
  685. X            addnode(matches,s);
  686. X            prefork(matches);
  687. X            if (!errflag) postfork(matches,1);
  688. X            if (!errflag) {
  689. X                prefix = peekfirst(matches);
  690. X                if (prefix) commonprefix = strlen(prefix) + 1;
  691. X                *pt = '/';
  692. X            }
  693. X        }
  694. X        if (s[strlen(s) - 1] == '/') {
  695. X            /* if strings ends in a '/' always add a '*' */
  696. X            s = dyncat(s,"x");
  697. X            s[strlen(s)-1] = Star;
  698. X            addedstar = 1;
  699. X        }
  700. X        matches = newlist();
  701. X        addnode(matches,s);
  702. X        prefork(matches);
  703. X        if (!errflag) postfork(matches,1);
  704. X        opts[NONOMATCH] = nonomatch;
  705. X        if (errflag || !full(matches) || !nextnode(firstnode(matches))) {
  706. X            /* if there were no matches (or only one)
  707. X                add a trailing * and try again */
  708. X            s = dyncat(s,"x");
  709. X            s[strlen(s)-1] = Star;
  710. X            addedstar = 1;
  711. X            matches = newlist();
  712. X            addnode(matches,s);
  713. X            prefork(matches);
  714. X            if (errflag) return;
  715. X            postfork(matches,1);
  716. X            if (errflag) return;
  717. X        }
  718. X        /* remove the common prefix from all the matches */
  719. X        if (commonprefix)
  720. X            for (n = firstnode(matches); n; incnode(n))
  721. X                n->dat = (char *) n->dat+commonprefix;
  722. X        s = pt;
  723. X        *s = 0;
  724. X    }
  725. X}
  726. X
  727. Xvoid gen_matches_reg(s,incmd,regfiles) /**/
  728. Xchar *s;int incmd;int regfiles;
  729. X{
  730. Xchar *u;
  731. XDIR *d;
  732. Xstruct direct *de;
  733. X
  734. X    haspath = 0;
  735. X    for (u = s+strlen(s); u >= s; u--)
  736. X        if (*u == '/' || *u == '@' || *u == '$') break;
  737. X    if (u >= s) {
  738. X        typechar = *u;
  739. X        *u++ = '\0';
  740. X        haspath = 1;
  741. X    } else if (*s == '=') {
  742. X        typechar = '=';
  743. X        *s = '\0'; u = s+1;
  744. X        haspath = 1;
  745. X    } else u = s;
  746. X    pat = u;
  747. X    if (typechar == '$' && haspath) {
  748. X        /* slashflag = SLASH_NO; */
  749. X        listhtable(paramtab,addcmdmatch);
  750. X    } else if (typechar == '=' && haspath) {
  751. X        slashflag = SLASH_NO;
  752. X        if (isset(HASHLISTALL)) fullhash();
  753. X        listhtable(cmdnamtab,addcmdnodis);
  754. X    } else if (typechar == '@' && haspath) {
  755. X        char **x;
  756. X        slashflag = SLASH_NO;
  757. X        for (x = hosts; *x; x++) addcmdmatch(*x,NULL);
  758. X    } else if (*s == '~' && !haspath) {
  759. X        maketildelist(s);
  760. X        pathprefix = s;
  761. X        slashflag = SLASH_YES;
  762. X    } else if (incmd && !haspath) {
  763. X        slashflag = SLASH_NO;
  764. X        listhtable(aliastab ,addcmdmatch);
  765. X        if (isset(HASHLISTALL)) fullhash();
  766. X        listhtable(cmdnamtab,addcmdnodis);
  767. X        if (isset(AUTOCD) && isset(CDABLEVARS))
  768. X            listhtable(paramtab ,addcmddirparam);
  769. X        if (d = opendir(".")) {
  770. X            char *q;
  771. X            struct stat buf;
  772. X
  773. X            readdir(d); readdir(d);
  774. X            if (regfiles) {
  775. X                while ((de = readdir(d)) && !errflag)
  776. X                    if (strpfx(pat,q = de->d_name) &&
  777. X                        (*q != '.' || *u == '.' || isset(GLOBDOTS))) addmatch(q);
  778. X            } else if (isset(AUTOCD)) {
  779. X                while ((de = readdir(d)) && !errflag)
  780. X                    if (strpfx(pat,q = de->d_name) &&
  781. X                        (*q != '.' || *u == '.' || isset(GLOBDOTS)) &&
  782. X                        stat(q,&buf) >= 0 &&
  783. X                        (buf.st_mode & S_IEXEC) == S_IEXEC) addmatch(q);
  784. X            } else {
  785. X                while ((de = readdir(d)) && !errflag)
  786. X                    if (strpfx(pat,q = de->d_name) &&
  787. X                        (*q != '.' || *u == '.' || isset(GLOBDOTS)) &&
  788. X                        stat(q,&buf) >= 0 &&
  789. X                        (buf.st_mode & (S_IFMT|S_IEXEC)) == (S_IFREG|S_IEXEC))
  790. X                            addmatch(q);
  791. X            }
  792. X            closedir(d);
  793. X        }
  794. X    } else if (d = OPENDIR(pathprefix =
  795. X            ((haspath || *s == '~') ? ((*s) ? s : "/") : "."))) {
  796. X        char *q,buf2[MAXPATHLEN];
  797. X        struct stat buf;
  798. X        char dn[MAXPATHLEN];
  799. X        
  800. X        strcpy(dn,dirname(pathprefix));
  801. X        readdir(d); readdir(d);
  802. X        while ((de = readdir(d)) && !errflag)
  803. X          if (strpfx(pat,q = de->d_name) &&
  804. X                (*q != '.' || *u == '.' || isset(GLOBDOTS))) {
  805. X             if (incmd) {
  806. X                sprintf(buf2,"%s/%s",dn,q);
  807. X                if (stat(buf2,&buf) < 0 ||
  808. X                     (buf.st_mode & S_IEXEC) == S_IEXEC) {
  809. X                  addmatch(q);
  810. X                }
  811. X             } else {
  812. X                addmatch(q);
  813. X             }
  814. X          }
  815. X        closedir(d);
  816. X    }
  817. X}
  818. X
  819. Xvoid do_fignore(origstr) /**/
  820. Xchar *origstr;
  821. X{
  822. X    if (full(matches) && nextnode(firstnode(matches))) {
  823. X        Lknode z,zn;
  824. X
  825. X        z = firstnode(matches);
  826. X        ambig = 1000;
  827. X        for (z = firstnode(matches); z; z = zn) {
  828. X            char *q = getdata(z);
  829. X            int namlen = strlen(q);
  830. X            int    slen = strlen(origstr);
  831. X            int    slpt;
  832. X            char **pt = fignore;
  833. X    
  834. X            zn = nextnode(z);
  835. X            for (; *pt; pt++) {
  836. X                /* We try to be smart here and override the
  837. X                   fignore variable if the user has explicity
  838. X                   used the ignored prefix, pem, 7 May 1991 */
  839. X                slpt = strlen(*pt);
  840. X                if (!addedstar && slen > slpt &&
  841. X                        strcmp(origstr+slen-slpt, *pt) == 0)
  842. X                    continue;
  843. X                if (slpt < namlen && !strcmp(q+namlen-slpt,*pt)) {
  844. X                    uremnode(matches,z);
  845. X                    break;
  846. X                }
  847. X            }
  848. X            if (!*pt) {
  849. X                int y = pfxlen(peekfirst(matches),q);
  850. X                if (y < ambig) ambig = y;
  851. X            }
  852. X        }
  853. X    }
  854. X}
  855. X
  856. Xvoid do_ambiguous(s) /**/
  857. Xchar *s;
  858. X{
  859. X    lastambig = 1;
  860. X    if (usemenu) { do_ambig_menu(s); return; }
  861. X    if (useglob) {
  862. X        feep();
  863. X        if (isset(AUTOLIST))
  864. X            listmatches(matches,
  865. X                unset(LISTTYPES) ? NULL : (haspath) ? pathprefix : "./");
  866. X        return;
  867. X    }
  868. X    cs = wb;
  869. X    foredel(we-wb);
  870. X    if (*s == '~' || *s == '=' || *s == '$') {
  871. X        spaceinline(1);
  872. X        line[cs++] = *s++;
  873. X    }
  874. X    if (haspath) {
  875. X        inststr(s);
  876. X        spaceinline(1);
  877. X        line[cs++] = typechar;
  878. X    }
  879. X    if (isset(RECEXACT) && exact) {
  880. X        lastambig = 0;
  881. X        if ((*pat == '~' || *pat == '=' || *pat == '$') && !haspath) {
  882. X            spaceinline(1);
  883. X            line[cs++] = *s++;
  884. X        }
  885. X        inststr(exactstr);
  886. X        spaceinline(1);
  887. X        switch (slashflag) {
  888. X            case SLASH_YES: line[cs++] = '/'; break;
  889. X            case SLASH_NO : line[cs++] = ' '; break;
  890. X            case SLASH_MAYBE: line[cs++] =
  891. X                isdir(exactstr,pathprefix) ? '/' : ' '; break;
  892. X        }
  893. X        return;
  894. X    }
  895. X    s = peekfirst(matches);
  896. X    if ((*s == '~' || *s == '=' || *s == '$') && !haspath) {
  897. X        spaceinline(1);
  898. X        line[cs++] = *s++;
  899. X        ambig--;
  900. X    }
  901. X    inststrlen(s,ambig);
  902. X    refresh();
  903. X    if (isset(AUTOLIST)) {
  904. X        if (unset(NOLISTBEEP)) feep();
  905. X        listmatches(matches,
  906. X            unset(LISTTYPES) ? NULL : (haspath) ? pathprefix : "./");
  907. X    } else feep();
  908. X}
  909. X
  910. Xvoid do_single(s) /**/
  911. Xchar *s;
  912. X{
  913. X    cs = wb;
  914. X    foredel(we-wb);
  915. X    if (*s == '~' || *s == '=' || *s == '$') {
  916. X        spaceinline(1);
  917. X        line[cs++] = *s++;
  918. X    }
  919. X    if (haspath) {
  920. X        inststr(s);
  921. X        spaceinline(1);
  922. X        line[cs++] = typechar;
  923. X    }
  924. X    s = peekfirst(matches);
  925. X    if ((*s == '~' || *s == '=' || *s == '$') && !haspath) {
  926. X        spaceinline(1);
  927. X        line[cs++] = *s++;
  928. X    }
  929. X    inststr(s);
  930. X    spaceinline(1);
  931. X    switch (slashflag) {
  932. X        case SLASH_YES: line[cs++] = '/'; break;
  933. X        case SLASH_NO : line[cs++] = ' '; break;
  934. X        case SLASH_MAYBE: line[cs++] = isdir(s,pathprefix) ? '/' : ' '; break;
  935. X    }
  936. X    if (isset(AUTOREMOVESLASH) && line[cs-1] == '/') addedslash = 1;
  937. X}
  938. X
  939. Xvoid do_ambig_menu(s) /**/
  940. Xchar *s;
  941. X{
  942. X    menucmp = 1;
  943. X    if (isset(MENUCOMPLETEBEEP)) feep();
  944. X    cs = wb;
  945. X    menuw = cs;
  946. X    foredel(we-wb);
  947. X    if (*s == '~' || *s == '=' || *s == '$') {
  948. X        spaceinline(1);
  949. X        line[cs++] = *s++;
  950. X    }
  951. X    if (haspath) {
  952. X        inststr(s);
  953. X        spaceinline(1);
  954. X        line[cs++] = typechar;
  955. X    }
  956. X    menub = cs;
  957. X    s = peekfirst(matches);
  958. X    if ((*s == '~' || *s == '=' || *s == '$') && !haspath) {
  959. X        spaceinline(1);
  960. X        line[cs++] = *s++;
  961. X    }
  962. X    inststr(s);
  963. X    menue = cs;
  964. X    permalloc();
  965. X    menulist = duplist(matches,(VFunc)ztrdup);
  966. X    heapalloc();
  967. X    menunode = firstnode(menulist);
  968. X    permalloc();
  969. X    if (isset(LASTMENU)) {
  970. X        if (lastmenu)
  971. X            free(lastmenu);
  972. X        lastmenu = ztrdup(line);
  973. X        lastmenupos = cs;
  974. X    }
  975. X}
  976. X
  977. Xint strpfx(s,t) /**/
  978. Xchar *s;char *t;
  979. X{
  980. X    while (*s && *s == *t) s++,t++;
  981. X    return !*s;
  982. X}
  983. X
  984. Xint pfxlen(s,t) /**/
  985. Xchar *s;char *t;
  986. X{
  987. Xint i = 0;
  988. X
  989. X    while (*s && *s == *t) s++,t++,i++;
  990. X    return i;
  991. X}
  992. X
  993. Xvoid listmatches(l,apps) /**/
  994. XLklist l;char *apps;
  995. X{
  996. Xint longest = 1,fct,fw = 0,colsz,t0,t1,ct;
  997. XLknode n;
  998. Xchar **arr,**ap;
  999. X
  1000. X    trashzle();
  1001. X    ct = countnodes(l);
  1002. X    if (listmax && ct > listmax)
  1003. X        {
  1004. X        fprintf(stdout,"zsh: do you wish to see all %d possibilities? ",ct);
  1005. X        fflush(stdout);
  1006. X        if (getquery() != 'y')
  1007. X            return;
  1008. X        }
  1009. X    ap = arr = alloc((countnodes(l)+1)*sizeof(char **));
  1010. X    for (n = firstnode(l); n; incnode(n))
  1011. X        *ap++ = getdata(n);
  1012. X    *ap = NULL;
  1013. X    for (ap = arr; *ap; ap++)
  1014. X        if (strlen(*ap) > longest)
  1015. X            longest = strlen(*ap);
  1016. X    if (apps)
  1017. X        {
  1018. X        apps = strdup(apps);
  1019. X        if (*apps == '~')
  1020. X            *apps = Tilde;
  1021. X        else if (*apps == '=')
  1022. X            *apps = Equals;
  1023. X        else if (*apps == '$')
  1024. X            *apps = String;
  1025. X        singsub(&apps);
  1026. X        longest++;
  1027. X        }
  1028. X    qsort(arr,ct,sizeof(char *),forstrcmp);
  1029. X    fct = (columns-1)/(longest+2);
  1030. X    if (fct == 0)
  1031. X        fct = 1;
  1032. X    else
  1033. X        fw = (columns-1)/fct;
  1034. X    colsz = (ct+fct-1)/fct;
  1035. X    for (t1 = 0; t1 != colsz; t1++)
  1036. X        {
  1037. X        ap = arr+t1;
  1038. X        if (apps)
  1039. X            {
  1040. X            do
  1041. X                {
  1042. X                int t2 = strlen(*ap)+1;
  1043. X                char pbuf[MAXPATHLEN];
  1044. X                struct stat buf;
  1045. X
  1046. X                printf("%s",*ap);
  1047. X                sprintf(pbuf,"%s/%s",apps,*ap);
  1048. X                if (lstat(pbuf,&buf)) putchar(' ');
  1049. X                else switch (buf.st_mode & S_IFMT) /* screw POSIX */
  1050. X                    {
  1051. X                    case S_IFDIR: putchar('/'); break;
  1052. X#ifdef S_IFIFO
  1053. X                    case S_IFIFO: putchar('|'); break;
  1054. X#endif
  1055. X                    case S_IFCHR: putchar('%'); break;
  1056. X                    case S_IFBLK: putchar('#'); break;
  1057. X#ifdef S_IFLNK
  1058. X                    case S_IFLNK: putchar(
  1059. X                        (access(pbuf,F_OK) == -1) ? '&' : '@'); break;
  1060. X#endif
  1061. X#ifdef S_IFSOCK
  1062. X                    case S_IFSOCK: putchar('='); break;
  1063. X#endif
  1064. X                    default:
  1065. X                        if (buf.st_mode & 0111)
  1066. X                            putchar('*');
  1067. X                        else
  1068. X                            putchar(' ');
  1069. X                        break;
  1070. X                    }
  1071. X                for (; t2 < fw; t2++) putchar(' ');
  1072. X                for (t0 = colsz; t0 && *ap; t0--,ap++);
  1073. X                }
  1074. X            while (*ap);
  1075. X            }
  1076. X        else
  1077. X            do
  1078. X                {
  1079. X                int t2 = strlen(*ap);
  1080. X
  1081. X                printf("%s",*ap);
  1082. X                for (; t2 < fw; t2++) putchar(' ');
  1083. X                for (t0 = colsz; t0 && *ap; t0--,ap++);
  1084. X                }
  1085. X            while (*ap);
  1086. X        putchar('\n');
  1087. X        }
  1088. X    resetneeded = 1;
  1089. X    fflush(stdout);
  1090. X}
  1091. X
  1092. Xvoid selectlist(l) /**/
  1093. XLklist l;
  1094. X{
  1095. Xint longest = 1,fct,fw = 0,colsz,t0,t1,ct;
  1096. XLknode n;
  1097. Xchar **arr,**ap;
  1098. X
  1099. X    trashzle();
  1100. X    ct = countnodes(l);
  1101. X    ap = arr = alloc((countnodes(l)+1)*sizeof(char **));
  1102. X    for (n = firstnode(l); n; incnode(n))
  1103. X        *ap++ = getdata(n);
  1104. X    *ap = NULL;
  1105. X    for (ap = arr; *ap; ap++)
  1106. X        if (strlen(*ap) > longest)
  1107. X            longest = strlen(*ap);
  1108. X    t0 = ct;
  1109. X    longest++;
  1110. X    while (t0)
  1111. X        t0 /= 10, longest++;
  1112. X    fct = (columns-1)/(longest+3); /* to compensate for added ')' */
  1113. X    if (fct == 0)
  1114. X        fct = 1;
  1115. X    else
  1116. X        fw = (columns-1)/fct;
  1117. X    colsz = (ct+fct-1)/fct;
  1118. X    for (t1 = 0; t1 != colsz; t1++) {
  1119. X        ap = arr+t1;
  1120. X        do {
  1121. X            int t2 = strlen(*ap)+2,t3;
  1122. X
  1123. X            fprintf(stderr,"%d) %s",t3 = ap-arr+1,*ap);
  1124. X            while (t3) t2++,t3 /= 10;
  1125. X            for (; t2 < fw; t2++) fputc(' ',stderr);
  1126. X            for (t0 = colsz; t0 && *ap; t0--,ap++);
  1127. X        } while (*ap);
  1128. X        fputc('\n',stderr);
  1129. X    } 
  1130. X
  1131. X/* Below is a simple attempt at doing it the Korn Way.. 
  1132. X    ap = arr;
  1133. X    t0 = 0;
  1134. X    do
  1135. X        {
  1136. X        t0++;
  1137. X        fprintf(stderr,"%d) %s\n",t0,*ap);
  1138. X        ap++;
  1139. X        }
  1140. X    while (*ap);*/
  1141. X    resetneeded = 1;
  1142. X    fflush(stderr);
  1143. X}
  1144. X
  1145. Xint doexpandhist() /**/
  1146. X{
  1147. Xunsigned char *cc,*ce;
  1148. Xint t0,oldcs,oldll;
  1149. X
  1150. X    for (cc = line, ce = line+ll; cc < ce; cc++)
  1151. X        if (*cc == '\\' && cc[1])
  1152. X            cc++;
  1153. X        else if (*cc == bangchar ||
  1154. X                (*cc == hatchar && *line == hatchar && cc != line))
  1155. X            break;
  1156. X    if (*cc == bangchar && cc[1] == '"') return 0;
  1157. X    if (cc == ce) return 0;
  1158. X    oldcs = cs;
  1159. X    oldll = ll;
  1160. X    zleparse = 1;
  1161. X    lexsave();
  1162. X    hungets(line);
  1163. X    strinbeg();
  1164. X    pushheap();
  1165. X    ll = cs = 0;
  1166. X    for(;;)
  1167. X        {
  1168. X        t0 = hgetc();
  1169. X        if (lexstop)
  1170. X            break;
  1171. X        spaceinline(1);
  1172. X        line[cs++] = t0;
  1173. X        }
  1174. X    hflush();
  1175. X    popheap();
  1176. X    strinend();
  1177. X    errflag = zleparse = 0;
  1178. X    t0 = histdone;
  1179. X    lexrestore();
  1180. X    line[ll = cs] = '\0';
  1181. X    if (ll == oldll) cs = oldcs;
  1182. X    return t0;
  1183. X}
  1184. X
  1185. Xvoid magicspace() /**/
  1186. X{
  1187. X    c = ' ';
  1188. X    selfinsert();
  1189. X    doexpandhist();
  1190. X}
  1191. X
  1192. Xvoid expandhistory() /**/
  1193. X{
  1194. X    if (!doexpandhist())
  1195. X        feep();
  1196. X}
  1197. X
  1198. Xstatic int cmdwb,cmdwe;
  1199. X
  1200. Xchar *getcurcmd() /**/
  1201. X{
  1202. Xint lincmd = incmdpos;
  1203. Xchar *s = NULL;
  1204. X
  1205. X    zleparse = 1;
  1206. X    lexsave();
  1207. X    hungets(" "); /* KLUDGE! */
  1208. X    hungets(line);
  1209. X    strinbeg();
  1210. X    pushheap();
  1211. X    do {
  1212. X        lincmd = incmdpos;
  1213. X        ctxtlex();
  1214. X        if (tok == ENDINPUT) break;
  1215. X        if (tok == STRING && lincmd) {
  1216. X            if (s) free(s);
  1217. X            s = ztrdup(tokstr);
  1218. X            cmdwb = ll-wordbeg; cmdwe = ll+1-inbufct;
  1219. X        }
  1220. X        lincmd = incmdpos;
  1221. X    } while (tok != ENDINPUT && zleparse);
  1222. X    hflush();
  1223. X    popheap();
  1224. X    strinend();
  1225. X    errflag = zleparse = 0;
  1226. X    lexrestore();
  1227. X    return s;
  1228. X}
  1229. X
  1230. Xvoid processcmd() /**/
  1231. X{
  1232. Xchar *s,*t;
  1233. X
  1234. X    s = getcurcmd();
  1235. X    if (!s) { feep(); return; }
  1236. X    t = zlecmds[bindk].name;
  1237. X    mult = 1;
  1238. X    pushline();
  1239. X    sizeline(strlen(s)+strlen(t)+1);
  1240. X    strcpy((char *) line,t);
  1241. X    strcat((char *) line," ");
  1242. X    cs = ll = strlen((char *) line);
  1243. X    inststr(s);
  1244. X    free(s);
  1245. X    done = 1;
  1246. X}
  1247. X
  1248. Xvoid expandcmdpath() /**/
  1249. X{
  1250. Xint oldcs = cs;
  1251. Xchar *s,*str;
  1252. X
  1253. X    s = getcurcmd();
  1254. X    if (!s) { feep(); return; }
  1255. X    str = findcmd(s);
  1256. X    free(s);
  1257. X    if (!str) { feep(); return; }
  1258. X    cs = cmdwb;
  1259. X    foredel(cmdwe-cmdwb);
  1260. X    spaceinline(strlen(str));
  1261. X    strncpy((char *) line+cs,str,strlen(str));
  1262. X    cs = oldcs;
  1263. X    if (cs >= cmdwe) cs += cmdwe-cmdwb+strlen(str);
  1264. X    if (cs > ll) cs = ll;
  1265. X    free(str);
  1266. X}
  1267. X
  1268. Xvoid freemenu() /**/
  1269. X{
  1270. X    if (menucmp && (unset(LASTMENU) || lastmenu == NULL)) {
  1271. X        menucmp = 0;
  1272. X        freetable(menulist,freestr);
  1273. X    }
  1274. X}
  1275. X
  1276. Xint inarray(s,a) /**/
  1277. Xchar *s; char **a;
  1278. X{
  1279. X    for (; *a; a++) if (!strcmp(*a,s)) return 1;
  1280. X    return 0;
  1281. X}
  1282. X
  1283. SHAR_EOF
  1284. echo 'File zsh2.2/src/zle_tricky.c is complete' &&
  1285. chmod 0644 zsh2.2/src/zle_tricky.c ||
  1286. echo 'restore of zsh2.2/src/zle_tricky.c failed'
  1287. Wc_c="`wc -c < 'zsh2.2/src/zle_tricky.c'`"
  1288. test 26002 -eq "$Wc_c" ||
  1289.     echo 'zsh2.2/src/zle_tricky.c: original size 26002, current size' "$Wc_c"
  1290. rm -f _shar_wnt_.tmp
  1291. fi
  1292. # ============= zsh2.2/src/builtin.pro ==============
  1293. if test -f 'zsh2.2/src/builtin.pro' -a X"$1" != X"-c"; then
  1294.     echo 'x - skipping zsh2.2/src/builtin.pro (File already exists)'
  1295.     rm -f _shar_wnt_.tmp
  1296. else
  1297. > _shar_wnt_.tmp
  1298. echo 'x - extracting zsh2.2/src/builtin.pro (Text)'
  1299. sed 's/^X//' << 'SHAR_EOF' > 'zsh2.2/src/builtin.pro' &&
  1300. Xvoid addbuiltins DCLPROTO((void));
  1301. Xint bin_enable DCLPROTO((char *name,char **argv,char *ops,int whocares));
  1302. Xint bin_colon DCLPROTO((char *name,char **argv,char *ops,int whocares));
  1303. Xint bin_break DCLPROTO((char *name,char **argv,char *ops,int func));
  1304. Xint bin_fg DCLPROTO((char *name,char **argv,char *ops,int func));
  1305. Xint bin_let DCLPROTO((char *name,char **argv,char *ops,int func));
  1306. Xint zexit DCLPROTO((int val));
  1307. Xint optlookup DCLPROTO((char *s));
  1308. Xint bin_setopt DCLPROTO((char *nam,char **args,char *ops,int isun));
  1309. Xvoid listhtable DCLPROTO((Hashtab ht,HFunc func));
  1310. Xvoid pshfunc DCLPROTO((char *s,Cmdnam cc));
  1311. Xvoid niceprint DCLPROTO((char *s));
  1312. Xvoid niceprintf DCLPROTO((char *s,FILE *f));
  1313. Xint bin_umask DCLPROTO((char *nam,char **args,char *ops,int func));
  1314. Xint bin_whence DCLPROTO((char *nam,char **argv,char *ops,int func));
  1315. Xint bin_cd DCLPROTO((char *nam,char **argv,char *ops,int func));
  1316. Xchar *cd_get_dest DCLPROTO((char *nam,char **argv,char *ops,int func));
  1317. Xchar *cd_do_chdir DCLPROTO((char *cnam, char *dest));
  1318. Xchar *cd_try_chdir DCLPROTO((char *pfix, char *dest));
  1319. Xint fixdir DCLPROTO((char *d, char *s));
  1320. Xvoid cd_new_pwd DCLPROTO((int func, char *s));
  1321. Xvoid convertwd DCLPROTO((char *s, char *t, int off));
  1322. Xint bin_rehash DCLPROTO((char *name,char **argv,char *ops,int func));
  1323. Xint bin_hash DCLPROTO((char *name,char **argv,char *ops,int func));
  1324. Xint prefix DCLPROTO((char *s,char *t));
  1325. Xint getjob DCLPROTO((char *s,char *prog));
  1326. Xint findjobnam DCLPROTO((char *s));
  1327. Xint isanum DCLPROTO((char *s));
  1328. Xint bin_kill DCLPROTO((char *nam,char **argv,char *ops,int func));
  1329. Xint bin_limit DCLPROTO((char *nam,char **argv,char *ops,int func));
  1330. Xint bin_unlimit DCLPROTO((char *nam,char **argv,char *ops,int func));
  1331. Xvoid showlimits DCLPROTO((int hard,int lim));
  1332. Xint bin_sched DCLPROTO((char *nam,char **argv,char *ops,int func));
  1333. Xint bin_eval DCLPROTO((char *nam,char **argv,char *ops,int func));
  1334. Xint fcgetcomm DCLPROTO((char *s));
  1335. Xint fcsubs DCLPROTO((char **sp,struct asgment *sub));
  1336. Xint fclist DCLPROTO((FILE *f,int n,int r,int D,int d,int first,int last,struct asgment *subs));
  1337. Xint fcedit DCLPROTO((char *ename,char *fn));
  1338. Xint bin_fc DCLPROTO((char *nam,char **argv,char *ops,int func));
  1339. Xint bin_suspend DCLPROTO((char *name,char **argv,char *ops,int func));
  1340. Xint bin_alias DCLPROTO((char *name,char **argv,char *ops,int func));
  1341. Xvoid printalias DCLPROTO((char *s,struct alias *a));
  1342. Xvoid printparam DCLPROTO((char *s,Param p));
  1343. Xint bin_typeset DCLPROTO((char *name,char **argv,char *ops,int func));
  1344. Xchar *escsubst DCLPROTO((char *s, int *nnl));
  1345. Xint bin_print DCLPROTO((char *name,char **args,char *ops,int func));
  1346. Xint bin_dirs DCLPROTO((char *name,char **argv,char *ops,int func));
  1347. Xint bin_unalias DCLPROTO((char *name,char **argv,char *ops,int func));
  1348. Xint bin_disable DCLPROTO((char *name,char **argv,char *ops,int func));
  1349. Xint bin_unhash DCLPROTO((char *name,char **argv,char *ops,int func));
  1350. Xint bin_unset DCLPROTO((char *name,char **argv,char *ops,int func));
  1351. Xint zread DCLPROTO((void));
  1352. Xint bin_read DCLPROTO((char *name,char **args,char *ops,int func));
  1353. Xint bin_vared DCLPROTO((char *name,char **args,char *ops,int func));
  1354. Xint execbin DCLPROTO((Lklist args,Cmdnam cnode));
  1355. Xstruct asgment *getasg DCLPROTO((char *s));
  1356. Xint bin_dot DCLPROTO((char *name,char **argv,char *ops,int func));
  1357. Xint bin_set DCLPROTO((char *name,char **argv,char *ops,int func));
  1358. Xint bin_times DCLPROTO((char *name,char **argv,char *ops,int func));
  1359. Xint bin_getopts DCLPROTO((char *name,char **argv,char *ops,int func));
  1360. Xint getsignum DCLPROTO((char *s));
  1361. Xint bin_trap DCLPROTO((char *name,char **argv,char *ops,int func));
  1362. Xvoid printulimit DCLPROTO((int lim,int hard));
  1363. Xint bin_ulimit DCLPROTO((char *name,char **argv,char *ops,int func));
  1364. Xint putraw DCLPROTO((int c));
  1365. Xint bin_echotc DCLPROTO((char *name,char **argv,char *ops,int func));
  1366. Xint bin_pwd DCLPROTO((char *name,char **argv,char *ops,int func));
  1367. Xint bin_test DCLPROTO((char *name,char **argv,char *ops,int func));
  1368. XCond partest DCLPROTO((int level));
  1369. Xint bin_compctl DCLPROTO((char *name,char **argv,char *ops,int func));
  1370. Xvoid printcompctl DCLPROTO((char *s,Compctl cc));
  1371. Xvoid compctl_process DCLPROTO((char **s,int mask,char *uk));
  1372. Xint bin_ttyctl DCLPROTO((char *name,char **argv,char *ops,int func));
  1373. SHAR_EOF
  1374. chmod 0644 zsh2.2/src/builtin.pro ||
  1375. echo 'restore of zsh2.2/src/builtin.pro failed'
  1376. Wc_c="`wc -c < 'zsh2.2/src/builtin.pro'`"
  1377. test 4239 -eq "$Wc_c" ||
  1378.     echo 'zsh2.2/src/builtin.pro: original size 4239, current size' "$Wc_c"
  1379. rm -f _shar_wnt_.tmp
  1380. fi
  1381. # ============= zsh2.2/src/cond.pro ==============
  1382. if test -f 'zsh2.2/src/cond.pro' -a X"$1" != X"-c"; then
  1383.     echo 'x - skipping zsh2.2/src/cond.pro (File already exists)'
  1384.     rm -f _shar_wnt_.tmp
  1385. else
  1386. > _shar_wnt_.tmp
  1387. echo 'x - extracting zsh2.2/src/cond.pro (Text)'
  1388. sed 's/^X//' << 'SHAR_EOF' > 'zsh2.2/src/cond.pro' &&
  1389. Xint evalcond DCLPROTO((Cond c));
  1390. Xint doaccess DCLPROTO((char *s,int c));
  1391. Xstruct stat *getstat DCLPROTO((char *s));
  1392. Xunsigned short dostat DCLPROTO((char *s));
  1393. Xunsigned short dolstat DCLPROTO((char *s));
  1394. Xint optison DCLPROTO((char *s));
  1395. SHAR_EOF
  1396. chmod 0644 zsh2.2/src/cond.pro ||
  1397. echo 'restore of zsh2.2/src/cond.pro failed'
  1398. Wc_c="`wc -c < 'zsh2.2/src/cond.pro'`"
  1399. test 235 -eq "$Wc_c" ||
  1400.     echo 'zsh2.2/src/cond.pro: original size 235, current size' "$Wc_c"
  1401. rm -f _shar_wnt_.tmp
  1402. fi
  1403. # ============= zsh2.2/src/exec.pro ==============
  1404. if test -f 'zsh2.2/src/exec.pro' -a X"$1" != X"-c"; then
  1405.     echo 'x - skipping zsh2.2/src/exec.pro (File already exists)'
  1406.     rm -f _shar_wnt_.tmp
  1407. else
  1408. > _shar_wnt_.tmp
  1409. echo 'x - extracting zsh2.2/src/exec.pro (Text)'
  1410. sed 's/^X//' << 'SHAR_EOF' > 'zsh2.2/src/exec.pro' &&
  1411. XList parselstring DCLPROTO((char *s));
  1412. Xvoid execstring DCLPROTO((char *s));
  1413. Xint phork DCLPROTO((void));
  1414. Xint execcursh DCLPROTO((Cmd cmd));
  1415. Xint zexecve DCLPROTO((char *pth,char **argv));
  1416. Xvoid execute DCLPROTO((int dash));
  1417. Xchar *findcmd DCLPROTO((char *arg0));
  1418. Xint iscom DCLPROTO((char *s));
  1419. Xint isrelative DCLPROTO((char *s));
  1420. Xint hashcmd DCLPROTO((char *arg0,char **pp));
  1421. Xvoid fullhash DCLPROTO((void));
  1422. Xvoid execlist DCLPROTO((List list));
  1423. Xvoid execlist2 DCLPROTO((Sublist list,int type,int last1));
  1424. Xint execpline DCLPROTO((Sublist l,int how,int last1));
  1425. Xvoid execpline2 DCLPROTO((Pline pline,int how,int input,int output,int last1));
  1426. Xchar **makecline DCLPROTO((struct lklist *list));
  1427. Xvoid fixcline DCLPROTO((Lklist l));
  1428. Xvoid untokenize DCLPROTO((char *s));
  1429. Xint dontclob DCLPROTO((struct redir *f));
  1430. Xvoid closemn DCLPROTO((struct multio **mfds,int fd));
  1431. Xvoid closemnodes DCLPROTO((struct multio **mfds));
  1432. Xvoid addfd DCLPROTO((int forked,int *save,struct multio **mfds,int fd1,int fd2,int rflag));
  1433. Xvoid addvars DCLPROTO((Lklist l,int export));
  1434. Xvoid execcmd DCLPROTO((Cmd cmd,int input,int output,int bkg,int last1));
  1435. Xvoid fixfds DCLPROTO((int *save));
  1436. Xvoid entersubsh DCLPROTO((int bkg));
  1437. Xvoid closem DCLPROTO((void));
  1438. Xchar *gethere DCLPROTO((char *str,int typ));
  1439. Xint getherestr DCLPROTO((struct redir *fn));
  1440. Xvoid catproc DCLPROTO((struct multio *mn));
  1441. Xvoid teeproc DCLPROTO((struct multio *mn));
  1442. Xvoid closeallelse DCLPROTO((struct multio *mn));
  1443. Xlong int zstrtol DCLPROTO((char *s,char **t,int base));
  1444. XLklist getoutput DCLPROTO((char *cmd,int qt));
  1445. XLklist readoutput DCLPROTO((int in,int qt));
  1446. Xchar *getoutputfile DCLPROTO((char *cmd));
  1447. Xchar *namedpipe DCLPROTO((void));
  1448. Xchar *getoutproc DCLPROTO((char *cmd));
  1449. Xchar *getinproc DCLPROTO((char *cmd));
  1450. Xint getinpipe DCLPROTO((char *cmd));
  1451. Xint getoutpipe DCLPROTO((char *cmd));
  1452. Xvoid runlist DCLPROTO((List l));
  1453. Xchar *gettemp DCLPROTO((void));
  1454. Xchar *zgetwd DCLPROTO((void));
  1455. Xvoid mpipe DCLPROTO((int *pp));
  1456. Xvoid spawnpipes DCLPROTO((Lklist l));
  1457. Xint exectime DCLPROTO((Cmd cmd));
  1458. Xint execfuncdef DCLPROTO((Cmd cmd));
  1459. Xint execcond DCLPROTO((Cmd cmd));
  1460. Xvoid execshfunc DCLPROTO((Cmd cmd,Cmdnam cn));
  1461. Xvoid doshfuncnoval DCLPROTO((List list, Lklist args, int flags));
  1462. Xvoid doshfunc DCLPROTO((List list, Lklist args, int flags));
  1463. XList getfpfunc DCLPROTO((char *s));
  1464. SHAR_EOF
  1465. chmod 0644 zsh2.2/src/exec.pro ||
  1466. echo 'restore of zsh2.2/src/exec.pro failed'
  1467. Wc_c="`wc -c < 'zsh2.2/src/exec.pro'`"
  1468. test 2306 -eq "$Wc_c" ||
  1469.     echo 'zsh2.2/src/exec.pro: original size 2306, current size' "$Wc_c"
  1470. rm -f _shar_wnt_.tmp
  1471. fi
  1472. # ============= zsh2.2/src/glob.pro ==============
  1473. if test -f 'zsh2.2/src/glob.pro' -a X"$1" != X"-c"; then
  1474.     echo 'x - skipping zsh2.2/src/glob.pro (File already exists)'
  1475.     rm -f _shar_wnt_.tmp
  1476. else
  1477. > _shar_wnt_.tmp
  1478. echo 'x - extracting zsh2.2/src/glob.pro (Text)'
  1479. sed 's/^X//' << 'SHAR_EOF' > 'zsh2.2/src/glob.pro' &&
  1480. Xvoid glob DCLPROTO((Lklist list,Lknode *np));
  1481. Xlong qgetnum DCLPROTO((char **s));
  1482. Xint notstrcmp DCLPROTO((char **a,char **b));
  1483. Xint forstrcmp DCLPROTO((char **a,char **b));
  1484. Xvoid insert DCLPROTO((char *s));
  1485. Xint haswilds DCLPROTO((char *str));
  1486. Xint hasbraces DCLPROTO((char *str));
  1487. Xint xpandredir DCLPROTO((struct redir *fn,Lklist tab));
  1488. Xchar *dyncat DCLPROTO((char *s1,char *s2));
  1489. Xchar *tricat DCLPROTO((char *s1,char *s2,char *s3));
  1490. Xvoid xpandbraces DCLPROTO((Lklist list,Lknode *np));
  1491. Xchar *getparen DCLPROTO((char *str));
  1492. Xint matchpat DCLPROTO((char *a,char *b));
  1493. Xvoid getmatch DCLPROTO((char **sp,char *pat,int dd));
  1494. Xchar *getfullpath DCLPROTO((char *s));
  1495. Xvoid scanner DCLPROTO((Complist q));
  1496. Xint minimatch DCLPROTO((char **pat,char **str));
  1497. Xint domatch DCLPROTO((char *str,Comp c,int fist));
  1498. Xint doesmatch DCLPROTO((Comp c));
  1499. XComplist parsepat DCLPROTO((char *str));
  1500. XComp parsereg DCLPROTO((char *str));
  1501. XComplist parsecomplist DCLPROTO((void));
  1502. XComp parsecomp DCLPROTO((void));
  1503. XComp parsecompsw DCLPROTO((void));
  1504. Xint patmatch DCLPROTO((char *ss,char *tt));
  1505. Xvoid remnulargs DCLPROTO((char *s));
  1506. Xint qualdev DCLPROTO((struct stat *buf,long dv));
  1507. Xint qualnlink DCLPROTO((struct stat *buf,long ct));
  1508. Xint qualuid DCLPROTO((struct stat *buf,long uid));
  1509. Xint qualgid DCLPROTO((struct stat *buf,long gid));
  1510. Xint qualisdev DCLPROTO((struct stat *buf,long junk));
  1511. Xint qualmode DCLPROTO((struct stat *buf,long mod));
  1512. Xint qualflags DCLPROTO((struct stat *buf,long mod));
  1513. Xint qualiscom DCLPROTO((struct stat *buf,long mod));
  1514. SHAR_EOF
  1515. chmod 0644 zsh2.2/src/glob.pro ||
  1516. echo 'restore of zsh2.2/src/glob.pro failed'
  1517. Wc_c="`wc -c < 'zsh2.2/src/glob.pro'`"
  1518. test 1511 -eq "$Wc_c" ||
  1519.     echo 'zsh2.2/src/glob.pro: original size 1511, current size' "$Wc_c"
  1520. rm -f _shar_wnt_.tmp
  1521. fi
  1522. # ============= zsh2.2/src/hist.pro ==============
  1523. if test -f 'zsh2.2/src/hist.pro' -a X"$1" != X"-c"; then
  1524.     echo 'x - skipping zsh2.2/src/hist.pro (File already exists)'
  1525.     rm -f _shar_wnt_.tmp
  1526. else
  1527. > _shar_wnt_.tmp
  1528. echo 'x - extracting zsh2.2/src/hist.pro (Text)'
  1529. sed 's/^X//' << 'SHAR_EOF' > 'zsh2.2/src/hist.pro' &&
  1530. Xvoid hwaddc DCLPROTO((int c));
  1531. Xint hgetc DCLPROTO((void));
  1532. Xvoid clearalstack DCLPROTO((void));
  1533. Xint hgetch DCLPROTO((void));
  1534. Xchar *hgets DCLPROTO((char *buf,int n));
  1535. Xvoid hungets DCLPROTO((char *str));
  1536. Xvoid hungetc DCLPROTO((int c));
  1537. Xvoid hungetch DCLPROTO((int c));
  1538. Xvoid strinbeg DCLPROTO((void));
  1539. Xvoid strinend DCLPROTO((void));
  1540. Xint stuff DCLPROTO((char *fn));
  1541. Xvoid hflush DCLPROTO((void));
  1542. Xvoid hbegin DCLPROTO((void));
  1543. Xvoid inittty DCLPROTO((void));
  1544. Xint hend DCLPROTO((void));
  1545. Xvoid remhist DCLPROTO((void));
  1546. Xvoid hwbegin DCLPROTO((void));
  1547. Xchar *hwadd DCLPROTO((void));
  1548. Xint getargspec DCLPROTO((int argc,int marg));
  1549. Xint hconsearch DCLPROTO((char *str,int *marg));
  1550. Xint hcomsearch DCLPROTO((char *str));
  1551. Xint remtpath DCLPROTO((char **junkptr));
  1552. Xint remtext DCLPROTO((char **junkptr));
  1553. Xint rembutext DCLPROTO((char **junkptr));
  1554. Xint remlpaths DCLPROTO((char **junkptr));
  1555. Xint makeuppercase DCLPROTO((char **junkptr));
  1556. Xint makelowercase DCLPROTO((char **junkptr));
  1557. Xvoid subst DCLPROTO((char **strptr,char *in,char *out,int gbal));
  1558. Xchar *convamps DCLPROTO((char *out,char *in));
  1559. Xchar *makehstr DCLPROTO((char *s));
  1560. Xchar *quietgetevent DCLPROTO((int ev));
  1561. Xchar *getevent DCLPROTO((int ev));
  1562. Xint getargc DCLPROTO((char *list));
  1563. Xchar *getargs DCLPROTO((char *elist,int arg1,int arg2));
  1564. Xvoid upcase DCLPROTO((char **x));
  1565. Xvoid downcase DCLPROTO((char **x));
  1566. Xint quote DCLPROTO((char **tr));
  1567. Xint quotebreak DCLPROTO((char **tr));
  1568. Xvoid herrflush DCLPROTO((void));
  1569. Xchar *hdynread DCLPROTO((int stop));
  1570. Xchar *hdynread2 DCLPROTO((int stop));
  1571. Xvoid inithist DCLPROTO((void));
  1572. Xvoid resizehistents DCLPROTO((void));
  1573. Xchar *hp_alloc DCLPROTO((Hp *hp, int siz));
  1574. Xchar *hp_realloc DCLPROTO((Hp *hp, char *ptr, int oldsiz, int newsiz));
  1575. Xvoid hp_free DCLPROTO((Hp h, char *ptr, int siz));
  1576. Xchar *hp_concat DCLPROTO((char *old, char *new));
  1577. Xvoid hp_purge DCLPROTO((Hp h, int lim));
  1578. Xvoid readhistfile DCLPROTO((char *s,int err));
  1579. Xvoid savehistfile DCLPROTO((char *s,int err,int app));
  1580. Xint firsthist DCLPROTO((void));
  1581. SHAR_EOF
  1582. chmod 0644 zsh2.2/src/hist.pro ||
  1583. echo 'restore of zsh2.2/src/hist.pro failed'
  1584. Wc_c="`wc -c < 'zsh2.2/src/hist.pro'`"
  1585. test 1989 -eq "$Wc_c" ||
  1586.     echo 'zsh2.2/src/hist.pro: original size 1989, current size' "$Wc_c"
  1587. rm -f _shar_wnt_.tmp
  1588. fi
  1589. # ============= zsh2.2/src/init.pro ==============
  1590. if test -f 'zsh2.2/src/init.pro' -a X"$1" != X"-c"; then
  1591.     echo 'x - skipping zsh2.2/src/init.pro (File already exists)'
  1592.     rm -f _shar_wnt_.tmp
  1593. else
  1594. > _shar_wnt_.tmp
  1595. echo 'x - extracting zsh2.2/src/init.pro (Text)'
  1596. sed 's/^X//' << 'SHAR_EOF' > 'zsh2.2/src/init.pro' &&
  1597. Xvoid main DCLPROTO((int argc, char **argv, char **envp));
  1598. Xvoid loop DCLPROTO((void));
  1599. Xvoid setflags DCLPROTO((void));
  1600. Xvoid parseargs DCLPROTO((char **argv));
  1601. Xvoid setmoreflags DCLPROTO((void));
  1602. Xvoid setupvals DCLPROTO((void));
  1603. Xvoid compctlsetup DCLPROTO((void));
  1604. Xvoid initialize DCLPROTO((void));
  1605. Xvoid addreswords DCLPROTO((void));
  1606. Xvoid runscripts DCLPROTO((void));
  1607. Xvoid ainit DCLPROTO((void));
  1608. SHAR_EOF
  1609. chmod 0644 zsh2.2/src/init.pro ||
  1610. echo 'restore of zsh2.2/src/init.pro failed'
  1611. Wc_c="`wc -c < 'zsh2.2/src/init.pro'`"
  1612. test 395 -eq "$Wc_c" ||
  1613.     echo 'zsh2.2/src/init.pro: original size 395, current size' "$Wc_c"
  1614. rm -f _shar_wnt_.tmp
  1615. fi
  1616. # ============= zsh2.2/src/jobs.pro ==============
  1617. if test -f 'zsh2.2/src/jobs.pro' -a X"$1" != X"-c"; then
  1618.     echo 'x - skipping zsh2.2/src/jobs.pro (File already exists)'
  1619.     rm -f _shar_wnt_.tmp
  1620. else
  1621. > _shar_wnt_.tmp
  1622. echo 'x - extracting zsh2.2/src/jobs.pro (Text)'
  1623. sed 's/^X//' << 'SHAR_EOF' > 'zsh2.2/src/jobs.pro' &&
  1624. XHANDTYPE handler DCLPROTO((int sig,int code));
  1625. Xvoid makerunning DCLPROTO((Job jn));
  1626. Xvoid updatestatus DCLPROTO((Job jn));
  1627. Xvoid findproc DCLPROTO((int pid,Job *jptr,struct process **pptr));
  1628. Xvoid printjob DCLPROTO((Job jn,int lng));
  1629. Xvoid setprevjob DCLPROTO((void));
  1630. Xvoid initjob DCLPROTO((void));
  1631. Xstruct process *addproc DCLPROTO((long pid,char *text));
  1632. Xint execok DCLPROTO((void));
  1633. Xvoid waitforpid DCLPROTO((long pid));
  1634. Xvoid waitjob DCLPROTO((int job));
  1635. Xvoid waitjobs DCLPROTO((void));
  1636. Xvoid clearjobtab DCLPROTO((void));
  1637. Xint getfreejob DCLPROTO((void));
  1638. Xvoid spawnjob DCLPROTO((void));
  1639. Xvoid fixsigs DCLPROTO((void));
  1640. Xint report DCLPROTO((Job j));
  1641. Xvoid printtime DCLPROTO((time_t real,struct timeinfo *ti,char *desc));
  1642. Xvoid dumptime DCLPROTO((Job jn));
  1643. Xvoid shelltime DCLPROTO((void));
  1644. Xvoid killrunjobs DCLPROTO((void));
  1645. Xvoid checkjobs DCLPROTO((void));
  1646. Xint killjb DCLPROTO((Job jn,int sig));
  1647. SHAR_EOF
  1648. chmod 0644 zsh2.2/src/jobs.pro ||
  1649. echo 'restore of zsh2.2/src/jobs.pro failed'
  1650. Wc_c="`wc -c < 'zsh2.2/src/jobs.pro'`"
  1651. test 892 -eq "$Wc_c" ||
  1652.     echo 'zsh2.2/src/jobs.pro: original size 892, current size' "$Wc_c"
  1653. rm -f _shar_wnt_.tmp
  1654. fi
  1655. # ============= zsh2.2/src/lex.pro ==============
  1656. if test -f 'zsh2.2/src/lex.pro' -a X"$1" != X"-c"; then
  1657.     echo 'x - skipping zsh2.2/src/lex.pro (File already exists)'
  1658.     rm -f _shar_wnt_.tmp
  1659. else
  1660. > _shar_wnt_.tmp
  1661. echo 'x - extracting zsh2.2/src/lex.pro (Text)'
  1662. sed 's/^X//' << 'SHAR_EOF' > 'zsh2.2/src/lex.pro' &&
  1663. Xvoid lexsave DCLPROTO((void));
  1664. Xvoid lexrestore DCLPROTO((void));
  1665. Xvoid yylex DCLPROTO((void));
  1666. Xvoid ctxtlex DCLPROTO((void));
  1667. Xvoid initlextabs DCLPROTO((void));
  1668. Xvoid lexinit DCLPROTO((void));
  1669. Xvoid add DCLPROTO((int c));
  1670. Xint gettok DCLPROTO((void));
  1671. Xint exalias DCLPROTO((void));
  1672. Xint skipcomm DCLPROTO((void));
  1673. SHAR_EOF
  1674. chmod 0644 zsh2.2/src/lex.pro ||
  1675. echo 'restore of zsh2.2/src/lex.pro failed'
  1676. Wc_c="`wc -c < 'zsh2.2/src/lex.pro'`"
  1677. test 309 -eq "$Wc_c" ||
  1678.     echo 'zsh2.2/src/lex.pro: original size 309, current size' "$Wc_c"
  1679. rm -f _shar_wnt_.tmp
  1680. fi
  1681. # ============= zsh2.2/src/loop.pro ==============
  1682. if test -f 'zsh2.2/src/loop.pro' -a X"$1" != X"-c"; then
  1683.     echo 'x - skipping zsh2.2/src/loop.pro (File already exists)'
  1684.     rm -f _shar_wnt_.tmp
  1685. else
  1686. > _shar_wnt_.tmp
  1687. echo 'x - extracting zsh2.2/src/loop.pro (Text)'
  1688. sed 's/^X//' << 'SHAR_EOF' > 'zsh2.2/src/loop.pro' &&
  1689. Xint execfor DCLPROTO((Cmd cmd));
  1690. Xint execselect DCLPROTO((Cmd cmd));
  1691. Xint execwhile DCLPROTO((Cmd cmd));
  1692. Xint execrepeat DCLPROTO((Cmd cmd));
  1693. Xint execif DCLPROTO((Cmd cmd));
  1694. Xint execcase DCLPROTO((Cmd cmd));
  1695. SHAR_EOF
  1696. chmod 0644 zsh2.2/src/loop.pro ||
  1697. echo 'restore of zsh2.2/src/loop.pro failed'
  1698. Wc_c="`wc -c < 'zsh2.2/src/loop.pro'`"
  1699. test 206 -eq "$Wc_c" ||
  1700.     echo 'zsh2.2/src/loop.pro: original size 206, current size' "$Wc_c"
  1701. rm -f _shar_wnt_.tmp
  1702. fi
  1703. # ============= zsh2.2/src/math.pro ==============
  1704. if test -f 'zsh2.2/src/math.pro' -a X"$1" != X"-c"; then
  1705.     echo 'x - skipping zsh2.2/src/math.pro (File already exists)'
  1706.     rm -f _shar_wnt_.tmp
  1707. else
  1708. > _shar_wnt_.tmp
  1709. echo 'x - extracting zsh2.2/src/math.pro (Text)'
  1710. sed 's/^X//' << 'SHAR_EOF' > 'zsh2.2/src/math.pro' &&
  1711. Xint zzlex DCLPROTO((void));
  1712. Xint notzero DCLPROTO((int a));
  1713. Xvoid op DCLPROTO((int what));
  1714. Xvoid bop DCLPROTO((int tk));
  1715. Xlong mathevall DCLPROTO((char *s,int prek,char **ep));
  1716. Xlong matheval DCLPROTO((char *s));
  1717. Xlong mathevalarg DCLPROTO((char *s,char **ss));
  1718. Xvoid mathparse DCLPROTO((int pc));
  1719. SHAR_EOF
  1720. chmod 0644 zsh2.2/src/math.pro ||
  1721. echo 'restore of zsh2.2/src/math.pro failed'
  1722. Wc_c="`wc -c < 'zsh2.2/src/math.pro'`"
  1723. test 291 -eq "$Wc_c" ||
  1724.     echo 'zsh2.2/src/math.pro: original size 291, current size' "$Wc_c"
  1725. rm -f _shar_wnt_.tmp
  1726. fi
  1727. # ============= zsh2.2/src/mem.pro ==============
  1728. if test -f 'zsh2.2/src/mem.pro' -a X"$1" != X"-c"; then
  1729.     echo 'x - skipping zsh2.2/src/mem.pro (File already exists)'
  1730.     rm -f _shar_wnt_.tmp
  1731. else
  1732. > _shar_wnt_.tmp
  1733. echo 'x - extracting zsh2.2/src/mem.pro (Text)'
  1734. sed 's/^X//' << 'SHAR_EOF' > 'zsh2.2/src/mem.pro' &&
  1735. Xvoid meminit DCLPROTO((void));
  1736. Xvoid heapalloc DCLPROTO((void));
  1737. Xvoid permalloc DCLPROTO((void));
  1738. Xvoid lastalloc DCLPROTO((void));
  1739. Xvoid pushheap DCLPROTO((void));
  1740. Xvoid freeheap DCLPROTO((void));
  1741. Xvoid popheap DCLPROTO((void));
  1742. Xvoid freeh DCLPROTO((Heap h));
  1743. Xvptr halloc DCLPROTO((int size));
  1744. Xvptr hcalloc DCLPROTO((int size));
  1745. Xvptr hrealloc DCLPROTO((char *p,int old,int new));
  1746. Xvptr zalloc DCLPROTO((int l));
  1747. Xvptr zcalloc DCLPROTO((int size));
  1748. Xchar *strdup DCLPROTO((char *s));
  1749. Xchar *ztrdup DCLPROTO((char *s));
  1750. SHAR_EOF
  1751. chmod 0644 zsh2.2/src/mem.pro ||
  1752. echo 'restore of zsh2.2/src/mem.pro failed'
  1753. Wc_c="`wc -c < 'zsh2.2/src/mem.pro'`"
  1754. test 510 -eq "$Wc_c" ||
  1755.     echo 'zsh2.2/src/mem.pro: original size 510, current size' "$Wc_c"
  1756. rm -f _shar_wnt_.tmp
  1757. fi
  1758. # ============= zsh2.2/src/params.pro ==============
  1759. if test -f 'zsh2.2/src/params.pro' -a X"$1" != X"-c"; then
  1760.     echo 'x - skipping zsh2.2/src/params.pro (File already exists)'
  1761.     rm -f _shar_wnt_.tmp
  1762. else
  1763. > _shar_wnt_.tmp
  1764. echo 'x - extracting zsh2.2/src/params.pro (Text)'
  1765. sed 's/^X//' << 'SHAR_EOF' > 'zsh2.2/src/params.pro' &&
  1766. Xvoid setupparams DCLPROTO((void));
  1767. Xstruct param *createparam DCLPROTO((char *name,vptr value,int flags));
  1768. Xint isident DCLPROTO((char *s));
  1769. XValue getvalue DCLPROTO((char **pptr,int bracks));
  1770. Xchar *getstrvalue DCLPROTO((Value v));
  1771. Xchar **getarrvalue DCLPROTO((Value v));
  1772. Xlong getintvalue DCLPROTO((Value v));
  1773. Xvoid setstrvalue DCLPROTO((Value v,char *val));
  1774. Xvoid setintvalue DCLPROTO((Value v,long val));
  1775. Xvoid setintenv DCLPROTO((char *s, long val));
  1776. Xvoid setarrvalue DCLPROTO((Value v,char **val));
  1777. Xchar *getsparamval DCLPROTO((char *s,int l));
  1778. Xlong getiparam DCLPROTO((char *s));
  1779. Xchar *getsparam DCLPROTO((char *s));
  1780. Xchar **getaparam DCLPROTO((char *s));
  1781. XParam setsparam DCLPROTO((char *s,char *val));
  1782. XParam setaparam DCLPROTO((char *s,char **val));
  1783. XParam setiparam DCLPROTO((char *s,long val));
  1784. Xvoid unsetparam DCLPROTO((char *s));
  1785. Xvoid intsetfn DCLPROTO((Param pm,long x));
  1786. Xlong intgetfn DCLPROTO((Param pm));
  1787. Xvoid strsetfn DCLPROTO((Param pm,char *x));
  1788. Xchar *strgetfn DCLPROTO((Param pm));
  1789. Xvoid nullsetfn DCLPROTO((Param pm, char *x));
  1790. Xvoid arrsetfn DCLPROTO((Param pm,char **x));
  1791. Xchar **arrgetfn DCLPROTO((Param pm));
  1792. Xvoid intvarsetfn DCLPROTO((Param pm,long x));
  1793. Xlong intvargetfn DCLPROTO((Param pm));
  1794. Xvoid strvarsetfn DCLPROTO((Param pm,char *x));
  1795. Xvoid strvarnonullsetfn DCLPROTO((Param pm,char *x));
  1796. Xchar *strvargetfn DCLPROTO((Param pm));
  1797. Xchar *strconstgetfn DCLPROTO((Param pm));
  1798. Xvoid colonarrsetfn DCLPROTO((Param pm,char *x));
  1799. Xchar *colonarrgetfn DCLPROTO((Param pm));
  1800. Xchar **arrvargetfn DCLPROTO((Param pm));
  1801. Xvoid arrvarsetfn DCLPROTO((Param pm,char **x));
  1802. Xchar **pathgetfn DCLPROTO((Param pm));
  1803. Xvoid pathsetfn DCLPROTO((Param pm,char **x));
  1804. Xvoid hostcmdssetfn DCLPROTO((Param pm,char **x));
  1805. Xvoid optcmdssetfn DCLPROTO((Param pm,char **x));
  1806. Xvoid bindcmdssetfn DCLPROTO((Param pm,char **x));
  1807. Xvoid varcmdssetfn DCLPROTO((Param pm,char **x));
  1808. Xchar **nullgetfn DCLPROTO((Param pm));
  1809. Xvoid unsettablesetfn DCLPROTO((Param pm,char *x));
  1810. Xlong poundgetfn DCLPROTO((Param pm));
  1811. Xlong randomgetfn DCLPROTO((Param pm));
  1812. Xvoid randomsetfn DCLPROTO((Param pm,long v));
  1813. Xlong secondsgetfn DCLPROTO((Param pm));
  1814. Xvoid secondssetfn DCLPROTO((Param pm,long x));
  1815. Xlong uidgetfn DCLPROTO((Param pm));
  1816. Xlong gidgetfn DCLPROTO((Param pm));
  1817. Xchar *usernamegetfn DCLPROTO((Param pm));
  1818. Xchar *hostgetfn DCLPROTO((Param pm));
  1819. Xchar *ifsgetfn DCLPROTO((Param pm));
  1820. Xvoid ifssetfn DCLPROTO((Param pm,char *x));
  1821. Xvoid histsizesetfn DCLPROTO((Param pm,long v));
  1822. Xlong histsizegetfn DCLPROTO((Param pm));
  1823. SHAR_EOF
  1824. true || echo 'restore of zsh2.2/src/params.pro failed'
  1825. fi
  1826. echo 'End of zsh2.2 part 15'
  1827. echo 'File zsh2.2/src/params.pro is continued in part 16'
  1828. echo 16 > _shar_seq_.tmp
  1829. exit 0
  1830.  
  1831. exit 0 # Just in case...
  1832.