home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / lclint.zip / lclint-2_3h-os2-bin.zip / test / db3 / employee.c < prev    next >
Text File  |  1997-09-03  |  829b  |  41 lines

  1. # include <stdio.h>
  2. # include <string.h>
  3. # include "employee.h"
  4.  
  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.     {
  13.       return FALSE;
  14.     }
  15.     }
  16.  
  17.   strcpy (e->name, na);
  18.   return TRUE;
  19. }
  20.  
  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.  
  30. typedef /*@observer@*/ char *obscharp;
  31.  
  32. void employee_sprint (char s[], employee e) 
  33. {
  34.   static obscharp gender[] ={ "male", "female", "?" };
  35.   static obscharp jobs[] = { "manager", "non-manager", "?" };
  36.   
  37.   (void) sprintf (s, FORMATEMPLOYEE, e.ssNum, e.name,
  38.           gender[(int) e.gen], jobs[(int) e.j], e.salary);
  39. }
  40.  
  41.