亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? kill.c

?? 《Linux應用開發技術詳解》附書光盤中的例程。
?? C
字號:
/* kill -- send a signal to a process
   Copyright (C) 2002 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */

/* Written by Paul Eggert.  */

#include <config.h>
#include <stdio.h>
#include <getopt.h>
#include <sys/types.h>
#include <signal.h>

#if HAVE_SYS_WAIT_H
# include <sys/wait.h>
#endif
#ifndef WIFSIGNALED
# define WIFSIGNALED(s) (((s) & 0xFFFF) - 1 < (unsigned int) 0xFF)
#endif
#ifndef WTERMSIG
# define WTERMSIG(s) ((s) & 0x7F)
#endif

#include "system.h"
#include "closeout.h"
#include "error.h"
#include "sig2str.h"

/* The official name of this program (e.g., no `g' prefix).  */
#define PROGRAM_NAME "kill"

#define AUTHORS "Paul Eggert"
 

#if ! (HAVE_DECL_STRTOIMAX || defined strtoimax)
intmax_t strtoimax ();
#endif

#if ! (HAVE_DECL_STRSIGNAL || defined strsignal)
# if ! (HAVE_DECL_SYS_SIGLIST || defined sys_siglist)
#  if HAVE_DECL__SYS_SIGLIST || defined _sys_siglist
#   define sys_siglist _sys_siglist
#  endif
# endif
# if HAVE_DECL_SYS_SIGLIST || defined sys_siglist
#  define strsignal(signum) (0 <= (signum) && (signum) <= SIGNUM_BOUND \
			     ? sys_siglist[signum] \
			     : 0)
# endif
# ifndef strsignal
#  define strsignal(signum) 0
# endif
#endif
 

/* The name this program was run with, for error messages.  */
char *program_name;

static char const short_options[] =
  "0::1::2::3::4::5::6::7::8::9::"
  "A::B::C::D::E::F::G::H::I::J::K::L::M::"
  "N::O::P::Q::R::S::T::U::V::W::X::Y::Z::"
  "ln:s:t";

static struct option const long_options[] =
{
  {"list", no_argument, NULL, 'l'},
  {"signal", required_argument, NULL, 's'},
  {"table", no_argument, NULL, 't'},
  {GETOPT_HELP_OPTION_DECL},
  {GETOPT_VERSION_OPTION_DECL},
  {NULL, 0, NULL, 0}
};

void
usage (int status)
{
  if (status != 0)
    fprintf (stderr, _("Try `%s --help' for more information.\n"),
	     program_name);
  else
    {
      printf (_("\
Usage: %s [-s SIGNAL | -SIGNAL] PID...\n\
  or:  %s -l [SIGNAL]...\n\
  or:  %s -t [SIGNAL]...\n\
"),
	      program_name, program_name, program_name);
      fputs (_("\
Send signals to processes, or list signals.\n\
\n\
"), stdout);
      fputs (_("\
Mandatory arguments to long options are mandatory for short options too.\n\
"), stdout);
      fputs (_("\
  -s, --signal=SIGNAL, -SIGNAL\n\
                   specify the name or number of the signal to be sent\n\
  -l, --list       list signal names, or convert signal names to/from numbers\n\
  -t, --table      print a table of signal information\n\
"), stdout);
      fputs (HELP_OPTION_DESCRIPTION, stdout);
      fputs (VERSION_OPTION_DESCRIPTION, stdout);
      fputs (_("\n\
SIGNAL may be a signal name like `HUP', or a signal number like `1',\n\
or an exit status of a process terminated by a signal.\n\
PID is an integer; if negative it identifies a process group.\n\
"), stdout);
      printf (_("\nReport bugs to <%s>.\n"), PACKAGE_BUGREPORT);
    }
  exit (status);
}
 

/* Convert OPERAND to a signal number with printable representation SIGNAME.
   Return the signal number, or -1 if unsuccessful.  */

