parameters.c revision 6fa27c330f9e07c5be553614b9c6e2f08461780f
1/* Ltrace Test : parameters.c.
2   Objectives  : Verify that Ltrace can handle all the different
3   parameter types
4
5   This file was written by Steve Fink <sphink@gmail.com>. */
6
7#include <stdio.h>
8#include <unistd.h>
9#include <sys/syscall.h>
10#include <sys/stat.h>
11#include <errno.h>
12#include <string.h>
13#include <stdlib.h>
14
15void func_ignore(int a, int b, int c);
16void func_intptr(int *i);
17void func_intptr_ret(int *i);
18int func_strlen(char*);
19void func_strfixed(char*);
20void func_ppp(int***);
21void func_stringp(char**);
22void func_short(short, short);
23void func_ushort(unsigned short, unsigned short);
24void func_float(float, float);
25
26typedef enum {
27  RED,
28  GREEN,
29  BLUE,
30  CHARTREUSE,
31  PETUNIA
32} color_t;
33void func_enum(color_t);
34
35int
36main ()
37{
38  int x = 17;
39  int *xP, **xPP;
40  char buf[200];
41  char *s;
42
43  func_ignore(1, 2, 3);
44
45  func_intptr(&x);
46
47  func_intptr_ret(&x);
48
49  func_strlen(buf);
50  printf("%s\n", buf);
51
52  func_strfixed(buf);
53  printf("%s\n", buf);
54
55  x = 80;
56  xP = &x;
57  xPP = &xP;
58  func_ppp(&xPP);
59
60  s = (char*) malloc(100);
61  strcpy(s, "Dude");
62  func_stringp(&s);
63
64  func_enum(BLUE);
65
66  func_short(-8, -9);
67  func_ushort(33, 34);
68  func_float(3.4, -3.4);
69
70  return 0;
71}
72