~ubuntu-branches/ubuntu/vivid/emscripten/vivid-proposed

« back to all changes in this revision

Viewing changes to tests/core/test_getopt.in

  • Committer: Package Import Robot
  • Author(s): Sylvestre Ledru
  • Date: 2014-01-19 14:12:40 UTC
  • mfrom: (4.1.2 sid)
  • Revision ID: package-import@ubuntu.com-20140119141240-nfiw0p8033oitpfz
Tags: 1.9.0~20140119~7dc8c2f-1
* New snapshot release (Closes: #733714)
* Provide sources for javascript and flash. Done in orig-tar.sh
  Available in third_party/websockify/include/web-socket-js/src/
  (Closes: #735903)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#pragma clang diagnostic ignored "-Winvalid-pp-token"
 
2
#include <unistd.h>
 
3
#include <stdlib.h>
 
4
#include <stdio.h>
 
5
 
 
6
int main(int argc, char *argv[]) {
 
7
  int flags, opt;
 
8
  int nsecs, tfnd;
 
9
 
 
10
  nsecs = 0;
 
11
  tfnd = 0;
 
12
  flags = 0;
 
13
  while ((opt = getopt(argc, argv, "nt:")) != -1) {
 
14
    switch (opt) {
 
15
      case 'n':
 
16
        flags = 1;
 
17
        break;
 
18
      case 't':
 
19
        nsecs = atoi(optarg);
 
20
        tfnd = 1;
 
21
        break;
 
22
      default: /* '?' */
 
23
        fprintf(stderr, "Usage: %s [-t nsecs] [-n] name\n", argv[0]);
 
24
        exit(EXIT_FAILURE);
 
25
    }
 
26
  }
 
27
 
 
28
  printf("flags=%d; tfnd=%d; optind=%d\n", flags, tfnd, optind);
 
29
 
 
30
  if (optind >= argc) {
 
31
    fprintf(stderr, "Expected argument after options\n");
 
32
    exit(EXIT_FAILURE);
 
33
  }
 
34
 
 
35
  printf("name argument = %s\n", argv[optind]);
 
36
 
 
37
  /* Other code omitted */
 
38
 
 
39
  exit(EXIT_SUCCESS);
 
40
}