diff options
author | Bill Nottingham <notting@redhat.com> | 2012-08-06 15:20:03 -0400 |
---|---|---|
committer | Bill Nottingham <notting@redhat.com> | 2012-08-06 15:20:03 -0400 |
commit | 345e4fc14c6e6a043bc3fe4eeb8c39a36957fbf8 (patch) | |
tree | 0e14194887c2c248a7b5ec22aa38f5c1406a9251 /src | |
parent | 23bfcbd74b4a02d302927961dc183066937e17e4 (diff) | |
download | initscripts-345e4fc14c6e6a043bc3fe4eeb8c39a36957fbf8.tar initscripts-345e4fc14c6e6a043bc3fe4eeb8c39a36957fbf8.tar.gz initscripts-345e4fc14c6e6a043bc3fe4eeb8c39a36957fbf8.tar.bz2 initscripts-345e4fc14c6e6a043bc3fe4eeb8c39a36957fbf8.tar.xz initscripts-345e4fc14c6e6a043bc3fe4eeb8c39a36957fbf8.zip |
Drop fstab-decode and getkey; no longer used.
Drop the umount loop from rc.d/init.d/functions.
Diffstat (limited to 'src')
-rw-r--r-- | src/Makefile | 9 | ||||
-rw-r--r-- | src/fstab-decode.8 | 46 | ||||
-rw-r--r-- | src/fstab-decode.c | 86 | ||||
-rw-r--r-- | src/getkey.1 | 80 | ||||
-rw-r--r-- | src/getkey.c | 141 |
5 files changed, 1 insertions, 361 deletions
diff --git a/src/Makefile b/src/Makefile index 09f17771..d93e7202 100644 --- a/src/Makefile +++ b/src/Makefile @@ -1,7 +1,7 @@ CFLAGS+=$(RPM_OPT_FLAGS) -Wall -D_GNU_SOURCE PROGS=usernetctl netreport usleep ipcalc \ - fstab-decode getkey ppp-watch consoletype genhostid rename_device + ppp-watch consoletype genhostid rename_device PPPWATCH_OBJS=ppp-watch.o shvar.o CONSOLE_INIT_OBJS=console_init.o shvar.o USLEEP_OBJS=usleep.o @@ -22,18 +22,14 @@ install: install -m 4755 usernetctl $(ROOT)/usr/sbin/usernetctl install -m 2755 netreport $(ROOT)/sbin/netreport install -m 755 ipcalc $(ROOT)/bin/ipcalc - install -m 755 fstab-decode $(ROOT)/sbin/fstab-decode install -m 755 genhostid $(ROOT)/sbin/genhostid - install -m 755 getkey $(ROOT)/sbin/getkey install -m 755 ppp-watch $(ROOT)/sbin/ppp-watch install -m 755 consoletype $(ROOT)/sbin/consoletype install -m 755 sushell $(ROOT)/sbin/sushell install -m 755 rename_device $(ROOT)/lib/udev/rename_device install -m 644 genhostid.1 $(ROOT)$(mandir)/man1 - install -m 644 getkey.1 $(ROOT)$(mandir)/man1 install -m 644 netreport.1 $(ROOT)$(mandir)/man1 install -m 644 usleep.1 $(ROOT)$(mandir)/man1 - install -m 644 fstab-decode.8 $(ROOT)$(mandir)/man8 install -m 644 usernetctl.8 $(ROOT)$(mandir)/man8 install -m 644 ppp-watch.8 $(ROOT)$(mandir)/man8 install -m 644 ipcalc.1 $(ROOT)$(mandir)/man1 @@ -43,9 +39,6 @@ install: install -m 644 sushell.8 $(ROOT)$(mandir)/man8 ln -s ifup.8 $(ROOT)$(mandir)/man8/ifdown.8 -getkey: getkey.o - $(CC) $(LDFLAGS) -o $@ $< -lpopt - ipcalc: ipcalc.o $(CC) -D_GNU_SOURCE $(LDFLAGS) -o $@ $< -lpopt diff --git a/src/fstab-decode.8 b/src/fstab-decode.8 deleted file mode 100644 index d7ce9e70..00000000 --- a/src/fstab-decode.8 +++ /dev/null @@ -1,46 +0,0 @@ -.\" A man page for fstab-decode(8). -.\" -.\" Copyright (C) 2006 Red Hat, Inc. All rights reserved. -.\" -.\" This copyrighted material is made available to anyone wishing to use, -.\" modify, copy, or redistribute it subject to the terms and conditions of the -.\" GNU General Public License v.2. -.\" -.\" 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., -.\" 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -.\" -.\" Author: Miloslav Trmac <mitr@redhat.com> -.TH fstab-decode 8 "May 2006" - -.SH NAME -fstab-decode \- run a command with fstab-encoded arguments - -.SH SYNOPSIS -\fB fstab-decode\fR \fICOMMAND\fR [\fIARGUMENT\fR]... - -.SH DESCRIPTION -.B fstab-decode -decodes escapes in the specified \FIARGUMENT\fRs -and uses them to run \fICOMMAND\fR. -The argument escaping uses the same rules as path escaping in -\fB/etc/fstab\fR, -.B /etc/mtab -and \fB/proc/mtab\fR. - -.SH EXIT STATUS -.B fstab-decode -exits with status 127 if -.I COMMAND -can't be run. -Otherwise it exits with the status returned by \fICOMMAND\fR. - -.SH EXAMPLES - -.B -fstab-decode umount $(awk '$3 == "vfat" { print $2 }' /etc/fstab) diff --git a/src/fstab-decode.c b/src/fstab-decode.c deleted file mode 100644 index 4a162dfe..00000000 --- a/src/fstab-decode.c +++ /dev/null @@ -1,86 +0,0 @@ -/* fstab-decode(8). - -Copyright (c) 2006 Red Hat, Inc. All rights reserved. - -This copyrighted material is made available to anyone wishing to use, modify, -copy, or redistribute it subject to the terms and conditions of the GNU General -Public License v.2. - -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., 51 Franklin -Street, Fifth Floor, Boston, MA 02110-1301, USA. - -Author: Miloslav Trmac <mitr@redhat.com> */ - -#include <errno.h> -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <unistd.h> - -/* Decode the fstab-encoded string in place. */ -static void -decode(char *s) -{ - const char *src; - char *dest; - - src = s; - dest = s; - while (*src != '\0') { - if (*src != '\\') - *dest = *src++; - else { - static const struct repl { - char orig[4]; - size_t len; - char new; - } repls[] = { -#define R(X, Y) { X, sizeof(X) - 1, Y } - R("\\", '\\'), - R("011", '\t'), - R("012", '\n'), - R("040", ' '), - R("134", '\\') -#undef R - }; - - size_t i; - - for (i = 0; i < sizeof (repls) / sizeof (repls[0]); - i++) { - if (memcmp(src + 1, repls[i].orig, - repls[i].len) == 0) { - *dest = repls[i].new; - src += 1 + repls[i].len; - goto found; - } - } - *dest = *src++; - found: - ; - } - dest++; - } - *dest = '\0'; -} - -int -main (int argc, char *argv[]) -{ - size_t i; - - if (argc < 2) { - fprintf(stderr, "Usage: fstab-decode command [arguments]\n"); - return EXIT_FAILURE; - } - for (i = 2; i < (size_t)argc; i++) - decode(argv[i]); - execvp(argv[1], argv + 1); - fprintf(stderr, "fstab-decode: %s: %s\n", argv[1], strerror(errno)); - return 127; -} diff --git a/src/getkey.1 b/src/getkey.1 deleted file mode 100644 index f6c11616..00000000 --- a/src/getkey.1 +++ /dev/null @@ -1,80 +0,0 @@ -.\" A man page for getkey(1). -*- nroff -*- -.\" -.\" Copyright (C) 2006 Red Hat, Inc. All rights reserved. -.\" -.\" This copyrighted material is made available to anyone wishing to use, -.\" modify, copy, or redistribute it subject to the terms and conditions of the -.\" GNU General Public License v.2. -.\" -.\" 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., -.\" 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -.\" -.\" Author: Miloslav Trmac <mitr@redhat.com> -.TH getkey 1 "Jan 2006" - -.SH NAME -getkey \- wait until a key is pressed - -.SH SYNOPSIS -\fBgetkey\fR [\fIOPTION\fR]... [\fIKEYS\fR] - -.SH DESCRIPTION -.B getkey -waits until one of -.I KEYS -is pressed. -If -.I KEYS -are not specified, any key is accepted. -.I KEYS -are matched case-insensitive. - -.SH EXIT STATUS -.B getkey -exits with status 0 if one of the expected keys is pressed. -If invalid arguments are specified, -.B getkey -exits with status 255. -If -.B getkey -is interrupted or the wait times out, -.B getkey -exits with other non-zero status. - -.SH OPTIONS -.TP -\fB\-c\fR, \fB\-\-wait\fR \fISECONDS\fR -Wait only for -.I SECONDS -seconds. -The default is 0, which means to wait without a time limit. - -.TP -\fB\-i\fR, \fB\-\-ignore\-control\-chars\fR -Don't treat Ctrl+C and Ctrl+D specially. -When this option is not specified, these characters interrupt \fBgetkey\fR. - -.TP -\fB\-m\fR, \fB\-\-message\fR \fIMESSAGE\fR -Display -.I MESSAGE -while waiting. -The message is used as a format string in -.BR sprintf (3), -with a single argument, the number of seconds left. -Typical usage is therefore -\fB"Press a key within %d seconds to ..."\fR. -If -.I MESSAGE -contains other format string directives, the behavior is undefined and -.B getkey -may crash. - -If there is no time limit specified, -the number of seconds left is reported as 0. diff --git a/src/getkey.c b/src/getkey.c deleted file mode 100644 index 95e660ba..00000000 --- a/src/getkey.c +++ /dev/null @@ -1,141 +0,0 @@ -/*
- * Copyright (c) 1999-2003, 2006 Red Hat, Inc. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License, version 2, - * as published by the Free Software Foundation. - * - * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * - * getkey - * - * A very simple keygrabber.
- *
- */
-#include <ctype.h>
-#include <errno.h>
-#include <signal.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <termios.h>
-#include <unistd.h>
-#include <sys/poll.h>
-#include "popt.h"
-
-static struct termios orig_tp;
-
-static void reset_term(int x) {
- tcsetattr(0,TCSANOW,&orig_tp);
- _exit(x);
-}
-
-int main(int argc, char **argv) {
- static const char default_list[] = "";
-
- const char *list;
- char *waitmessage = NULL;
- char *waitprint, *waitsprint;
- int waitseconds=0;
- int alarmlen=0;
- int ignore_control=0;
- struct termios tp;
- int r;
- struct pollfd ufds; /* only one, no need for an array... */
- poptContext context;
- struct poptOption options[] = {
- { "wait", 'c', POPT_ARG_INT, &waitseconds, 0, "Number of seconds to wait for keypress", NULL },
- { "message", 'm', POPT_ARG_STRING, &waitmessage, 0, "Message to print out while waiting for string\nNOTE: The message may have a \"%d\" in it, to hold the number of seconds left to wait.", NULL },
- { "ignore-control-chars", 'i', POPT_ARG_NONE, &ignore_control, 0, "Ignore Control-C and Control-D", NULL },
- POPT_AUTOHELP
- POPT_TABLEEND
- };
-
- context = poptGetContext("getkey", argc, (const char **)argv, options,
- POPT_CONTEXT_POSIXMEHARDER);
- poptSetOtherOptionHelp(context, "[keys]");
-
- r = poptGetNextOpt(context);
- if (r < -1) {
- fprintf(stderr, "%s: %s\n",
- poptBadOption(context, POPT_BADOPTION_NOALIAS),
- poptStrerror(r));
-
- return -1;
- }
- list = poptGetArg(context);
- if (list != NULL) {
- char *p;
-
- p = strdup(list);
- list = p;
- while (*p != 0) {
- *p = toupper(*p);
- p++;
- }
- } else
- list = default_list;
- if (waitseconds) {
- if (waitseconds < 0) {
- fprintf(stderr, "--wait: Invalid time %d seconds\n",
- waitseconds);
- return -1;
- }
- alarmlen = waitseconds;
- }
-
- tcgetattr(0,&tp);
- orig_tp = tp;
- signal(SIGTERM,reset_term);
- if (alarmlen != 0) {
- signal(SIGALRM,reset_term);
- alarm(alarmlen);
- }
-
- tp.c_iflag=0;
- tp.c_oflag &= ~OPOST;
- tp.c_lflag &= ~(ISIG | ICANON);
- tcsetattr(0,TCSANOW,&tp);
-
- ufds.events = POLLIN;
- ufds.fd = 0;
-
- if (waitmessage) {
- waitprint = alloca (strlen(waitmessage)+15); /* long enough */
- waitprint[0] = '\r';
- waitsprint = waitprint + 1;
- }
-
- while (1) {
- if (waitmessage) {
- sprintf (waitsprint, waitmessage, waitseconds);
- write (1, waitprint, strlen(waitprint));
- }
- r = poll(&ufds, 1, alarmlen ? 1000 : -1);
- if (r == 0) {
- /* we have waited a whole second with no keystroke... */
- waitseconds--;
- }
- if (r > 0) {
- char ch;
-
- read(0, &ch, sizeof(ch));
- ch = toupper(ch);
- /* Die if we get a control-c or control-d */
- if (ignore_control == 0 && (ch == 3 || ch == 4))
- reset_term(1);
- /* Don't let a null character be interpreted as a match
- by strchr */
- if (ch != 0
- && (strcmp(list, "") == 0 || strchr(list, ch) != NULL))
- reset_term(0);
- }
- }
-}
|