add directory Linux-0.12

This commit is contained in:
gohigh
2024-02-19 00:21:02 -05:00
parent 26e015eb99
commit 059f8848b1
177 changed files with 15195 additions and 0 deletions

View File

@@ -0,0 +1,125 @@
*** orig/makefile Thu Feb 21 17:15:06 1991
--- makefile Wed Feb 5 10:38:20 1992
***************
*** 4,12 ****
#
# define STDLIB for systems that have <stdlib.h>
DEFS = -DUNIX -DSTDLIB
! CFLAGS = -g ${DEFS}
HDR = cawf.h regexp.h regmagic.h
--- 4,14 ----
#
# define STDLIB for systems that have <stdlib.h>
+ CC = gcc
+
DEFS = -DUNIX -DSTDLIB
! CFLAGS = ${DEFS}
HDR = cawf.h regexp.h regmagic.h
*** orig/bsfilt.c Thu Feb 21 17:14:54 1991
--- bsfilt.c Sat Jan 18 20:15:50 1992
***************
*** 45,51 ****
int Ulx = 0; /* underline buffer index */
void Putchar();
! #ifndef STDDEF
char *strrchr();
#endif
--- 45,51 ----
int Ulx = 0; /* underline buffer index */
void Putchar();
! #ifndef STDLIB
char *strrchr();
#endif
*** orig/cawf.c Thu Feb 21 17:14:54 1991
--- cawf.c Sat Jan 18 20:15:50 1992
*** orig/cawf.h Thu Feb 21 17:14:54 1991
--- cawf.h Wed Feb 5 10:43:06 1992
***************
*** 40,46 ****
#include "regexp.h"
#ifdef UNIX
! #define CAWFLIB "/Homes/abe/src/cawf" /* UNIX library location */
#else
#define CAWFLIB "c:/sys/lib/cawf" /* PC-DOS library location */
#endif
--- 40,46 ----
#include "regexp.h"
#ifdef UNIX
! #define CAWFLIB "/usr/local/lib" /* UNIX library location */
#else
#define CAWFLIB "c:/sys/lib/cawf" /* PC-DOS library location */
#endif
*** orig/error.c Thu Feb 21 17:14:56 1991
--- error.c Sat Jan 18 20:15:50 1992
*** orig/expand.c Thu Feb 21 17:14:56 1991
--- expand.c Sat Jan 18 20:15:50 1992
*** orig/expr.c Thu Feb 21 17:14:56 1991
--- expr.c Sat Jan 18 20:15:50 1992
*** orig/macsup.c Thu Feb 21 17:14:56 1991
--- macsup.c Sat Jan 18 20:15:50 1992
*** orig/output.c Thu Feb 21 17:14:56 1991
--- output.c Sat Jan 18 20:15:50 1992
*** orig/pass2.c Thu Feb 21 17:14:58 1991
--- pass2.c Sat Jan 18 20:15:50 1992
*** orig/pass3.c Thu Feb 21 17:14:58 1991
--- pass3.c Sat Jan 18 20:15:50 1992
*** orig/regerror.c Thu Feb 21 17:14:58 1991
--- regerror.c Sat Jan 18 20:15:50 1992
*** orig/regexp.c Thu Feb 21 17:15:00 1991
--- regexp.c Sat Jan 18 20:25:37 1992
***************
*** 708,714 ****
register char *string;
{
register char *s;
! extern char *strchr();
/* Be paranoid... */
if (prog == NULL || string == NULL) {
--- 708,714 ----
register char *string;
{
register char *s;
! /* extern char *strchr(); */
/* Be paranoid... */
if (prog == NULL || string == NULL) {
***************
*** 807,813 ****
{
register char *scan; /* Current node. */
char *next; /* Next node. */
! extern char *strchr();
scan = prog;
#ifdef DEBUG
--- 807,813 ----
{
register char *scan; /* Current node. */
char *next; /* Next node. */
! /* extern char *strchr(); */
scan = prog;
#ifdef DEBUG
*** orig/regexp.h Thu Feb 21 17:15:00 1991
--- regexp.h Sat Jan 18 19:55:38 1992
*** orig/regmagic.h Thu Feb 21 17:15:00 1991
--- regmagic.h Sat Jan 18 20:10:06 1992
*** orig/store.c Thu Feb 21 17:15:00 1991
--- store.c Sat Jan 18 20:26:26 1992
*** orig/string.c Thu Feb 21 17:15:02 1991
--- string.c Sat Jan 18 20:27:18 1992

Binary file not shown.

View File

@@ -0,0 +1,104 @@
/* df.c: Copywrite (92) Peter MacDonald: distribute freely, don't restrict. */
#include <sys/time.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include <stdio.h>
#include <linux/fs.h>
char *hdr1="\n inodes inodes inodes blocks blocks blocks mount";
char *hdr2= "device total used free total used free point";
char *hdr3= "--------------------------------------------------------------------";
char *fmt = "%-9s %-7d %-7d %-7d %-7d %-7d %-7d %s\n";
void do_df(char *dev, char *dir);
int main(int argc, char *argv[])
{ int i;
sync();
puts(hdr1);
puts(hdr2);
puts(hdr3);
if (argc != 1)
for (i=1; i<argc; i++)
do_df(argv[i],"");
else
{ FILE *F = fopen("/etc/mtab","r");
if (!F)
{ fprintf(stderr,"/etc/mtab not found\n");
exit(1);
}
do
{ char buf[200], dev[40], dir[150];
fgets(buf,200,F);
if (feof(F) || (strlen(buf)<6))
break;
sscanf(buf,"%s %s",dev,dir);
do_df(dev,dir);
} while (1);
}
exit(0);
}
#define oops(str,arg) { fprintf(stderr,str,arg); close(fd); return; }
int fd;
int nibblemap[] = { 0,1,1,2,1,2,2,3,1,2,2,3,2,3,3,4 };
ino_t count(unsigned numblocks, unsigned numbits)
{ unsigned i, j, end, sum = 0;
char buf[BLOCK_SIZE];
for (i=0; (i<numblocks) && numbits; i++)
{
if (read(fd,buf,sizeof(buf))<0)
return(0);
if (numbits >= (8*BLOCK_SIZE))
{
end = BLOCK_SIZE;
numbits -= 8*BLOCK_SIZE;
}
else
{ int tmp;
end = numbits >> 3;
numbits &= 0x7;
tmp = buf[end] & ((1<<numbits)-1);
sum += nibblemap[tmp&0xf] + nibblemap[(tmp>>4)&0xf];
numbits = 0;
}
for (j=0; j<end; j++)
sum += nibblemap[buf[j] & 0xf] + nibblemap[(buf[j]>>4)&0xf];
}
return(sum);
}
void do_df(char *dev, char *dir)
{ int it,iu,bt,bu;
struct super_block supstruct;
if ((fd=open(dev,O_RDONLY))<0)
oops("df can't open device: %s",dev);
lseek(fd,BLOCK_SIZE,SEEK_SET);
if (read(fd,(char*)&supstruct,sizeof(struct super_block))
!= sizeof(struct super_block))
oops("super block unreadable: %s",dev);
lseek(fd,BLOCK_SIZE*2,SEEK_SET);
if (supstruct.s_magic != SUPER_MAGIC)
oops("not a valid file system: %s",dev);
it = supstruct.s_ninodes;
iu = count(supstruct.s_imap_blocks,supstruct.s_ninodes+1);
bt = supstruct.s_nzones << supstruct.s_log_zone_size;
bu = count(supstruct.s_zmap_blocks,supstruct.s_nzones) <<
supstruct.s_log_zone_size;
printf(fmt,dev,it,iu,it-iu,bt,bu,bt-bu,dir);
}

Binary file not shown.

View File

@@ -0,0 +1,34 @@
#include <stdio.h>
#include <sys/file.h>
#include <errno.h>
extern char *sys_errlist[];
main(int argc, char *argv[])
{
if (argc != 3) {
fprintf(stderr, "usage: doshell <ttyname> <shellname> &\n");
exit(1);
}
/* close down fd's */
close(0);
close(1);
close(2);
/* detach from parent process's group */
setsid();
/* open new tty */
if (open(argv[1], O_RDWR, 0) == -1)
exit(2);
dup(0);
dup(0);
execlp(argv[2], "-", 0);
/* should appear on new tty...: */
fprintf(stderr, "can't exec shell: %s\n", sys_errlist[errno]);
exit(3);
}

View File

@@ -0,0 +1,204 @@
To: Linux-Activists@BLOOM-PICAYUNE.MIT.EDU
From: gt0178a@prism.gatech.EDU (BURNS)
Subject: Re: elle(1) and rc(1) ports uploaded to tsx-11.mit.edu
Date: 10 May 92 08:13:59 GMT
I found out why I was getting undefineds from elle's make. There was a
syntax problem with the '-sh -c if ...' line in Makefile that prevented
ranlib from processing the made libraries. That, plus adding -ltermcap to
the link line solved everything. To remake things in mid-stream, I also had
to reorganize things in sbmake. New make files follow:
=========
Makefile:
=========
# ELLE Makefile.
# The main trickery to notice is that this Makefile invokes itself
# in order to build ELLE. This allows it to generate sections of
# the makefile dynamically, namely:
# makecf.rl - defines the RANLIB macro to use "ranlib" if system has it
# makecf.fun - defines the FUN_OFILES macro to specify which modules
# are needed in order to furnish all of the desired
# functions for a specific ELLE configuration.
# Basic definitions
CFLAGS = -c -O
CONFS = makecf.rl makecf.fun defprf.c eefdef.h eefidx.h
CORE_OFILES = eemain.o eecmds.o eesite.o eevini.o\
eedisp.o eeterm.o eeerr.o eeques.o\
eebuff.o eefile.o eefed.o eeedit.o eebit.o
.c.o:
cc $(CFLAGS) $*.c
ar rv elib.a $*.o
# ------------------------------------------------------------------
# Standard ELLE configuration: "elle".
# Default if no target given to make.
# Note that "xelle" is created, not "elle".
elle: $(CONFS)
make -f makecf.rl -f makecf.fun -f Makefile B-elle
B-elle: $(CORE_OFILES) $(FUN_OFILES) elle.h eesite.h libsb.a
$(RANLIB) elib.a
cc -o xelle eemain.o elib.a libsb.a -ltermcap
# Don't flush these files if interrupted, dammit!
.PRECIOUS: ellec deffun.e defprf.e $(CONFS) libsb.a
# Configuration setup stuff, for files listed by CONFS.
# If any of the files is missing or outdated, all must be
# re-generated. We assume the *.t files always exist.
# A forced re-compilation of eecmds.c must also be done to
# ensure that the latest .h files are included in ELLE.
makecf.fun defprf.c eefdef.h eefidx.h : ellec defprf.e deffun.e
cat deffun.e defprf.e | ./ellec -CMconf > makecf.fun
cat deffun.e defprf.e | ./ellec -Pconf > defprf.c
cat deffun.e defprf.e | ./ellec -Fconf > eefdef.h
cat deffun.e defprf.e | ./ellec -FXconf > eefidx.h
rm -f eecmds.o
# The following modules make use of eefidx.h and thus must also
# be recompiled if the configuration is changed.
eebuff.o eeerr.o eehelp.o eejust.o eemain.o eeques.o eef1.o : eefidx.h
cc $(CFLAGS) $*.c
ar rv elib.a $*.o
# RANLIB definition stuff. The idea here is to automatically check to see
# whether a system has the "ranlib" program, and set up the RANLIB
# macro appropriately (use ranlib if possible; else substitute a dummy
# program, "echo" in this case). The existence of "makecf.rl"
# indicates that this setup code has been executed; it should never
# need to be done again.
makecf.rl:
echo "RANLIB = echo" > makecf.rl
-sh -c "if [ ranlib ]; then (echo \"RANLIB = ranlib\" > makecf.rl;) fi"
# ELLE profile compiler. Needed to generate makecf files!
# Although eefdef.h and defprf.c are included by ELLEC, they
# are not listed as dependencies in order to avoid loops (see
# their target entries). That is OK because their information is not
# used when generating the makecf files; it only furnishes default
# values needed when an ELLE user compiles a user profile.
ellec: ellec.c
cc -o ellec -O ellec.c
# SB library, used by ELLE.
# This target should not be directly invoked by the user since it
# requires that RANLIB be defined; for direct invocation, better to
# just do a MAKE of "sb" in the sbmake file.
libsb.a:
make -f sbmake sbnoran
$(RANLIB) libsb.a
# ------------------------------------------------------------------
# ELLE Variants (system or configuration dependent)
# SUN workstation system/configuration.
# Needs extra libraries to support window hacking; libsb.a comes last
# so that "valloc" refs can be satisfied from SB library instead of
# C library.
# Plus special patch to binary, very installation-dependent!
sunelle: $(CONFS)
make -f makecf.rl -f makecf.fun -f Makefile B-sunelle
B-sunelle: $(CORE_OFILES) $(FUN_OFILES) eesun.o elle.h eesite.h libsb.a
$(RANLIB) elib.a
cc -o xelle -u _main elib.a -ltermlib\
-lsuntool -lsunwindow -lpixrect\
libsb.a
echo "tool_select+148?W my_select" > esunpat.sh
adb -w xelle < esunpat.sh
# APOLLO system.
# Linker doesn't understand libraries as regular arguments.
# May have troubles with duplication of CORE and FUN files.
# System has no termlib - uses TERMCAP emulation that comes with AUX.
SB_OFILES = sbstr.o sbm.o sberr.o
apolloelle: $(CONFS)
make -f makecf.rl -f makecf.fun -f Makefile B-apolloelle
B-apolloelle: $(CORE_OFILES) $(FUN_OFILES) elle.h eesite.h libsb.a
cc -o xelle $(CORE_OFILES) $(FUN_OFILES) $(SB_OFILES) -ltermcap
# IBM PC/IX system.
# Just needs -ltermcap instead of -ltermlib.
# Does not have/need "ranlib" by the way.
pcixelle: $(CONFS)
make -f makecf.rl -f makecf.fun -f Makefile B-pcixelle
B-pcixelle: $(CORE_OFILES) $(FUN_OFILES) elle.h eesite.h libsb.a
cc -i -o xelle -u _main elib.a libsb.a -ltermcap
=========
sbmake:
=========
# SB library makefile.
# Only funny stuff is handling for the "bcopy" routine, where
# we try to use the system version if any exists.
#
# On PDP-11 systems only, BCOPYSUF can be set to ".s" to use
# an assembly-language version. The bcopy.s here is
# better than the BSD2.9 version and can replace it.
CFLAGS = -c -O
OFILES = sbstr.o sbvall.o sbm.o sberr.o sbbcpy.o
BCOPYSUF = .c
.c.o:
cc $(CFLAGS) $*.c
# ar rv libsb.a $*.o
# Default entry - build library and attempt ranlib, but since some
# systems don't have ranlib, ignore error in latter.
sb: libsb.a $(OFILES)
-sh -c "ranlib libsb.a"
# Note that ELLE's makefile invokes this entry, since it does the ranlib
# itself if necessary.
sbnoran: libsb.a $(OFILES)
libsb.a: $(OFILES)
ar rv libsb.a $(OFILES)
# BCOPY special-case handling. If system already appears to have
# a "bcopy" routine, we use that for best efficiency (normally it
# is written in assembler to take advantage of things like
# block move instructions).
# Otherwise, we use our own C-language version.
sbbcpy.o: sbbcpy$(BCOPYSUF)
cc -c -O sbbcpy$(BCOPYSUF)
rm -f a.out bnull.c bnull.o bfind.c bfind.o bfind
echo "sbm_null(){}" > bnull.c
cc -c bnull.c
echo "main(){exit(0);bcopy();}" > bfind.c
-cc -o bfind bfind.c
-sh -c "if ./bfind;\
then echo Using system bcopy; (mv bnull.o sbbcpy.o)\
else echo Using SB bcopy; fi"
rm -f bfind bfind.c bfind.o a.out bnull.c bnull.o
ar rv libsb.a sbbcpy.o
--
BURNS,JIM (returned student)
Georgia Institute of Technology, 30178 Georgia Tech Station,
Atlanta Georgia, 30332 | Internet: gt0178a@prism.gatech.edu
uucp: ...!{decvax,hplabs,ncar,purdue,rutgers}!gatech!prism!gt0178a

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -0,0 +1,27 @@
/*
* Set or display hostname. Jeff Comstock - Bloomington, MN USA 1992
* Usage: hostname [name]
* Only root may change the hostname.
*/
#include <stdio.h>
#include <unistd.h>
main(int argc, char **argv) {
struct utsname uts;
if ( argc == 2 ) {
if ( sethostname(argv[1],strlen(argv[1]))) {
perror("sethostname");
exit(1);
}
}
else {
if (uname(&uts)) {
perror("uname");
exit(1);
}
else
puts(uts.nodename);
}
return(0);
}

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -0,0 +1,11 @@
This archive contains a Executable of LHA and an archive with the source
and the addapted Makefile so one can compile under Linux.
I (The Sender of this File) would like to see this archive added to the
archive of Linux Programs.
I hope it is of any use to someone out there!
For any questions I'm reacheable by E-Mail under
m2c6@sci.kun.nl (At least until June 1992).

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -0,0 +1,44 @@
This is the Mtools v2.0 distribution package. Mtools is a public domain
collection of programs to allow Unix systems to read, write, and
manipulate files on an MSDOS filesystem (typically a diskette).
The following MSDOS commands are emulated:
Mtool MSDOS
name equivalent Description
----- ---- -----------
mattrib ATTRIB change MSDOS file attribute flags
mcd CD change MSDOS directory
mcopy COPY copy MSDOS files to/from Unix
mdel DEL/ERASE delete an MSDOS file
mdir DIR display an MSDOS directory
mformat FORMAT add MSDOS filesystem to a low-level format
mlabel LABEL make an MSDOS volume label.
mmd MD/MKDIR make an MSDOS subdirectory
mrd RD/RMDIR remove an MSDOS subdirectory
mread COPY low level read (copy) an MSDOS file to Unix
mren REN/RENAME rename an existing MSDOS file
mtype TYPE display contents of an MSDOS file
mwrite COPY low level write (copy) a Unix file to MSDOS
Here are what the files should look like:
file name length att sum bsd sum
mtools_patches1-5.Z 43331 01381 04887
mtools_sh.1.Z 27527 34726 38082
mtools_sh.2.Z 26902 17097 42191
mtools_sh.3.Z 16327 04558 20371
mtools_sh.4.Z 10405 51165 39152
The 'mtools_patches1-5' file is for those people who already have Mtools
version 2.0, but are missing one or more of the patches. The 'mtools_sh.*'
files already have the patches installed. The last file 'mtools_sh.4' is
optional... it contains the formatted output of the manual pages for the
benefit of those without nroff.
Emmet P. Gray US Army, HQ III Corps & Fort Hood
...!uunet!uiucuxc!fthood!egray Attn: AFZF-DE-ENV
fthood!egray@uxc.cso.uiuc.edu Directorate of Engineering & Housing
Environmental Management Office
Fort Hood, TX 76544-5057

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -0,0 +1,283 @@
/*
* Stat.c Dump out inode info in nice form. pur-ee!rsk
* Original version by someone at Purdue in the days of v6;
* this one by Rsk for modern times. (4.2, V)
*
* Bug fix for setuid bit misplacement, and modifications
* for System V by Bill Stoll, whuxlm!wws.
*
* Masscomp (and system V) mods by Stan Barber, neuro1!sob.
*
* Bug fix for setuid bit and flag mods, and for
* misplaced include of time.h, okstate!zap.
* Note: I left SINCE as a compile-time option; it
* probably shouldn't even be there. ---Rsk
*
* (void)'s added to make lint happy, pur-ee!rsk.
*
* Still doesn't run under 2.9; to be fixed soon.
*
*
* Vanilla version is for system V.
* Define BSD42 for 4.2bsd version.
* Define SINCE for "elapsed time" since inode times.
* Define MASSCOMP for those machines; this implies system V.
*/
/*
* 1992-03-03 bergt@informatik.tu-chemnitz.de: ported the stuff
* to Linux 0.12 and add's unknown uid's and gid's
*/
#ifdef MASSCOMP
#undef BSD42
#endif MASSCOMP
#include <stdio.h>
#include <sys/time.h>
#include <sys/types.h>
#include <ctype.h>
#include <sys/stat.h>
#include <pwd.h>
#include <grp.h>
#include <strings.h>
#include <stdlib.h>
#define FAIL -1 /* Failure return code from call */
#define OKAY 0 /* Success return code from call */
struct stat Sbuf; /* for return values from stat() call */
char *ctime(); /* Time conversion */
struct passwd *pwent; /* User structure */
struct group *grent; /* Group structure */
char Mode[10]; /* File protection mode */
#define LBUFSIZ 256 /* Length for symbolic link translation buffer */
char Lbuf[LBUFSIZ]; /* Symbolic link translation buffer */
main(argc, argv)
int argc;
char *argv[];
{
int i;
i = 1;
if(argc == 1) {
(void) fprintf(stderr,"Usage: stat file1 [file2 ...]\n");
exit(1);
}
do {
(void) stat_it(argv[i]);
if( (argc > 1) && (i < (argc-1)) )
(void) printf("\n");
}
while(++i < argc);
exit(0);
}
/*
* stat_it() - Actually stat and format results from file.
* exit - OKAY if no problems encountered
* FAIL if couldn't open or other nastiness
*
*/
stat_it(filename)
char *filename;
{
int count;
#ifdef BSD42
if( lstat(filename,&Sbuf) == FAIL) {
(void) fprintf(stderr,"Can't lstat %s\n",filename);
return(FAIL);
}
#else BSD42
if( stat(filename,&Sbuf) == FAIL) {
(void) fprintf(stderr,"Can't stat %s\n",filename);
return(FAIL);
}
#endif BSD42
#ifdef BSD42
if( (Sbuf.st_mode & S_IFMT) == S_IFLNK) {
if( (count=readlink(filename,Lbuf,LBUFSIZ)) == FAIL) {
(void) fprintf(stderr,"Can't readlink %s\n", filename);
return(FAIL);
}
if( count < LBUFSIZ)
Lbuf[count] = '\0';
(void) printf(" File: \"%s\" -> \"%s\"\n",filename,Lbuf);
}
else
#endif BSD42
(void) printf(" File: \"%s\"\n", filename);
(void) printf(" Size: %-10d", Sbuf.st_size);
#ifdef BSD42
(void) printf(" Allocated Blocks: %-10ld", Sbuf.st_blocks);
#endif BSD42
(void) printf(" Filetype: ");
switch( Sbuf.st_mode & S_IFMT) {
case S_IFDIR: (void) printf("Directory\n");
break;
case S_IFCHR: (void) printf("Character Device\n");
break;
case S_IFBLK: (void) printf("Block Device\n");
break;
case S_IFREG: (void) printf("Regular File\n");
break;
#ifdef BSD42
case S_IFLNK: (void) printf("Symbolic Link\n");
break;
case S_IFSOCK: (void) printf("Socket\n");
break;
#else BSD42
case S_IFIFO: (void) printf("Fifo File\n");
break;
#endif BSD42
#ifdef MASSCOMP
case S_IFCTG: (void) printf("Contiguous File\n");
break;
#endif MASSCOMP
default : (void) printf("Unknown\n");
}
(void) strcpy(Mode,"----------");
if(Sbuf.st_mode & (S_IXUSR>>6)) /* Other execute */
Mode[9] = 'x';
if(Sbuf.st_mode & (S_IWUSR>>6)) /* Other write */
Mode[8] = 'w';
if(Sbuf.st_mode & (S_IRUSR>>6)) /* Other read */
Mode[7] = 'r';
if(Sbuf.st_mode & (S_IXUSR>>3)) /* Group execute */
Mode[6] = 'x';
if(Sbuf.st_mode & (S_IWUSR>>3)) /* Group write */
Mode[5] = 'w';
if(Sbuf.st_mode & (S_IRUSR>>3)) /* Group read */
Mode[4] = 'r';
if(Sbuf.st_mode & S_IXUSR) /* User execute */
Mode[3] = 'x';
if(Sbuf.st_mode & S_IWUSR) /* User write */
Mode[2] = 'w';
if(Sbuf.st_mode & S_IRUSR) /* User read */
Mode[1] = 'r';
if(Sbuf.st_mode & S_ISVTX) /* Sticky bit */
Mode[9] = 't';
if(Sbuf.st_mode & S_ISGID) /* Set group id */
Mode[6] = 's';
if(Sbuf.st_mode & S_ISUID) /* Set user id */
Mode[3] = 's';
switch( Sbuf.st_mode & S_IFMT) {
case S_IFDIR: Mode[0] = 'd';
break;
case S_IFCHR: Mode[0] = 'c';
break;
case S_IFBLK: Mode[0] = 'b';
break;
case S_IFREG: Mode[0] = '-';
break;
#ifdef BSD42
case S_IFLNK: Mode[0] = 'l';
break;
case S_IFSOCK: Mode[0] = 's';
break;
#else BSD42
case S_IFIFO: Mode[0] = 'f';
break;
#endif BSD42
#ifdef MASSCOMP
case S_IFCTG: Mode[0] = 'C';
break;
#endif MASSCOMP
default : Mode[0] = '?';
}
(void) printf(" Mode: (%04o/%s)", Sbuf.st_mode&07777,Mode);
(void) setpwent();
if( (pwent = getpwuid(Sbuf.st_uid)) == NULL) {
pwent = (PTR) malloc(sizeof(struct passwd));
(void) strcpy(pwent->pw_name, "???");
}
(void) printf(" Uid: (%5d/%8s)", Sbuf.st_uid, pwent->pw_name);
(void) setgrent();
if( (grent = getgrgid(Sbuf.st_gid)) == NULL) {
grent = (PTR) malloc(sizeof(struct passwd));
(void) strcpy(grent->gr_name, "???");
}
(void) printf(" Gid: (%5d/%8s)\n", Sbuf.st_gid, grent->gr_name);
(void) printf("Device: %-5d", Sbuf.st_dev);
(void) printf(" Inode: %-10d", Sbuf.st_ino);
(void) printf("Links: %-5d", Sbuf.st_nlink);
/* Only meaningful if file is device */
if( ( (Sbuf.st_mode & S_IFMT) == S_IFCHR)
|| ( (Sbuf.st_mode & S_IFMT) == S_IFBLK) )
(void) printf(" Device type: %d\n",Sbuf.st_rdev);
else
(void) printf("\n");
/* The %.24s strips the newline from the ctime() string */
#ifdef SINCE
(void) printf("Access: %.24s",ctime(&Sbuf.st_atime));
(void) tsince(Sbuf.st_atime);
(void) printf("Modify: %.24s",ctime(&Sbuf.st_mtime));
(void) tsince(Sbuf.st_mtime);
(void) printf("Change: %.24s",ctime(&Sbuf.st_ctime));
(void) tsince(Sbuf.st_ctime);
#else SINCE
(void) printf("Access: %s",ctime(&Sbuf.st_atime));
(void) printf("Modify: %s",ctime(&Sbuf.st_mtime));
(void) printf("Change: %s",ctime(&Sbuf.st_ctime));
#endif SINCE
/*
* Should I put this in somewhere? No.
*
* printf("Optimal Blocksize: %ld\n", Sbuf.st_blksize);
*/
return(OKAY);
}
#ifdef SINCE
tsince(time_sec)
long time_sec;
{
long time_buf;
long d_since; /* days elapsed since time */
long h_since; /* hours elapsed since time */
long m_since; /* minutes elapsed since time */
long s_since; /* seconds elapsed since time */
(void) time(&time_buf);
if(time_sec > time_buf) {
(void) fprintf(stderr,"Time going backwards\n");
exit(1);
}
s_since = time_buf - time_sec;
d_since = s_since / 86400l ;
s_since -= d_since * 86400l ;
h_since = s_since / 3600l ;
s_since -= h_since * 3600l ;
m_since = s_since / 60l ;
s_since -= m_since * 60l ;
(void) printf("(%05ld.%02ld:%02ld:%02ld)\n",d_since,h_since,m_since,s_since);
return(OKAY);
}
#endif SINCE

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -0,0 +1,133 @@
This is a version of tty.c for linux.
john harvey JOHNBOB at AUSVMQ I don't speak for my employer.
johnbob@innerdoor.austin.ibm.com johnbob@there.austin.ibm.com
johnbob@129.35.81.111 johnbob@129.35.81.200
main(int c,char**v){if(c==2){int n=atoi(v[1]);printf("%d\n",
n*main(-n+1,v));}else if(c<0)return-c*main(c+1,v);return 1;}
---- Cut Here and unpack ----
#!/bin/sh
# This is a shell archive (shar 3.10)
# made 01/21/1992 18:47 UTC by rjohnbobpts/4@AIX
# Source directory /drive2/u/johnbob/net/linux/contrib
#
# existing files will NOT be overwritten
#
# This shar contains:
# length mode name
# ------ ---------- ------------------------------------------
# 170 -rw-r--r-- Makefile
# 158 -rw-r--r-- add.this
# 587 -rw-r--r-- tty.c
#
touch 2>&1 | fgrep '[-amc]' > /tmp/s3_touch$$
if [ -s /tmp/s3_touch$$ ]
then
TOUCH=can
else
TOUCH=cannot
fi
rm -f /tmp/s3_touch$$
# ============= Makefile ==============
if test -f Makefile; then echo "File Makefile exists"; else
echo "x - extracting Makefile (Text)"
sed 's/^X//' << 'SHAR_EOF' > Makefile &&
X#
X#
X
XPROGRAM = tty
XSRC = tty.c
XOBJS = tty.o
X
XCC=cc
XCFLAGS = -O
X
X
Xall: $(PROGRAM)
X
X$(PROGRAM): $(OBJS)
X $(CC) -o $(PROGRAM) $(OBJS) $(LIBS)
X
X.c.o:
X $(CC) $(CFLAGS) -c $<
X
SHAR_EOF
chmod 0644 Makefile || echo "restore of Makefile fails"
if [ $TOUCH = can ]
then
touch -am 0120162992 Makefile
fi
fi
# ============= add.this ==============
if test -f add.this; then echo "File add.this exists"; else
echo "x - extracting add.this (Text)"
sed 's/^X//' << 'SHAR_EOF' > add.this &&
XThe prototype for the ttyname() function wasn't in
X/usr/include/unistd.h so you will have to add it to
Xthe bottom of the file:
X
Xchar * ttyname(int fildes);
X
X
SHAR_EOF
chmod 0644 add.this || echo "restore of add.this fails"
if [ $TOUCH = can ]
then
touch -am 0120174392 add.this
fi
fi
# ============= tty.c ==============
if test -f tty.c; then echo "File tty.c exists"; else
echo "x - extracting tty.c (Text)"
sed 's/^X//' << 'SHAR_EOF' > tty.c &&
X/*
X tty.c
X By John Harvey AKA johnbob AKA qk
X copy this all you want
X*/
X
X#include <sys/types.h>
X#include <stdio.h>
X#include <unistd.h>
X
Xvoid syntax(int rv)
X{
X fprintf(stderr,"syntax: tty [-s]\n");
X exit(rv);
X}
X
Xmain(int argc, char **argv)
X{
X int silent = 0;
X char *n;
X
X if( argc == 2 )
X {
X if( strcmp(argv[1],"-s") )
X syntax(1);
X silent = 1;
X }
X else if ( argc != 1 )
X syntax(1);
X if( n=ttyname(0) )
X {
X if ( ! silent )
X printf("%s\n", n);
X exit(0);
X }
X else
X {
X if ( ! silent )
X printf("%s\n", "Not a tty");
X exit(1);
X }
X}
SHAR_EOF
chmod 0644 tty.c || echo "restore of tty.c fails"
if [ $TOUCH = can ]
then
touch -am 0120173492 tty.c
fi
fi
exit 0

Binary file not shown.

View File

@@ -0,0 +1,72 @@
/*
* uname - print system information. Jeff Comstock - Bloomington, MN USA 1992
* Usage: uname [-asnrvm]
* -s prints system name
* -n prints nodename
* -r prints software release
* -v prints os version
* -m prints machine name
* -a prinst all the above information
*/
#include <stdio.h>
#include <getopt.h>
#include <unistd.h>
#define SYSNAME 0
#define NODENAME 1
#define RELEASE 2
#define VERSION 3
#define MACHINE 4
struct utsname u;
struct utstab {
char *str;
int requested;
} uttab[] = {
{ u.sysname, 0 },
{ u.nodename, 0 },
{ u.release, 0 },
{ u.version, 0 },
{ u.machine, 0 }
};
main(int argc, char **argv) {
char *opts="amnrsv";
register int c,space, all=0;
if ( ! uname(&u) ) {
if ( argc == 1 ) {
puts(u.sysname);
} else {
while ( (c = getopt(argc,argv,opts)) != -1 ) {
switch ( c ) {
case 'a' : all++;
break;
case 'm' : uttab[MACHINE].requested++;
break;
case 'n' : uttab[NODENAME].requested++;
break;
case 'r' : uttab[RELEASE].requested++;
break;
case 's' : uttab[SYSNAME].requested++;
break;
case 'v' : uttab[VERSION].requested++;
break;
}
}
space=0;
for(c=0; c <= MACHINE; c++) {
if ( uttab[c].requested || all ) {
if ( space )
putchar(' ');
printf("%s", uttab[c].str);
space++;
}
}
puts("");
}
}
else
perror("uname");
}

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.