home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1994 March / Source_Code_CD-ROM_Walnut_Creek_March_1994.iso / compsrcs / misc / volume39 / cwish / part04 < prev    next >
Encoding:
Text File  |  1993-09-22  |  58.6 KB  |  1,790 lines

  1. Newsgroups: comp.sources.misc
  2. From: hm@hcshh.hcs.de (Hellmuth Michaelis)
  3. Subject: v39i100:  cwish - Window Shell / Filemanager v1.00, Part04/04
  4. Message-ID: <1993Sep22.161653.26314@sparky.sterling.com>
  5. X-Md4-Signature: f30f0a7f18cae7ab273c202d1ad5a099
  6. Sender: kent@sparky.sterling.com (Kent Landfield)
  7. Reply-To: hm@hcshh.hcs.de
  8. Organization: HCS Hanseatischer Computerservice GmbH
  9. Date: Wed, 22 Sep 1993 16:16:53 GMT
  10. Approved: kent@sparky.sterling.com
  11.  
  12. Submitted-by: hm@hcshh.hcs.de (Hellmuth Michaelis)
  13. Posting-number: Volume 39, Issue 100
  14. Archive-name: cwish/part04
  15. Environment: HP-UX, 386BSD, NETBSD, ANSI-C, SYSV-CURSES
  16.  
  17. #! /bin/sh
  18. # This is a shell archive.  Remove anything before this line, then feed it
  19. # into a shell via "sh file" or similar.  To overwrite existing files,
  20. # type "sh file -c".
  21. # Contents:  MANIFEST Makefile.386bsd Makefile.hpux complete.c config.h
  22. #   control.h cursor.c dot-wishrc fkeys.c help.c patchlevel.h rcinit.h
  23. #   showtime.c usage.c usrgrp.c
  24. # Wrapped by kent@sparky on Wed Sep 22 10:49:58 1993
  25. PATH=/bin:/usr/bin:/usr/ucb:/usr/local/bin:/usr/lbin ; export PATH
  26. echo If this archive is complete, you will see the following message:
  27. echo '          "shar: End of archive 4 (of 4)."'
  28. if test -f 'MANIFEST' -a "${1}" != "-c" ; then 
  29.   echo shar: Will not clobber existing file \"'MANIFEST'\"
  30. else
  31.   echo shar: Extracting \"'MANIFEST'\" \(1184 characters\)
  32.   sed "s/^X//" >'MANIFEST' <<'END_OF_FILE'
  33. XFile Name            Description
  34. X-----------------------------------------------------------
  35. XCOPYING                GNU GENERAL PUBLIC LICENSE
  36. XMANIFEST            This shipping list
  37. XMakefile.386bsd            Makefile for 386BSD, NetBSD etc.
  38. XMakefile.hpux            Makefile for HP-UX
  39. XREADME                Intro
  40. Xchdir.c                cd wildcard functions
  41. Xcommandline.c            commandline window handling
  42. Xcomplete.c            primitive filename completition
  43. Xconfig.c            runtime configuration menu
  44. Xconfig.h            header file for config.c
  45. Xcontrol.h            control character defines
  46. Xcursor.c            highlighting functions
  47. Xdot-wishrc            sample .wishrc file
  48. Xfiles.c                the directory scanner
  49. Xfkeys.c                function key label handling
  50. Xheader.c            header & attribute window misc
  51. Xhelp.c                help screen
  52. Xhistory.c            commandline history functions
  53. Xmovement.c            current file movement functions
  54. Xpaging.c            current directory linked list formatting
  55. Xpatchlevel.h            the current patchlevel
  56. Xrcinit.c            initialization file processing
  57. Xrcinit.h            defines for rcinit.c
  58. Xshowtime.c            signal handling for time display
  59. Xusage.c                usage and copyright information
  60. Xusrgrp.c            user and group name extraction & cacheing
  61. Xwish.1                the manual page
  62. Xwish.c                program startup and main loop
  63. Xwish.h                the global header file
  64. X
  65. END_OF_FILE
  66.   if test 1184 -ne `wc -c <'MANIFEST'`; then
  67.     echo shar: \"'MANIFEST'\" unpacked with wrong size!
  68.   fi
  69.   # end of 'MANIFEST'
  70. fi
  71. if test -f 'Makefile.386bsd' -a "${1}" != "-c" ; then 
  72.   echo shar: Will not clobber existing file \"'Makefile.386bsd'\"
  73. else
  74.   echo shar: Extracting \"'Makefile.386bsd'\" \(4226 characters\)
  75.   sed "s/^X//" >'Makefile.386bsd' <<'END_OF_FILE'
  76. X#---------------------------------------------------------------------------
  77. X#
  78. X#                  wish - windowing user friendly shell
  79. X#                  ------------------------------------
  80. X#
  81. X#               Copyright (c) 1988-1993 Hellmuth Michaelis
  82. X#
  83. X#                  Eggerstedtstr. 28
  84. X#                  22765 Hamburg
  85. X#                  Germany
  86. X#
  87. X#                  Tel:    +49 / 40 / 384298    (private)
  88. X#                  Tel:    +49 / 40 / 55903-170 (at work)
  89. X#                  e-mail: hm@hcshh.hcs.de
  90. X#
  91. X#                          --------oOo--------
  92. X#
  93. X#   This program is free software; you can redistribute it and/or modify
  94. X#   it under the terms of the GNU General Public License as published by
  95. X#   the Free Software Foundation; either version 2 of the License, or
  96. X#   (at your option) any later version.
  97. X#
  98. X#   This program is distributed in the hope that it will be useful,
  99. X#   but WITHOUT ANY WARRANTY; without even the implied warranty of
  100. X#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  101. X#   GNU General Public License for more details.
  102. X#
  103. X#   You should have received a copy of the GNU General Public License
  104. X#   along with this program; if not, write to the Free Software
  105. X#   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  106. X#
  107. X#---------------------------------------------------------------------------
  108. X#
  109. X#    Last edit-date: [Wed Sep 22 13:27:01 1993]
  110. X#
  111. X#    Flags:
  112. X#
  113. X#    CURSESBUG    workaround for a bug in curses to re-enable
  114. X#            sending of special keys after system(), commandline.c
  115. X#
  116. X#---------------------------------------------------------------------------
  117. X
  118. XCC=        gcc2
  119. XNAME=        wish
  120. XDEST=        /usr/local/bin
  121. XMANDIR=        /usr/local/man
  122. XMANBSD=        cat1
  123. XMANHPUX=    man1
  124. XPRINTPROG=    cprps
  125. X
  126. X#-- 386BSD debugging -------------------------------------------------------
  127. XCFLAGS=    -O2 -Wall -g -pipe -DCURSESBUG -I/usr/local/include
  128. XLFLAGS=    -lncurses
  129. X
  130. X#-- 386BSD curses debugging ------------------------------------------------
  131. X#CFLAGS=    -O2 -Wall -g -pipe -DCURSESBUG -I/usr/local/include
  132. X#LFLAGS=    -ldncurses
  133. X
  134. X#-- 386BSD production ------------------------------------------------------
  135. X#CFLAGS=    -O2 -Wall -pipe -DCURSESBUG -I/usr/local/include
  136. X#LFLAGS=    -s -lncurses
  137. X
  138. X
  139. XCFILES=        wish.c files.c movement.c commandline.c rcinit.c \
  140. X        fkeys.c paging.c cursor.c header.c history.c help.c \
  141. X        usrgrp.c showtime.c config.c chdir.c complete.c\
  142. X        usage.c 
  143. X
  144. XOFILES=        wish.o files.o movement.o commandline.o rcinit.o \
  145. X        fkeys.o paging.o cursor.o header.o history.o help.o \
  146. X        usrgrp.o showtime.o config.o chdir.o complete.o\
  147. X        usage.o 
  148. X
  149. XHFILES=        config.h control.h wish.h rcinit.h patchlevel.h
  150. X
  151. XMISCFILES=    COPYING MANIFEST README \
  152. X        Makefile.386bsd Makefile.hpux \
  153. X        dot-wishrc 
  154. X
  155. XMANFILE=    wish.1
  156. X
  157. XBAKFILES=    $(CFILES) $(HFILES) $(MISCFILES) $(MANFILE)
  158. X
  159. X$(NAME):    $(OFILES)
  160. X            $(CC) $(OFILES) $(LFLAGS) -o $(NAME)
  161. X            
  162. Xupdate.h:    Makefile $(CFILES) $(HFILES)
  163. X    @/bin/sh -c "[ -f update.h ] || (echo 0 > update.h)"
  164. X    @/bin/sh -c "expr `cat update.h` + 1 > update1.h && mv update1.h update.h"
  165. X    @echo ""
  166. X    @echo "        compilation number updated to `cat update.h`"
  167. X    @echo ""
  168. X
  169. X$(OFILES):    wish.h
  170. Xwish.o:        control.h
  171. Xusage.o:    update.h patchlevel.h
  172. Xrcinit.o:    rcinit.h
  173. Xconfig.o:    config.h
  174. X
  175. Xinstall:    $(NAME)
  176. X        cp $(NAME) $(DEST)
  177. X        strip $(DEST)/$(NAME)
  178. X        chmod og-rw,a+x,u+rwx $(DEST)/$(NAME)
  179. X        chown root $(DEST)/$(NAME)
  180. X        chgrp bin $(DEST)/$(NAME)
  181. X        @if [ -f /hp-ux ];\
  182. X         then echo "installing HPUX man-page";make man-hpux;\
  183. X        elif [ -f /386bsd -o /netbsd ];\
  184. X         then echo "installing 386BSD man-page";make man-386bsd;fi
  185. X        
  186. Xclean:        
  187. X        rm -f *.o wish trace core* lint.out
  188. X
  189. Xveryclean:
  190. X        rm -f *.o wish trace core* update.h lint.out
  191. X
  192. Xman-hpux:
  193. X        cp $(MANFILE) $(MANDIR)/$(MANHPUX)
  194. X
  195. Xman-386bsd:
  196. X        nroff -mandoc $(MANFILE) >$(MANDIR)/$(MANBSD)/$(NAME).0
  197. X
  198. Xprint:
  199. X        $(PRINTPROG) wish.h rcinit.h config.h $(CFILES)
  200. X
  201. Xlint:
  202. X        lint -s -Aa -D_HPUX_SOURCE -DCURSESBUG $(CFILES) | tee lint.out
  203. X
  204. Xbackup:
  205. X        @echo ""
  206. X        @if [ -d BACKUP ];then rm -rf BACKUP-OLD;\
  207. X            echo "moving BACKUP to BACKUP-OLD ...";\
  208. X            mkdir BACKUP-OLD;\
  209. X            mv BACKUP/* BACKUP-OLD;fi
  210. X        @rm -rf BACKUP
  211. X        @mkdir BACKUP
  212. X        @echo "copying files to BACKUP ..."
  213. X        @cp $(BAKFILES) BACKUP
  214. X        @echo ""
  215. X
  216. X#-------------------------- E O F ---------------------------------------------
  217. END_OF_FILE
  218.   if test 4226 -ne `wc -c <'Makefile.386bsd'`; then
  219.     echo shar: \"'Makefile.386bsd'\" unpacked with wrong size!
  220.   fi
  221.   # end of 'Makefile.386bsd'
  222. fi
  223. if test -f 'Makefile.hpux' -a "${1}" != "-c" ; then 
  224.   echo shar: Will not clobber existing file \"'Makefile.hpux'\"
  225. else
  226.   echo shar: Extracting \"'Makefile.hpux'\" \(4352 characters\)
  227.   sed "s/^X//" >'Makefile.hpux' <<'END_OF_FILE'
  228. X#---------------------------------------------------------------------------
  229. X#
  230. X#                  wish - windowing user friendly shell
  231. X#                  ------------------------------------
  232. X#
  233. X#               Copyright (c) 1988-1993 Hellmuth Michaelis
  234. X#
  235. X#                  Eggerstedtstr. 28
  236. X#                  22765 Hamburg
  237. X#                  Germany
  238. X#
  239. X#                  Tel:    +49 / 40 / 384298    (private)
  240. X#                  Tel:    +49 / 40 / 55903-170 (at work)
  241. X#                  e-mail: hm@hcshh.hcs.de
  242. X#
  243. X#                          --------oOo--------
  244. X#
  245. X#   This program is free software; you can redistribute it and/or modify
  246. X#   it under the terms of the GNU General Public License as published by
  247. X#   the Free Software Foundation; either version 2 of the License, or
  248. X#   (at your option) any later version.
  249. X#
  250. X#   This program is distributed in the hope that it will be useful,
  251. X#   but WITHOUT ANY WARRANTY; without even the implied warranty of
  252. X#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  253. X#   GNU General Public License for more details.
  254. X#
  255. X#   You should have received a copy of the GNU General Public License
  256. X#   along with this program; if not, write to the Free Software
  257. X#   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  258. X#
  259. X#---------------------------------------------------------------------------
  260. X#
  261. X#    Last edit-date: [Mon Sep 20 17:04:45 1993]
  262. X#
  263. X#    Flags:
  264. X#
  265. X#    CURSESBUG    workaround for a bug in curses to re-enable
  266. X#            sending of special keys after system(), commandline.c
  267. X#
  268. X#---------------------------------------------------------------------------
  269. X
  270. XCC=        cc
  271. XNAME=        wish
  272. XDEST=        /usr/local/bin
  273. XMANDIR=        /usr/local/man
  274. XMANBSD=        cat1
  275. XMANHPUX=    man1
  276. XPRINTPROG=    cprps
  277. X
  278. X#-- HPUX debugging (using HP's ANSI C-Compiler) -----------------------------
  279. X#CFLAGS=    -g -z -Wc,-w1 -Aa +ESlit -D_HPUX_SOURCE -DCURSESBUG
  280. X#LFLAGS=    -lcurses
  281. X
  282. X#-- HPUX production (using HP's ANSI C-Compiler) ----------------------------
  283. XCFLAGS=    -O -z -Wc,-w1 -Aa +ESlit -D_HPUX_SOURCE -DCURSESBUG
  284. XLFLAGS=    -lcurses
  285. X
  286. X#-- HPUX debugging (using GCC 2.2.2 or GCC 2.3.3) --------------------------
  287. X#CFLAGS=    -Wall -g -D_HPUX_SOURCE -DCURSESBUG -pipe
  288. X#LFLAGS=    -lcurses
  289. X
  290. X#-- HPUX production (using GCC 2.2.2 or GCC 2.3.3) -------------------------
  291. X#CFLAGS=    -O2 -D_HPUX_SOURCE -DCURSESBUG -pipe
  292. X#LFLAGS=    -lcurses
  293. X
  294. X
  295. XCFILES=        wish.c files.c movement.c commandline.c rcinit.c \
  296. X        fkeys.c paging.c cursor.c header.c history.c help.c \
  297. X        usrgrp.c showtime.c config.c chdir.c complete.c\
  298. X        usage.c 
  299. X
  300. XOFILES=        wish.o files.o movement.o commandline.o rcinit.o \
  301. X        fkeys.o paging.o cursor.o header.o history.o help.o \
  302. X        usrgrp.o showtime.o config.o chdir.o complete.o\
  303. X        usage.o 
  304. X
  305. XHFILES=        config.h control.h wish.h rcinit.h patchlevel.h
  306. X
  307. XMISCFILES=    COPYING MANIFEST README \
  308. X        Makefile.386bsd Makefile.hpux \
  309. X        dot-wishrc 
  310. X
  311. XMANFILE=    wish.1
  312. X
  313. XBAKFILES=    $(CFILES) $(HFILES) $(MISCFILES) $(MANFILE)
  314. X
  315. X$(NAME):    $(OFILES)
  316. X            $(CC) $(OFILES) $(LFLAGS) -o $(NAME)
  317. X            
  318. Xupdate.h:    Makefile $(CFILES) $(HFILES)
  319. X    @/bin/sh -c "[ -f update.h ] || (echo 0 > update.h)"
  320. X    @/bin/sh -c "expr `cat update.h` + 1 > update1.h && mv update1.h update.h"
  321. X    @echo ""
  322. X    @echo "        compilation number updated to `cat update.h`"
  323. X    @echo ""
  324. X
  325. X$(OFILES):    wish.h
  326. Xwish.o:        control.h
  327. Xusage.o:    update.h patchlevel.h
  328. Xrcinit.o:    rcinit.h
  329. Xconfig.o:    config.h
  330. X
  331. Xinstall:    $(NAME)
  332. X        cp $(NAME) $(DEST)
  333. X        strip $(DEST)/$(NAME)
  334. X        chmod og-rw,a+x,u+rwx $(DEST)/$(NAME)
  335. X        chown root $(DEST)/$(NAME)
  336. X        chgrp bin $(DEST)/$(NAME)
  337. X        @if [ -f /hp-ux ];\
  338. X         then echo "installing HPUX man-page";make man-hpux;\
  339. X        elif [ -f /386bsd -o /netbsd ];\
  340. X         then echo "installing 386BSD man-page";make man-386bsd;fi
  341. X
  342. Xclean:        
  343. X        rm -f *.o wish trace core* lint.out
  344. X
  345. Xveryclean:
  346. X        rm -f *.o wish trace core* update.h lint.out
  347. X
  348. Xman-hpux:
  349. X        cp $(MANFILE) $(MANDIR)/$(MANHPUX)
  350. X
  351. Xman-386bsd:
  352. X        nroff -mandoc $(MANFILE) >$(MANDIR)/$(MANBSD)/$(NAME).0
  353. X
  354. Xprint:
  355. X        $(PRINTPROG) wish.h rcinit.h config.h $(CFILES)
  356. X
  357. Xlint:
  358. X        lint -s -Aa -D_HPUX_SOURCE -DCURSESBUG $(CFILES) | tee lint.out
  359. X
  360. Xbackup:
  361. X        @echo ""
  362. X        @if [ -d BACKUP ];then rm -rf BACKUP-OLD;\
  363. X            echo "moving BACKUP to BACKUP-OLD ...";\
  364. X            mkdir BACKUP-OLD;\
  365. X            mv BACKUP/* BACKUP-OLD;fi
  366. X        @rm -rf BACKUP
  367. X        @mkdir BACKUP
  368. X        @echo "copying files to BACKUP ..."
  369. X        @cp $(BAKFILES) BACKUP
  370. X        @echo ""
  371. X
  372. X#-------------------------- E O F ---------------------------------------------
  373. END_OF_FILE
  374.   if test 4352 -ne `wc -c <'Makefile.hpux'`; then
  375.     echo shar: \"'Makefile.hpux'\" unpacked with wrong size!
  376.   fi
  377.   # end of 'Makefile.hpux'
  378. fi
  379. if test -f 'complete.c' -a "${1}" != "-c" ; then 
  380.   echo shar: Will not clobber existing file \"'complete.c'\"
  381. else
  382.   echo shar: Extracting \"'complete.c'\" \(4025 characters\)
  383.   sed "s/^X//" >'complete.c' <<'END_OF_FILE'
  384. X/*---------------------------------------------------------------------------*
  385. X *
  386. X *                  wish - windowing user friendly shell
  387. X *                 --------------------------------------
  388. X *
  389. X *              (c) Copyright Hellmuth Michaelis 1989 - 1993
  390. X *
  391. X *                  Eggerstedtstr. 28
  392. X *                  22765 Hamburg
  393. X *                  Germany
  394. X *
  395. X *                  Tel:    +49 / 40 / 384298    (private)
  396. X *                  Tel:    +49 / 40 / 55903-170 (at work)
  397. X *                  e-mail: hm@hcshh.hcs.de
  398. X *
  399. X *           All rights are reserved except as explicitly granted
  400. X *                  by written permission of the author.
  401. X *
  402. X *             See the file COPYING, distributed with wish, for
  403. X *                  restriction and warranty information
  404. X *
  405. X *---------------------------------------------------------------------------*
  406. X *
  407. X *    last edit-date: [Wed Sep 22 13:27:37 1993]
  408. X *
  409. X *    -hm    primitive filename completition
  410. X *
  411. X *----------------------------------------------------------------------------*/
  412. X
  413. X#include "wish.h"        /* local includes */
  414. X
  415. Xstatic char *wild(char *path, char *wildname);
  416. X
  417. X/*---------------------------------------------------------------------------*
  418. X *    complete name to first matching filename
  419. X *----------------------------------------------------------------------------*/
  420. Xvoid complete(void)
  421. X{
  422. X        char *cptr;        /* ptr to start of line after prompt */
  423. X    char *cend;        /* ptr to end of commandline */
  424. X    char *p,*q;        /* gp ptr */
  425. X    char *csave;        /* filename start position */
  426. X    char path[MAXPATHLEN+1];/* path portion */
  427. X    char name[MAXPATHLEN+1];/* name portion */
  428. X    
  429. X    cptr = cbuff+3;            /* init start ptr */
  430. X    cend = cptr + strlen(cptr);    /* int end ptr */
  431. X
  432. X    while(cend > cptr)        /* end of commandline */
  433. X    {
  434. X        cend--;
  435. X        if(isspace(*cend))    /* start of filename ? */
  436. X            break;
  437. X    }
  438. X    if(cend <= cptr)        /* hmm ... */
  439. X        return;
  440. X
  441. X    cend++;                /* first char of filename */
  442. X    csave = cend;            /* save position for later compare */
  443. X    
  444. X    if((p = strrchr(cend, '/')) == NULL)
  445. X    {
  446. X        path[0] = '\0';        /* setup path part */
  447. X        strcpy(name, cend);    /* setup name part */
  448. X    }
  449. X    else
  450. X    {
  451. X        q = path;        /* setup path part */
  452. X        while(cend <= p)
  453. X            *q++ = *cend++;
  454. X        *q = '\0';
  455. X        
  456. X        q = name;        /* setup name part */
  457. X        while(*cend)
  458. X            *q++ = *cend++;
  459. X        *q = '\0';
  460. X    }        
  461. X    strcat(name, "*");            /* add wildcard char */
  462. X        
  463. X    if((q = wild(path, name)) == NULL)    /* resolve wildcards */
  464. X        return;                /* not found */
  465. X
  466. X    while(*csave && *q && (*csave++ == *q++))    /* skip same chars */
  467. X        ;
  468. X
  469. X    while(*q && (cmdline(*q++) == GOOD))    /* rest to commandline */
  470. X        ;
  471. X}
  472. X            
  473. X/*---------------------------------------------------------------------------*
  474. X *    check if "wildname" matches any name in directory "path"
  475. X *    return concatenated "path" and matched name from dir
  476. X *    if directory found, append a '/' to resulting name
  477. X *----------------------------------------------------------------------------*/
  478. Xstatic char *wild(char *path, char *wildname)
  479. X{
  480. X    register struct direct *dp;        /* dir access */
  481. X    register DIR *dirp;            /* dir access */
  482. X    struct stat fdbuffer;            /* stat buffer */
  483. X    static char wtry[MAXPATHLEN+1];        /* try buffer */
  484. X    char rpath[MAXPATHLEN+1];        /* resulting path */
  485. X    
  486. X    strcpy(rpath, path);            /* path -> result path */
  487. X    strcat(rpath, ".");            /* for readdir */
  488. X    
  489. X    if((dirp = opendir(rpath)) == NULL)
  490. X        return(NULL);            /* cannot open directory */
  491. X
  492. X    for(dp = readdir(dirp); dp != NULL; dp = readdir(dirp))
  493. X    {
  494. X        if((!(strcmp(dp->d_name, "."))) || (!(strcmp(dp->d_name, ".."))))
  495. X            continue;
  496. X
  497. X        if(wildmat(dp->d_name, wildname) == TRUE) /* hit ? */
  498. X        {
  499. X            strcpy(wtry, path);        /* pathname */
  500. X            strcat(wtry, dp->d_name);    /* matchname */
  501. X            if(stat(wtry, &fdbuffer) < 0)
  502. X                continue;        /* not accessible */
  503. X            closedir(dirp);            /* close */
  504. X            if(S_ISDIR(fdbuffer.st_mode))    /* directory ? */
  505. X                strcat(wtry, "/");    /* yes, append / */
  506. X            return(wtry);            /* return result */
  507. X        }
  508. X    }
  509. X    closedir(dirp);        /* close */
  510. X    return(NULL);        /* failed */
  511. X}
  512. X
  513. X/*---------------------------------- EOF -------------------------------------*/
  514. END_OF_FILE
  515.   if test 4025 -ne `wc -c <'complete.c'`; then
  516.     echo shar: \"'complete.c'\" unpacked with wrong size!
  517.   fi
  518.   # end of 'complete.c'
  519. fi
  520. if test -f 'config.h' -a "${1}" != "-c" ; then 
  521.   echo shar: Will not clobber existing file \"'config.h'\"
  522. else
  523.   echo shar: Extracting \"'config.h'\" \(4528 characters\)
  524.   sed "s/^X//" >'config.h' <<'END_OF_FILE'
  525. X/*---------------------------------------------------------------------------*
  526. X *
  527. X *                  wish - windowing user friendly shell
  528. X *                 --------------------------------------
  529. X *
  530. X *              (c) Copyright Hellmuth Michaelis 1989 - 1993
  531. X *
  532. X *                  Eggerstedtstr. 28
  533. X *                  22765 Hamburg 
  534. X *                  Germany
  535. X *
  536. X *                  Tel:    +49 / 40 / 384298    (private)
  537. X *                  Tel:    +49 / 40 / 55903-170 (at work)
  538. X *                  e-mail: hm@hcshh.hcs.de
  539. X *
  540. X *           All rights are reserved except as explicitly granted
  541. X *                  by written permission of the author.
  542. X *
  543. X *             See the file COPYING, distributed with wish, for
  544. X *                  restriction and warranty information
  545. X *
  546. X *---------------------------------------------------------------------------*
  547. X *
  548. X *    Last Edit-Date: [Mon Aug 30 11:36:22 1993]
  549. X *
  550. X *    -hm    initial creation
  551. X *    -hm    debug / streamline
  552. X *    -hm    wildcards
  553. X *
  554. X *----------------------------------------------------------------------------*/
  555. X
  556. Xstruct item {
  557. X    int row;        /* name row position */
  558. X    int col;        /* name column position */
  559. X    char *name;        /* field name */
  560. X    int nl;            /* name length */
  561. X    int type;        /* item type */
  562. X#define ITEM_ONOFF    0        /* YES / NO */
  563. X#define ITEM_STRING    1        /* a string */
  564. X#define ITEM_CHAR    2        /* a character */
  565. X#define ITEM_NOCHANGE    0x80        /* user cannot chage item at run-time */
  566. X    int *value;        /* pointer to variable [...hmmm] */
  567. X    char *help;        /* help/description string */
  568. X    struct item *next;    /* ptr to next item struct */
  569. X    struct item *prev;    /* ptr to previous item struct */    
  570. X};
  571. X
  572. Xstruct item i_ret, i_attr, i_pres, i_fkey, i_link, i_point, i_pager, i_editor,
  573. X        i_delim, i_wild, i_wldon, i_cdrom, i_cdnop, i_dotfn;
  574. X
  575. X#define FIRST_I        (&i_ret)
  576. X
  577. X/* ----- changable ON/OFF ----- */
  578. X
  579. Xstruct item i_ret = {
  580. X    2, 0, "   Return: ", 11, ITEM_ONOFF, (int *)&opt_return,
  581. X    "Specify wait for RETURN/ENTER key after executing an external command",
  582. X    &i_pres, &i_delim
  583. X};
  584. X
  585. Xstruct item i_pres = {
  586. X    2, 26, " Preserve: ", 11, ITEM_ONOFF, (int *)&opt_preserve, 
  587. X    "Preserve current directory when moving up in directory tree",
  588. X    &i_link, &i_ret
  589. X};
  590. X
  591. Xstruct item i_link = {
  592. X    2, 52, "    Links: ", 11, ITEM_ONOFF, (int *)&opt_links, 
  593. X    "Enable detection and display of links in the attribute window",
  594. X    &i_point, &i_pres
  595. X};
  596. X
  597. Xstruct item i_point = {
  598. X    4, 0, "      Dot: ", 11, ITEM_ONOFF, (int *)&opt_point, 
  599. X    "Enable to display the current directory as a dot",
  600. X    &i_wldon, &i_link
  601. X};
  602. X
  603. Xstruct item i_wldon = {
  604. X    4, 26, "WildEnabl: ", 11, ITEM_ONOFF, (int *)&opt_wildon,     
  605. X    "Enable wildcard filename display filtering",
  606. X    &i_delim, &i_point
  607. X};
  608. X
  609. Xstruct item i_delim = {
  610. X    4, 52, "Delimiter: ", 11, ITEM_CHAR, (int *)&opt_delimiter, 
  611. X    "Character to be used a a horizontal delimiter between windows",
  612. X    &i_cdrom, &i_wldon
  613. X};
  614. X
  615. Xstruct item i_cdrom = {
  616. X    6, 0, "   CD-Rom: ", 11, ITEM_ONOFF, (int *)&opt_cdrom,
  617. X    "Do special filename processing for cdrom filenames containing ';'",
  618. X    &i_cdnop, &i_delim
  619. X};
  620. X
  621. Xstruct item i_cdnop = {
  622. X    6, 26, "CDNoProgs: ", 11, ITEM_ONOFF, (int *)&opt_cdnoprog,         
  623. X    "Take all executable programs on CDROM as data files for display",
  624. X    &i_dotfn, &i_cdrom
  625. X};
  626. X
  627. Xstruct item i_dotfn = {
  628. X    6, 52, " DotNames: ", 11, ITEM_ONOFF, (int *)&opt_dotnames,    
  629. X    "Display Filenames starting with a Dot",
  630. X    &i_wild, &i_cdnop
  631. X};
  632. X
  633. X/* ----- changable STRING ----- */
  634. X
  635. Xstruct item i_wild = {
  636. X    8, 0, " Wildcard: ", 11, ITEM_STRING, (int *)&opt_wild[0], 
  637. X    "Wildcard string for files being displayed in the file window",
  638. X    &i_attr, &i_dotfn
  639. X};
  640. X
  641. X
  642. X/* ----- NOT changeable ON/OFF ----- */
  643. X
  644. Xstruct item i_attr = {
  645. X    12, 0, "  Attribs: ", 11, ITEM_ONOFF | ITEM_NOCHANGE, (int *)&opt_attrib, 
  646. X    "Display the current file's attributes and Permissions (NOT CHANGEABLE)",
  647. X    &i_fkey, &i_wild
  648. X};
  649. X
  650. Xstruct item i_fkey = {
  651. X    12, 40, "    Fkeys: ", 11, ITEM_ONOFF | ITEM_NOCHANGE, (int *)&opt_labels, 
  652. X    "Display virtual function key labels at bottom of the screen (NOT CHANGEABLE)",
  653. X    &i_pager, &i_attr
  654. X};
  655. X
  656. X/*----------------------- string variables -------------------------------*/
  657. X
  658. Xstruct item i_pager = {
  659. X    14, 0, "    Pager: ", 11, ITEM_STRING | ITEM_NOCHANGE, (int *)&opt_more[0], 
  660. X    "External command for program to display text (NOT CHANGEABLE)",
  661. X    &i_editor, &i_fkey    
  662. X};
  663. X
  664. Xstruct item i_editor = {
  665. X    16, 0, "   Editor: ", 11, ITEM_STRING | ITEM_NOCHANGE, (int *)&opt_edit[0], 
  666. X    "External command for program to edit text (NOT CHANGEABLE)",
  667. X    &i_ret, &i_pager
  668. X};
  669. X
  670. X/*---------------------------------- EOF ------------------------------------*/
  671. END_OF_FILE
  672.   if test 4528 -ne `wc -c <'config.h'`; then
  673.     echo shar: \"'config.h'\" unpacked with wrong size!
  674.   fi
  675.   # end of 'config.h'
  676. fi
  677. if test -f 'control.h' -a "${1}" != "-c" ; then 
  678.   echo shar: Will not clobber existing file \"'control.h'\"
  679. else
  680.   echo shar: Extracting \"'control.h'\" \(1499 characters\)
  681.   sed "s/^X//" >'control.h' <<'END_OF_FILE'
  682. X/*---------------------------------------------------------------------------*
  683. X *
  684. X *                  wish - windowing user friendly shell
  685. X *                 --------------------------------------
  686. X *
  687. X *              (c) Copyright Hellmuth Michaelis 1989 - 1993
  688. X *
  689. X *                  Eggerstedtstr. 28
  690. X *                  22765 Hamburg
  691. X *                  Germany
  692. X *
  693. X *                  Tel:    +49 / 40 / 384298    (private)
  694. X *                  Tel:    +49 / 40 / 55903-170 (at work)
  695. X *                  e-mail: hm@hcshh.hcs.de
  696. X *
  697. X *           All rights are reserved except as explicitly granted
  698. X *                  by written permission of the author.
  699. X *
  700. X *             See the file COPYING, distributed with wish, for
  701. X *                  restriction and warranty information
  702. X *
  703. X *---------------------------------------------------------------------------*/
  704. X
  705. X#define CNTRL_@    0x00
  706. X#define CNTRL_A    0x01
  707. X#define CNTRL_B    0x02
  708. X#define CNTRL_C    0x03
  709. X#define CNTRL_D    0x04
  710. X#define CNTRL_E    0x05
  711. X#define CNTRL_F    0x06
  712. X#define CNTRL_G    0x07
  713. X#define CNTRL_H    0x08
  714. X#define CNTRL_I    0x09
  715. X#define CNTRL_J    0x0A
  716. X#define CNTRL_K    0x0B 
  717. X#define CNTRL_L    0x0C
  718. X#define CNTRL_M    0x0D
  719. X#define CNTRL_N    0x0E
  720. X#define CNTRL_O    0x0F
  721. X#define CNTRL_P    0x10
  722. X#define CNTRL_Q    0x11
  723. X#define CNTRL_R    0x12
  724. X#define CNTRL_S    0x13
  725. X#define CNTRL_T    0x14
  726. X#define CNTRL_U    0x15
  727. X#define CNTRL_V    0x16
  728. X#define CNTRL_W    0x17
  729. X#define CNTRL_X    0x18
  730. X#define CNTRL_Y    0x19
  731. X#define CNTRL_Z    0x1A
  732. X
  733. X
  734. X/*--------------------------- EOF -----------------------------*/
  735. END_OF_FILE
  736.   if test 1499 -ne `wc -c <'control.h'`; then
  737.     echo shar: \"'control.h'\" unpacked with wrong size!
  738.   fi
  739.   # end of 'control.h'
  740. fi
  741. if test -f 'cursor.c' -a "${1}" != "-c" ; then 
  742.   echo shar: Will not clobber existing file \"'cursor.c'\"
  743. else
  744.   echo shar: Extracting \"'cursor.c'\" \(4494 characters\)
  745.   sed "s/^X//" >'cursor.c' <<'END_OF_FILE'
  746. X/*---------------------------------------------------------------------------*
  747. X *
  748. X *                  wish - windowing user friendly shell
  749. X *                 --------------------------------------
  750. X *
  751. X *              (c) Copyright Hellmuth Michaelis 1989 - 1993
  752. X *
  753. X *                  Eggerstedtstr. 28
  754. X *                  22765 Hamburg
  755. X *                  Germany
  756. X *
  757. X *                  Tel:    +49 / 40 / 384298    (private)
  758. X *                  Tel:    +49 / 40 / 55903-170 (at work)
  759. X *                  e-mail: hm@hcshh.hcs.de
  760. X *
  761. X *           All rights are reserved except as explicitly granted
  762. X *                  by written permission of the author.
  763. X *
  764. X *             See the file COPYING, distributed with wish, for
  765. X *                  restriction and warranty information
  766. X *
  767. X *---------------------------------------------------------------------------*
  768. X *
  769. X *    Last Edit-Date: [Fri Jul  9 15:56:23 1993]
  770. X *
  771. X *    -hm    conversion to multiple curses windows
  772. X *
  773. X *----------------------------------------------------------------------------*/
  774. X
  775. X#include "wish.h"
  776. X
  777. X/*---------------------------------------------------------------------------*
  778. X *    make current file name inverse, fill file attributes
  779. X *---------------------------------------------------------------------------*/
  780. Xvoid cur_inv(struct onefile *current)
  781. X{
  782. X    wmove(file_w,current->orow,current->ocol);
  783. X
  784. X    if(current->tag)
  785. X        wattrset(file_w, A_UNDERLINE);
  786. X    else
  787. X        wattron(file_w, A_REVERSE);
  788. X
  789. X    waddstr(file_w, &(current->onam[1]));
  790. X    wattrset(file_w, A_NORMAL);
  791. X    attribs(0);
  792. X}
  793. X
  794. X/*---------------------------------------------------------------------------*
  795. X *    make current file name blink
  796. X *---------------------------------------------------------------------------*/
  797. Xvoid cur_blink(struct onefile *current)
  798. X{
  799. X    wmove(file_w,current->orow,current->ocol);
  800. X    wattrset(file_w, A_BLINK | A_REVERSE);
  801. X    waddstr(file_w, &(current->onam[1]));
  802. X    wattrset(file_w, A_NORMAL);
  803. X}
  804. X
  805. X/*---------------------------------------------------------------------------*
  806. X *    make current filename normal again
  807. X *---------------------------------------------------------------------------*/
  808. Xvoid cur_norm(struct onefile *current)
  809. X{
  810. X    wmove(file_w, current->orow, current->ocol);
  811. X
  812. X    if(current->tag)
  813. X        wattrset(file_w, A_REVERSE);
  814. X    else
  815. X        wattrset(file_w, A_NORMAL);
  816. X
  817. X    waddstr(file_w, &(current->onam[1]));
  818. X    wattrset(file_w, A_REVERSE);
  819. X
  820. X}
  821. X
  822. X/*---------------------------------------------------------------------------*
  823. X *    tag current filename and print as tagged
  824. X *---------------------------------------------------------------------------*/
  825. Xvoid tag_current(struct onefile *current)
  826. X{
  827. X    wmove(file_w, current->orow, current->ocol);
  828. X
  829. X    if(current->tag)        /* current filename already tagged ? */
  830. X    {
  831. X        wattron(file_w, A_REVERSE);
  832. X        waddstr(file_w, &(current->onam[1]));
  833. X        wattroff(file_w, A_REVERSE);
  834. X        current->tag = 0;    /* was tagged, now untag */        
  835. X    }
  836. X    else
  837. X    {
  838. X        wattron(file_w, A_UNDERLINE);
  839. X        waddstr(file_w, &(current->onam[1]));
  840. X        wattroff(file_w, A_UNDERLINE);
  841. X        current->tag = 1;    /* was not tagged, now tag */
  842. X    }
  843. X}
  844. X
  845. X/*---------------------------------------------------------------------------*
  846. X *    if filename tagged, print as tagged, else print normal
  847. X *---------------------------------------------------------------------------*/
  848. Xvoid is_tagged(struct onefile *current)
  849. X{
  850. X    wmove(file_w, current->orow, current->ocol);
  851. X    
  852. X    if(current->tag)        /* current filename tagged ? */
  853. X    {
  854. X        wattron(file_w, A_REVERSE);
  855. X        waddstr(file_w, &(current->onam[1]));
  856. X        wattroff(file_w, A_REVERSE);
  857. X    }
  858. X    else
  859. X    {
  860. X        waddstr(file_w, &(current->onam[1]));
  861. X    }
  862. X}
  863. X
  864. X/*---------------------------------------------------------------------------*
  865. X *    untag ALL tagged filenames
  866. X *---------------------------------------------------------------------------*/
  867. Xvoid untag_all(void)
  868. X{
  869. X    struct onefile *cur_ptr;
  870. X
  871. X    int thispage = ((cur_file->page) & PAGEMASK);
  872. X    
  873. X    cur_ptr = first;    /* first file in dir */
  874. X
  875. X    while(cur_ptr != NULL)
  876. X    {
  877. X        if(cur_ptr->tag)
  878. X        {
  879. X            if((cur_ptr->page == thispage) || (cur_ptr->page == (thispage | FIRST)))
  880. X            {
  881. X                wmove(file_w, cur_ptr->orow,((cur_ptr->ocol)-1));
  882. X                wattroff(file_w,A_REVERSE);
  883. X                waddch(file_w,SPACE);
  884. X                wattroff(file_w,A_REVERSE);
  885. X                waddstr(file_w,&(cur_ptr->onam[1]));
  886. X                wattroff(file_w,A_REVERSE);
  887. X                waddch(file_w,SPACE);
  888. X                wattroff(file_w,A_REVERSE);
  889. X            }
  890. X        }
  891. X        cur_ptr->tag = 0;        
  892. X        cur_ptr = cur_ptr->next;
  893. X    }
  894. X    cur_inv(cur_file);    /* just for shure ... */
  895. X}
  896. X
  897. X/*---------------------------------- EOF -------------------------------------*/
  898. X
  899. END_OF_FILE
  900.   if test 4494 -ne `wc -c <'cursor.c'`; then
  901.     echo shar: \"'cursor.c'\" unpacked with wrong size!
  902.   fi
  903.   # end of 'cursor.c'
  904. fi
  905. if test -f 'dot-wishrc' -a "${1}" != "-c" ; then 
  906.   echo shar: Will not clobber existing file \"'dot-wishrc'\"
  907. else
  908.   echo shar: Extracting \"'dot-wishrc'\" \(1696 characters\)
  909.   sed "s/^X//" >'dot-wishrc' <<'END_OF_FILE'
  910. X#-------------------------------------------------------------------------------
  911. X#
  912. X#    .wishrc - "wish" runtime initialization file ($HOME - directory)
  913. X#
  914. X#    last edit-date: [Mon Aug 30 11:47:38 1993]
  915. X#
  916. X#-------------------------------------------------------------------------------
  917. Xattributes=on            # enable the display of file attributes in a 
  918. X                # separate window at the bottom of the screen
  919. X
  920. Xpreserve=on            # when moving the directory tree up, place the
  921. X                # current file at the directory we came from
  922. X
  923. Xfkeys=on            # enable the display of function key labels in
  924. X                # a separate window at the bootom of the screen
  925. X
  926. Xlinks=on            # enable detection of links for display in the
  927. X                # attribute window (slows reading down)
  928. X
  929. Xpoint=off            # do not show "." directory in file window
  930. X
  931. Xreturn=on            # wait for return on external command
  932. X
  933. Xshell=/bin/ksh            # shell to be used for executing commands
  934. X
  935. Xpager=/usr/local/bin/less    # pager to be used for display data
  936. X
  937. Xeditor=/usr/local/bin/emacs    # editor to be used for editing data
  938. X
  939. X# delimiter=~            # delimiter to be used to delimit the windows
  940. X                # horizontally, normally got from terminfo
  941. X
  942. Xwildenable=off            # enable filename wildcard matching, directories
  943. X                # are displayed as usual
  944. X
  945. Xwildcard=*            # wildcard specification string, see also
  946. X                # wildenable above (slows reading down if enabled)
  947. X
  948. Xcdrom=off            # cdrom special filename processing enable (some
  949. X                # systems place a ';' in the filename i.e HPUX)
  950. X
  951. Xcdnoprog=on            # display all executables on cdrom in files sect
  952. X                # (some systems tag data files as executables)
  953. X
  954. Xdotnames=on            # display filenames starting with a "."
  955. X
  956. X#-------------------------------------------------------------------------------
  957. END_OF_FILE
  958.   if test 1696 -ne `wc -c <'dot-wishrc'`; then
  959.     echo shar: \"'dot-wishrc'\" unpacked with wrong size!
  960.   fi
  961.   # end of 'dot-wishrc'
  962. fi
  963. if test -f 'fkeys.c' -a "${1}" != "-c" ; then 
  964.   echo shar: Will not clobber existing file \"'fkeys.c'\"
  965. else
  966.   echo shar: Extracting \"'fkeys.c'\" \(3867 characters\)
  967.   sed "s/^X//" >'fkeys.c' <<'END_OF_FILE'
  968. X/*---------------------------------------------------------------------------*
  969. X *
  970. X *                  wish - windowing user friendly shell
  971. X *                 --------------------------------------
  972. X *
  973. X *              (c) Copyright Hellmuth Michaelis 1989 - 1993
  974. X *
  975. X *                  Eggerstedtstr. 28
  976. X *                  22765 Hamburg
  977. X *                  Germany
  978. X *
  979. X *                  Tel:    +49 / 40 / 384298    (private)
  980. X *                  Tel:    +49 / 40 / 55903-170 (at work)
  981. X *                  e-mail: hm@hcshh.hcs.de
  982. X *
  983. X *           All rights are reserved except as explicitly granted
  984. X *                  by written permission of the author.
  985. X *
  986. X *             See the file COPYING, distributed with wish, for
  987. X *                  restriction and warranty information
  988. X *
  989. X *---------------------------------------------------------------------------*
  990. X *
  991. X *    last edit-date: [Tue Aug 24 09:50:09 1993]
  992. X *
  993. X *    -hm    modifying function key label layout
  994. X *    -hm    consistent fkey labels ( just 8 ! )
  995. X *    -hm    flabel.c -> fkeys.c
  996. X *    -hm    hpterm support
  997. X *    -hm    interactive configuration
  998. X *    -hm    fkey label structures
  999. X *
  1000. X *----------------------------------------------------------------------------*/
  1001. X
  1002. X#include "wish.h"
  1003. X
  1004. X/*---------------------------------------------------------------------------*
  1005. X *    write string to function key label
  1006. X *---------------------------------------------------------------------------*/
  1007. Xvoid fnclabel(int n, char *string)
  1008. X{
  1009. X    char xmit[5];        /* transmitted string ( ESC 'p'...'w' ) */
  1010. X    char result[50];    /* result buffer */
  1011. X
  1012. X    /* check if we are on an hp-terminal or lookalike */
  1013. X
  1014. X    if(termtype == TERM_HP || termtype == TERM_PCVT || termtype == TERM_HPX)
  1015. X    {
  1016. X        if(n < 1 || n > 8) /* and it must be a legal key number */
  1017. X            return;
  1018. X        if((strlen(string)) != 16)
  1019. X            return;
  1020. X            
  1021. X        xmit[0] = ESC;
  1022. X        xmit[1] = 'o' + n;
  1023. X        xmit[2] = '\0';
  1024. X        sprintf(result,"%c&f0a%dk16d2L%s%s",ESC,n,string,xmit);
  1025. X        write(2,result,strlen(result));
  1026. X        sprintf(result,"%c&jB",ESC);    /* display user function keys */
  1027. X        write(2,result,strlen(result));
  1028. X        return;
  1029. X    }
  1030. X    else if(opt_labels)    /* if virtual f-key labels .. */
  1031. X    {
  1032. X        if(n < 1 || n > 8) /* and it must be a legal key number */
  1033. X            return;
  1034. X
  1035. X        if((strlen(string)) != 9)
  1036. X            return;
  1037. X
  1038. X        wmove(flbl_w, 0, ((n-1)*10)); /* last line */
  1039. X
  1040. X        wattron(flbl_w, A_REVERSE);
  1041. X        waddstr(flbl_w, string);
  1042. X        wattroff(flbl_w, A_REVERSE);
  1043. X        wrefresh(flbl_w);        
  1044. X    }
  1045. X}
  1046. X
  1047. X/*---------------------------------------------------------------------------*
  1048. X *    function key labels initialization
  1049. X *---------------------------------------------------------------------------*/
  1050. Xvoid init_flabels(void)
  1051. X{
  1052. X    int i;
  1053. X    for(i = 0; i < 8; i++)
  1054. X    {
  1055. X        if(termtype == TERM_HP || termtype == TERM_PCVT || termtype == TERM_HPX)
  1056. X            fnclabel(i+1, (*cur_fktab)[i].label_16);
  1057. X        else if(opt_labels)
  1058. X            fnclabel(i+1, (*cur_fktab)[i].label_8);
  1059. X        else
  1060. X            break;
  1061. X    }
  1062. X}
  1063. X
  1064. X/*---------------------------------------------------------------------------*
  1065. X *    restore function key labels
  1066. X *---------------------------------------------------------------------------*/
  1067. Xvoid fini_flabels(void)
  1068. X{
  1069. X    static char modes[] = { ESC, '&', 'j', 'A', '\0'};
  1070. X
  1071. X     /* check if we are on an hp-terminal */
  1072. X    
  1073. X    if(termtype == TERM_HP || termtype == TERM_PCVT || termtype == TERM_HPX)
  1074. X        write(2,modes,strlen(modes));
  1075. X}
  1076. X
  1077. X/*---------------------------------------------------------------------------*
  1078. X *    system function keys table
  1079. X *---------------------------------------------------------------------------*/
  1080. X
  1081. Xstruct fk_tab sys_keys[] = {
  1082. X    {"  Edit    File  ", "Edit File"},
  1083. X    {"  Echo  Filename", "Echo Name"},
  1084. X    {"  Help  Commands", "Help Cmds"},
  1085. X    {" Config  Screen ", "Conf Scrn"},
  1086. X    {"  Mark  Filename", "Mark File"},
  1087. X    {" Unmark allmarkd", "UnmarkAll"},
  1088. X    {"                ", "         "},
  1089. X    {" Close   CurDir ", "Close Dir"}
  1090. X};
  1091. X    
  1092. X/*---------------------------------- EOF -------------------------------------*/
  1093. END_OF_FILE
  1094.   if test 3867 -ne `wc -c <'fkeys.c'`; then
  1095.     echo shar: \"'fkeys.c'\" unpacked with wrong size!
  1096.   fi
  1097.   # end of 'fkeys.c'
  1098. fi
  1099. if test -f 'help.c' -a "${1}" != "-c" ; then 
  1100.   echo shar: Will not clobber existing file \"'help.c'\"
  1101. else
  1102.   echo shar: Extracting \"'help.c'\" \(5040 characters\)
  1103.   sed "s/^X//" >'help.c' <<'END_OF_FILE'
  1104. X/*---------------------------------------------------------------------------*
  1105. X *
  1106. X *                  wish - windowing user friendly shell
  1107. X *                  ------------------------------------
  1108. X *
  1109. X *               Copyright (c) 1988-1993 Hellmuth Michaelis
  1110. X *
  1111. X *                  Eggerstedtstr. 28
  1112. X *                  22765 Hamburg
  1113. X *                  Germany
  1114. X *
  1115. X *                  Tel:    +49 / 40 / 384298    (private)
  1116. X *                  Tel:    +49 / 40 / 55903-170 (at work)
  1117. X *                  e-mail: hm@hcshh.hcs.de
  1118. X *
  1119. X *                          --------oOo--------
  1120. X *
  1121. X *   This program is free software; you can redistribute it and/or modify
  1122. X *   it under the terms of the GNU General Public License as published by
  1123. X *   the Free Software Foundation; either version 2 of the License, or
  1124. X *   (at your option) any later version.
  1125. X *
  1126. X *   This program is distributed in the hope that it will be useful,
  1127. X *   but WITHOUT ANY WARRANTY; without even the implied warranty of
  1128. X *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  1129. X *   GNU General Public License for more details.
  1130. X *
  1131. X *   You should have received a copy of the GNU General Public License
  1132. X *   along with this program; if not, write to the Free Software
  1133. X *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  1134. X *
  1135. X *---------------------------------------------------------------------------*
  1136. X *
  1137. X *    Last Edit-Date: [Mon Aug 30 19:50:42 1993]
  1138. X *
  1139. X *    -hm    fkey labels for help screen
  1140. X *
  1141. X *----------------------------------------------------------------------------*/
  1142. X#include "wish.h"
  1143. X
  1144. X#define    MAXHELPL    20
  1145. X
  1146. X
  1147. X/*---------------------------------------------------------------------------*
  1148. X *    help function keys
  1149. X *---------------------------------------------------------------------------*/
  1150. X    
  1151. Xstatic struct fk_tab help_keys[] = {
  1152. X    {"                ", "         "},
  1153. X    {"                ", "         "},
  1154. X    {"                ", "         "},
  1155. X    {"                ", "         "},
  1156. X    {"                ", "         "},
  1157. X    {"                ", "         "},
  1158. X    {"                ", "         "},
  1159. X    {"                ", "         "}
  1160. X};
  1161. X
  1162. Xstatic char *helpstr[MAXHELPL] = {
  1163. X"   ----------------------- Command Window Commands: -------------------------",
  1164. X"",
  1165. X"   Backspace - Delete left Character    Delete    - Delete Cursor Character",
  1166. X"   Control-F - Character forward        Control-B - Character backward",
  1167. X"   Control-A - Begin of Line            Control-E - End of Line",
  1168. X"   Control-N - Next Line                Control-P - Previous Line",
  1169. X"   Control-K - Kill Line from Cursor    Control-Y - Yank back killed Line",
  1170. X"   Control-D - Exit back to System      \"%\" is the marked files wildcard char",
  1171. X"",
  1172. X"   ------------------------- File Window Commands: --------------------------",
  1173. X"",
  1174. X"   Cursor up, Cursor down, Cursor right, Cursor left - Select a file",
  1175. X"   Page Up   - Previous file page       Page Down - Next file page",
  1176. X"   F1        - Edit current file        F2        - Echo name to commandline",
  1177. X"   F3        - Display this help        F4        - Enter configuration menu",
  1178. X"   F5        - Mark the current file    F6        - Unmark all marked files",
  1179. X"   F7        -                          F8        - Close current directory",
  1180. X"",
  1181. X"   Alternate Invocation of F1...F8 by pressing ESCAPE and then '1'...'8'",
  1182. X"   Alternate Invocation of Page up/down by pressing ESCAPE and then 'N' or 'P'",
  1183. X};
  1184. X
  1185. Xchar *contin = {"Press any Key to continue ..."};
  1186. X
  1187. X/*---------------------------------------------------------------------------*
  1188. X *    help page
  1189. X *---------------------------------------------------------------------------*/
  1190. Xvoid help(void)
  1191. X{
  1192. X    int i;
  1193. X    
  1194. X    suspend_time();        /* stop updating time */
  1195. X
  1196. X    cur_fktab = &help_keys;    /* help screen fkey label table */
  1197. X    init_flabels();
  1198. X    
  1199. X    wmove(stdscr, 0, 0);    /* first line */
  1200. X    wclear(stdscr);        /* clear window */
  1201. X    touchwin(stdscr);
  1202. X    wnoutrefresh(stdscr);
  1203. X
  1204. X    move(0, 0);        /* first line */
  1205. X    attron(A_REVERSE);    /* highlight on */
  1206. X    addstr(headerline);    /* program/copyright header */
  1207. X    attroff(A_REVERSE);    /* highlight off */
  1208. X
  1209. X    for(i = 0; i < MAXHELPL; i++)
  1210. X        mvaddstr(2+i, 0, helpstr[i]);    /* print help screen */
  1211. X    
  1212. X    move(LINES-1, 0);            /* last line */
  1213. X
  1214. X    attron(A_REVERSE);            /* highlight on */
  1215. X    addstr(contin);
  1216. X    attroff(A_REVERSE);            /* highlight on */        
  1217. X    move(LINES-1, strlen(contin));        /* last line */    
  1218. X    refresh();                /* show it */
  1219. X
  1220. X    getch();        /* get any char from user */
  1221. X
  1222. X    wmove(stdscr, 0, 0);    /* first line */
  1223. X    wclear(stdscr);        /* clear window */
  1224. X    touchwin(stdscr);
  1225. X    wnoutrefresh(stdscr);
  1226. X
  1227. X    touchwin(cmnd_w);
  1228. X    touchwin(fst_w);
  1229. X    touchwin(file_w);
  1230. X    if(opt_attrib)
  1231. X        touchwin(attr_w);
  1232. X    if(opt_labels)
  1233. X        touchwin(flbl_w);
  1234. X    
  1235. X    resume_time();        /* restart updating time */
  1236. X
  1237. X    header();        /* new header */
  1238. X    dis_hist();        /* display current commandline */
  1239. X    fresh_files();        /* refresh files */
  1240. X    attribs(1);        /* new attributes */
  1241. X    update_all();        /* update complete screen */
  1242. X
  1243. X    cur_fktab = &sys_keys;    /* system fkey label table */
  1244. X    init_flabels();
  1245. X}
  1246. X
  1247. X/*----------------------- E O F -------------------------------------------*/
  1248. END_OF_FILE
  1249.   if test 5040 -ne `wc -c <'help.c'`; then
  1250.     echo shar: \"'help.c'\" unpacked with wrong size!
  1251.   fi
  1252.   # end of 'help.c'
  1253. fi
  1254. if test -f 'patchlevel.h' -a "${1}" != "-c" ; then 
  1255.   echo shar: Will not clobber existing file \"'patchlevel.h'\"
  1256. else
  1257.   echo shar: Extracting \"'patchlevel.h'\" \(1734 characters\)
  1258.   sed "s/^X//" >'patchlevel.h' <<'END_OF_FILE'
  1259. X/*---------------------------------------------------------------------------*
  1260. X *
  1261. X *                  wish - windowing user friendly shell
  1262. X *                  ------------------------------------
  1263. X *
  1264. X *               Copyright (c) 1988-1993 Hellmuth Michaelis
  1265. X *
  1266. X *                  Eggerstedtstr. 28
  1267. X *                  22765 Hamburg
  1268. X *                  Germany
  1269. X *
  1270. X *                  Tel:    +49 / 40 / 384298    (private)
  1271. X *                  Tel:    +49 / 40 / 55903-170 (at work)
  1272. X *                  e-mail: hm@hcshh.hcs.de
  1273. X *
  1274. X *                          --------oOo--------
  1275. X *
  1276. X *   This program is free software; you can redistribute it and/or modify
  1277. X *   it under the terms of the GNU General Public License as published by
  1278. X *   the Free Software Foundation; either version 2 of the License, or
  1279. X *   (at your option) any later version.
  1280. X *
  1281. X *   This program is distributed in the hope that it will be useful,
  1282. X *   but WITHOUT ANY WARRANTY; without even the implied warranty of
  1283. X *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  1284. X *   GNU General Public License for more details.
  1285. X *
  1286. X *   You should have received a copy of the GNU General Public License
  1287. X *   along with this program; if not, write to the Free Software
  1288. X *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  1289. X *
  1290. X *---------------------------------------------------------------------------*
  1291. X *
  1292. X *    Last Edit-Date: [Mon Sep 20 16:55:05 1993]
  1293. X *
  1294. X *    -hm    added patchlevel.h for submission
  1295. X *
  1296. X *----------------------------------------------------------------------------*/
  1297. X
  1298. X/* first public release to comp.sources.misc in September 1993 */
  1299. X
  1300. X#define PATCHLEVEL "1.00"
  1301. X
  1302. X/*--------------------------------- EOF -------------------------------------*/
  1303. END_OF_FILE
  1304.   if test 1734 -ne `wc -c <'patchlevel.h'`; then
  1305.     echo shar: \"'patchlevel.h'\" unpacked with wrong size!
  1306.   fi
  1307.   # end of 'patchlevel.h'
  1308. fi
  1309. if test -f 'rcinit.h' -a "${1}" != "-c" ; then 
  1310.   echo shar: Will not clobber existing file \"'rcinit.h'\"
  1311. else
  1312.   echo shar: Extracting \"'rcinit.h'\" \(2259 characters\)
  1313.   sed "s/^X//" >'rcinit.h' <<'END_OF_FILE'
  1314. X/*---------------------------------------------------------------------------*
  1315. X *
  1316. X *                  wish - windowing user friendly shell
  1317. X *                  ------------------------------------
  1318. X *
  1319. X *               Copyright (c) 1988-1993 Hellmuth Michaelis
  1320. X *
  1321. X *                  Eggerstedtstr. 28
  1322. X *                  22765 Hamburg
  1323. X *                  Germany
  1324. X *
  1325. X *                  Tel:    +49 / 40 / 384298    (private)
  1326. X *                  Tel:    +49 / 40 / 55903-170 (at work)
  1327. X *                  e-mail: hm@hcshh.hcs.de
  1328. X *
  1329. X *                          --------oOo--------
  1330. X *
  1331. X *   This program is free software; you can redistribute it and/or modify
  1332. X *   it under the terms of the GNU General Public License as published by
  1333. X *   the Free Software Foundation; either version 2 of the License, or
  1334. X *   (at your option) any later version.
  1335. X *
  1336. X *   This program is distributed in the hope that it will be useful,
  1337. X *   but WITHOUT ANY WARRANTY; without even the implied warranty of
  1338. X *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  1339. X *   GNU General Public License for more details.
  1340. X *
  1341. X *   You should have received a copy of the GNU General Public License
  1342. X *   along with this program; if not, write to the Free Software
  1343. X *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  1344. X *
  1345. X *---------------------------------------------------------------------------*
  1346. X *
  1347. X *    Last Edit-Date: [Mon Aug 30 19:52:11 1993]
  1348. X *
  1349. X *    -hm    init file ".wishrc"
  1350. X *    -hm    wildcards
  1351. X *    -hm    cdrom processing for ';' chars
  1352. X *
  1353. X *----------------------------------------------------------------------------*/
  1354. X
  1355. X#define WISHRC        ".wishrc"    /* our config file */
  1356. X
  1357. X#define    RC_ON        "on"
  1358. X#define    RC_OFF        "off"
  1359. X
  1360. X/* booolean variables (on/off) */
  1361. X
  1362. X#define    RC_ATTR        "attributes"
  1363. X#define    RC_PRESERVE    "preserve"
  1364. X#define    RC_FKEYS    "fkeys"
  1365. X#define    RC_LINKS    "links"
  1366. X#define    RC_POINT    "point"
  1367. X#define RC_RETURN    "return"
  1368. X#define RC_WILDON    "wildenable"
  1369. X#define RC_CDROM    "cdrom"
  1370. X#define RC_CDNOPROG    "cdnoprog"
  1371. X#define RC_DOTNAMES    "dotnames"
  1372. X
  1373. X/* string variables */
  1374. X
  1375. X#define    RC_PAGER    "pager"
  1376. X#define    RC_EDITOR    "editor"
  1377. X#define RC_WILDCARD    "wildcard"
  1378. X
  1379. X/* character variables */
  1380. X
  1381. X#define RC_DELIMITER    "delimiter"
  1382. X
  1383. X/*---------------------------------- EOF ------------------------------------*/
  1384. END_OF_FILE
  1385.   if test 2259 -ne `wc -c <'rcinit.h'`; then
  1386.     echo shar: \"'rcinit.h'\" unpacked with wrong size!
  1387.   fi
  1388.   # end of 'rcinit.h'
  1389. fi
  1390. if test -f 'showtime.c' -a "${1}" != "-c" ; then 
  1391.   echo shar: Will not clobber existing file \"'showtime.c'\"
  1392. else
  1393.   echo shar: Extracting \"'showtime.c'\" \(3438 characters\)
  1394.   sed "s/^X//" >'showtime.c' <<'END_OF_FILE'
  1395. X/*---------------------------------------------------------------------------*
  1396. X *
  1397. X *                  wish - windowing user friendly shell
  1398. X *                  ------------------------------------
  1399. X *
  1400. X *               Copyright (c) 1988-1993 Hellmuth Michaelis
  1401. X *
  1402. X *                  Eggerstedtstr. 28
  1403. X *                  22765 Hamburg
  1404. X *                  Germany
  1405. X *
  1406. X *                  Tel:    +49 / 40 / 384298    (private)
  1407. X *                  Tel:    +49 / 40 / 55903-170 (at work)
  1408. X *                  e-mail: hm@hcshh.hcs.de
  1409. X *
  1410. X *                          --------oOo--------
  1411. X *
  1412. X *   This program is free software; you can redistribute it and/or modify
  1413. X *   it under the terms of the GNU General Public License as published by
  1414. X *   the Free Software Foundation; either version 2 of the License, or
  1415. X *   (at your option) any later version.
  1416. X *
  1417. X *   This program is distributed in the hope that it will be useful,
  1418. X *   but WITHOUT ANY WARRANTY; without even the implied warranty of
  1419. X *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  1420. X *   GNU General Public License for more details.
  1421. X *
  1422. X *   You should have received a copy of the GNU General Public License
  1423. X *   along with this program; if not, write to the Free Software
  1424. X *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  1425. X *
  1426. X *---------------------------------------------------------------------------*
  1427. X *
  1428. X *    last edit-date: [Mon Aug 30 19:52:27 1993]
  1429. X *
  1430. X *---------------------------------------------------------------------------*/
  1431. X
  1432. X#include "wish.h"
  1433. X
  1434. Xvoid timeout_hdlr(int sig);
  1435. Xstatic void make_time(void);
  1436. X
  1437. X/*---------------------------------------------------------------------------*
  1438. X *    init time display in header
  1439. X *---------------------------------------------------------------------------*/
  1440. Xvoid init_time(void)
  1441. X{
  1442. X    signal(SIGALRM, &timeout_hdlr);
  1443. X    make_time();
  1444. X    alarm(30);
  1445. X}
  1446. X
  1447. X/*---------------------------------------------------------------------------*
  1448. X *    print current time into header
  1449. X *---------------------------------------------------------------------------*/
  1450. Xstatic void make_time(void)
  1451. X{
  1452. X    static struct tm *tmptr;
  1453. X    static time_t t;
  1454. X    static char buf[6];
  1455. X    
  1456. X    time(&t);
  1457. X    tmptr = localtime(&t);
  1458. X    sprintf(buf,"%02d:%02d", tmptr->tm_hour,tmptr->tm_min);
  1459. X
  1460. X    strcpy(headerline+75,buf);
  1461. X}
  1462. X
  1463. X/*---------------------------------------------------------------------------*
  1464. X *    the timeout handler
  1465. X *---------------------------------------------------------------------------*/
  1466. Xvoid timeout_hdlr(int sig)
  1467. X{
  1468. X    static int i;
  1469. X
  1470. X    signal(SIGALRM, SIG_IGN);
  1471. X
  1472. X    make_time();
  1473. X    
  1474. X    if(!errorflag)
  1475. X    {
  1476. X        i = 0;
  1477. X        if(COLS > 80)
  1478. X            i = (COLS - 80)/2;
  1479. X        wmove(cmnd_w, C_HEAD, 75+i );
  1480. X        wattron(cmnd_w, A_REVERSE);
  1481. X        waddstr(cmnd_w, headerline+75);
  1482. X        wattroff(cmnd_w, A_REVERSE);
  1483. X        wmove(cmnd_w, C_LINE, curcol());
  1484. X        wrefresh(cmnd_w);
  1485. X    }
  1486. X    alarm(30);
  1487. X    signal(SIGALRM, timeout_hdlr);
  1488. X}    
  1489. X
  1490. X/*---------------------------------------------------------------------------*
  1491. X *    stop updating the time
  1492. X *---------------------------------------------------------------------------*/
  1493. Xvoid suspend_time(void)
  1494. X{
  1495. X    signal(SIGALRM, SIG_IGN);
  1496. X}
  1497. X
  1498. X/*---------------------------------------------------------------------------*
  1499. X *    restart updating the time
  1500. X *---------------------------------------------------------------------------*/
  1501. Xvoid resume_time(void)    
  1502. X{
  1503. X    signal(SIGALRM, &timeout_hdlr);
  1504. X    make_time();
  1505. X}    
  1506. X
  1507. X/*---------------------------------- EOF -------------------------------------*/
  1508. END_OF_FILE
  1509.   if test 3438 -ne `wc -c <'showtime.c'`; then
  1510.     echo shar: \"'showtime.c'\" unpacked with wrong size!
  1511.   fi
  1512.   # end of 'showtime.c'
  1513. fi
  1514. if test -f 'usage.c' -a "${1}" != "-c" ; then 
  1515.   echo shar: Will not clobber existing file \"'usage.c'\"
  1516. else
  1517.   echo shar: Extracting \"'usage.c'\" \(4355 characters\)
  1518.   sed "s/^X//" >'usage.c' <<'END_OF_FILE'
  1519. X/*---------------------------------------------------------------------------*
  1520. X *
  1521. X *                  wish - windowing user friendly shell
  1522. X *                  ------------------------------------
  1523. X *
  1524. X *               Copyright (c) 1988-1993 Hellmuth Michaelis
  1525. X *
  1526. X *                  Eggerstedtstr. 28
  1527. X *                  22765 Hamburg
  1528. X *                  Germany
  1529. X *
  1530. X *                  Tel:    +49 / 40 / 384298    (private)
  1531. X *                  Tel:    +49 / 40 / 55903-170 (at work)
  1532. X *                  e-mail: hm@hcshh.hcs.de
  1533. X *
  1534. X *                          --------oOo--------
  1535. X *
  1536. X *   This program is free software; you can redistribute it and/or modify
  1537. X *   it under the terms of the GNU General Public License as published by
  1538. X *   the Free Software Foundation; either version 2 of the License, or
  1539. X *   (at your option) any later version.
  1540. X *
  1541. X *   This program is distributed in the hope that it will be useful,
  1542. X *   but WITHOUT ANY WARRANTY; without even the implied warranty of
  1543. X *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  1544. X *   GNU General Public License for more details.
  1545. X *
  1546. X *   You should have received a copy of the GNU General Public License
  1547. X *   along with this program; if not, write to the Free Software
  1548. X *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  1549. X *
  1550. X *---------------------------------------------------------------------------*
  1551. X *
  1552. X *    Last Edit-Date: [Mon Sep 20 16:52:10 1993]
  1553. X *
  1554. X *    -hm    adding compilation revision numbers
  1555. X *    -hm    prototyping, updating, vt220 support
  1556. X *    -hm    386bsd intro
  1557. X *    -hm    hpterm, hpux 9.0
  1558. X *    -hm    interactive configuration
  1559. X *    -hm    altcharset in config.c on hpux
  1560. X *    -hm    preserve bug fixed in hpux
  1561. X *    -hm    multiple extension support in commandline.c
  1562. X *    -hm    fkey label structures
  1563. X *    -hm    wildcards
  1564. X *    -hm    cdrom options
  1565. X *    -hm    primitive filename completition
  1566. X *    -hm    option display dot-filenames
  1567. X *    -hm    option processing
  1568. X *    -hm    added patchlevel.h for submission
  1569. X *    -hm    released to comp.sources.misc
  1570. X *
  1571. X *----------------------------------------------------------------------------*/
  1572. X
  1573. X#include "wish.h"
  1574. X#include "patchlevel.h"
  1575. X
  1576. X/*---------------------------------------------------------------------------*
  1577. X *    format the headerline
  1578. X *---------------------------------------------------------------------------*/
  1579. Xvoid init_header(void)
  1580. X{
  1581. X    sprintf(headerline, "Wish %s.%02d  (c)Copyright 1988-1993 Hellmuth Michaelis, Hamburg [%6.6s]       ", 
  1582. X    PATCHLEVEL,
  1583. X#include "update.h"
  1584. X    ,term_string);
  1585. X}
  1586. X
  1587. X/*---------------------------------------------------------------------------*
  1588. X *    format & print the usage display
  1589. X *---------------------------------------------------------------------------*/
  1590. Xvoid usage(void)
  1591. X{
  1592. X    fprintf(stderr,"\n   Wish - WindowShell  Revision %s.%02d, %s, %s\n",
  1593. X    PATCHLEVEL,
  1594. X#include "update.h"
  1595. X    ,__DATE__,__TIME__);
  1596. X    fprintf(stderr,"Copyright (c) 1988 - 1993 by Hellmuth Michaelis, Hamburg, Germany\n\n");
  1597. X    fprintf(stderr," Wish comes with ABSOLUTELY NO WARRANTY; for details see the file\n");
  1598. X    fprintf(stderr," COPYING, which should have come with the source for this program.\n");
  1599. X    fprintf(stderr,"   This is free software, and you are welcome to redistribute it\n");
  1600. X    fprintf(stderr,"      under certain conditions; see file COPYING for details.\n\n");
  1601. X    fprintf(stderr,"     Usage:   wish [[+ | -] [acCdflnprw]] | [-?]\n\n");
  1602. X    fprintf(stderr,"   Options:   +/-a  file attributes display window on/off\n");
  1603. X    fprintf(stderr,"              +/-c  enable special cdrom filename processing (\";\") on/off\n");
  1604. X    fprintf(stderr,"              +/-C  on cdrom handle programs as data files on/off\n");
  1605. X    fprintf(stderr,"              +/-d  preserve current directory when \"cd ..\" on/off\n");
  1606. X    fprintf(stderr,"              +/-f  display virtual fkey labels window on/off\n");
  1607. X    fprintf(stderr,"              +/-l  file link detection enable on/off\n");
  1608. X    fprintf(stderr,"              +/-n  display filenames beginning with a dot (\".\") on/off\n");
  1609. X    fprintf(stderr,"              +/-p  display the current directory (as a \".\") on/off\n");
  1610. X    fprintf(stderr,"              +/-r  wait for return after external command on/off\n");
  1611. X    fprintf(stderr,"              +/-w  enable wildcard filename processing on/off\n");    
  1612. X    fprintf(stderr,"              -?    display this help text\n\n");
  1613. X    exit(99);    
  1614. X}
  1615. X
  1616. X/*---------------------------------- EOF -------------------------------------*/
  1617. END_OF_FILE
  1618.   if test 4355 -ne `wc -c <'usage.c'`; then
  1619.     echo shar: \"'usage.c'\" unpacked with wrong size!
  1620.   fi
  1621.   # end of 'usage.c'
  1622. fi
  1623. if test -f 'usrgrp.c' -a "${1}" != "-c" ; then 
  1624.   echo shar: Will not clobber existing file \"'usrgrp.c'\"
  1625. else
  1626.   echo shar: Extracting \"'usrgrp.c'\" \(4639 characters\)
  1627.   sed "s/^X//" >'usrgrp.c' <<'END_OF_FILE'
  1628. X/*---------------------------------------------------------------------------*
  1629. X *
  1630. X *                  wish - windowing user friendly shell
  1631. X *                  ------------------------------------
  1632. X *
  1633. X *               Copyright (c) 1988-1993 Hellmuth Michaelis
  1634. X *
  1635. X *                  Eggerstedtstr. 28
  1636. X *                  22765 Hamburg
  1637. X *                  Germany
  1638. X *
  1639. X *                  Tel:    +49 / 40 / 384298    (private)
  1640. X *                  Tel:    +49 / 40 / 55903-170 (at work)
  1641. X *                  e-mail: hm@hcshh.hcs.de
  1642. X *
  1643. X *                          --------oOo--------
  1644. X *
  1645. X *   This program is free software; you can redistribute it and/or modify
  1646. X *   it under the terms of the GNU General Public License as published by
  1647. X *   the Free Software Foundation; either version 2 of the License, or
  1648. X *   (at your option) any later version.
  1649. X *
  1650. X *   This program is distributed in the hope that it will be useful,
  1651. X *   but WITHOUT ANY WARRANTY; without even the implied warranty of
  1652. X *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  1653. X *   GNU General Public License for more details.
  1654. X *
  1655. X *   You should have received a copy of the GNU General Public License
  1656. X *   along with this program; if not, write to the Free Software
  1657. X *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  1658. X *
  1659. X *---------------------------------------------------------------------------*
  1660. X *
  1661. X * This is based on some file i got from some Berkley distribution years ago,
  1662. X * i really forgot which one, and i forgot the name of the file this is from,
  1663. X * so i just copied the copyright notice from some other file:
  1664. X *
  1665. X * Copyright (c) 1988 The Regents of the University of California.
  1666. X * All rights reserved.
  1667. X *
  1668. X * Redistribution and use in source and binary forms are permitted
  1669. X * provided that: (1) source distributions retain this entire copyright
  1670. X * notice and comment, and (2) distributions including binaries display
  1671. X * the following acknowledgement:  ``This product includes software
  1672. X * developed by the University of California, Berkeley and its contributors''
  1673. X * in the documentation or other materials provided with the distribution
  1674. X * and in all advertising materials mentioning features or use of this
  1675. X * software. Neither the name of the University nor the names of its
  1676. X * contributors may be used to endorse or promote products derived
  1677. X * from this software without specific prior written permission.
  1678. X * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
  1679. X * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
  1680. X * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  1681. X *
  1682. X *---------------------------------------------------------------------------*
  1683. X *
  1684. X *    last edit-date: [Wed Sep 22 13:28:38 1993]
  1685. X *
  1686. X *    -hm    caching uid/gid entries
  1687. X *    -hm    new calling sequence
  1688. X *
  1689. X *---------------------------------------------------------------------------*/ 
  1690. X
  1691. X#include "wish.h"
  1692. X
  1693. X#ifndef min
  1694. X#define min(x, y)    (((x) < (y)) ? (x) : (y))
  1695. X#endif
  1696. X
  1697. X#define    NCACHE        256
  1698. X#define    MASK        (NCACHE - 1)
  1699. X#define NAMELENGTH    16
  1700. X
  1701. X/*---------------------------------------------------------------------------*
  1702. X *    make a user id string from the numeric user id (and cache a bit)
  1703. X *---------------------------------------------------------------------------*/
  1704. Xchar *user_from_uid(uid_t uid, int size)
  1705. X{
  1706. X    static struct ncache
  1707. X    {
  1708. X        uid_t    uid;
  1709. X        char    name[NAMELENGTH];
  1710. X    } c_uid[NCACHE];
  1711. X
  1712. X    static char nbuf[15];
  1713. X    register struct passwd *pw;
  1714. X    register struct ncache *cp;
  1715. X    int length = min(NAMELENGTH, size);
  1716. X    
  1717. X    cp = (c_uid + (uid & MASK));
  1718. X
  1719. X    if (cp->uid != uid || !*cp->name)
  1720. X    {
  1721. X        if (!(pw = getpwuid(uid)))
  1722. X        {
  1723. X            sprintf(nbuf, "%-*u", length, uid);
  1724. X            return(nbuf);
  1725. X        }
  1726. X        cp->uid = uid;
  1727. X        sprintf(cp->name, "%-*s", NAMELENGTH, pw->pw_name);
  1728. X    }
  1729. X    strncpy(nbuf, cp->name, length);
  1730. X    return(nbuf);
  1731. X}
  1732. X
  1733. X/*---------------------------------------------------------------------------*
  1734. X *    make a group id string from the numeric group id (and cache a bit)
  1735. X *---------------------------------------------------------------------------*/
  1736. Xchar *group_from_gid(gid_t gid, int size)
  1737. X{
  1738. X    static struct ncache
  1739. X    {
  1740. X        gid_t    gid;
  1741. X        char    name[NAMELENGTH];
  1742. X    } c_gid[NCACHE];
  1743. X
  1744. X    static char nbuf[15];
  1745. X    register struct group *gr;
  1746. X    register struct ncache *cp;
  1747. X    int length = min(NAMELENGTH, size);
  1748. X    
  1749. X    cp = c_gid + (gid & MASK);
  1750. X    if (cp->gid != gid || !*cp->name)
  1751. X    {
  1752. X        if (!(gr = getgrgid(gid)))
  1753. X        {
  1754. X            sprintf(nbuf, "%-*u", length, gid);
  1755. X            return(nbuf);
  1756. X        }
  1757. X        cp->gid = gid;
  1758. X        sprintf(cp->name, "%-*s", NAMELENGTH, gr->gr_name);
  1759. X    }
  1760. X
  1761. X    strncpy(nbuf, cp->name, length);
  1762. X    return(nbuf);
  1763. X}
  1764. X
  1765. X/*---------------------------------- EOF -------------------------------------*/
  1766. END_OF_FILE
  1767.   if test 4639 -ne `wc -c <'usrgrp.c'`; then
  1768.     echo shar: \"'usrgrp.c'\" unpacked with wrong size!
  1769.   fi
  1770.   # end of 'usrgrp.c'
  1771. fi
  1772. echo shar: End of archive 4 \(of 4\).
  1773. cp /dev/null ark4isdone
  1774. MISSING=""
  1775. for I in 1 2 3 4 ; do
  1776.     if test ! -f ark${I}isdone ; then
  1777.     MISSING="${MISSING} ${I}"
  1778.     fi
  1779. done
  1780. if test "${MISSING}" = "" ; then
  1781.     echo You have unpacked all 4 archives.
  1782.     rm -f ark[1-9]isdone
  1783. else
  1784.     echo You still must unpack the following archives:
  1785.     echo "        " ${MISSING}
  1786. fi
  1787. exit 0
  1788. exit 0 # Just in case...
  1789.