summaryrefslogtreecommitdiff
path: root/lib-src
diff options
context:
space:
mode:
authorKen Raeburn <raeburn@raeburn.org>2001-07-06 08:41:36 +0000
committerKen Raeburn <raeburn@raeburn.org>2001-07-06 08:41:36 +0000
commitad782551325b7c694ee234b5ff4c5688d90e561c (patch)
treef4355f141142b6018183518fa1761b53e295ede2 /lib-src
parentf25cfe53951f57e1b2c3972877297df3d86bb980 (diff)
downloademacs-ad782551325b7c694ee234b5ff4c5688d90e561c.tar.gz
properly mark Attic files as deleted
Diffstat (limited to 'lib-src')
-rw-r--r--lib-src/env.c353
-rw-r--r--lib-src/etags-vmslib.c155
-rw-r--r--lib-src/make-path.c105
-rwxr-xr-xlib-src/rcs2log679
-rw-r--r--lib-src/timer.c368
-rw-r--r--lib-src/wakeup.c53
6 files changed, 0 insertions, 1713 deletions
diff --git a/lib-src/env.c b/lib-src/env.c
deleted file mode 100644
index 2ae81a630b8..00000000000
--- a/lib-src/env.c
+++ /dev/null
@@ -1,353 +0,0 @@
-/* env - manipulate environment and execute a program in that environment
- Copyright (C) 1986, 1994 Free Software Foundation, Inc.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
-
-/* Mly 861126 */
-
-/* If first argument is "-", then a new environment is constructed
- from scratch; otherwise the environment is inherited from the parent
- process, except as modified by other options.
-
- So, "env - foo" will invoke the "foo" program in a null environment,
- whereas "env foo" would invoke "foo" in the same environment as that
- passed to "env" itself.
-
- Subsequent arguments are interpreted as follows:
-
- * "variable=value" (i.e., an arg containing a "=" character)
- means to set the specified environment variable to that value.
- `value' may be of zero length ("variable="). Note that setting
- a variable to a zero-length value is different from unsetting it.
-
- * "-u variable" or "-unset variable"
- means to unset that variable.
- If that variable isn't set, does nothing.
-
- * "-s variable value" or "-set variable value"
- same as "variable=value".
-
- * "-" or "--"
- are used to indicate that the following argument is the program
- to invoke. This is only necessary when the program's name
- begins with "-" or contains a "=".
-
- * anything else
- The first remaining argument specifies a program to invoke
- (it is searched for according to the specification of the PATH
- environment variable) and any arguments following that are
- passed as arguments to that program.
-
- If no program-name is specified following the environment
- specifications, the resulting environment is printed.
- This is like specifying a program-name of "printenv".
-
- Examples:
- If the environment passed to "env" is
- { USER=rms EDITOR=emacs PATH=.:/gnubin:/hacks }
-
- * "env DISPLAY=gnu:0 nemacs"
- calls "nemacs" in the environment
- { USER=rms EDITOR=emacs PATH=.:/gnubin:/hacks DISPLAY=gnu:0 }
-
- * "env - USER=foo /hacks/hack bar baz"
- calls the "hack" program on arguments "bar" and "baz"
- in an environment in which the only variable is "USER".
- Note that the "-" option clears out the PATH variable,
- so one should be careful to specify in which directory
- to find the program to call.
-
- * "env -u EDITOR USER=foo PATH=/energy -- e=mc2 bar baz"
- The program "/energy/e=mc2" is called with environment
- { USER=foo PATH=/energy }
-*/
-
-#ifdef EMACS
-#define NO_SHORTNAMES
-#include "../src/config.h"
-#endif /* EMACS */
-
-#include <stdio.h>
-
-extern int execvp ();
-
-char *xmalloc (), *xrealloc ();
-char *concat ();
-
-extern char **environ;
-
-char **nenv;
-int nenv_size;
-
-char *progname;
-void setenv ();
-void fatal ();
-char *myindex ();
-
-extern char *strerror ();
-
-
-main (argc, argv, envp)
- register int argc;
- register char **argv;
- char **envp;
-{
- register char *tem;
-
- progname = argv[0];
- argc--;
- argv++;
-
- nenv_size = 100;
- nenv = (char **) xmalloc (nenv_size * sizeof (char *));
- *nenv = (char *) 0;
-
- /* "-" flag means to not inherit parent's environment */
- if (argc && !strcmp (*argv, "-"))
- {
- argc--;
- argv++;
- }
- else
- /* Else pass on existing env vars. */
- for (; *envp; envp++)
- {
- tem = myindex (*envp, '=');
- if (tem)
- {
- *tem = '\000';
- setenv (*envp, tem + 1);
- }
- }
-
- while (argc > 0)
- {
- tem = myindex (*argv, '=');
- if (tem)
- /* If arg contains a "=" it specifies to set a variable */
- {
- *tem = '\000';
- setenv (*argv, tem + 1);
- argc--;
- argv++;
- continue;
- }
-
- if (**argv != '-')
- /* Remaining args are program name and args to pass it */
- break;
-
- if (argc < 2)
- fatal ("no argument for `%s' option", *argv);
- if (!strcmp (*argv, "-u")
- || !strcmp (*argv, "-unset"))
- /* Unset a variable */
- {
- argc--;
- argv++;
- setenv (*argv, (char *) 0);
- argc--;
- argv++;
- }
- else if (!strcmp (*argv, "-s") ||
- !strcmp (*argv, "-set"))
- /* Set a variable */
- {
- argc--;
- argv++;
- tem = *argv;
- if (argc < 2)
- fatal ("no value specified for variable \"%s\"", tem);
- argc--;
- argv++;
- setenv (tem, *argv);
- argc--;
- argv++;
- }
- else if (!strcmp (*argv, "-") || !strcmp (*argv, "--"))
- {
- argc--;
- argv++;
- break;
- }
- else
- {
- fatal ("unrecognized option `%s'", *argv);
- }
- }
-
- /* If no program specified print the environment and exit */
- if (argc <= 0)
- {
- while (*nenv)
- printf ("%s\n", *nenv++);
- exit (0);
- }
- else
- {
- extern int errno;
- extern char *strerror ();
-
- environ = nenv;
- (void) execvp (*argv, argv);
-
- fprintf (stderr, "%s: cannot execute `%s': %s\n",
- progname, *argv, strerror (errno));
- exit (errno != 0 ? errno : 1);
- }
-}
-
-void
-setenv (var, val)
- register char *var, *val;
-{
- register char **e;
- int len = strlen (var);
-
- {
- register char *tem = myindex (var, '=');
- if (tem)
- fatal ("environment variable names can not contain `=': %s", var);
- else if (*var == '\000')
- fatal ("zero-length environment variable name specified");
- }
-
- for (e = nenv; *e; e++)
- if (!strncmp (var, *e, len) && (*e)[len] == '=')
- {
- if (val)
- goto set;
- else
- do
- {
- *e = *(e + 1);
- } while (*e++);
- return;
- }
-
- if (!val)
- return; /* Nothing to unset */
-
- len = e - nenv;
- if (len + 1 >= nenv_size)
- {
- nenv_size += 100;
- nenv = (char **) xrealloc (nenv, nenv_size * sizeof (char *));
- e = nenv + len;
- }
-
-set:
- val = concat (var, "=", val);
- if (*e)
- free (*e);
- else
- *(e + 1) = (char *) 0;
- *e = val;
- return;
-}
-
-void
-fatal (msg, arg1, arg2)
- char *msg, *arg1, *arg2;
-{
- fprintf (stderr, "%s: ", progname);
- fprintf (stderr, msg, arg1, arg2);
- putc ('\n', stderr);
- exit (1);
-}
-
-
-extern char *malloc (), *realloc ();
-
-void
-memory_fatal ()
-{
- fatal ("virtual memory exhausted");
-}
-
-char *
-xmalloc (size)
- int size;
-{
- register char *value;
- value = (char *) malloc (size);
- if (!value)
- memory_fatal ();
- return (value);
-}
-
-char *
-xrealloc (ptr, size)
- char *ptr;
- int size;
-{
- register char *value;
- value = (char *) realloc (ptr, size);
- if (!value)
- memory_fatal ();
- return (value);
-}
-
-/* Return a newly-allocated string whose contents concatenate
- those of S1, S2, S3. */
-
-char *
-concat (s1, s2, s3)
- char *s1, *s2, *s3;
-{
- int len1 = strlen (s1), len2 = strlen (s2), len3 = strlen (s3);
- char *result = (char *) xmalloc (len1 + len2 + len3 + 1);
-
- strcpy (result, s1);
- strcpy (result + len1, s2);
- strcpy (result + len1 + len2, s3);
- result[len1 + len2 + len3] = 0;
-
- return result;
-}
-
-/* Return a pointer to the first occurrence in STR of C,
- or 0 if C does not occur. */
-
-char *
-myindex (str, c)
- char *str;
- char c;
-{
- char *s = str;
-
- while (*s)
- {
- if (*s == c)
- return s;
- s++;
- }
- return 0;
-}
-
-#ifndef HAVE_STRERROR
-char *
-strerror (errnum)
- int errnum;
-{
- extern char *sys_errlist[];
- extern int sys_nerr;
-
- if (errnum >= 0 && errnum < sys_nerr)
- return sys_errlist[errnum];
- return (char *) "Unknown error";
-}
-
-#endif /* ! HAVE_STRERROR */
diff --git a/lib-src/etags-vmslib.c b/lib-src/etags-vmslib.c
deleted file mode 100644
index cddb68085f8..00000000000
--- a/lib-src/etags-vmslib.c
+++ /dev/null
@@ -1,155 +0,0 @@
-/* File name wild card expansion for VMS.
- This file is part of the etags program.
- Copyright (C) 1987 Free Software Foundation, Inc.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
-
-#include <stdio.h>
-typedef char tbool;
-
-/* This is a BUG! ANY arbitrary limit is a BUG!
- Won't someone please fix this? */
-#define MAX_FILE_SPEC_LEN 255
-typedef struct {
- short curlen;
- char body[MAX_FILE_SPEC_LEN + 1];
-} vspec;
-#define EOS '\0'
-#define NO 0
-#define YES 1
-#define NULL 0
-
-/* gfnames - return in successive calls the
- name of each file specified by all the remaining args in the command-line
- expanding wild cards and
- stepping over arguments when they have been processed completely
-*/
-char*
-gfnames(pac, pav, p_error)
- int *pac;
- char **pav[];
- tbool *p_error;
-{
- static vspec filename = {MAX_FILE_SPEC_LEN, "\0"};
- short fn_exp();
-
- while (1)
- if (*pac == 0)
- {
- *p_error = NO;
- return(NULL);
- }
- else switch(fn_exp(&filename, **pav))
- {
- case 1:
- *p_error = NO;
- return(filename.body);
- break;
- case 0:
- --*pac;
- ++*pav;
- break;
- default:
- *p_error = YES;
- return(filename.body);
- break;
- }
-
-}
-
-/* fn_exp - expand specification of list of file names
- returning in each successive call the next filename matching the input
- spec. The function expects that each in_spec passed
- to it will be processed to completion; in particular, up to and
- including the call following that in which the last matching name
- is returned, the function ignores the value of in_spec, and will
- only start processing a new spec with the following call.
- If an error occurs, on return out_spec contains the value
- of in_spec when the error occurred.
-
- With each successive filename returned in out_spec, the
- function's return value is one. When there are no more matching
- names the function returns zero. If on the first call no file
- matches in_spec, or there is any other error, -1 is returned.
-*/
-
-#include <rmsdef.h>
-#include <descrip.h>
-#define OUTSIZE MAX_FILE_SPEC_LEN
-short
-fn_exp(out, in)
- vspec *out;
- char *in;
-{
- static long context = 0;
- static struct dsc$descriptor_s o;
- static struct dsc$descriptor_s i;
- static tbool pass1 = YES;
- long status;
- short retval;
-
- if (pass1)
- {
- pass1 = NO;
- o.dsc$a_pointer = (char *) out;
- o.dsc$w_length = (short)OUTSIZE;
- i.dsc$a_pointer = in;
- i.dsc$w_length = (short)strlen(in);
- i.dsc$b_dtype = DSC$K_DTYPE_T;
- i.dsc$b_class = DSC$K_CLASS_S;
- o.dsc$b_dtype = DSC$K_DTYPE_VT;
- o.dsc$b_class = DSC$K_CLASS_VS;
- }
- if ( (status = lib$find_file(&i, &o, &context, 0, 0)) == RMS$_NORMAL)
- {
- out->body[out->curlen] = EOS;
- return(1);
- }
- else if (status == RMS$_NMF)
- retval = 0;
- else
- {
- strcpy(out->body, in);
- retval = -1;
- }
- lib$find_file_end(&context);
- pass1 = YES;
- return(retval);
-}
-
-#ifndef OLD /* Newer versions of VMS do provide `system'. */
-system(cmd)
- char *cmd;
-{
- fprintf(stderr, "system() function not implemented under VMS\n");
-}
-#endif
-
-#define VERSION_DELIM ';'
-char *massage_name(s)
- char *s;
-{
- char *start = s;
-
- for ( ; *s; s++)
- if (*s == VERSION_DELIM)
- {
- *s = EOS;
- break;
- }
- else
- *s = tolower(*s);
- return(start);
-}
diff --git a/lib-src/make-path.c b/lib-src/make-path.c
deleted file mode 100644
index c4e5bf93144..00000000000
--- a/lib-src/make-path.c
+++ /dev/null
@@ -1,105 +0,0 @@
-/* Make all the directories along a path.
- Copyright (C) 1992 Free Software Foundation, Inc.
-
-This file is part of GNU Emacs.
-
-GNU Emacs is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Emacs is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Emacs; see the file COPYING. If not, write to
-the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
-
-/* This program works like mkdir, except that it generates
- intermediate directories if they don't exist. This is just like
- the `mkdir -p' command on most systems; unfortunately, the mkdir
- command on some of the purer BSD systems (like Mt. Xinu) don't have
- that option. */
-
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <stdio.h>
-#include <errno.h>
-
-extern int errno;
-
-char *prog_name;
-
-/* Create directory DIRNAME if it does not exist already.
- Then give permission for everyone to read and search it.
- Return 0 if successful, 1 if not. */
-
-int
-touchy_mkdir (dirname)
- char *dirname;
-{
- struct stat buf;
-
- /* If DIRNAME already exists and is a directory, don't create. */
- if (! (stat (dirname, &buf) >= 0
- && (buf.st_mode & S_IFMT) == S_IFDIR))
- {
- /* Otherwise, try to make it. If DIRNAME exists but isn't a directory,
- this will signal an error. */
- if (mkdir (dirname, 0777) < 0)
- {
- fprintf (stderr, "%s: ", prog_name);
- perror (dirname);
- return 1;
- }
- }
-
- /* Make sure everyone can look at this directory. */
- if (stat (dirname, &buf) < 0)
- {
- fprintf (stderr, "%s: ", prog_name);
- perror (dirname);
- return 1;
- }
- if (chmod (dirname, 0555 | (buf.st_mode & 0777)) < 0)
- {
- fprintf (stderr, "%s: ", prog_name);
- perror (dirname);
- }
-
- return 0;
-}
-
-int
-main (argc, argv)
- int argc;
- char **argv;
-{
- prog_name = *argv;
-
- for (argc--, argv++; argc > 0; argc--, argv++)
- {
- char *dirname = *argv;
- int i;
-
- /* Stop at each slash in dirname and try to create the directory.
- Skip any initial slash. */
- for (i = (dirname[0] == '/') ? 1 : 0; dirname[i]; i++)
- if (dirname[i] == '/')
- {
- dirname[i] = '\0';
- if (touchy_mkdir (dirname) < 0)
- goto next_dirname;
- dirname[i] = '/';
- }
-
- touchy_mkdir (dirname);
-
- next_dirname:
- ;
- }
-
- return 0;
-}
diff --git a/lib-src/rcs2log b/lib-src/rcs2log
deleted file mode 100755
index dd49a04f3c2..00000000000
--- a/lib-src/rcs2log
+++ /dev/null
@@ -1,679 +0,0 @@
-#! /bin/sh
-
-# RCS to ChangeLog generator
-
-# Generate a change log prefix from RCS files (perhaps in the CVS repository)
-# and the ChangeLog (if any).
-# Output the new prefix to standard output.
-# You can edit this prefix by hand, and then prepend it to ChangeLog.
-
-# Ignore log entries that start with `#'.
-# Clump together log entries that start with `{topic} ',
-# where `topic' contains neither white space nor `}'.
-
-Help='The default FILEs are the files registered under the working directory.
-Options:
-
- -c CHANGELOG Output a change log prefix to CHANGELOG (default ChangeLog).
- -h HOSTNAME Use HOSTNAME in change log entries (default current host).
- -i INDENT Indent change log lines by INDENT spaces (default 8).
- -l LENGTH Try to limit log lines to LENGTH characters (default 79).
- -R If no FILEs are given and RCS is used, recurse through working directory.
- -r OPTION Pass OPTION to subsidiary log command.
- -t TABWIDTH Tab stops are every TABWIDTH characters (default 8).
- -u "LOGIN<tab>FULLNAME<tab>MAILADDR" Assume LOGIN has FULLNAME and MAILADDR.
- -v Append RCS revision to file names in log lines.
- --help Output help.
- --version Output version number.
-
-Report bugs to <bug-gnu-emacs@gnu.org>.'
-
-Id='$Id: rcs2log,v 1.46 2001/01/02 18:50:14 eggert Exp $'
-
-# Copyright 1992, 93, 94, 95, 96, 97, 1998 Free Software Foundation, Inc.
-
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2, or (at your option)
-# any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; see the file COPYING. If not, write to the
-# Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-# Boston, MA 02111-1307, USA.
-
-Copyright='Copyright 1998 Free Software Foundation, Inc.
-This program comes with NO WARRANTY, to the extent permitted by law.
-You may redistribute copies of this program
-under the terms of the GNU General Public License.
-For more information about these matters, see the files named COPYING.
-Author: Paul Eggert <eggert@twinsun.com>'
-
-tab=' '
-nl='
-'
-
-# Parse options.
-
-# defaults
-: ${AWK=awk}
-: ${TMPDIR=/tmp}
-changelog=ChangeLog # change log file name
-datearg= # rlog date option
-hostname= # name of local host (if empty, will deduce it later)
-indent=8 # indent of log line
-length=79 # suggested max width of log line
-logins= # login names for people we know fullnames and mailaddrs of
-loginFullnameMailaddrs= # login<tab>fullname<tab>mailaddr triplets
-logTZ= # time zone for log dates (if empty, use local time)
-recursive= # t if we want recursive rlog
-revision= # t if we want revision numbers
-rlog_options= # options to pass to rlog
-tabwidth=8 # width of horizontal tab
-
-while :
-do
- case $1 in
- -c) changelog=${2?}; shift;;
- -i) indent=${2?}; shift;;
- -h) hostname=${2?}; shift;;
- -l) length=${2?}; shift;;
- -[nu]) # -n is obsolescent; it is replaced by -u.
- case $1 in
- -n) case ${2?}${3?}${4?} in
- *"$tab"* | *"$nl"*)
- echo >&2 "$0: -n '$2' '$3' '$4': tabs, newlines not allowed"
- exit 1
- esac
- case $loginFullnameMailaddrs in
- '') loginFullnameMailaddrs=$2$tab$3$tab$4;;
- ?*) loginFullnameMailaddrs=$loginFullnameMailaddrs$nl$2$tab$3$tab$4
- esac
- shift; shift; shift;;
- -u)
- # If $2 is not tab-separated, use colon for separator.
- case ${2?} in
- *"$nl"*)
- echo >&2 "$0: -u '$2': newlines not allowed"
- exit 1;;
- *"$tab"*)
- t=$tab;;
- *)
- t=:
- esac
- case $2 in
- *"$t"*"$t"*"$t"*)
- echo >&2 "$0: -u '$2': too many fields"
- exit 1;;
- *"$t"*"$t"*)
- ;;
- *)
- echo >&2 "$0: -u '$2': not enough fields"
- exit 1
- esac
- case $loginFullnameMailaddrs in
- '') loginFullnameMailaddrs=$2;;
- ?*) loginFullnameMailaddrs=$loginFullnameMailaddrs$nl$2
- esac
- shift
- esac
- case $logins in
- '') logins=$login;;
- ?*) logins=$logins$nl$login
- esac
- ;;
- -r)
- case $rlog_options in
- '') rlog_options=${2?};;
- ?*) rlog_options=$rlog_options$nl${2?}
- esac
- shift;;
- -R) recursive=t;;
- -t) tabwidth=${2?}; shift;;
- -v) revision=t;;
- --version)
- set $Id
- rcs2logVersion=$3
- echo >&2 "rcs2log (GNU Emacs) $rcs2logVersion$nl$Copyright"
- exit 0;;
- -*) echo >&2 "Usage: $0 [OPTION]... [FILE ...]$nl$Help"
- case $1 in
- --help) exit 0;;
- *) exit 1
- esac;;
- *) break
- esac
- shift
-done
-
-month_data='
- m[0]="Jan"; m[1]="Feb"; m[2]="Mar"
- m[3]="Apr"; m[4]="May"; m[5]="Jun"
- m[6]="Jul"; m[7]="Aug"; m[8]="Sep"
- m[9]="Oct"; m[10]="Nov"; m[11]="Dec"
-'
-
-
-# Put rlog output into $rlogout.
-
-# If no rlog options are given,
-# log the revisions checked in since the first ChangeLog entry.
-# Since ChangeLog is only by date, some of these revisions may be duplicates of
-# what's already in ChangeLog; it's the user's responsibility to remove them.
-case $rlog_options in
-'')
- if test -s "$changelog"
- then
- e='
- /^[0-9]+-[0-9][0-9]-[0-9][0-9]/{
- # ISO 8601 date
- print $1
- exit
- }
- /^... ... [ 0-9][0-9] [ 0-9][0-9]:[0-9][0-9]:[0-9][0-9] [0-9]+ /{
- # old-fashioned date and time (Emacs 19.31 and earlier)
- '"$month_data"'
- year = $5
- for (i=0; i<=11; i++) if (m[i] == $2) break
- dd = $3
- printf "%d-%02d-%02d\n", year, i+1, dd
- exit
- }
- '
- d=`$AWK "$e" <"$changelog"` || exit
- case $d in
- ?*) datearg="-d>$d"
- esac
- fi
-esac
-
-# Use TZ specified by ChangeLog local variable, if any.
-if test -s "$changelog"
-then
- extractTZ='
- /^.*change-log-time-zone-rule['"$tab"' ]*:['"$tab"' ]*"\([^"]*\)".*/{
- s//\1/; p; q
- }
- /^.*change-log-time-zone-rule['"$tab"' ]*:['"$tab"' ]*t.*/{
- s//UTC0/; p; q
- }
- '
- logTZ=`tail "$changelog" | sed -n "$extractTZ"`
- case $logTZ in
- ?*) TZ=$logTZ; export TZ
- esac
-fi
-
-# If CVS is in use, examine its repository, not the normal RCS files.
-if test ! -f CVS/Repository
-then
- rlog=rlog
- repository=
-else
- rlog='cvs -q log'
- repository=`sed 1q <CVS/Repository` || exit
- test ! -f CVS/Root || CVSROOT=`cat <CVS/Root` || exit
- case $CVSROOT in
- *:/*)
- # remote repository
- ;;
- *)
- # local repository
- case $repository in
- /*) ;;
- *) repository=${CVSROOT?}/$repository
- esac
- if test ! -d "$repository"
- then
- echo >&2 "$0: $repository: bad repository (see CVS/Repository)"
- exit 1
- fi
- esac
-fi
-
-# Use $rlog's -zLT option, if $rlog supports it.
-case `$rlog -zLT 2>&1` in
-*' option'*) ;;
-*)
- case $rlog_options in
- '') rlog_options=-zLT;;
- ?*) rlog_options=-zLT$nl$rlog_options
- esac
-esac
-
-# With no arguments, examine all files under the RCS directory.
-case $# in
-0)
- case $repository in
- '')
- oldIFS=$IFS
- IFS=$nl
- case $recursive in
- t)
- RCSdirs=`find . -name RCS -type d -print`
- filesFromRCSfiles='s|,v$||; s|/RCS/|/|; s|^\./||'
- files=`
- {
- case $RCSdirs in
- ?*) find $RCSdirs \
- -type f \
- ! -name '*_' \
- ! -name ',*,' \
- ! -name '.*_' \
- ! -name .rcsfreeze.log \
- ! -name .rcsfreeze.ver \
- -print
- esac
- find . -name '*,v' -print
- } |
- sort -u |
- sed "$filesFromRCSfiles"
- `;;
- *)
- files=
- for file in RCS/.* RCS/* .*,v *,v
- do
- case $file in
- RCS/. | RCS/.. | RCS/,*, | RCS/*_) continue;;
- RCS/.rcsfreeze.log | RCS/.rcsfreeze.ver) continue;;
- RCS/.\* | RCS/\* | .\*,v | \*,v) test -f "$file" || continue;;
- RCS/*,v | RCS/.*,v) ;;
- RCS/* | RCS/.*) test -f "$file" || continue
- esac
- case $files in
- '') files=$file;;
- ?*) files=$files$nl$file
- esac
- done
- case $files in
- '') exit 0
- esac
- esac
- set x $files
- shift
- IFS=$oldIFS
- esac
-esac
-
-logdir=$TMPDIR/rcs2log$$
-llogout=$logdir/l
-rlogout=$logdir/r
-trap exit 1 2 13 15
-trap "rm -fr $logdir 2>/dev/null" 0
-(umask 077 && exec mkdir $logdir) || exit
-
-case $datearg in
-?*) $rlog $rlog_options "$datearg" ${1+"$@"} >$rlogout;;
-'') $rlog $rlog_options ${1+"$@"} >$rlogout
-esac || exit
-
-
-# Get the full name of each author the logs mention, and set initialize_fullname
-# to awk code that initializes the `fullname' awk associative array.
-# Warning: foreign authors (i.e. not known in the passwd file) are mishandled;
-# you have to fix the resulting output by hand.
-
-initialize_fullname=
-initialize_mailaddr=
-
-case $loginFullnameMailaddrs in
-?*)
- case $loginFullnameMailaddrs in
- *\"* | *\\*)
- sed 's/["\\]/\\&/g' >$llogout <<EOF || exit
-$loginFullnameMailaddrs
-EOF
- loginFullnameMailaddrs=`cat $llogout`
- esac
-
- oldIFS=$IFS
- IFS=$nl
- for loginFullnameMailaddr in $loginFullnameMailaddrs
- do
- case $loginFullnameMailaddr in
- *"$tab"*) IFS=$tab;;
- *) IFS=:
- esac
- set x $loginFullnameMailaddr
- login=$2
- fullname=$3
- mailaddr=$4
- initialize_fullname="$initialize_fullname
- fullname[\"$login\"] = \"$fullname\""
- initialize_mailaddr="$initialize_mailaddr
- mailaddr[\"$login\"] = \"$mailaddr\""
- done
- IFS=$oldIFS
-esac
-
-case $llogout in
-?*) sort -u -o $llogout <<EOF || exit
-$logins
-EOF
-esac
-output_authors='/^date: / {
- if ($2 ~ /^[0-9]*[-\/][0-9][0-9][-\/][0-9][0-9]$/ && $3 ~ /^[0-9][0-9]:[0-9][0-9]:[0-9][0-9][-+0-9:]*;$/ && $4 == "author:" && $5 ~ /^[^;]*;$/) {
- print substr($5, 1, length($5)-1)
- }
-}'
-authors=`
- $AWK "$output_authors" <$rlogout |
- case $llogout in
- '') sort -u;;
- ?*) sort -u | comm -23 - $llogout
- esac
-`
-case $authors in
-?*)
- cat >$llogout <<EOF || exit
-$authors
-EOF
- initialize_author_script='s/["\\]/\\&/g; s/.*/author[\"&\"] = 1/'
- initialize_author=`sed -e "$initialize_author_script" <$llogout`
- awkscript='
- BEGIN {
- alphabet = "abcdefghijklmnopqrstuvwxyz"
- ALPHABET = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
- '"$initialize_author"'
- }
- {
- if (author[$1]) {
- fullname = $5
- if (fullname ~ /[0-9]+-[^(]*\([0-9]+\)$/) {
- # Remove the junk from fullnames like "0000-Admin(0000)".
- fullname = substr(fullname, index(fullname, "-") + 1)
- fullname = substr(fullname, 1, index(fullname, "(") - 1)
- }
- if (fullname ~ /,[^ ]/) {
- # Some sites put comma-separated junk after the fullname.
- # Remove it, but leave "Bill Gates, Jr" alone.
- fullname = substr(fullname, 1, index(fullname, ",") - 1)
- }
- abbr = index(fullname, "&")
- if (abbr) {
- a = substr($1, 1, 1)
- A = a
- i = index(alphabet, a)
- if (i) A = substr(ALPHABET, i, 1)
- fullname = substr(fullname, 1, abbr-1) A substr($1, 2) substr(fullname, abbr+1)
- }
-
- # Quote quotes and backslashes properly in full names.
- # Do not use gsub; traditional awk lacks it.
- quoted = ""
- rest = fullname
- for (;;) {
- p = index(rest, "\\")
- q = index(rest, "\"")
- if (p) {
- if (q && q<p) p = q
- } else {
- if (!q) break
- p = q
- }
- quoted = quoted substr(rest, 1, p-1) "\\" substr(rest, p, 1)
- rest = substr(rest, p+1)
- }
-
- printf "fullname[\"%s\"] = \"%s%s\"\n", $1, quoted, rest
- author[$1] = 0
- }
- }
- '
-
- initialize_fullname=`
- {
- (getent passwd $authors) ||
- (
- cat /etc/passwd
- for author in $authors
- do NIS_PATH= nismatch $author passwd.org_dir
- done
- ypmatch $authors passwd
- )
- } 2>/dev/null |
- $AWK -F: "$awkscript"
- `$initialize_fullname
-esac
-
-
-# Function to print a single log line.
-# We don't use awk functions, to stay compatible with old awk versions.
-# `Log' is the log message (with \n replaced by \001).
-# `files' contains the affected files.
-printlogline='{
-
- # Following the GNU coding standards, rewrite
- # * file: (function): comment
- # to
- # * file (function): comment
- if (Log ~ /^\([^)]*\): /) {
- i = index(Log, ")")
- files = files " " substr(Log, 1, i)
- Log = substr(Log, i+3)
- }
-
- # If "label: comment" is too long, break the line after the ":".
- sep = " "
- if ('"$length"' <= '"$indent"' + 1 + length(files) + index(Log, SOH)) sep = "\n" indent_string
-
- # Print the label.
- printf "%s*%s:", indent_string, files
-
- # Print each line of the log, transliterating \001 to \n.
- while ((i = index(Log, SOH)) != 0) {
- logline = substr(Log, 1, i-1)
- if (logline ~ /[^'"$tab"' ]/) {
- printf "%s%s\n", sep, logline
- } else {
- print ""
- }
- sep = indent_string
- Log = substr(Log, i+1)
- }
-}'
-
-# Pattern to match the `revision' line of rlog output.
-rlog_revision_pattern='^revision [0-9]+\.[0-9]+(\.[0-9]+\.[0-9]+)*(['"$tab"' ]+locked by: [^'"$tab"' $,.0-9:;@]*[^'"$tab"' $,:;@][^'"$tab"' $,.0-9:;@]*;)?['"$tab"' ]*$'
-
-case $hostname in
-'')
- hostname=`(
- hostname || uname -n || uuname -l || cat /etc/whoami
- ) 2>/dev/null` || {
- echo >&2 "$0: cannot deduce hostname"
- exit 1
- }
-
- case $hostname in
- *.*) ;;
- *)
- domainname=`(domainname) 2>/dev/null` &&
- case $domainname in
- *.*) hostname=$hostname.$domainname
- esac
- esac
-esac
-
-
-# Process the rlog output, generating ChangeLog style entries.
-
-# First, reformat the rlog output so that each line contains one log entry.
-# Transliterate \n to \001 so that multiline entries fit on a single line.
-# Discard irrelevant rlog output.
-$AWK <$rlogout '
- BEGIN { repository = "'"$repository"'" }
- /^RCS file:/ {
- if (repository != "") {
- filename = $3
- if (substr(filename, 1, length(repository) + 1) == repository "/") {
- filename = substr(filename, length(repository) + 2)
- }
- if (filename ~ /,v$/) {
- filename = substr(filename, 1, length(filename) - 2)
- }
- if (filename ~ /(^|\/)Attic\/[^\/]*$/) {
- i = length(filename)
- while (substr(filename, i, 1) != "/") i--
- filename = substr(filename, 1, i - 6) substr(filename, i + 1)
- }
- }
- rev = "?"
- }
- /^Working file:/ { if (repository == "") filename = $3 }
- /'"$rlog_revision_pattern"'/, /^(-----------*|===========*)$/ {
- line = $0
- if (line ~ /'"$rlog_revision_pattern"'/) {
- rev = $2
- next
- }
- if (line ~ /^date: [0-9][- +\/0-9:]*;/) {
- date = $2
- if (date ~ /\//) {
- # This is a traditional RCS format date YYYY/MM/DD.
- # Replace "/"s with "-"s to get ISO format.
- newdate = ""
- while ((i = index(date, "/")) != 0) {
- newdate = newdate substr(date, 1, i-1) "-"
- date = substr(date, i+1)
- }
- date = newdate date
- }
- time = substr($3, 1, length($3) - 1)
- author = substr($5, 1, length($5)-1)
- printf "%s %s %s %s %s %c", filename, rev, date, time, author, 1
- rev = "?"
- next
- }
- if (line ~ /^branches: /) { next }
- if (line ~ /^(-----------*|===========*)$/) { print ""; next }
- if (line == "Initial revision" || line ~ /^file .+ was initially added on branch .+\.$/) {
- line = "New file."
- }
- printf "%s%c", line, 1
- }
-' |
-
-# Now each line is of the form
-# FILENAME REVISION YYYY-MM-DD HH:MM:SS[+-TIMEZONE] AUTHOR \001LOG
-# where \001 stands for a carriage return,
-# and each line of the log is terminated by \001 instead of \n.
-# Sort the log entries, first by date+time (in reverse order),
-# then by author, then by log entry, and finally by file name and revision
-# (just in case).
-sort +2 -4r +4 +0 |
-
-# Finally, reformat the sorted log entries.
-$AWK '
- BEGIN {
- logTZ = "'"$logTZ"'"
- revision = "'"$revision"'"
-
- # Some awk variants do not understand "\001", so we have to
- # put the char directly in the file.
- SOH="" # <-- There is a single SOH (octal code 001) here.
-
- # Initialize the fullname and mailaddr associative arrays.
- '"$initialize_fullname"'
- '"$initialize_mailaddr"'
-
- # Initialize indent string.
- indent_string = ""
- i = '"$indent"'
- if (0 < '"$tabwidth"')
- for (; '"$tabwidth"' <= i; i -= '"$tabwidth"')
- indent_string = indent_string "\t"
- while (1 <= i--)
- indent_string = indent_string " "
- }
-
- {
- newlog = substr($0, 1 + index($0, SOH))
-
- # Ignore log entries prefixed by "#".
- if (newlog ~ /^#/) { next }
-
- if (Log != newlog || date != $3 || author != $5) {
-
- # The previous log and this log differ.
-
- # Print the old log.
- if (date != "") '"$printlogline"'
-
- # Logs that begin with "{clumpname} " should be grouped together,
- # and the clumpname should be removed.
- # Extract the new clumpname from the log header,
- # and use it to decide whether to output a blank line.
- newclumpname = ""
- sep = "\n"
- if (date == "") sep = ""
- if (newlog ~ /^\{[^'"$tab"' }]*}['"$tab"' ]/) {
- i = index(newlog, "}")
- newclumpname = substr(newlog, 1, i)
- while (substr(newlog, i+1) ~ /^['"$tab"' ]/) i++
- newlog = substr(newlog, i+1)
- if (clumpname == newclumpname) sep = ""
- }
- printf sep
- clumpname = newclumpname
-
- # Get ready for the next log.
- Log = newlog
- if (files != "")
- for (i in filesknown)
- filesknown[i] = 0
- files = ""
- }
- if (date != $3 || author != $5) {
- # The previous date+author and this date+author differ.
- # Print the new one.
- date = $3
- time = $4
- author = $5
-
- zone = ""
- if (logTZ && ((i = index(time, "-")) || (i = index(time, "+"))))
- zone = " " substr(time, i)
-
- # Print "date[ timezone] fullname <email address>".
- # Get fullname and email address from associative arrays;
- # default to author and author@hostname if not in arrays.
- if (fullname[author])
- auth = fullname[author]
- else
- auth = author
- printf "%s%s %s ", date, zone, auth
- if (mailaddr[author])
- printf "<%s>\n\n", mailaddr[author]
- else
- printf "<%s@%s>\n\n", author, "'"$hostname"'"
- }
- if (! filesknown[$1]) {
- filesknown[$1] = 1
- if (files == "") files = " " $1
- else files = files ", " $1
- if (revision && $2 != "?") files = files " " $2
- }
- }
- END {
- # Print the last log.
- if (date != "") {
- '"$printlogline"'
- printf "\n"
- }
- }
-' &&
-
-
-# Exit successfully.
-
-exec rm -fr $logdir
-
-# Local Variables:
-# tab-width:4
-# End:
diff --git a/lib-src/timer.c b/lib-src/timer.c
deleted file mode 100644
index 9bd547ce8f2..00000000000
--- a/lib-src/timer.c
+++ /dev/null
@@ -1,368 +0,0 @@
-/* timer.c --- daemon to provide a tagged interval timer service
-
- This little daemon runs forever waiting for commands to schedule events.
- SIGALRM causes
- it to check its queue for events attached to the current second; if
- one is found, its label is written to stdout. SIGTERM causes it to
- terminate, printing a list of pending events.
-
- This program is intended to be used with the lisp package called
- timer.el. The first such program was written anonymously in 1990.
- This version was documented and rewritten for portability by
- esr@snark.thyrsus.com, Aug 7 1992. */
-
-#include <stdio.h>
-#include <signal.h>
-#include <errno.h>
-#include <sys/types.h> /* time_t */
-
-#include <../src/config.h>
-#undef read
-
-#ifdef LINUX
-/* Perhaps this is correct unconditionally. */
-#undef signal
-#endif
-#ifdef _CX_UX
-/* I agree with the comment above, this probably should be unconditional (it
- * is already unconditional in a couple of other files in this directory),
- * but in the spirit of minimizing the effects of my port, I am making it
- * conditional on _CX_UX.
- */
-#undef signal
-#endif
-
-
-extern int errno;
-extern char *strerror ();
-extern time_t time ();
-
-/*
- * The field separator for input. This character shouldn't occur in dates,
- * and should be printable so event strings are readable by people.
- */
-#define FS '@'
-
-struct event
- {
- char *token;
- time_t reply_at;
- };
-int events_size; /* How many slots have we allocated? */
-int num_events; /* How many are actually scheduled? */
-struct event *events; /* events[0 .. num_events-1] are the
- valid events. */
-
-char *pname; /* program name for error messages */
-
-/* This buffer is used for reading commands.
- We make it longer when necessary, but we never free it. */
-char *buf;
-/* This is the allocated size of buf. */
-int buf_size;
-
-/* Non-zero means don't handle an alarm now;
- instead, just set alarm_deferred if an alarm happens.
- We set this around parts of the program that call malloc and free. */
-int defer_alarms;
-
-/* Non-zero if an alarm came in during the reading of a command. */
-int alarm_deferred;
-
-/* Schedule one event, and arrange an alarm for it.
- STR is a string of two fields separated by FS.
- First field is string for get_date, saying when to wake-up.
- Second field is a token to identify the request. */
-
-void
-schedule (str)
- char *str;
-{
- extern time_t get_date ();
- extern char *strcpy ();
- time_t now;
- register char *p;
- static struct event *ep;
-
- /* check entry format */
- for (p = str; *p && *p != FS; p++)
- continue;
- if (!*p)
- {
- fprintf (stderr, "%s: bad input format: %s\n", pname, str);
- return;
- }
- *p++ = 0;
-
- /* allocate an event slot */
- ep = events + num_events;
-
- /* If the event array is full, stretch it. After stretching, we know
- that ep will be pointing to an available event spot. */
- if (ep == events + events_size)
- {
- int old_size = events_size;
-
- events_size *= 2;
- events = ((struct event *)
- realloc (events, events_size * sizeof (struct event)));
- if (! events)
- {
- fprintf (stderr, "%s: virtual memory exhausted.\n", pname);
- /* Since there is so much virtual memory, and running out
- almost surely means something is very very wrong,
- it is best to exit rather than continue. */
- exit (1);
- }
-
- while (old_size < events_size)
- events[old_size++].token = NULL;
- }
-
- /* Don't allow users to schedule events in past time. */
- ep->reply_at = get_date (str, NULL);
- if (ep->reply_at - time (&now) < 0)
- {
- fprintf (stderr, "%s: bad time spec: %s%c%s\n", pname, str, FS, p);
- return;
- }
-
- /* save the event description */
- ep->token = (char *) malloc ((unsigned) strlen (p) + 1);
- if (! ep->token)
- {
- fprintf (stderr, "%s: malloc %s: %s%c%s\n",
- pname, strerror (errno), str, FS, p);
- return;
- }
-
- strcpy (ep->token, p);
- num_events++;
-}
-
-/* Print the notification for the alarmed event just arrived if any,
- and schedule an alarm for the next event if any. */
-
-void
-notify ()
-{
- time_t now, tdiff, waitfor = -1;
- register struct event *ep;
-
- /* Inhibit interference with alarms while changing global vars. */
- defer_alarms = 1;
- alarm_deferred = 0;
-
- now = time ((time_t *) NULL);
-
- for (ep = events; ep < events + num_events; ep++)
- /* Are any events ready to fire? */
- if (ep->reply_at <= now)
- {
- fputs (ep->token, stdout);
- putc ('\n', stdout);
- fflush (stdout);
- free (ep->token);
-
- /* We now have a hole in the event array; fill it with the last
- event. */
- ep->token = events[num_events - 1].token;
- ep->reply_at = events[num_events - 1].reply_at;
- num_events--;
-
- /* We ought to scan this event again. */
- ep--;
- }
- else
- {
- /* next timeout should be the soonest of any remaining */
- if ((tdiff = ep->reply_at - now) < waitfor || waitfor < 0)
- waitfor = (long)tdiff;
- }
-
- /* If there are no more events, we needn't bother setting an alarm. */
- if (num_events > 0)
- alarm (waitfor);
-
- /* Now check if there was another alarm
- while we were handling an explicit request. */
- defer_alarms = 0;
- if (alarm_deferred)
- notify ();
- alarm_deferred = 0;
-}
-
-/* Read one command from command from standard input
- and schedule the event for it. */
-
-void
-getevent ()
-{
- int i;
-
- /* In principle the itimer should be disabled on entry to this
- function, but it really doesn't make any important difference
- if it isn't. */
-
- if (buf == 0)
- {
- buf_size = 80;
- buf = (char *) malloc (buf_size);
- }
-
- /* Read a line from standard input, expanding buf if it is too short
- to hold the line. */
- for (i = 0; ; i++)
- {
- char c;
- int nread;
-
- if (i >= buf_size)
- {
- buf_size *= 2;
- alarm_deferred = 0;
- defer_alarms = 1;
- buf = (char *) realloc (buf, buf_size);
- defer_alarms = 0;
- if (alarm_deferred)
- notify ();
- alarm_deferred = 0;
- }
-
- /* Read one character into c. */
- while (1)
- {
- nread = read (fileno (stdin), &c, 1);
-
- /* Retry after transient error. */
- if (nread < 0
- && (1
-#ifdef EINTR
- || errno == EINTR
-#endif
-#ifdef EAGAIN
- || errno == EAGAIN
-#endif
- ))
- continue;
-
- /* Report serious errors. */
- if (nread < 0)
- {
- perror ("read");
- exit (1);
- }
-
- /* On eof, exit. */
- if (nread == 0)
- exit (0);
-
- break;
- }
-
- if (c == '\n')
- {
- buf[i] = '\0';
- break;
- }
-
- buf[i] = c;
- }
-
- /* Register the event. */
- alarm_deferred = 0;
- defer_alarms = 1;
- schedule (buf);
- defer_alarms = 0;
- notify ();
- alarm_deferred = 0;
-}
-
-/* Handle incoming signal SIG. */
-
-SIGTYPE
-sigcatch (sig)
- int sig;
-{
- struct event *ep;
-
- /* required on older UNIXes; harmless on newer ones */
- signal (sig, sigcatch);
-
- switch (sig)
- {
- case SIGALRM:
- if (defer_alarms)
- alarm_deferred = 1;
- else
- notify ();
- break;
- case SIGTERM:
- fprintf (stderr, "Events still queued:\n");
- for (ep = events; ep < events + num_events; ep++)
- fprintf (stderr, "%d = %ld @ %s\n",
- ep - events, ep->reply_at, ep->token);
- exit (0);
- break;
- }
-}
-
-/*ARGSUSED*/
-int
-main (argc, argv)
- int argc;
- char **argv;
-{
- for (pname = argv[0] + strlen (argv[0]);
- *pname != '/' && pname != argv[0];
- pname--);
- if (*pname == '/')
- pname++;
-
- events_size = 16;
- events = ((struct event *) malloc (events_size * sizeof (*events)));
- num_events = 0;
-
- signal (SIGALRM, sigcatch);
- signal (SIGTERM, sigcatch);
-
- /* Loop reading commands from standard input
- and scheduling alarms accordingly.
- The alarms are handled asynchronously, while we wait for commands. */
- while (1)
- getevent ();
-}
-
-#ifndef HAVE_STRERROR
-char *
-strerror (errnum)
- int errnum;
-{
- extern char *sys_errlist[];
- extern int sys_nerr;
-
- if (errnum >= 0 && errnum < sys_nerr)
- return sys_errlist[errnum];
- return (char *) "Unknown error";
-}
-
-#endif /* ! HAVE_STRERROR */
-
-long *
-xmalloc (size)
- int size;
-{
- register long *val;
-
- val = (long *) malloc (size);
-
- if (!val && size)
- {
- fprintf (stderr, "timer: virtual memory exceeded\n");
- exit (1);
- }
-
- return val;
-}
-
-/* timer.c ends here */
diff --git a/lib-src/wakeup.c b/lib-src/wakeup.c
deleted file mode 100644
index 389519ba1f7..00000000000
--- a/lib-src/wakeup.c
+++ /dev/null
@@ -1,53 +0,0 @@
-/* Program to produce output at regular intervals. */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <stdio.h>
-#include <sys/types.h>
-
-#ifdef TIME_WITH_SYS_TIME
-#include <sys/time.h>
-#include <time.h>
-#else
-#ifdef HAVE_SYS_TIME_H
-#include <sys/time.h>
-#else
-#include <time.h>
-#endif
-#endif
-
-struct tm *localtime ();
-
-void
-main (argc, argv)
- int argc;
- char **argv;
-{
- int period = 60;
- time_t when;
- struct tm *tp;
-
- if (argc > 1)
- period = atoi (argv[1]);
-
- while (1)
- {
- /* Make sure wakeup stops when Emacs goes away. */
- if (getppid () == 1)
- exit (0);
- printf ("Wake up!\n");
- fflush (stdout);
- /* If using a period of 60, produce the output when the minute
- changes. */
- if (period == 60)
- {
- time (&when);
- tp = localtime (&when);
- sleep (60 - tp->tm_sec);
- }
- else
- sleep (period);
- }
-}