~ubuntu-branches/ubuntu/utopic/coreutils/utopic-proposed

« back to all changes in this revision

Viewing changes to src/nproc.c

  • Committer: Package Import Robot
  • Author(s): Colin Watson
  • Date: 2012-11-28 03:03:42 UTC
  • mfrom: (8.3.4 sid)
  • Revision ID: package-import@ubuntu.com-20121128030342-21zanj8354gas5gr
Tags: 8.20-3ubuntu1
* Resynchronise with Debian.  Remaining changes:
  - Make 'uname -i -p' return the real processor/hardware, instead of
    unknown.
  - Build-depend on gettext:any instead of on gettext, so that apt-get can
    properly resolve build-dependencies on the tool when cross-building.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/* nproc - print the number of processors.
2
 
   Copyright (C) 2009-2011 Free Software Foundation, Inc.
 
2
   Copyright (C) 2009-2012 Free Software Foundation, Inc.
3
3
 
4
4
   This program is free software: you can redistribute it and/or modify
5
5
   it under the terms of the GNU General Public License as published by
24
24
#include "system.h"
25
25
#include "error.h"
26
26
#include "nproc.h"
 
27
#include "quote.h"
27
28
#include "xstrtol.h"
28
29
 
29
 
/* The official name of this program (e.g., no `g' prefix).  */
 
30
/* The official name of this program (e.g., no 'g' prefix).  */
30
31
#define PROGRAM_NAME "nproc"
31
32
 
32
33
#define AUTHORS proper_name ("Giuseppe Scrivano")
50
51
usage (int status)
51
52
{
52
53
  if (status != EXIT_SUCCESS)
53
 
    fprintf (stderr, _("Try `%s --help' for more information.\n"),
54
 
             program_name);
 
54
    emit_try_help ();
55
55
  else
56
56
    {
57
57
      printf (_("Usage: %s [OPTION]...\n"), program_name);
114
114
        }
115
115
    }
116
116
 
 
117
  if (argc != optind)
 
118
    {
 
119
      error (0, 0, _("extra operand %s"), quote (argv[optind]));
 
120
      usage (EXIT_FAILURE);
 
121
    }
 
122
 
117
123
  nproc = num_processors (mode);
118
124
 
119
125
  if (ignore < nproc)