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