static int
operand2sig (char const *operand, char *signame)
{
  int signum;

  if (ISDIGIT (*operand))
    {
      char *endp;
      long int l = (errno = 0, strtol (operand, &endp, 10));
      int i = l;
      signum = (operand == endp || *endp || errno || i != l ? -1
		: WIFSIGNALED (i) ? WTERMSIG (i)
		: i);
    }
  else
    {
      /* Convert signal to upper case in the C locale, not in the
	 current locale.  Don't assume ASCII; it might be EBCDIC.  */
      char *upcased = xstrdup (operand);
      char *p;
      for (p = upcased; *p; p++)
	if (strchr ("abcdefghijklmnopqrstuvwxyz", *p))
	  *p += 'A' - 'a';

      /* Look for the signal name, possibly prefixed by "SIG",
	 and possibly lowercased.  */
      if (! (str2sig (upcased, &signum) == 0
	     || (upcased[0] == 'S' && upcased[1] == 'I' && upcased[2] == 'G'
		 && str2sig (upcased + 3, &signum) == 0)))
	signum = -1;

      free (upcased);
    }

  if (signum < 0 || sig2str (signum, signame) != 0)
    {
      error (0, 0, _("%s: invalid signal"), operand);
      return -1;
    }

  return signum;
}
 

/* Print a row of `kill -t' output.  NUM_WIDTH is the maximum signal
   number width, and SIGNUM is the signal number to print.  The
   maximum name width is NAME_WIDTH, and SIGNAME is the name to print.  */

static void
print_table_row (unsigned int num_width, int signum,
		 unsigned int name_width, char const *signame)
{
  char const *description = strsignal (signum);
  printf ("%*d %-*s %s\n", num_width, signum, name_width, signame,
	  description ? description : "?");
}

/* Print a list of signal names.  If TABLE, print a table.
   Print the names specified by ARGV if nonzero; otherwise,
   print all known names.  Return a suitable exit status.  */

static int
list_signals (bool table, char *const *argv)
{
  int signum;
  int status = EXIT_SUCCESS;
  char signame[SIG2STR_MAX];

  if (table)
    {
      unsigned int name_width = 0;

      /* Compute the maximum width of a signal number.  */
      unsigned int num_width = 1;
      for (signum = 1; signum <= SIGNUM_BOUND / 10; signum *= 10)
	num_width++;

      /* Compute the maximum width of a signal name.  */
      for (signum = 1; signum <= SIGNUM_BOUND; signum++)
	if (sig2str (signum, signame) == 0)
	  {
	    size_t len = strlen (signame);
	    if (name_width < len)
	      name_width = len;
	  }

      if (argv)
	for (; *argv; argv++)
	  {
	    signum = operand2sig (*argv, signame);
	    if (signum < 0)
	      status = EXIT_FAILURE;
	    else
	      print_table_row (num_width, signum, name_width, signame);
	  }
      else
	for (signum = 1; signum <= SIGNUM_BOUND; signum++)
	  if (sig2str (signum, signame) == 0)
	    print_table_row (num_width, signum, name_width, signame);
    }
  else
    {
      if (argv)
	for (; *argv; argv++)
	  {
	    signum = operand2sig (*argv, signame);
	    if (signum < 0)
	      status = EXIT_FAILURE;
	    else
	      {
		if (ISDIGIT (**argv))
		  puts (signame);
		else
		  printf ("%d\n", signum);
	      }
	  }
      else
	for (signum = 1; signum <= SIGNUM_BOUND; signum++)
	  if (sig2str (signum, signame) == 0)
	    puts (signame);
    }

  return status;
}
 

/* Send signal SIGNUM to all the processes or process groups specified
   by ARGV.  Return a suitable exit status.  */

static int
send_signals (int signum, char *const *argv)
{
  int status = EXIT_SUCCESS;
  char const *arg = *argv;

  if (! arg)
    {
      error (0, 0, _("missing operand after `%s'"), argv[-1]);
      usage (EXIT_FAILURE);
    }

  do
    {
      char *endp;
      intmax_t n = (errno = 0, strtoimax (arg, &endp, 10));
      pid_t pid = n;

      if (errno == ERANGE || pid != n || arg == endp || *endp)
	{
	  error (0, 0, _("%s: invalid process id"), arg);
	  status = EXIT_FAILURE;
	}
      else if (kill (pid, signum) != 0)
	{
	  error (0, errno, "%s", arg);
	  status = EXIT_FAILURE;
	}
    }
  while ((arg = *++argv));

  return status;
}
 

