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

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

?? wc.c

?? 對windows平臺程序開發到Linux平臺的程序開過渡做了說明
?? C
字號:
/* GNU's uptime.
   Copyright (C) 1992-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.  */

/* Created by hacking who.c by Kaveh Ghazi ghazi@caip.rutgers.edu.  */

#include <config.h>
#include <getopt.h>
#include <stdio.h>

#include <sys/types.h>
#include "system.h"

#if HAVE_SYSCTL && HAVE_SYS_SYSCTL_H
# include <sys/sysctl.h>
#endif

#include "error.h"
#include "long-options.h"
#include "readutmp.h"
#include "closeout.h"

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

#define AUTHORS N_ ("Joseph Arceneaux, David MacKenzie, and Kaveh Ghazi")

int getloadavg ();

/* The name this program was run with. */
char *program_name;

static struct option const longopts[] =
{
  {NULL, 0, NULL, 0}
};

static void
print_uptime (int n, const STRUCT_UTMP *this)
{
  register int entries = 0;
  time_t boot_time = 0;
  time_t time_now;
  time_t uptime = 0;
  int updays;
  int uphours;
  int upmins;
  struct tm *tmn;
  double avg[3];
  int loads;
#ifdef HAVE_PROC_UPTIME
  FILE *fp;
  double upsecs;

  fp = fopen ("/proc/uptime", "r");
  if (fp != NULL)
    {
      char buf[BUFSIZ];
      int res;
      char *b = fgets (buf, BUFSIZ, fp);
      if (b == buf)
	{
	  /* The following sscanf must use the C locale.  */
	  setlocale (LC_NUMERIC, "C");
	  res = sscanf (buf, "%lf", &upsecs);
	  setlocale (LC_NUMERIC, "");
	  if (res == 1)
	    uptime = (time_t) upsecs;
	}

      fclose (fp);
    }
#endif /* HAVE_PROC_UPTIME */

#if HAVE_SYSCTL && defined CTL_KERN && defined KERN_BOOTTIME
  {
    /* FreeBSD specific: fetch sysctl "kern.boottime".  */
    static int request[2] = { CTL_KERN, KERN_BOOTTIME };
    struct timeval result;
    size_t result_len = sizeof result;

    if (sysctl (request, 2, &result, &result_len, NULL, 0) >= 0)
      boot_time = result.tv_sec;
  }
#endif

  /* Loop through all the utmp entries we just read and count up the valid
     ones, also in the process possibly gleaning boottime. */
  while (n--)
    {
      if (UT_USER (this) [0]
#ifdef USER_PROCESS
	  && this->ut_type == USER_PROCESS
#endif
	  )
	{
	  ++entries;
	}
      /* If BOOT_MSG is defined, we can get boottime from utmp.  This avoids
	 possibly needing special privs to read /dev/kmem. */
#ifdef BOOT_MSG
# if HAVE_PROC_UPTIME
      if (uptime == 0)
# endif /* HAVE_PROC_UPTIME */
	if (STREQ (this->ut_line, BOOT_MSG))
	  boot_time = UT_TIME_MEMBER (this);
#endif /* BOOT_MSG */
      ++this;
    }
  time_now = time (0);
#if defined HAVE_PROC_UPTIME
  if (uptime == 0)
#endif
    {
      if (boot_time == 0)
	error (EXIT_FAILURE, errno, _("couldn't get boot time"));
      uptime = time_now - boot_time;
    }
  updays = uptime / 86400;
  uphours = (uptime - (updays * 86400)) / 3600;
  upmins = (uptime - (updays * 86400) - (uphours * 3600)) / 60;
  tmn = localtime (&time_now);
  printf (_(" %2d:%02d%s  up "), ((tmn->tm_hour % 12) == 0
				  ? 12 : tmn->tm_hour % 12),
	  /* FIXME: use strftime, not am, pm.  Uli reports that
	     the german translation is meaningless.  */
	  tmn->tm_min, (tmn->tm_hour < 12 ? _("am") : _("pm")));
  if (updays > 0)
    printf (ngettext("%d day", "%d days", updays), updays);
  printf (" %2d:%02d,  ", uphours, upmins);
  printf (ngettext ("%d user", "%d users", entries), entries);

#if defined (HAVE_GETLOADAVG) || defined (C_GETLOADAVG)
  loads = getloadavg (avg, 3);
#else
  loads = -1;
#endif

  if (loads == -1)
    putchar ('\n');
  else
    {
      if (loads > 0)
	printf (_(",  load average: %.2f"), avg[0]);
      if (loads > 1)
	printf (", %.2f", avg[1]);
      if (loads > 2)
	printf (", %.2f", avg[2]);
      if (loads > 0)
	putchar ('\n');
    }
}

