]> andersk Git - splint.git/blame - test/db2/employee.c
*** empty log message ***
[splint.git] / test / db2 / employee.c
CommitLineData
885824d3 1# include <stdio.h>
2# include <string.h>
3# include "employee.h"
4
5bool employee_setName (employee *e, char na [])
6{
7 size_t i;
8
9 for (i = 0; na[i] != '\0'; i++)
10 {
3120b462 11 if (i == maxEmployeeName) {
12 e->name[0] = '\0';
13 return FALSE;
14 }
885824d3 15 }
16
17 strcpy (e->name, na);
18 return TRUE;
19}
20
21bool employee_equal (employee * e1, employee * e2)
22{
23 return ((e1->ssNum == e2->ssNum)
24 && (e1->salary == e2->salary)
25 && (e1->gen == e2->gen)
26 && (e1->j == e2->j)
27 && (strncmp (e1->name, e2->name, maxEmployeeName) == 0));
28}
29
30void employee_sprint (char s[], employee e)
31{
32 static char *gender[] ={ "male", "female", "?" };
33 static char *jobs[] = { "manager", "non-manager", "?" };
34
35 (void) sprintf (s, employeeFormat, e.ssNum, e.name,
36 gender[e.gen], jobs[e.j], e.salary);
37}
38
This page took 1.107483 seconds and 5 git commands to generate.