home *** CD-ROM | disk | FTP | other *** search
Text File | 1993-11-01 | 35.3 KB | 1,035 lines |
- Newsgroups: comp.sources.misc
- From: hm@hcshh.hcs.de (Hellmuth Michaelis)
- Subject: v40i072: cwish - Window Shell / Filemanager v2.00, Part05/05
- Message-ID: <1993Nov1.220812.9651@sparky.sterling.com>
- X-Md4-Signature: dcf0e3012b99fd2c103b4da69dea30ea
- Sender: kent@sparky.sterling.com (Kent Landfield)
- Organization: Sterling Software
- Date: Mon, 1 Nov 1993 22:08:12 GMT
- Approved: kent@sparky.sterling.com
-
- Submitted-by: hm@hcshh.hcs.de (Hellmuth Michaelis)
- Posting-number: Volume 40, Issue 72
- Archive-name: cwish/part05
- Environment: UNIX, ANSI-C, SYSV-CURSES
- Supersedes: cwish: Volume 39, Issue 97-100
-
- #! /bin/sh
- # This is a shell archive. Remove anything before this line, then feed it
- # into a shell via "sh file" or similar. To overwrite existing files,
- # type "sh file -c".
- # Contents: MANIFEST ChangeLog complete.c config.h control.h fkeys.c
- # patchlevel.h rcinit.h usage.c usrgrp.c
- # Wrapped by kent@sparky on Fri Oct 29 14:39:11 1993
- PATH=/bin:/usr/bin:/usr/ucb:/usr/local/bin:/usr/lbin:$PATH ; export PATH
- echo If this archive is complete, you will see the following message:
- echo ' "shar: End of archive 5 (of 5)."'
- if test -f 'MANIFEST' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'MANIFEST'\"
- else
- echo shar: Extracting \"'MANIFEST'\" \(1407 characters\)
- sed "s/^X//" >'MANIFEST' <<'END_OF_FILE'
- XFile Name Description
- X-----------------------------------------------------------
- XCOPYING GNU GENERAL PUBLIC LICENSE
- XChangeLog Description of changes
- XMANIFEST This shipping list
- XMakefile.386bsd Makefile for 386BSD, NetBSD etc.
- XMakefile.aix Makefile for RS/6000 AIX 3.2.4
- XMakefile.hpux Makefile for HP-UX 8.0/9.0
- XMakefile.linux Makefile for Linux (0.99.pl9-1)
- XMakefile.sunos Makefile for SunOS 4.1.3
- XMakefile.ultrix Makefile for Ultrix
- XREADME Intro
- Xchdir.c cd wildcard functions
- Xcommandline.c commandline window handling
- Xcomplete.c primitive filename completition
- Xconfig.c runtime configuration menu
- Xconfig.h header file for config.c
- Xcontrol.h control character defines
- Xcursor.c highlighting functions
- Xdot-cwishrc sample .cwishrc file
- Xfiles.c the directory scanner
- Xfkeys.c function key label handling
- Xheader.c header & attribute window misc
- Xhelp.c help screen
- Xhistory.c commandline history functions
- Xmovement.c current file movement functions
- Xpaging.c current directory linked list formatting
- Xpatchlevel.h the current patchlevel
- Xrcinit.c initialization file processing
- Xrcinit.h defines for rcinit.c
- Xshowtime.c signal handling for time display
- Xusage.c usage and copyright information
- Xusrgrp.c user and group name extraction & cacheing
- Xcwish.1 the manual page
- Xcwish.c program startup and main loop
- Xcwish.h the global header file
- X
- END_OF_FILE
- if test 1407 -ne `wc -c <'MANIFEST'`; then
- echo shar: \"'MANIFEST'\" unpacked with wrong size!
- fi
- # end of 'MANIFEST'
- fi
- if test -f 'ChangeLog' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'ChangeLog'\"
- else
- echo shar: Extracting \"'ChangeLog'\" \(1289 characters\)
- sed "s/^X//" >'ChangeLog' <<'END_OF_FILE'
- X
- XPATCHLEVEL 2.00
- X-------------------------------------------------------------------------------
- X
- X - headerline terminal name field adjusted
- X - makefile for Linux
- X - added counter to keep track of the size of all tagged files
- X (suggested by Jim Graham, jim@n5ial.mythical.com)
- X - inode display in alternate attribute line
- X - Makefile for AIX
- X - soft/hard links confusion cleanup
- X - alternate status line switchable by F7 / status line cleanup
- X - rename wish to cwish, cleanup of all text and man page
- X - intro of DATE_US and REREAD_AFTER_EDIT flag in Makefiles
- X - malloced filename string in struct onefile to save runtime space
- X - added variable opt_tagmove to select wether to move to the next
- X file after tagging the current one or to stay on the current.
- X (suggested by Jim Graham, jim@n5ial.mythical.com)
- X - added conditional defines for S_ISLNK and S_ISSOCK in files.c
- X (report by Thanh Ma, tma@encore.com)
- X - SunOS 4.1.3 patch from Thomas E. Dickey, dickey@software.org
- X - patch for hp-ux 8.0 from: Jean-Yves Kerjan, jyk@ratp.noisy.ratp.fr
- X - ultrix patches from Gertjan van Oosten, gvoosten@isosa1.estec.esa.nl
- X
- X
- XPATCHLEVEL 1.00
- X-------------------------------------------------------------------------------
- X
- X - first public release to comp.sources.misc in September 1993
- END_OF_FILE
- if test 1289 -ne `wc -c <'ChangeLog'`; then
- echo shar: \"'ChangeLog'\" unpacked with wrong size!
- fi
- # end of 'ChangeLog'
- fi
- if test -f 'complete.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'complete.c'\"
- else
- echo shar: Extracting \"'complete.c'\" \(4028 characters\)
- sed "s/^X//" >'complete.c' <<'END_OF_FILE'
- X/*---------------------------------------------------------------------------*
- X *
- X * cwish - windowing user friendly shell
- X * -------------------------------------
- X *
- X * (c) Copyright Hellmuth Michaelis 1989 - 1993
- X *
- X * Eggerstedtstr. 28
- X * 22765 Hamburg
- X * Germany
- X *
- X * Tel: +49 / 40 / 384298 (private)
- X * Tel: +49 / 40 / 55903-170 (at work)
- X * e-mail: hm@hcshh.hcs.de
- X *
- X * All rights are reserved except as explicitly granted
- X * by written permission of the author.
- X *
- X * See the file COPYING, distributed with cwish, for
- X * restriction and warranty information
- X *
- X *---------------------------------------------------------------------------*
- X *
- X * last edit-date: [Sun Oct 17 18:03:43 1993]
- X *
- X * -hm primitive filename completition
- X *
- X *----------------------------------------------------------------------------*/
- X
- X#include "cwish.h" /* local includes */
- X
- Xstatic char *wild(char *path, char *wildname);
- X
- X/*---------------------------------------------------------------------------*
- X * complete name to first matching filename
- X *----------------------------------------------------------------------------*/
- Xvoid complete(void)
- X{
- X char *cptr; /* ptr to start of line after prompt */
- X char *cend; /* ptr to end of commandline */
- X char *p,*q; /* gp ptr */
- X char *csave; /* filename start position */
- X char path[MAXPATHLEN+1];/* path portion */
- X char name[MAXPATHLEN+1];/* name portion */
- X
- X cptr = cbuff+3; /* init start ptr */
- X cend = cptr + strlen(cptr); /* int end ptr */
- X
- X while(cend > cptr) /* end of commandline */
- X {
- X cend--;
- X if(isspace(*cend)) /* start of filename ? */
- X break;
- X }
- X if(cend <= cptr) /* hmm ... */
- X return;
- X
- X cend++; /* first char of filename */
- X csave = cend; /* save position for later compare */
- X
- X if((p = strrchr(cend, '/')) == NULL)
- X {
- X path[0] = '\0'; /* setup path part */
- X strcpy(name, cend); /* setup name part */
- X }
- X else
- X {
- X q = path; /* setup path part */
- X while(cend <= p)
- X *q++ = *cend++;
- X *q = '\0';
- X
- X q = name; /* setup name part */
- X while(*cend)
- X *q++ = *cend++;
- X *q = '\0';
- X }
- X strcat(name, "*"); /* add wildcard char */
- X
- X if((q = wild(path, name)) == NULL) /* resolve wildcards */
- X return; /* not found */
- X
- X while(*csave && *q && (*csave++ == *q++)) /* skip same chars */
- X ;
- X
- X while(*q && (cmdline(*q++) == GOOD)) /* rest to commandline */
- X ;
- X}
- X
- X/*---------------------------------------------------------------------------*
- X * check if "wildname" matches any name in directory "path"
- X * return concatenated "path" and matched name from dir
- X * if directory found, append a '/' to resulting name
- X *----------------------------------------------------------------------------*/
- Xstatic char *wild(char *path, char *wildname)
- X{
- X register struct direct *dp; /* dir access */
- X register DIR *dirp; /* dir access */
- X struct stat fdbuffer; /* stat buffer */
- X static char wtry[MAXPATHLEN+1]; /* try buffer */
- X char rpath[MAXPATHLEN+1]; /* resulting path */
- X
- X strcpy(rpath, path); /* path -> result path */
- X strcat(rpath, "."); /* for readdir */
- X
- X if((dirp = opendir(rpath)) == NULL)
- X return(NULL); /* cannot open directory */
- X
- X for(dp = readdir(dirp); dp != NULL; dp = readdir(dirp))
- X {
- X if((!(strcmp(dp->d_name, "."))) || (!(strcmp(dp->d_name, ".."))))
- X continue;
- X
- X if(wildmat(dp->d_name, wildname) == TRUE) /* hit ? */
- X {
- X strcpy(wtry, path); /* pathname */
- X strcat(wtry, dp->d_name); /* matchname */
- X if(stat(wtry, &fdbuffer) < 0)
- X continue; /* not accessible */
- X closedir(dirp); /* close */
- X if(S_ISDIR(fdbuffer.st_mode)) /* directory ? */
- X strcat(wtry, "/"); /* yes, append / */
- X return(wtry); /* return result */
- X }
- X }
- X closedir(dirp); /* close */
- X return(NULL); /* failed */
- X}
- X
- X/*---------------------------------- EOF -------------------------------------*/
- END_OF_FILE
- if test 4028 -ne `wc -c <'complete.c'`; then
- echo shar: \"'complete.c'\" unpacked with wrong size!
- fi
- # end of 'complete.c'
- fi
- if test -f 'config.h' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'config.h'\"
- else
- echo shar: Extracting \"'config.h'\" \(4734 characters\)
- sed "s/^X//" >'config.h' <<'END_OF_FILE'
- X/*---------------------------------------------------------------------------*
- X *
- X * cwish - windowing user friendly shell
- X * -------------------------------------
- X *
- X * (c) Copyright Hellmuth Michaelis 1989 - 1993
- X *
- X * Eggerstedtstr. 28
- X * 22765 Hamburg
- X * Germany
- X *
- X * Tel: +49 / 40 / 384298 (private)
- X * Tel: +49 / 40 / 55903-170 (at work)
- X * e-mail: hm@hcshh.hcs.de
- X *
- X * All rights are reserved except as explicitly granted
- X * by written permission of the author.
- X *
- X * See the file COPYING, distributed with cwish, for
- X * restriction and warranty information
- X *
- X *---------------------------------------------------------------------------*
- X *
- X * Last Edit-Date: [Sun Oct 17 18:17:40 1993]
- X *
- X * -hm initial creation
- X * -hm debug / streamline
- X * -hm wildcards
- X * -hm move after tagging
- X *
- X *----------------------------------------------------------------------------*/
- X
- Xstruct item {
- X int row; /* name row position */
- X int col; /* name column position */
- X char *name; /* field name */
- X int nl; /* name length */
- X int type; /* item type */
- X#define ITEM_ONOFF 0 /* YES / NO */
- X#define ITEM_STRING 1 /* a string */
- X#define ITEM_CHAR 2 /* a character */
- X#define ITEM_NOCHANGE 0x80 /* user cannot chage item at run-time */
- X int *value; /* pointer to variable [...hmmm] */
- X char *help; /* help/description string */
- X struct item *next; /* ptr to next item struct */
- X struct item *prev; /* ptr to previous item struct */
- X};
- X
- Xstruct item i_ret, i_attr, i_pres, i_fkey, i_link, i_point, i_pager, i_editor,
- X i_delim, i_wild, i_wldon, i_cdrom, i_cdnop, i_dotfn, i_tagmv;
- X
- X#define FIRST_I (&i_ret)
- X
- X/* ----- changable ON/OFF ----- */
- X
- Xstruct item i_ret = {
- X 2, 0, " Return: ", 11, ITEM_ONOFF, (int *)&opt_return,
- X "Specify wait for RETURN/ENTER key after executing an external command",
- X &i_pres, &i_delim
- X};
- X
- Xstruct item i_pres = {
- X 2, 26, " Preserve: ", 11, ITEM_ONOFF, (int *)&opt_preserve,
- X "Preserve current directory when moving up in directory tree",
- X &i_link, &i_ret
- X};
- X
- Xstruct item i_link = {
- X 2, 52, "SoftLinks: ", 11, ITEM_ONOFF, (int *)&opt_links,
- X "Enable detection and display of Softlinks in the attribute window",
- X &i_point, &i_pres
- X};
- X
- Xstruct item i_point = {
- X 4, 0, " Dot: ", 11, ITEM_ONOFF, (int *)&opt_point,
- X "Enable to display the current directory as a dot",
- X &i_tagmv, &i_link
- X};
- X
- Xstruct item i_tagmv = {
- X 4, 26, " TagMove: ", 11, ITEM_ONOFF, (int *)&opt_tagmove,
- X "Move to next filename after tagging the current one",
- X &i_delim, &i_point
- X};
- X
- Xstruct item i_delim = {
- X 4, 52, "Delimiter: ", 11, ITEM_CHAR, (int *)&opt_delimiter,
- X "Character to be used a a horizontal delimiter between windows",
- X &i_cdrom, &i_tagmv
- X};
- X
- Xstruct item i_cdrom = {
- X 6, 0, " CD-Rom: ", 11, ITEM_ONOFF, (int *)&opt_cdrom,
- X "Do special filename processing for cdrom filenames containing ';'",
- X &i_cdnop, &i_delim
- X};
- X
- Xstruct item i_cdnop = {
- X 6, 26, "CDNoProgs: ", 11, ITEM_ONOFF, (int *)&opt_cdnoprog,
- X "Take all executable programs on CDROM as data files for display",
- X &i_dotfn, &i_cdrom
- X};
- X
- Xstruct item i_dotfn = {
- X 6, 52, " DotNames: ", 11, ITEM_ONOFF, (int *)&opt_dotnames,
- X "Display Filenames starting with a Dot",
- X &i_wldon, &i_cdnop
- X};
- X
- Xstruct item i_wldon = {
- X 8, 0, "WildEnabl: ", 11, ITEM_ONOFF, (int *)&opt_wildon,
- X "Enable wildcard filename display filtering",
- X &i_wild, &i_dotfn
- X};
- X
- X/* ----- changable STRING ----- */
- X
- Xstruct item i_wild = {
- X 8, 26, " Wildcard: ", 11, ITEM_STRING, (int *)&opt_wild[0],
- X "Wildcard string for files being displayed in the file window",
- X &i_attr, &i_wldon
- X};
- X
- X
- X/* ----- NOT changeable ON/OFF ----- */
- X
- Xstruct item i_attr = {
- X 12, 0, " Attribs: ", 11, ITEM_ONOFF | ITEM_NOCHANGE, (int *)&opt_attrib,
- X "Display the current file's attributes and Permissions (NOT CHANGEABLE)",
- X &i_fkey, &i_wild
- X};
- X
- Xstruct item i_fkey = {
- X 12, 40, " Fkeys: ", 11, ITEM_ONOFF | ITEM_NOCHANGE, (int *)&opt_labels,
- X "Display virtual function key labels at bottom of the screen (NOT CHANGEABLE)",
- X &i_pager, &i_attr
- X};
- X
- X/*----------------------- string variables -------------------------------*/
- X
- Xstruct item i_pager = {
- X 14, 0, " Pager: ", 11, ITEM_STRING | ITEM_NOCHANGE, (int *)&opt_more[0],
- X "External command for program to display text (NOT CHANGEABLE)",
- X &i_editor, &i_fkey
- X};
- X
- Xstruct item i_editor = {
- X 16, 0, " Editor: ", 11, ITEM_STRING | ITEM_NOCHANGE, (int *)&opt_edit[0],
- X "External command for program to edit text (NOT CHANGEABLE)",
- X &i_ret, &i_pager
- X};
- X
- X/*---------------------------------- EOF ------------------------------------*/
- END_OF_FILE
- if test 4734 -ne `wc -c <'config.h'`; then
- echo shar: \"'config.h'\" unpacked with wrong size!
- fi
- # end of 'config.h'
- fi
- if test -f 'control.h' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'control.h'\"
- else
- echo shar: Extracting \"'control.h'\" \(1501 characters\)
- sed "s/^X//" >'control.h' <<'END_OF_FILE'
- X/*---------------------------------------------------------------------------*
- X *
- X * cwish - windowing user friendly shell
- X * -------------------------------------
- X *
- X * (c) Copyright Hellmuth Michaelis 1989 - 1993
- X *
- X * Eggerstedtstr. 28
- X * 22765 Hamburg
- X * Germany
- X *
- X * Tel: +49 / 40 / 384298 (private)
- X * Tel: +49 / 40 / 55903-170 (at work)
- X * e-mail: hm@hcshh.hcs.de
- X *
- X * All rights are reserved except as explicitly granted
- X * by written permission of the author.
- X *
- X * See the file COPYING, distributed with cwish, for
- X * restriction and warranty information
- X *
- X *---------------------------------------------------------------------------*/
- X
- X#define CNTRL_@ 0x00
- X#define CNTRL_A 0x01
- X#define CNTRL_B 0x02
- X#define CNTRL_C 0x03
- X#define CNTRL_D 0x04
- X#define CNTRL_E 0x05
- X#define CNTRL_F 0x06
- X#define CNTRL_G 0x07
- X#define CNTRL_H 0x08
- X#define CNTRL_I 0x09
- X#define CNTRL_J 0x0A
- X#define CNTRL_K 0x0B
- X#define CNTRL_L 0x0C
- X#define CNTRL_M 0x0D
- X#define CNTRL_N 0x0E
- X#define CNTRL_O 0x0F
- X#define CNTRL_P 0x10
- X#define CNTRL_Q 0x11
- X#define CNTRL_R 0x12
- X#define CNTRL_S 0x13
- X#define CNTRL_T 0x14
- X#define CNTRL_U 0x15
- X#define CNTRL_V 0x16
- X#define CNTRL_W 0x17
- X#define CNTRL_X 0x18
- X#define CNTRL_Y 0x19
- X#define CNTRL_Z 0x1A
- X
- X
- X/*--------------------------- EOF -----------------------------*/
- END_OF_FILE
- if test 1501 -ne `wc -c <'control.h'`; then
- echo shar: \"'control.h'\" unpacked with wrong size!
- fi
- # end of 'control.h'
- fi
- if test -f 'fkeys.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'fkeys.c'\"
- else
- echo shar: Extracting \"'fkeys.c'\" \(3899 characters\)
- sed "s/^X//" >'fkeys.c' <<'END_OF_FILE'
- X/*---------------------------------------------------------------------------*
- X *
- X * cwish - windowing user friendly shell
- X * -------------------------------------
- X *
- X * (c) Copyright Hellmuth Michaelis 1989 - 1993
- X *
- X * Eggerstedtstr. 28
- X * 22765 Hamburg
- X * Germany
- X *
- X * Tel: +49 / 40 / 384298 (private)
- X * Tel: +49 / 40 / 55903-170 (at work)
- X * e-mail: hm@hcshh.hcs.de
- X *
- X * All rights are reserved except as explicitly granted
- X * by written permission of the author.
- X *
- X * See the file COPYING, distributed with cwish, for
- X * restriction and warranty information
- X *
- X *---------------------------------------------------------------------------*
- X *
- X * last edit-date: [Wed Oct 20 16:52:06 1993]
- X *
- X * -hm modifying function key label layout
- X * -hm consistent fkey labels ( just 8 ! )
- X * -hm flabel.c -> fkeys.c
- X * -hm hpterm support
- X * -hm interactive configuration
- X * -hm fkey label structures
- X * -hm alternate attrib line
- X *
- X *----------------------------------------------------------------------------*/
- X
- X#include "cwish.h"
- X
- X/*---------------------------------------------------------------------------*
- X * write string to function key label
- X *---------------------------------------------------------------------------*/
- Xvoid fnclabel(int n, char *string)
- X{
- X char xmit[5]; /* transmitted string ( ESC 'p'...'w' ) */
- X char result[50]; /* result buffer */
- X
- X /* check if we are on an hp-terminal or lookalike */
- X
- X if(termtype == TERM_HP || termtype == TERM_PCVT || termtype == TERM_HPX)
- X {
- X if(n < 1 || n > 8) /* and it must be a legal key number */
- X return;
- X if((strlen(string)) != 16)
- X return;
- X
- X xmit[0] = ESC;
- X xmit[1] = 'o' + n;
- X xmit[2] = '\0';
- X sprintf(result,"%c&f0a%dk16d2L%s%s",ESC,n,string,xmit);
- X write(2,result,strlen(result));
- X sprintf(result,"%c&jB",ESC); /* display user function keys */
- X write(2,result,strlen(result));
- X return;
- X }
- X else if(opt_labels) /* if virtual f-key labels .. */
- X {
- X if(n < 1 || n > 8) /* and it must be a legal key number */
- X return;
- X
- X if((strlen(string)) != 9)
- X return;
- X
- X wmove(flbl_w, 0, ((n-1)*10)); /* last line */
- X
- X wattron(flbl_w, A_REVERSE);
- X waddstr(flbl_w, string);
- X wattroff(flbl_w, A_REVERSE);
- X wrefresh(flbl_w);
- X }
- X}
- X
- X/*---------------------------------------------------------------------------*
- X * function key labels initialization
- X *---------------------------------------------------------------------------*/
- Xvoid init_flabels(void)
- X{
- X int i;
- X for(i = 0; i < 8; i++)
- X {
- X if(termtype == TERM_HP || termtype == TERM_PCVT || termtype == TERM_HPX)
- X fnclabel(i+1, (*cur_fktab)[i].label_16);
- X else if(opt_labels)
- X fnclabel(i+1, (*cur_fktab)[i].label_8);
- X else
- X break;
- X }
- X}
- X
- X/*---------------------------------------------------------------------------*
- X * restore function key labels
- X *---------------------------------------------------------------------------*/
- Xvoid fini_flabels(void)
- X{
- X static char modes[] = { ESC, '&', 'j', 'A', '\0'};
- X
- X /* check if we are on an hp-terminal */
- X
- X if(termtype == TERM_HP || termtype == TERM_PCVT || termtype == TERM_HPX)
- X write(2,modes,strlen(modes));
- X}
- X
- X/*---------------------------------------------------------------------------*
- X * system function keys table
- X *---------------------------------------------------------------------------*/
- X
- Xstruct fk_tab sys_keys[] = {
- X {" Edit File ", "Edit File"},
- X {" Echo Filename", "Echo Name"},
- X {" Help Commands", "Help Cmds"},
- X {" Config Screen ", "Conf Scrn"},
- X {" Mark Filename", "Mark File"},
- X {" Unmark allmarkd", "UnmarkAll"},
- X {"AlternatAttrLine", "Alt AttLn"},
- X {" Close CurDir ", "Close Dir"}
- X};
- X
- X/*---------------------------------- EOF -------------------------------------*/
- END_OF_FILE
- if test 3899 -ne `wc -c <'fkeys.c'`; then
- echo shar: \"'fkeys.c'\" unpacked with wrong size!
- fi
- # end of 'fkeys.c'
- fi
- if test -f 'patchlevel.h' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'patchlevel.h'\"
- else
- echo shar: Extracting \"'patchlevel.h'\" \(1690 characters\)
- sed "s/^X//" >'patchlevel.h' <<'END_OF_FILE'
- X/*---------------------------------------------------------------------------*
- X *
- X * cwish - windowing user friendly shell
- X * -------------------------------------
- X *
- X * Copyright (c) 1988-1993 Hellmuth Michaelis
- X *
- X * Eggerstedtstr. 28
- X * 22765 Hamburg
- X * Germany
- X *
- X * Tel: +49 / 40 / 384298 (private)
- X * Tel: +49 / 40 / 55903-170 (at work)
- X * e-mail: hm@hcshh.hcs.de
- X *
- X * --------oOo--------
- X *
- X * This program is free software; you can redistribute it and/or modify
- X * it under the terms of the GNU General Public License as published by
- X * the Free Software Foundation; either version 2 of the License, or
- X * (at your option) any later version.
- X *
- X * This program is distributed in the hope that it will be useful,
- X * but WITHOUT ANY WARRANTY; without even the implied warranty of
- X * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- X * GNU General Public License for more details.
- X *
- X * You should have received a copy of the GNU General Public License
- X * along with this program; if not, write to the Free Software
- X * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- X *
- X *---------------------------------------------------------------------------*
- X *
- X * Last Edit-Date: [Fri Oct 29 10:44:38 1993]
- X *
- X * -hm added patchlevel.h for submission to comp.sources.misc
- X *
- X *----------------------------------------------------------------------------*/
- X
- X#define PATCHLEVEL "2.00"
- X
- X/*--------------------------------- EOF -------------------------------------*/
- END_OF_FILE
- if test 1690 -ne `wc -c <'patchlevel.h'`; then
- echo shar: \"'patchlevel.h'\" unpacked with wrong size!
- fi
- # end of 'patchlevel.h'
- fi
- if test -f 'rcinit.h' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'rcinit.h'\"
- else
- echo shar: Extracting \"'rcinit.h'\" \(2314 characters\)
- sed "s/^X//" >'rcinit.h' <<'END_OF_FILE'
- X/*---------------------------------------------------------------------------*
- X *
- X * cwish - windowing user friendly shell
- X * -------------------------------------
- X *
- X * Copyright (c) 1988-1993 Hellmuth Michaelis
- X *
- X * Eggerstedtstr. 28
- X * 22765 Hamburg
- X * Germany
- X *
- X * Tel: +49 / 40 / 384298 (private)
- X * Tel: +49 / 40 / 55903-170 (at work)
- X * e-mail: hm@hcshh.hcs.de
- X *
- X * --------oOo--------
- X *
- X * This program is free software; you can redistribute it and/or modify
- X * it under the terms of the GNU General Public License as published by
- X * the Free Software Foundation; either version 2 of the License, or
- X * (at your option) any later version.
- X *
- X * This program is distributed in the hope that it will be useful,
- X * but WITHOUT ANY WARRANTY; without even the implied warranty of
- X * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- X * GNU General Public License for more details.
- X *
- X * You should have received a copy of the GNU General Public License
- X * along with this program; if not, write to the Free Software
- X * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- X *
- X *---------------------------------------------------------------------------*
- X *
- X * Last Edit-Date: [Sun Oct 17 18:17:42 1993]
- X *
- X * -hm init file ".wishrc"
- X * -hm wildcards
- X * -hm cdrom processing for ';' chars
- X * -hm move after tag
- X *
- X *----------------------------------------------------------------------------*/
- X
- X#define CWISHRC ".cwishrc" /* our config file */
- X
- X#define RC_ON "on"
- X#define RC_OFF "off"
- X
- X/* booolean variables (on/off) */
- X
- X#define RC_ATTR "attributes"
- X#define RC_PRESERVE "preserve"
- X#define RC_FKEYS "fkeys"
- X#define RC_LINKS "links"
- X#define RC_POINT "point"
- X#define RC_RETURN "return"
- X#define RC_WILDON "wildenable"
- X#define RC_CDROM "cdrom"
- X#define RC_CDNOPROG "cdnoprog"
- X#define RC_DOTNAMES "dotnames"
- X#define RC_TAGMOVE "tagmove"
- X
- X/* string variables */
- X
- X#define RC_PAGER "pager"
- X#define RC_EDITOR "editor"
- X#define RC_WILDCARD "wildcard"
- X
- X/* character variables */
- X
- X#define RC_DELIMITER "delimiter"
- X
- X/*---------------------------------- EOF ------------------------------------*/
- END_OF_FILE
- if test 2314 -ne `wc -c <'rcinit.h'`; then
- echo shar: \"'rcinit.h'\" unpacked with wrong size!
- fi
- # end of 'rcinit.h'
- fi
- if test -f 'usage.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'usage.c'\"
- else
- echo shar: Extracting \"'usage.c'\" \(4589 characters\)
- sed "s/^X//" >'usage.c' <<'END_OF_FILE'
- X/*---------------------------------------------------------------------------*
- X *
- X * cwish - windowing user friendly shell
- X * -------------------------------------
- X *
- X * Copyright (c) 1988-1993 Hellmuth Michaelis
- X *
- X * Eggerstedtstr. 28
- X * 22765 Hamburg
- X * Germany
- X *
- X * Tel: +49 / 40 / 384298 (private)
- X * Tel: +49 / 40 / 55903-170 (at work)
- X * e-mail: hm@hcshh.hcs.de
- X *
- X * --------oOo--------
- X *
- X * This program is free software; you can redistribute it and/or modify
- X * it under the terms of the GNU General Public License as published by
- X * the Free Software Foundation; either version 2 of the License, or
- X * (at your option) any later version.
- X *
- X * This program is distributed in the hope that it will be useful,
- X * but WITHOUT ANY WARRANTY; without even the implied warranty of
- X * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- X * GNU General Public License for more details.
- X *
- X * You should have received a copy of the GNU General Public License
- X * along with this program; if not, write to the Free Software
- X * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- X *
- X *---------------------------------------------------------------------------*
- X *
- X * Last Edit-Date: [Fri Oct 29 11:27:16 1993]
- X *
- X * -hm adding compilation revision numbers
- X * -hm prototyping, updating, vt220 support
- X * -hm 386bsd intro
- X * -hm hpterm, hpux 9.0
- X * -hm interactive configuration
- X * -hm altcharset in config.c on hpux
- X * -hm preserve bug fixed in hpux
- X * -hm multiple extension support in commandline.c
- X * -hm fkey label structures
- X * -hm wildcards
- X * -hm cdrom options
- X * -hm primitive filename completition
- X * -hm option display dot-filenames
- X * -hm option processing
- X * -hm added patchlevel.h for submission
- X * -hm released to comp.sources.misc
- X * -hm renamed to cwish
- X *
- X *----------------------------------------------------------------------------*/
- X
- X#include "cwish.h"
- X#include "patchlevel.h"
- X
- X/*---------------------------------------------------------------------------*
- X * format the headerline
- X *---------------------------------------------------------------------------*/
- Xvoid init_header(void)
- X{
- X sprintf(headerline, "cwish %s.%02d (c)Copyright 1988-1993 Hellmuth Michaelis, Hamburg [%7.7s] ",
- X PATCHLEVEL,
- X#include "update.h"
- X ,term_string);
- X}
- X
- X/*---------------------------------------------------------------------------*
- X * format & print the usage display
- X *---------------------------------------------------------------------------*/
- Xvoid usage(void)
- X{
- X fprintf(stderr,"\n cwish - revision %s - compilation %02d - %s - %s\n",
- X PATCHLEVEL,
- X#include "update.h"
- X ,__DATE__,__TIME__);
- X fprintf(stderr," Copyright (c) 1988 - 1993 by Hellmuth Michaelis, Hamburg, Germany\n\n");
- X fprintf(stderr," Cwish comes with ABSOLUTELY NO WARRANTY; for details see the file\n");
- X fprintf(stderr," COPYING, which should have come with the source for this program.\n");
- X fprintf(stderr," This program is free software; you can redistribute it and/or modify\n");
- X fprintf(stderr," it under the terms of the GNU General Public License as published by\n");
- X fprintf(stderr," the Free Software Foundation; either version 2 of the License, or\n");
- X fprintf(stderr," (at your option) any later version; see file COPYING for details.\n\n");
- X fprintf(stderr," Usage: cwish [[+ | -] [acCdflnprw]] | [-?]\n");
- X fprintf(stderr," Options: +/-a file attributes display window on/off\n");
- X fprintf(stderr," +/-c enable special cdrom filename processing (\";\") on/off\n");
- X fprintf(stderr," +/-C on cdrom handle programs as data files on/off\n");
- X fprintf(stderr," +/-d preserve current directory when \"cd ..\" on/off\n");
- X fprintf(stderr," +/-f display virtual fkey labels window on/off\n");
- X fprintf(stderr," +/-l file link detection enable on/off\n");
- X fprintf(stderr," +/-n display filenames beginning with a dot (\".\") on/off\n");
- X fprintf(stderr," +/-p display the current directory (as a \".\") on/off\n");
- X fprintf(stderr," +/-r wait for return after external command on/off\n");
- X fprintf(stderr," +/-w enable wildcard filename processing on/off\n");
- X fprintf(stderr," -? display this help text\n");
- X exit(99);
- X}
- X
- X/*---------------------------------- EOF -------------------------------------*/
- END_OF_FILE
- if test 4589 -ne `wc -c <'usage.c'`; then
- echo shar: \"'usage.c'\" unpacked with wrong size!
- fi
- # end of 'usage.c'
- fi
- if test -f 'usrgrp.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'usrgrp.c'\"
- else
- echo shar: Extracting \"'usrgrp.c'\" \(4642 characters\)
- sed "s/^X//" >'usrgrp.c' <<'END_OF_FILE'
- X/*---------------------------------------------------------------------------*
- X *
- X * cwish - windowing user friendly shell
- X * -------------------------------------
- X *
- X * Copyright (c) 1988-1993 Hellmuth Michaelis
- X *
- X * Eggerstedtstr. 28
- X * 22765 Hamburg
- X * Germany
- X *
- X * Tel: +49 / 40 / 384298 (private)
- X * Tel: +49 / 40 / 55903-170 (at work)
- X * e-mail: hm@hcshh.hcs.de
- X *
- X * --------oOo--------
- X *
- X * This program is free software; you can redistribute it and/or modify
- X * it under the terms of the GNU General Public License as published by
- X * the Free Software Foundation; either version 2 of the License, or
- X * (at your option) any later version.
- X *
- X * This program is distributed in the hope that it will be useful,
- X * but WITHOUT ANY WARRANTY; without even the implied warranty of
- X * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- X * GNU General Public License for more details.
- X *
- X * You should have received a copy of the GNU General Public License
- X * along with this program; if not, write to the Free Software
- X * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- X *
- X *---------------------------------------------------------------------------*
- X *
- X * This is based on some file i got from some Berkley distribution years ago,
- X * i really forgot which one, and i forgot the name of the file this is from,
- X * so i just copied the copyright notice from some other file:
- X *
- X * Copyright (c) 1988 The Regents of the University of California.
- X * All rights reserved.
- X *
- X * Redistribution and use in source and binary forms are permitted
- X * provided that: (1) source distributions retain this entire copyright
- X * notice and comment, and (2) distributions including binaries display
- X * the following acknowledgement: ``This product includes software
- X * developed by the University of California, Berkeley and its contributors''
- X * in the documentation or other materials provided with the distribution
- X * and in all advertising materials mentioning features or use of this
- X * software. Neither the name of the University nor the names of its
- X * contributors may be used to endorse or promote products derived
- X * from this software without specific prior written permission.
- X * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
- X * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
- X * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
- X *
- X *---------------------------------------------------------------------------*
- X *
- X * last edit-date: [Sun Oct 17 18:09:36 1993]
- X *
- X * -hm caching uid/gid entries
- X * -hm new calling sequence
- X *
- X *---------------------------------------------------------------------------*/
- X
- X#include "cwish.h"
- X
- X#ifndef min
- X#define min(x, y) (((x) < (y)) ? (x) : (y))
- X#endif
- X
- X#define NCACHE 256
- X#define MASK (NCACHE - 1)
- X#define NAMELENGTH 16
- X
- X/*---------------------------------------------------------------------------*
- X * make a user id string from the numeric user id (and cache a bit)
- X *---------------------------------------------------------------------------*/
- Xchar *user_from_uid(uid_t uid, int size)
- X{
- X static struct ncache
- X {
- X uid_t uid;
- X char name[NAMELENGTH];
- X } c_uid[NCACHE];
- X
- X static char nbuf[15];
- X register struct passwd *pw;
- X register struct ncache *cp;
- X int length = min(NAMELENGTH, size);
- X
- X cp = (c_uid + (uid & MASK));
- X
- X if (cp->uid != uid || !*cp->name)
- X {
- X if (!(pw = getpwuid(uid)))
- X {
- X sprintf(nbuf, "%-*u", length, uid);
- X return(nbuf);
- X }
- X cp->uid = uid;
- X sprintf(cp->name, "%-*s", NAMELENGTH, pw->pw_name);
- X }
- X strncpy(nbuf, cp->name, length);
- X return(nbuf);
- X}
- X
- X/*---------------------------------------------------------------------------*
- X * make a group id string from the numeric group id (and cache a bit)
- X *---------------------------------------------------------------------------*/
- Xchar *group_from_gid(gid_t gid, int size)
- X{
- X static struct ncache
- X {
- X gid_t gid;
- X char name[NAMELENGTH];
- X } c_gid[NCACHE];
- X
- X static char nbuf[15];
- X register struct group *gr;
- X register struct ncache *cp;
- X int length = min(NAMELENGTH, size);
- X
- X cp = c_gid + (gid & MASK);
- X if (cp->gid != gid || !*cp->name)
- X {
- X if (!(gr = getgrgid(gid)))
- X {
- X sprintf(nbuf, "%-*u", length, gid);
- X return(nbuf);
- X }
- X cp->gid = gid;
- X sprintf(cp->name, "%-*s", NAMELENGTH, gr->gr_name);
- X }
- X
- X strncpy(nbuf, cp->name, length);
- X return(nbuf);
- X}
- X
- X/*---------------------------------- EOF -------------------------------------*/
- END_OF_FILE
- if test 4642 -ne `wc -c <'usrgrp.c'`; then
- echo shar: \"'usrgrp.c'\" unpacked with wrong size!
- fi
- # end of 'usrgrp.c'
- fi
- echo shar: End of archive 5 \(of 5\).
- cp /dev/null ark5isdone
- MISSING=""
- for I in 1 2 3 4 5 ; do
- if test ! -f ark${I}isdone ; then
- MISSING="${MISSING} ${I}"
- fi
- done
- if test "${MISSING}" = "" ; then
- echo You have unpacked all 5 archives.
- rm -f ark[1-9]isdone
- else
- echo You still must unpack the following archives:
- echo " " ${MISSING}
- fi
- exit 0
- exit 0 # Just in case...
-