1 # include <stdio.h>
2 # include <string.h>
3 # include "employee.h"
4 
employee_setName(employee * e,char na[])5 bool employee_setName (employee *e, char na [])
6 {
7   size_t i;
8 
9   for (i = 0; na[i] != '\0'; i++)
10     {
11       if (i == maxEmployeeName) {
12 	e->name[0] = '\0';
13 	return FALSE;
14       }
15     }
16 
17   strcpy (e->name, na);
18   return TRUE;
19 }
20 
employee_equal(employee * e1,employee * e2)21 bool 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 
employee_sprint(char s[],employee e)30 void 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 
39