int
main (int argc, char **argv)
{
  int optc;
  bool list = false;
  bool table = false;
  int signum = -1;
  char signame[SIG2STR_MAX];

  program_name = argv[0];
  setlocale (LC_ALL, "");
  bindtextdomain (PACKAGE, LOCALEDIR);
  textdomain (PACKAGE);

  atexit (close_stdout);

  while ((optc = getopt_long (argc, argv, short_options, long_options, NULL))
	 != -1)
    switch (optc)
      {
      case '0': case '1': case '2': case '3': case '4':
      case '5': case '6': case '7': case '8': case '9':
	if (optind != 2)
	  {
	    /* This option is actually a process-id.  */
	    optind--;
	    goto no_more_options;
	  }
	/* Fall through.  */
      case 'A': case 'B': case 'C': case 'D': case 'E':
      case 'F': case 'G': case 'H': case 'I': case 'J':
      case 'K': case 'L': case 'M': case 'N': case 'O':
      case 'P': case 'Q': case 'R': case 'S': case 'T':
      case 'U': case 'V': case 'W': case 'X': case 'Y':
      case 'Z':
	if (! optarg)
	  optarg = argv[optind - 1] + strlen (argv[optind - 1]);
	if (optarg != argv[optind - 1] + 2)
	  {
	    error (0, 0, _("invalid option -- %c"), optc);
	    usage (EXIT_FAILURE);
	  }
	optarg--;
	/* Fall through.  */
      case 'n': /* -n is not documented, but is for Bash compatibility.  */
      case 's':
	if (0 <= signum)
	  {
	    error (0, 0, _("%s: multiple signals specified"), optarg);
	    usage (EXIT_FAILURE);
	  }
	signum = operand2sig (optarg, signame);
	if (signum < 0)
	  usage (EXIT_FAILURE);
	break;

      case 't':
	table = true;
	/* Fall through.  */
      case 'l':
	if (list)
	  {
	    error (0, 0, _("multiple -l or -t options specified"));
	    usage (EXIT_FAILURE);
	  }
	list = true;
	break;

      case_GETOPT_HELP_CHAR;
      case_GETOPT_VERSION_CHAR (PROGRAM_NAME, AUTHORS);
      default:
	usage (EXIT_FAILURE);
      }
 no_more_options:;

  if (signum < 0)
    signum = SIGTERM;
  else if (list)
    {
      error (0, 0, _("cannot combine signal with -l or -t"));
      usage (EXIT_FAILURE);
    }

  return (list
	  ? list_signals (table, optind == argc ? NULL : argv + optind)
	  : send_signals (signum, argv + optind));
}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
精品国产第一区二区三区观看体验| 成人一区二区三区视频| 亚洲美女视频在线观看| 久久久美女毛片| 久久久久久久久久久久久夜| 久久久噜噜噜久久中文字幕色伊伊| 精品日韩在线一区| 欧美tk丨vk视频| 久久网这里都是精品| 26uuu精品一区二区三区四区在线| 欧美xxxxx牲另类人与| 日韩欧美www| 国产人成亚洲第一网站在线播放 | 亚洲日本在线视频观看| 亚洲欧美日韩中文播放| 一区二区三区产品免费精品久久75| 亚洲精品国产第一综合99久久| 亚洲第一搞黄网站| 麻豆国产精品777777在线| 国精品**一区二区三区在线蜜桃| 国产精品一区二区在线观看网站 | 五月激情综合婷婷| 久久精品99国产精品日本| 成人中文字幕电影| 色系网站成人免费| 欧美高清一级片在线| 精品国产乱码久久久久久图片| 国产三级精品三级| 亚洲综合丁香婷婷六月香| 久久精品99国产精品| 色综合天天综合网天天看片| 欧美日韩电影在线| 亚洲国产高清在线| 日韩影院在线观看| av网站免费线看精品| 日韩三级在线观看| 亚洲视频一区二区在线观看| 九九在线精品视频| 色欲综合视频天天天| 2023国产精华国产精品| 亚洲综合免费观看高清完整版在线| 国产一区二三区| 欧美一区二区三区色| 亚洲视频精选在线| 国产高清一区日本| 日韩欧美自拍偷拍| 1区2区3区精品视频| 国内一区二区视频| 欧美中文字幕一区二区三区 | 蜜臀av亚洲一区中文字幕| 99麻豆久久久国产精品免费优播| 欧美精品电影在线播放| 亚洲男女毛片无遮挡| 国产一区二区福利视频| 91精品国产免费| 亚洲制服丝袜av| 99久久久国产精品| 国产欧美精品一区二区三区四区| 美女mm1313爽爽久久久蜜臀| 欧美色男人天堂| 亚洲欧美日韩久久| 国产99精品国产| 精品国精品国产| 久久国产日韩欧美精品| 欧美一区二区在线看| 亚洲第一会所有码转帖| 欧美性猛交一区二区三区精品| 亚洲欧美日本韩国| 97aⅴ精品视频一二三区| 欧美日韩在线一区二区| 亚洲激情中文1区| 91九色最新地址| 综合久久国产九一剧情麻豆| fc2成人免费人成在线观看播放 | 一本久道中文字幕精品亚洲嫩| 欧美极品美女视频| 成人午夜伦理影院| 欧美国产精品专区| www.亚洲精品| 亚洲美女淫视频| 欧美日韩精品系列| 日本一区中文字幕| 日韩欧美一区二区视频| 精品在线播放免费| 精品91自产拍在线观看一区| 韩国精品主播一区二区在线观看 | 精品日本一线二线三线不卡| 久久99蜜桃精品| 国产亚洲欧美色| av激情综合网| 亚洲综合小说图片| 欧美大度的电影原声| 精品亚洲国内自在自线福利| 欧美激情在线一区二区三区| 色婷婷精品久久二区二区蜜臂av| 亚洲最快最全在线视频| 欧美久久一二区| 国产麻豆精品久久一二三| 一区在线中文字幕| 欧美群妇大交群的观看方式| 精品亚洲国内自在自线福利| 成人欧美一区二区三区| 91精品国产色综合久久| 国产激情精品久久久第一区二区| 亚洲欧美日韩综合aⅴ视频| 欧美精品精品一区| 成人一区二区三区在线观看| 天天爽夜夜爽夜夜爽精品视频| 国产女人18水真多18精品一级做| 欧美专区日韩专区| 国产ts人妖一区二区| 亚洲综合成人在线视频| 国产日本一区二区| 欧美精品tushy高清| 成人免费av资源| 久久精品国产网站| 亚洲精品高清在线观看| 久久久精品黄色| 7777精品伊人久久久大香线蕉的| 福利一区在线观看| 日产精品久久久久久久性色| 亚洲视频电影在线| 久久精品人人做人人综合| 欧美理论电影在线| 色哟哟精品一区| 不卡一区在线观看| 国产综合色视频| 日韩成人一区二区| 亚洲一区二区三区美女| 亚洲图片另类小说| 国产视频911| 日韩免费观看高清完整版| 欧美色图天堂网| 99久久精品国产观看| 国产一区二区三区久久久| 日本女人一区二区三区| 亚洲激情在线激情| 国产精品国产三级国产普通话三级| 日韩欧美激情一区| 91麻豆精品国产91久久久资源速度| 色综合天天综合网天天看片| 不卡的av在线播放| 国产麻豆视频一区| 国产乱码一区二区三区| 免费不卡在线观看| 日韩 欧美一区二区三区| 日韩精品国产精品| 午夜精品久久久久影视| 亚洲一区二区三区精品在线| 亚洲成人www| 秋霞电影一区二区| 麻豆一区二区99久久久久| 久久99久久99| 国产精品一区二区x88av| 国产91在线看| 色婷婷综合久色| 在线看国产一区二区| 欧美日韩三级一区二区| 欧美精品久久99| 欧美不卡123| 国产精品热久久久久夜色精品三区 | 成人在线视频首页| 成人视屏免费看| 91麻豆精品在线观看| 欧美综合一区二区| 欧美丰满少妇xxxxx高潮对白| 欧美zozozo| 国产精品视频免费| 亚洲精品久久嫩草网站秘色| 午夜不卡av免费| 国内精品伊人久久久久av影院| 国产高清精品网站| 色播五月激情综合网| 欧美精品色综合| 久久精子c满五个校花| 亚洲色图丝袜美腿| 午夜不卡av在线| 成人综合日日夜夜| 91黄色免费观看| 欧美xxxx在线观看| 中文字幕字幕中文在线中不卡视频| 亚洲一区二区三区精品在线| 久久99精品久久久久久国产越南 | 成人av手机在线观看| 欧美性生活大片视频| 精品欧美黑人一区二区三区| 国产精品天干天干在线综合| 亚洲国产日韩精品| 国产乱子伦视频一区二区三区| 91原创在线视频| 精品精品国产高清一毛片一天堂| 日韩理论电影院| 国产永久精品大片wwwapp| 色婷婷激情综合| 久久精品夜夜夜夜久久| 日韩激情中文字幕| 91蝌蚪porny九色| 久久网站热最新地址| 五月婷婷色综合| av不卡免费在线观看|