home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / unix / volume17 / ease2 / part01 / src / fixstrings.c < prev    next >
Encoding:
C/C++ Source or Header  |  1989-02-08  |  1.7 KB  |  89 lines

  1. /*
  2.  * $Source: /usr/src/local/local.bin/ease/src/RCS/fixstrings.c,v $
  3.  * $Locker:  $
  4.  *
  5.  * $Revision: 2.0 $
  6.  * Check-in $Date: 88/06/15 14:41:19 $
  7.  * $State: Exp $
  8.  *
  9.  * $Author: root $
  10.  *
  11.  * $Log:    fixstrings.c,v $
  12.  * Revision 2.0  88/06/15  14:41:19  root
  13.  * Baseline release for net posting. ADR.
  14.  * 
  15.  * Version 1.3  87/03/05  19:38:33  jeff
  16.  * Edited RCS header and FLUKEid[] string.
  17.  * 
  18.  * Version 1.2  87/02/25  16:55:13  jeff
  19.  * Add some RCS header lines.  No code changes.
  20.  * 
  21.  */
  22.  
  23. /*  FLUKE jps 16-apr-86 - special hacks for NULL pointers.
  24.  *
  25.  *  The author of ease used a *lot* of NULL pointers.  This isn't much
  26.  *  of a problem on a vax, where NULL pointers look like "".  Not so on a Sun.
  27.  *
  28.  *  We hack around the problem by defining a set of wrappers for the
  29.  *  standard string functions, making it appear as though they accept NULL
  30.  *  pointers.  In the other C files, cpp macros are used to revector the
  31.  *  standard string functions to this file.
  32.  */
  33. #include <strings.h>
  34. #define fix(s) ((s) ? (s) : "")
  35.  
  36. char *Xstrcat (s1, s2)
  37. char *s1, *s2; 
  38. {
  39.     return (strcat (s1, fix (s2)));
  40. }
  41.  
  42. char *Xstrncat (s1, s2, n)
  43. char *s1, *s2; 
  44. {
  45.     return (strncat (s1, fix (s2), n));
  46. }
  47.  
  48. Xstrcmp (s1, s2)
  49. char *s1, *s2; 
  50. {
  51.     return (strcmp (fix (s1), fix (s2)));
  52. }
  53.  
  54. Xstrncmp (s1, s2, n)
  55. char *s1, *s2; 
  56. {
  57.     return (strncmp (fix (s1), fix (s2), n));
  58. }
  59.  
  60. char *Xstrcpy (s1, s2)
  61. char *s1, *s2; 
  62. {
  63.     return (strcpy (s1, fix (s2)));
  64. }
  65.  
  66. char *Xstrncpy (s1, s2, n)
  67. char *s1, *s2; 
  68. {
  69.     return (strncpy (s1, fix (s2), n));
  70. }
  71.  
  72. Xstrlen (s)
  73. char *s; 
  74. {
  75.     return (strlen (fix (s)));
  76. }
  77.  
  78. char *Xindex (s, c)
  79. char *s, c; 
  80. {
  81.     return (index (fix (s), c));
  82. }
  83.  
  84. char *Xrindex (s, c)
  85. char *s, c; 
  86. {
  87.     return (rindex (fix (s), c));
  88. }
  89.