mirror of
https://github.com/GnoConsortium/gno.git
synced 2024-05-31 15:41:31 +00:00
initial checkin
This commit is contained in:
parent
91ac68c447
commit
6fbd0e2248
19
bin/pwd/Makefile
Normal file
19
bin/pwd/Makefile
Normal file
|
@ -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
|
71
bin/pwd/pwd.1
Normal file
71
bin/pwd/pwd.1
Normal file
|
@ -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)
|
137
bin/pwd/pwd.c
Normal file
137
bin/pwd/pwd.c
Normal file
|
@ -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 <err.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
|
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 <gno/gno.h>
|
||||||
|
#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);
|
||||||
|
}
|
10
bin/pwd/pwd.desc
Normal file
10
bin/pwd/pwd.desc
Normal file
|
@ -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/<prog>
|
||||||
|
FTP: ground.isca.uiowa.edu apple2.caltech.edu trenco.myrias.com
|
||||||
|
|
||||||
|
Print working directory name
|
||||||
|
|
30
bin/pwd/pwd.rez
Normal file
30
bin/pwd/pwd.rez
Normal file
|
@ -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."
|
||||||
|
};
|
60
bin/pwd/tests/dotests
Normal file
60
bin/pwd/tests/dotests
Normal file
|
@ -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)"
|
29
bin/pwd/tests/fulltests
Normal file
29
bin/pwd/tests/fulltests
Normal file
|
@ -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\""
|
19
bin/sleep/Makefile
Normal file
19
bin/sleep/Makefile
Normal file
|
@ -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
|
102
bin/sleep/sleep.1
Normal file
102
bin/sleep/sleep.1
Normal file
|
@ -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.
|
125
bin/sleep/sleep.c
Normal file
125
bin/sleep/sleep.c
Normal file
|
@ -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 <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
|
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 <gno/gno.h>
|
||||||
|
#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);
|
||||||
|
}
|
10
bin/sleep/sleep.desc
Normal file
10
bin/sleep/sleep.desc
Normal file
|
@ -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.
|
||||||
|
|
30
bin/sleep/sleep.rez
Normal file
30
bin/sleep/sleep.rez
Normal file
|
@ -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."
|
||||||
|
};
|
43
bin/sleep/tests/dotests
Normal file
43
bin/sleep/tests/dotests
Normal file
|
@ -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)"
|
29
bin/sleep/tests/fulltests
Normal file
29
bin/sleep/tests/fulltests
Normal file
|
@ -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\""
|
13
bin/yes/Makefile
Normal file
13
bin/yes/Makefile
Normal file
|
@ -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
|
1
bin/yes/tests/default.out
Normal file
1
bin/yes/tests/default.out
Normal file
|
@ -0,0 +1 @@
|
||||||
|
y
|
33
bin/yes/tests/dotests
Normal file
33
bin/yes/tests/dotests
Normal file
|
@ -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 ""
|
29
bin/yes/tests/fulltests
Normal file
29
bin/yes/tests/fulltests
Normal file
|
@ -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\""
|
27
bin/yes/yes.1
Normal file
27
bin/yes/yes.1
Normal file
|
@ -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.
|
19
bin/yes/yes.c
Normal file
19
bin/yes/yes.c
Normal file
|
@ -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 <stdio.h>
|
||||||
|
|
||||||
|
int main(int argc, char *argv[])
|
||||||
|
{
|
||||||
|
char *s, *y="y";
|
||||||
|
if (argc > 1)
|
||||||
|
s = argv[1];
|
||||||
|
else
|
||||||
|
s = y;
|
||||||
|
for (;;)
|
||||||
|
puts(s);
|
||||||
|
}
|
11
bin/yes/yes.desc
Normal file
11
bin/yes/yes.desc
Normal file
|
@ -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
|
||||||
|
|
||||||
|
|
30
bin/yes/yes.rez
Normal file
30
bin/yes/yes.rez
Normal file
|
@ -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."
|
||||||
|
};
|
Loading…
Reference in New Issue
Block a user