mirror of
https://github.com/sheumann/hush.git
synced 2024-12-25 18:33:06 +00:00
parent
9a53feaa76
commit
221b2ea6c4
@ -13,6 +13,7 @@
|
||||
New Applets:
|
||||
* David McCullough <davidm@lineo.com> -- modprobe
|
||||
* Vladimir Oleynik -- traceroute
|
||||
* Erik Andersen -- pidof
|
||||
|
||||
New Scripts:
|
||||
* David Schleef, Erik Andersen, Stuart Hughes -- depmod.pl
|
||||
|
1
Config.h
1
Config.h
@ -82,6 +82,7 @@
|
||||
#define BB_MV
|
||||
//#define BB_NC
|
||||
//#define BB_NSLOOKUP
|
||||
#define BB_PIDOF
|
||||
//#define BB_PING
|
||||
//#define BB_PIVOT_ROOT
|
||||
#define BB_POWEROFF
|
||||
|
@ -284,6 +284,9 @@
|
||||
#ifdef BB_NSLOOKUP
|
||||
APPLET(nslookup, nslookup_main, _BB_DIR_USR_BIN)
|
||||
#endif
|
||||
#ifdef BB_PIDOF
|
||||
APPLET(pidof, pidof_main, _BB_DIR_BIN)
|
||||
#endif
|
||||
#ifdef BB_PING
|
||||
APPLET(ping, ping_main, _BB_DIR_BIN)
|
||||
#endif
|
||||
|
@ -1190,6 +1190,14 @@
|
||||
"Name: debian\n" \
|
||||
"Address: 127.0.0.1\n"
|
||||
|
||||
#define pidof_trivial_usage \
|
||||
"process-name [process-name ...]"
|
||||
#define pidof_full_usage \
|
||||
"Lists the PIDs of all processes with names that match the names on the command line"
|
||||
#define pidof_example_usage \
|
||||
"$ pidof init\n" \
|
||||
"1\n"
|
||||
|
||||
#ifndef BB_FEATURE_FANCY_PING
|
||||
#define ping_trivial_usage "host"
|
||||
#define ping_full_usage "Send ICMP ECHO_REQUEST packets to network hosts"
|
||||
|
@ -284,6 +284,9 @@
|
||||
#ifdef BB_NSLOOKUP
|
||||
APPLET(nslookup, nslookup_main, _BB_DIR_USR_BIN)
|
||||
#endif
|
||||
#ifdef BB_PIDOF
|
||||
APPLET(pidof, pidof_main, _BB_DIR_BIN)
|
||||
#endif
|
||||
#ifdef BB_PING
|
||||
APPLET(ping, ping_main, _BB_DIR_BIN)
|
||||
#endif
|
||||
|
@ -1190,6 +1190,14 @@
|
||||
"Name: debian\n" \
|
||||
"Address: 127.0.0.1\n"
|
||||
|
||||
#define pidof_trivial_usage \
|
||||
"process-name [process-name ...]"
|
||||
#define pidof_full_usage \
|
||||
"Lists the PIDs of all processes with names that match the names on the command line"
|
||||
#define pidof_example_usage \
|
||||
"$ pidof init\n" \
|
||||
"1\n"
|
||||
|
||||
#ifndef BB_FEATURE_FANCY_PING
|
||||
#define ping_trivial_usage "host"
|
||||
#define ping_full_usage "Send ICMP ECHO_REQUEST packets to network hosts"
|
||||
|
79
pidof.c
Normal file
79
pidof.c
Normal file
@ -0,0 +1,79 @@
|
||||
/* vi: set sw=4 ts=4: */
|
||||
/*
|
||||
* pidof implementation for busybox
|
||||
*
|
||||
* Copyright (C) 2001 by Lineo, inc.
|
||||
* Written by Erik Andersen <andersen@lineo.com>, <andersee@debian.org>
|
||||
*
|
||||
* 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 of the License, 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <errno.h>
|
||||
#include <unistd.h>
|
||||
#include <signal.h>
|
||||
#include <ctype.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include "busybox.h"
|
||||
|
||||
|
||||
extern int pidof_main(int argc, char **argv)
|
||||
{
|
||||
int opt;
|
||||
|
||||
|
||||
/* do normal option parsing */
|
||||
while ((opt = getopt(argc, argv, "ne:f:")) > 0) {
|
||||
switch (opt) {
|
||||
#if 0
|
||||
case 'g':
|
||||
break;
|
||||
case 'e':
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
show_usage();
|
||||
}
|
||||
}
|
||||
|
||||
/* if we didn't get a process name, then we need to choke and die here */
|
||||
if (argv[optind] == NULL)
|
||||
show_usage();
|
||||
|
||||
/* Looks like everything is set to go. */
|
||||
while(optind < argc) {
|
||||
pid_t* pidList;
|
||||
|
||||
pidList = find_pid_by_name( argv[optind]);
|
||||
if (!pidList || *pidList<=0) {
|
||||
break;
|
||||
}
|
||||
|
||||
for(; pidList && *pidList!=0; pidList++) {
|
||||
printf("%ld ", (long)*pidList);
|
||||
}
|
||||
/* Note that we don't bother to free the memory
|
||||
* allocated in find_pid_by_name(). It will be freed
|
||||
* upon exit, so we can save a byte or two */
|
||||
optind++;
|
||||
}
|
||||
printf("\n");
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
79
procps/pidof.c
Normal file
79
procps/pidof.c
Normal file
@ -0,0 +1,79 @@
|
||||
/* vi: set sw=4 ts=4: */
|
||||
/*
|
||||
* pidof implementation for busybox
|
||||
*
|
||||
* Copyright (C) 2001 by Lineo, inc.
|
||||
* Written by Erik Andersen <andersen@lineo.com>, <andersee@debian.org>
|
||||
*
|
||||
* 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 of the License, 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <errno.h>
|
||||
#include <unistd.h>
|
||||
#include <signal.h>
|
||||
#include <ctype.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include "busybox.h"
|
||||
|
||||
|
||||
extern int pidof_main(int argc, char **argv)
|
||||
{
|
||||
int opt;
|
||||
|
||||
|
||||
/* do normal option parsing */
|
||||
while ((opt = getopt(argc, argv, "ne:f:")) > 0) {
|
||||
switch (opt) {
|
||||
#if 0
|
||||
case 'g':
|
||||
break;
|
||||
case 'e':
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
show_usage();
|
||||
}
|
||||
}
|
||||
|
||||
/* if we didn't get a process name, then we need to choke and die here */
|
||||
if (argv[optind] == NULL)
|
||||
show_usage();
|
||||
|
||||
/* Looks like everything is set to go. */
|
||||
while(optind < argc) {
|
||||
pid_t* pidList;
|
||||
|
||||
pidList = find_pid_by_name( argv[optind]);
|
||||
if (!pidList || *pidList<=0) {
|
||||
break;
|
||||
}
|
||||
|
||||
for(; pidList && *pidList!=0; pidList++) {
|
||||
printf("%ld ", (long)*pidList);
|
||||
}
|
||||
/* Note that we don't bother to free the memory
|
||||
* allocated in find_pid_by_name(). It will be freed
|
||||
* upon exit, so we can save a byte or two */
|
||||
optind++;
|
||||
}
|
||||
printf("\n");
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
8
usage.h
8
usage.h
@ -1190,6 +1190,14 @@
|
||||
"Name: debian\n" \
|
||||
"Address: 127.0.0.1\n"
|
||||
|
||||
#define pidof_trivial_usage \
|
||||
"process-name [process-name ...]"
|
||||
#define pidof_full_usage \
|
||||
"Lists the PIDs of all processes with names that match the names on the command line"
|
||||
#define pidof_example_usage \
|
||||
"$ pidof init\n" \
|
||||
"1\n"
|
||||
|
||||
#ifndef BB_FEATURE_FANCY_PING
|
||||
#define ping_trivial_usage "host"
|
||||
#define ping_full_usage "Send ICMP ECHO_REQUEST packets to network hosts"
|
||||
|
Loading…
Reference in New Issue
Block a user