From 6fbd0e224825615b120b7ed9c12cac0649829ef1 Mon Sep 17 00:00:00 2001 From: gdr Date: Fri, 3 Oct 1997 04:05:02 +0000 Subject: [PATCH] initial checkin --- bin/pwd/Makefile | 19 ++++++ bin/pwd/pwd.1 | 71 ++++++++++++++++++++ bin/pwd/pwd.c | 137 ++++++++++++++++++++++++++++++++++++++ bin/pwd/pwd.desc | 10 +++ bin/pwd/pwd.rez | 30 +++++++++ bin/pwd/tests/dotests | 60 +++++++++++++++++ bin/pwd/tests/fulltests | 29 ++++++++ bin/sleep/Makefile | 19 ++++++ bin/sleep/sleep.1 | 102 ++++++++++++++++++++++++++++ bin/sleep/sleep.c | 125 ++++++++++++++++++++++++++++++++++ bin/sleep/sleep.desc | 10 +++ bin/sleep/sleep.rez | 30 +++++++++ bin/sleep/tests/dotests | 43 ++++++++++++ bin/sleep/tests/fulltests | 29 ++++++++ bin/yes/Makefile | 13 ++++ bin/yes/tests/default.out | 1 + bin/yes/tests/dotests | 33 +++++++++ bin/yes/tests/fulltests | 29 ++++++++ bin/yes/yes.1 | 27 ++++++++ bin/yes/yes.c | 19 ++++++ bin/yes/yes.desc | 11 +++ bin/yes/yes.rez | 30 +++++++++ 22 files changed, 877 insertions(+) create mode 100644 bin/pwd/Makefile create mode 100644 bin/pwd/pwd.1 create mode 100644 bin/pwd/pwd.c create mode 100644 bin/pwd/pwd.desc create mode 100644 bin/pwd/pwd.rez create mode 100644 bin/pwd/tests/dotests create mode 100644 bin/pwd/tests/fulltests create mode 100644 bin/sleep/Makefile create mode 100644 bin/sleep/sleep.1 create mode 100644 bin/sleep/sleep.c create mode 100644 bin/sleep/sleep.desc create mode 100644 bin/sleep/sleep.rez create mode 100644 bin/sleep/tests/dotests create mode 100644 bin/sleep/tests/fulltests create mode 100644 bin/yes/Makefile create mode 100644 bin/yes/tests/default.out create mode 100644 bin/yes/tests/dotests create mode 100644 bin/yes/tests/fulltests create mode 100644 bin/yes/yes.1 create mode 100644 bin/yes/yes.c create mode 100644 bin/yes/yes.desc create mode 100644 bin/yes/yes.rez diff --git a/bin/pwd/Makefile b/bin/pwd/Makefile new file mode 100644 index 0000000..dfd8ee9 --- /dev/null +++ b/bin/pwd/Makefile @@ -0,0 +1,19 @@ +# +# This makefile is intended for use with dmake(1) on Apple IIGS +# $Id: Makefile,v 1.1 1997/10/03 04:02:33 gdr Exp $ +# +# Created by Dave Tribby, September 1997 + +# Program name +PROG= pwd + +# Default stack size and optimization (can be overridden by cmd line) +# These values have been tested and certified as working +.IF $(STACK) == $(NULL) + STACK = 1024 +.END +.IF $(OPTIMIZE) == $(NULL) + OPTIMIZE = -1 +.END + +.INCLUDE : /src/gno/prog.mk diff --git a/bin/pwd/pwd.1 b/bin/pwd/pwd.1 new file mode 100644 index 0000000..02df3af --- /dev/null +++ b/bin/pwd/pwd.1 @@ -0,0 +1,71 @@ +.\" Copyright (c) 1990, 1993 +.\" The Regents of the University of California. All rights reserved. +.\" +.\" This code is derived from software contributed to Berkeley by +.\" the Institute of Electrical and Electronics Engineers, Inc. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" 3. All advertising materials mentioning features or use of this software +.\" must display the following acknowledgement: +.\" This product includes software developed by the University of +.\" California, Berkeley and its contributors. +.\" 4. Neither the name of the University nor the names of its contributors +.\" may be used to endorse or promote products derived from this software +.\" without specific prior written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" @(#)pwd.1 8.2 (Berkeley) 4/28/95 +.\" $Id: pwd.1,v 1.1 1997/10/03 04:02:33 gdr Exp $ +.\" +.TH PWD 1 "September 1997" "GNO" "Commands and Applications" +.SH NAME +.BR pwd +\- return working directory name +.SH SYNOPSIS +.BR pwd +.SH DESCRIPTION +.BR pwd +writes the absolute pathname of the current working directory to +the standard output. +.LP +The pwd utility exits 0 on success, and >0 if an error occurs. +.SH VERSION +This manual page documents +.BR pwd +version 1.0. +.SH HISTORY +Prior to GNO 2.0.6, +.BR pwd +was released only as a built-in command to +.IR gsh (1). +.SH STANDARDS +The +.BR pwd +command is expected to be +POSIX.2 +compatible. +.SH ATTRIBUTIONS +This command was ported from FreeBSD source code +for distribution with GNO/ME 2.0.6. +.SH SEE ALSO +.BR cd (1), +.BR gsh (1), +.BR getcwd (3) diff --git a/bin/pwd/pwd.c b/bin/pwd/pwd.c new file mode 100644 index 0000000..55b875d --- /dev/null +++ b/bin/pwd/pwd.c @@ -0,0 +1,137 @@ +/* + * Copyright (c) 1991, 1993, 1994 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $Id: pwd.c,v 1.1 1997/10/03 04:02:33 gdr Exp $ + */ + +/* + * Modified for GNO (Apple IIGS) by Dave Tribby, September 1997 + * + * Constructs unacceptable to compiler are replaced using #ifndef __ORCAC__ + * + * Changes not related to compiler are replaced using #ifndef __GNO__ + * + * Added prototyped headers, surrounded by #ifndef __STDC__ + */ + +#ifndef __GNO__ +#ifndef lint +static char const copyright[] = +"@(#) Copyright (c) 1991, 1993, 1994\n\ + The Regents of the University of California. All rights reserved.\n"; +#endif /* not lint */ + +#ifndef lint +static char const sccsid[] = "@(#)pwd.c 8.3 (Berkeley) 4/1/94"; +#endif /* not lint */ +#endif + +#include +#include +#include +#include + +void usage __P((void)); + + +/* Interface to check on how much stack space a C program uses. */ +#if defined(__GNO__) && defined(__STACK_CHECK__) +#ifndef _GNO_GNO_H_ +#include +#endif +static void report_stack(void) +{ + fprintf(stderr,"\n ==> %d stack bytes used <== \n", _endStackCheck()); +} +#endif + + +int +#ifndef __STDC__ +main(argc, argv) + int argc; + char *argv[]; +#else +main(int argc, char *argv[]) +#endif +{ + int ch; + char *p; + +#if defined(__GNO__) && defined(__STACK_CHECK__) + _beginStackCheck(); + atexit(report_stack); +#endif + + /* + * Flags for pwd are a bit strange. The POSIX 1003.2B/D9 document + * has an optional -P flag for physical, which is what this program + * will produce by default. The logical flag, -L, should fail, as + * there's no way to display a logical path after forking. We don't + * document either flag, only adding -P for future portability. + */ + while ((ch = getopt(argc, argv, "P")) != -1) + switch (ch) { + case 'P': + break; + case '?': + default: + usage(); + } + argc -= optind; +#ifndef __ORCAC__ + argv += optind; +#else + /* ORCA/C 2.1 compiler cannot handle += on pointer */ + argv = argv + optind; +#endif + + if (argc != 0) + usage(); + + if ((p = getcwd(NULL, 0)) == NULL) + err(1, NULL); + (void)printf("%s\n", p); + exit(0); +} + +void +#ifndef __STDC__ +usage() +#else +usage(void) +#endif +{ + + (void)fprintf(stderr, "usage: pwd\n"); + exit(1); +} diff --git a/bin/pwd/pwd.desc b/bin/pwd/pwd.desc new file mode 100644 index 0000000..d498660 --- /dev/null +++ b/bin/pwd/pwd.desc @@ -0,0 +1,10 @@ +Name: pwd +Version: 1.0 (September 1997) +Shell: GNO +Author: Dave Tribby (from FreeBSD code) +Contact: tribby@cup.hp.com +Where: /bin/ +FTP: ground.isca.uiowa.edu apple2.caltech.edu trenco.myrias.com + + Print working directory name + diff --git a/bin/pwd/pwd.rez b/bin/pwd/pwd.rez new file mode 100644 index 0000000..209d92c --- /dev/null +++ b/bin/pwd/pwd.rez @@ -0,0 +1,30 @@ +/* + * Resources for version and comment + * $Id: pwd.rez,v 1.1 1997/10/03 04:02:33 gdr Exp $ + */ +#define PROG "pwd" +#define DESC "Print working directory name" + +#include "Types.rez" + +/* + * Version + */ +resource rVersion (1, purgeable3) { + { 1, 0, 0, /* Version 1.0.0 */ + release, /* development|alpha|beta|final|release */ + 0 }, /* non-final release number */ + verUS, /* Country */ + PROG, /* Program name */ + DESC " Released with GNO/ME." +}; + + +/* + * Comment + */ +resource rComment (1, purgeable3) { + PROG " v1.0 (September 1997)\n" + "GNO utility: " DESC "\n" + "Ported from FreeBSD code by Dave Tribby." +}; diff --git a/bin/pwd/tests/dotests b/bin/pwd/tests/dotests new file mode 100644 index 0000000..36a9928 --- /dev/null +++ b/bin/pwd/tests/dotests @@ -0,0 +1,60 @@ +# Tests for pwd command; invoked by command file "fulltests" +# Written by Dave Tribby (September 1997) +# $Id: dotests,v 1.1 1997/10/03 04:02:40 gdr Exp $ + +# Location of the pwd command to be tested +set cmdir=":src:gno:bin:pwd" +set testcmd="$cmdir:pwd" + +# Echoing to a file leaves a blank at the end of the line; +# clean this up with the tr command +set cleancmd=":src:gno:usr.bin:tr:tr -d ' '" + +# Record starting time +echo -n "Testing command $testcmd beginning at" +date + +set cmp=":tmp:pwd.gsh" +set dest=":tmp:pwd.new" + +echo "Command directory ($cmdir)" +cd $cmdir +echo "$cmdir" | $cleancmd > $cmp +$testcmd > $dest +echo " Completion status = $status" +echo "Checking results against gsh built-in (no differences expected)" +cmp $cmp $dest +echo " Completion status = $status" +echo "" + +set dir=":tmp" +echo "Temporary directory ($dir)" +cd $dir +echo "$dir" | $cleancmd > $cmp +$testcmd > $dest +echo " Completion status = $status" +echo "Checking results against gsh built-in (no differences expected)" +cmp $cmp $dest +echo " Completion status = $status" +echo "" + +set dir=":usr:include" +echo "Header directory ($dir)" +cd $dir +echo "$dir" | $cleancmd > $cmp +$testcmd > $dest +echo " Completion status = $status" +echo "Checking results against gsh built-in (no differences expected)" +cmp $cmp $dest +echo " Completion status = $status" +echo "" + + +echo "***** Error Messages *****" + +set dest=":tmp:err.cond" + +echo "" +echo "Expected error: illegal option" +$testcmd -x > $dest +echo " Error completion status = $status (expected: 1)" diff --git a/bin/pwd/tests/fulltests b/bin/pwd/tests/fulltests new file mode 100644 index 0000000..60cfd52 --- /dev/null +++ b/bin/pwd/tests/fulltests @@ -0,0 +1,29 @@ +# gsh script to run tests and collect results +# Written by Dave Tribby * August 1997 +# $Id: fulltests,v 1.1 1997/10/03 04:02:40 gdr Exp $ + +# Name of gsh script containing test cases +set command="dotests" +# Sometimes the file type is modified by editing; make it executable +chtyp -l exec $command + +# Filenames for raw and modified results +set raw_file="/tmp/rawlist" +set result_file="test.list" + +# Location of tr command that knows how to handle classes +set trcmd="/src/gno/usr.bin/tr/tr" + +# --- Begin the tests --- + +echo -n "Executing test script \"$command\" from directory " +pwd + +# Create a new gsh invocation and record all I/O +echo "$command ; exit" | script $raw_file + +# Cleanup control chars using either of the following... +echo "Done with tests. Removing control characters from results file" +$trcmd -c -ds '[:print:]\r' '\r' < $raw_file > $result_file + +echo "Tests results have been saved as \"$result_file\"" diff --git a/bin/sleep/Makefile b/bin/sleep/Makefile new file mode 100644 index 0000000..3b68668 --- /dev/null +++ b/bin/sleep/Makefile @@ -0,0 +1,19 @@ +# +# This makefile is intended for use with dmake(1) on Apple IIGS +# $Id: Makefile,v 1.1 1997/10/03 04:02:40 gdr Exp $ +# +# Created by Dave Tribby, September 1997 + +# Program name +PROG= sleep + +# Default stack size and optimization (can be overridden by cmd line) +# These values have been tested and certified as working +.IF $(STACK) == $(NULL) + STACK = 768 +.END +.IF $(OPTIMIZE) == $(NULL) + OPTIMIZE = -1 +.END + +.INCLUDE : /src/gno/prog.mk diff --git a/bin/sleep/sleep.1 b/bin/sleep/sleep.1 new file mode 100644 index 0000000..c59d0d0 --- /dev/null +++ b/bin/sleep/sleep.1 @@ -0,0 +1,102 @@ +.\" Copyright (c) 1990, 1993, 1994 +.\" The Regents of the University of California. All rights reserved. +.\" +.\" This code is derived from software contributed to Berkeley by +.\" the Institute of Electrical and Electronics Engineers, Inc. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" 3. All advertising materials mentioning features or use of this software +.\" must display the following acknowledgement: +.\" This product includes software developed by the University of +.\" California, Berkeley and its contributors. +.\" 4. Neither the name of the University nor the names of its contributors +.\" may be used to endorse or promote products derived from this software +.\" without specific prior written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" @(#)sleep.1 8.3 (Berkeley) 4/18/94 +.\" $Id: sleep.1,v 1.1 1997/10/03 04:02:40 gdr Exp $ +.\" +.TH SLEEP 1 "September 1997" "" "Commands and Applications" +.SH NAME +.BR sleep +\- suspend execution for an interval of time +.SH SYNOPSIS +.BR sleep +.BR seconds +.SH DESCRIPTION +The +.BR sleep +command +suspends execution for a minimum of +.BR seconds . +.BR sleep +is used to schedule the execution of other commands (see +.B EXAMPLES +below). +.LP +If the +.BR sleep +command +receives a SIGALRM signal, it terminates normally with a zero exit status, +for any other signal it takes the standard action. +.LP +The +.BR sleep +utility exits with one of the following values: +.RS +.BR 0 +On successful completion, or if the signal +.BR SIGALRM +was received. +.LP +.BR \&>\&0 +An error occurred. +.RE +.SH EXAMPLES +To schedule the execution of a command for +some +number of seconds later: +.LP +.B "sleep 1800; command_file" +.LP +This incantation would wait a half hour before +running the script command_file. (See the +.BR at (1) +utility.) +.SH VERSION +This manual page documents +.BR sleep +version 2.0. +.SH ATTRIBUTIONS +This command was ported from FreeBSD source code +for distribution with GNO/ME 2.0.6. +.SH SEE ALSO +.BR at (1), +.BR setitimer (2), +.BR alarm (3), +.BR sleep (3) +.SH STANDARDS +The +.BR sleep +command is expected to be +POSIX.2 +compatible. diff --git a/bin/sleep/sleep.c b/bin/sleep/sleep.c new file mode 100644 index 0000000..00a1b98 --- /dev/null +++ b/bin/sleep/sleep.c @@ -0,0 +1,125 @@ +/* + * Copyright (c) 1988, 1993, 1994 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $Id: sleep.c,v 1.1 1997/10/03 04:02:41 gdr Exp $ + */ + +/* + * Modified for GNO (Apple IIGS) by Dave Tribby, September 1997 + * + * Constructs unacceptable to compiler are replaced using #ifndef __ORCAC__ + * + * Changes not related to compiler are replaced using #ifndef __GNO__ + * + * Added prototyped headers, surrounded by #ifndef __STDC__ + */ + +#ifndef __GNO__ +#ifndef lint +static char const copyright[] = +"@(#) Copyright (c) 1988, 1993, 1994\n\ + The Regents of the University of California. All rights reserved.\n"; +#endif /* not lint */ + +#ifndef lint +static char const sccsid[] = "@(#)sleep.c 8.3 (Berkeley) 4/2/94"; +#endif /* not lint */ +#endif + +#include +#include +#include + +void usage __P((void)); + + +/* Interface to check on how much stack space a C program uses. */ +#if defined(__GNO__) && defined(__STACK_CHECK__) +#ifndef _GNO_GNO_H_ +#include +#endif +static void report_stack(void) +{ + fprintf(stderr,"\n ==> %d stack bytes used <== \n", _endStackCheck()); +} +#endif + + +int +#ifndef __STDC__ +main(argc, argv) + int argc; + char *argv[]; +#else +main(int argc, char *argv[]) +#endif +{ + int ch, secs; + +#if defined(__GNO__) && defined(__STACK_CHECK__) + _beginStackCheck(); + atexit(report_stack); +#endif + + while ((ch = getopt(argc, argv, "")) != -1) + switch(ch) { + case '?': + default: + usage(); + } + argc -= optind; +#ifndef __ORCAC__ + argv += optind; +#else + /* ORCA/C 2.1 compiler cannot handle += on pointer */ + argv = argv + optind; +#endif + + if (argc != 1) + usage(); + + if ((secs = atoi(*argv)) > 0) + (void)sleep(secs); + exit(0); +} + +void +#ifndef __STDC__ +usage() +#else +usage(void) +#endif +{ + + (void)fprintf(stderr, "usage: sleep seconds\n"); + exit(1); +} diff --git a/bin/sleep/sleep.desc b/bin/sleep/sleep.desc new file mode 100644 index 0000000..6c9d567 --- /dev/null +++ b/bin/sleep/sleep.desc @@ -0,0 +1,10 @@ +Name: sleep +Version: 2.0 (September 1997) +Shell: GNO +Author: Dave Tribby (from FreeBSD code) +Contact: tribby@cup.hp.com +Where: /bin/sleep +FTP: ground.isca.uiowa.edu apple2.caltech.edu trenco.myrias.com + + Suspend execution for an interval of time. + diff --git a/bin/sleep/sleep.rez b/bin/sleep/sleep.rez new file mode 100644 index 0000000..104e0f8 --- /dev/null +++ b/bin/sleep/sleep.rez @@ -0,0 +1,30 @@ +/* + * Resources for version and comment + * $Id: sleep.rez,v 1.1 1997/10/03 04:02:41 gdr Exp $ + */ +#define PROG "sleep" +#define DESC "Suspend execution for an interval of time." + +#include "Types.rez" + +/* + * Version + */ +resource rVersion (1, purgeable3) { + { 2, 0, 0, /* Version 2.0.0 */ + release, /* development|alpha|beta|final|release */ + 0 }, /* non-final release number */ + verUS, /* Country */ + PROG, /* Program name */ + DESC " Released with GNO/ME." +}; + + +/* + * Comment + */ +resource rComment (1, purgeable3) { + PROG " v2.0 (September 1997)\n" + "GNO utility: " DESC "\n" + "Ported from FreeBSD code by Dave Tribby." +}; diff --git a/bin/sleep/tests/dotests b/bin/sleep/tests/dotests new file mode 100644 index 0000000..389cbea --- /dev/null +++ b/bin/sleep/tests/dotests @@ -0,0 +1,43 @@ +# Tests for sleep command; invoked by command file "fulltests" +# Written by Dave Tribby (September 1997) +# $Id: dotests,v 1.1 1997/10/03 04:02:41 gdr Exp $ + +# Location of the pwd command to be tested +set testcmd="../sleep" + +# Record starting time +echo -n "Testing command $testcmd beginning at" +date + +set time=2 +echo "Sleep $time seconds" +date +$testcmd $time +set teststatus=$status +date +echo " Completion status = $teststatus" +echo "" + +set time=10 +echo "Sleep $time seconds" +date +$testcmd $time +set teststatus=$status +date +echo " Completion status = $teststatus" +echo "" + + +echo "***** Error Messages *****" + +set dest="/tmp/err.cond" + +echo "" +echo "Expected error: illegal option" +$testcmd -x +echo " Error completion status = $status (expected: 1)" + +echo "" +echo "Expected error: usage string only" +$testcmd +echo " Error completion status = $status (expected: 1)" diff --git a/bin/sleep/tests/fulltests b/bin/sleep/tests/fulltests new file mode 100644 index 0000000..ad22a5f --- /dev/null +++ b/bin/sleep/tests/fulltests @@ -0,0 +1,29 @@ +# gsh script to run tests and collect results +# Written by Dave Tribby * August 1997 +# $Id: fulltests,v 1.1 1997/10/03 04:02:41 gdr Exp $ + +# Name of gsh script containing test cases +set command="dotests" +# Sometimes the file type is modified by editing; make it executable +chtyp -l exec $command + +# Filenames for raw and modified results +set raw_file="/tmp/rawlist" +set result_file="test.list" + +# Location of tr command that knows how to handle classes +set trcmd="/src/gno/usr.bin/tr/tr" + +# --- Begin the tests --- + +echo -n "Executing test script \"$command\" from directory " +pwd + +# Create a new gsh invocation and record all I/O +echo "$command ; exit" | script $raw_file + +# Cleanup control chars using either of the following... +echo "Done with tests. Removing control characters from results file" +$trcmd -c -ds '[:print:]\r' '\r' < $raw_file > $result_file + +echo "Tests results have been saved as \"$result_file\"" diff --git a/bin/yes/Makefile b/bin/yes/Makefile new file mode 100644 index 0000000..e245ee4 --- /dev/null +++ b/bin/yes/Makefile @@ -0,0 +1,13 @@ +# +# This makefile is intended for use with dmake(1) on Apple IIGS +# $Id: Makefile,v 1.1 1997/10/03 04:04:52 gdr Exp $ +# +# Created by Dave Tribby, September 1997 + +# Program name +PROG= yes + +# Delivery directory +BINDIR = /usr/bin + +.INCLUDE : /src/gno/prog.mk diff --git a/bin/yes/tests/default.out b/bin/yes/tests/default.out new file mode 100644 index 0000000..975fbec --- /dev/null +++ b/bin/yes/tests/default.out @@ -0,0 +1 @@ +y diff --git a/bin/yes/tests/dotests b/bin/yes/tests/dotests new file mode 100644 index 0000000..3a76346 --- /dev/null +++ b/bin/yes/tests/dotests @@ -0,0 +1,33 @@ +# Tests for yes command; invoked by command file "fulltests" +# Written by Dave Tribby (September 1997) +# $Id: dotests,v 1.1 1997/10/03 04:05:02 gdr Exp $ + +# Location of the yes command to be tested +set testcmd="../yes" + +# Record starting time +echo -n "Testing command $testcmd beginning at" +date + +set cmp="default.out" +set dest="/tmp/$cmp" +echo "Default output of $testcmd" +$testcmd | head -1 > $dest +echo " Completion status = $status" +echo "Checking results against control file $cmp (no differences expected)" +cmp $cmp $dest +echo " Completion status = $status" +echo "" + +set cmp="/tmp/specific.out" +set dest="$cmp.2" +set specific="Test String" +echo "Specific output = \"$specific\"" +# NOTE: "echo" adds a blank to the end of the output line +echo "$specific" > $cmp +$testcmd "$specific " | head -1 > $dest +echo " Completion status = $status" +echo "Checking results against original string (no differences expected)" +cmp $cmp $dest +echo " Completion status = $status" +echo "" diff --git a/bin/yes/tests/fulltests b/bin/yes/tests/fulltests new file mode 100644 index 0000000..6d7c06d --- /dev/null +++ b/bin/yes/tests/fulltests @@ -0,0 +1,29 @@ +# gsh script to run tests and collect results +# Written by Dave Tribby * August 1997 +# $Id: fulltests,v 1.1 1997/10/03 04:05:02 gdr Exp $ + +# Name of gsh script containing test cases +set command="dotests" +# Sometimes the file type is modified by editing; make it executable +chtyp -l exec $command + +# Filenames for raw and modified results +set raw_file="/tmp/rawlist" +set result_file="test.list" + +# Location of tr command that knows how to handle classes +set trcmd="/src/gno/usr.bin/tr/tr" + +# --- Begin the tests --- + +echo -n "Executing test script \"$command\" from directory " +pwd + +# Create a new gsh invocation and record all I/O +echo "$command ; exit" | script $raw_file + +# Cleanup control chars using either of the following... +echo "Done with tests. Removing control characters from results file" +$trcmd -c -ds '[:print:]\r' '\r' < $raw_file > $result_file + +echo "Tests results have been saved as \"$result_file\"" diff --git a/bin/yes/yes.1 b/bin/yes/yes.1 new file mode 100644 index 0000000..57c7e64 --- /dev/null +++ b/bin/yes/yes.1 @@ -0,0 +1,27 @@ +.\" +.\" $Id: yes.1,v 1.1 1997/10/03 04:04:53 gdr Exp $ +.\" +.TH YES 1 "September 1997" "GNO" "Commands and Applications" +.SH NAME +.BR yes +\- repetitively echo "y" or command-line argument +.SH SYNOPSIS +.BR yes " [" expletive ] +.SH DESCRIPTION +.BR Yes +outputs +.BR expletive , +or, by default, +.BR y , +forever. +.SH VERSION +This manual page documents +.BR yes +version 2.0. +.SH ATTRIBUTIONS +This command was rewritten from FreeBSD source code by Dave Tribby +for distribution with GNO/ME 2.0.6. +.SH HISTORY +GNO version 1.0 of the +.BR yes +command appeared in GNO 1.0. diff --git a/bin/yes/yes.c b/bin/yes/yes.c new file mode 100644 index 0000000..e920210 --- /dev/null +++ b/bin/yes/yes.c @@ -0,0 +1,19 @@ +/* + * yes program: based on FreeBSD code, but significantly + * rewritten for GNO (Apple IIGS) by Dave Tribby, September 1997 + * + * $Id: yes.c,v 1.1 1997/10/03 04:04:53 gdr Exp $ + */ + +#include + +int main(int argc, char *argv[]) +{ + char *s, *y="y"; + if (argc > 1) + s = argv[1]; + else + s = y; + for (;;) + puts(s); +} diff --git a/bin/yes/yes.desc b/bin/yes/yes.desc new file mode 100644 index 0000000..48b9332 --- /dev/null +++ b/bin/yes/yes.desc @@ -0,0 +1,11 @@ +Name: yes +Version: 2.0 (September 1997) +Shell: GNO +Author: Dave Tribby +Contact: tribby@cup.hp.com +Where: /usr/bin/yes +FTP: ground.isca.uiowa.edu apple2.caltech.edu trenco.myrias.com + + Repetitively echo "y" or command-line argument + + diff --git a/bin/yes/yes.rez b/bin/yes/yes.rez new file mode 100644 index 0000000..73ef077 --- /dev/null +++ b/bin/yes/yes.rez @@ -0,0 +1,30 @@ +/* + * Resources for version and comment + * $Id: yes.rez,v 1.1 1997/10/03 04:04:53 gdr Exp $ + */ +#define PROG "yes" +#define DESC "Repetitively echo \"y\" or command-line argument" + +#include "Types.rez" + +/* + * Version + */ +resource rVersion (1, purgeable3) { + { 2, 0, 0, /* Version 2.0.0 */ + release, /* development|alpha|beta|final|release */ + 0 }, /* non-final release number */ + verUS, /* Country */ + PROG, /* Program name */ + DESC " Released with GNO/ME." +}; + + +/* + * Comment + */ +resource rComment (1, purgeable3) { + PROG " v2.0 (September 1997)\n" + "GNO utility: " DESC "\n" + "Ported from FreeBSD code by Dave Tribby." +};