source: rtems-testing/sim-scripts/usleep.c @ 6871c37

4.11
Last change on this file since 6871c37 was 450998b, checked in by Joel Sherrill <joel.sherrill@…>, on Jan 19, 2009 at 10:37:10 PM

2009-01-19 Joel Sherrill <joel.sherrill@…>

  • ChangeLog?, Makefile, README, gdb-sim-run.in, jmr3904.in, usleep.c: New files.
  • Property mode set to 100644
File size: 1.3 KB
Line 
1/* vi: set sw=4 ts=4: */
2/*
3 * Mini usleep implementation for busybox
4 *
5 *
6 * Copyright (C) 1995, 1996 by Bruce Perens <bruce@pixar.com>.
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 *
22 */
23
24// #include "internal.h"
25#include <stdlib.h>
26#include <unistd.h>
27#include <stdio.h>
28
29const char usleep_usage[] = "usleep N\n" 
30#ifndef BB_FEATURE_TRIVIAL_HELP
31  "\nPause for N microseconds.\n"
32#endif
33  ;
34
35int main(int argc, char **argv)
36{
37  if ((argc < 2) || (**(argv + 1) == '-')) {
38    fprintf(stderr, usleep_usage );
39  } else {
40    int usecs = atoi(*(++argv));
41    /* fprintf(stderr, "usleep %d\n", usecs ); */
42    usleep(usecs);
43  }
44  return 0;
45}
46
Note: See TracBrowser for help on using the repository browser.