/* Display the system uptime and the number of users on the system,
   according to utmp file FILENAME. */

static void
uptime (const char *filename)
{
  int n_users;
  STRUCT_UTMP *utmp_buf;
  int fail = read_utmp (filename, &n_users, &utmp_buf);

  if (fail)
    error (EXIT_FAILURE, errno, "%s", filename);

  print_uptime (n_users, utmp_buf);
}

void
usage (int status)
{
  if (status != 0)
    fprintf (stderr, _("Try `%s --help' for more information.\n"),
	     program_name);
  else
    {
      printf (_("Usage: %s [OPTION]... [ FILE ]\n"), program_name);
      printf (_("\
Print the current time, the length of time the system has been up,\n\
the number of users on the system, and the average number of jobs\n\
in the run queue over the last 1, 5 and 15 minutes.\n\
If FILE is not specified, use %s.  %s as FILE is common.\n\
\n\
"),
	      UTMP_FILE, WTMP_FILE);
      fputs (HELP_OPTION_DESCRIPTION, stdout);
      fputs (VERSION_OPTION_DESCRIPTION, stdout);
      printf (_("\nReport bugs to <%s>.\n"), PACKAGE_BUGREPORT);
    }
  exit (status);
}

int
main (int argc, char **argv)
{
  int optc, longind;
  program_name = argv[0];
  setlocale (LC_ALL, "");
  bindtextdomain (PACKAGE, LOCALEDIR);
  textdomain (PACKAGE);

  atexit (close_stdout);

  parse_long_options (argc, argv, PROGRAM_NAME, GNU_PACKAGE, VERSION,
		      AUTHORS, usage);

  while ((optc = getopt_long (argc, argv, "", longopts, &longind)) != -1)
    {
      switch (optc)
	{
	case 0:
	  break;

	default:
	  usage (EXIT_FAILURE);
	}
    }

  switch (argc - optind)
    {
    case 0:			/* uptime */
      uptime (UTMP_FILE);
      break;

    case 1:			/* uptime <utmp file> */
      uptime (argv[optind]);
      break;

    default:			/* lose */
      error (0, 0, _("too many arguments"));
      usage (EXIT_FAILURE);
    }

  exit (EXIT_SUCCESS);
}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲日本va午夜在线影院| 一区二区三区不卡视频在线观看| 成人在线一区二区三区| 亚洲激情图片qvod| 久久你懂得1024| 欧美日韩黄色一区二区| 成人aa视频在线观看| 老司机免费视频一区二区三区| 国产精品初高中害羞小美女文| 精品欧美久久久| 欧美日韩性生活| 99re66热这里只有精品3直播| 久久99精品国产.久久久久| 亚洲综合网站在线观看| 国产精品美女久久久久aⅴ国产馆| 欧美一区二区三区免费观看视频| 91麻豆国产福利在线观看| 国产原创一区二区| 奇米色一区二区| 亚洲午夜一区二区| 亚洲男帅同性gay1069| 日本一区二区综合亚洲| 精品对白一区国产伦| 3d动漫精品啪啪1区2区免费| 91九色02白丝porn| 色综合一区二区| 丰满少妇在线播放bd日韩电影| 久久99日本精品| 日本大胆欧美人术艺术动态| 亚洲一区视频在线观看视频| 亚洲精品第1页| 亚洲欧美日韩在线| 成人免费一区二区三区在线观看| 久久综合给合久久狠狠狠97色69| 91精品国产欧美一区二区成人 | 精品1区2区在线观看| 欧美精品18+| 欧美日韩你懂得| 在线视频你懂得一区二区三区| 精品999久久久| 欧美刺激午夜性久久久久久久 | 91麻豆精品国产自产在线观看一区| 色播五月激情综合网| 色一情一乱一乱一91av| 在线视频亚洲一区| 欧美日韩视频在线一区二区| 欧美男人的天堂一二区| 欧美精品tushy高清| 51精品秘密在线观看| 日韩欧美中文一区| 精品日韩成人av| 久久夜色精品一区| 国产欧美日本一区二区三区| 国产精品伦理在线| 中文字幕一区视频| 一区二区三区成人| 日韩精品视频网| 久久99最新地址| 丰满岳乱妇一区二区三区| 91视频.com| 在线不卡a资源高清| 欧美精品一区二区高清在线观看 | 亚洲一区二区五区| 天天综合色天天| 极品美女销魂一区二区三区免费| 国产在线播放一区三区四| 不卡视频在线看| 欧美在线观看视频在线| 欧美一区二区成人| 欧美国产综合色视频| 亚洲自拍偷拍av| 精品在线一区二区三区| 成人av网站在线| 欧美吞精做爰啪啪高潮| 精品成人私密视频| 综合久久久久综合| 首页国产欧美久久| 国产成人福利片| 亚洲欧美综合色| 午夜日韩在线电影| 国产精品一区免费视频| 99视频一区二区| 日韩一卡二卡三卡四卡| 中文字幕在线观看一区| 奇米777欧美一区二区| 国产高清久久久| 欧美视频一区二| 国产女同性恋一区二区| 亚洲a一区二区| 成人一区二区三区| 9191国产精品| 亚洲日本va在线观看| 精品一二三四在线| 欧亚一区二区三区| 久久久99久久精品欧美| 亚洲成av人在线观看| 成人伦理片在线| 日韩欧美一级片| 亚洲国产一区在线观看| 成人性生交大片免费| 欧美一区二区三区视频在线| 中文字幕一区二区三区在线播放| 美女网站在线免费欧美精品| 一本大道久久a久久综合婷婷| 精品乱人伦小说| 天天影视网天天综合色在线播放| av日韩在线网站| 久久久不卡网国产精品二区| 秋霞国产午夜精品免费视频 | 精品久久国产老人久久综合| 亚洲综合激情网| 99精品视频在线观看| 日韩国产精品久久久久久亚洲| 成人精品国产一区二区4080| 日韩美女天天操| 欧美aa在线视频| 欧美日韩一区二区三区视频 | 日韩精品一二三| 在线观看日韩国产| 日韩理论在线观看| 成人夜色视频网站在线观看| 久久婷婷色综合| 精品中文字幕一区二区小辣椒| 欧美日韩免费一区二区三区| 一区二区三区在线观看动漫| 91免费观看视频| 一区二区中文字幕在线| 国产不卡在线一区| 欧美高清在线精品一区| 国产精品主播直播| 久久久综合视频| 国产伦精品一区二区三区免费迷| 日韩精品一区二区三区四区视频| 免费观看在线综合色| 日韩午夜在线观看视频| 奇米影视一区二区三区小说| 欧美一区午夜精品| 免费欧美在线视频| 精品三级在线看| 精品一区二区三区在线观看| 亚洲精品一区二区三区四区高清| 久久精品99国产精品日本| 精品久久人人做人人爱| 狠狠色狠狠色综合日日91app| 精品av久久707| 国产不卡在线视频| 成人免费在线视频观看| 91丨porny丨户外露出| 国产99久久久国产精品潘金网站| 久久久精品综合| 成人午夜av影视| 亚洲精品亚洲人成人网在线播放| 欧洲一区二区三区在线| 午夜精品国产更新| 精品国产一区二区三区不卡 | 国产精品久久午夜| 91麻豆成人久久精品二区三区| 一区二区三区**美女毛片| 欧美日韩国产首页| 久久精品国产99久久6| 久久影院午夜论| 91欧美一区二区| 日韩一区精品字幕| 久久日韩精品一区二区五区| 成人午夜视频在线观看| 一区二区三区高清| 日韩欧美视频在线| 成人免费高清视频在线观看| 亚洲乱码国产乱码精品精可以看| 欧美疯狂性受xxxxx喷水图片| 韩日av一区二区| 亚洲男人天堂一区| 欧美一区午夜视频在线观看| 成人午夜精品一区二区三区| 亚洲高清视频在线| 久久中文字幕电影| 91高清视频在线| 国内欧美视频一区二区| 一区二区三区中文在线观看| 日韩一级精品视频在线观看| 成人精品高清在线| 日精品一区二区| 国产精品久久午夜| 日韩精品综合一本久道在线视频| 成人动漫一区二区三区| 青青草国产精品亚洲专区无| 国产精品乱码久久久久久| 欧美精品亚洲一区二区在线播放| 高清beeg欧美| 喷水一区二区三区| 最新不卡av在线| 精品国产乱码久久久久久影片| 色天使色偷偷av一区二区| 国产综合久久久久久久久久久久| 夜夜操天天操亚洲| 亚洲国产精华液网站w| 欧美一区三区二区| 色网站国产精品| 高清成人在线观看| 久久精品国产77777蜜臀|