home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / CLIPPER / MISC / XBBS7200.ZIP / XBBS7200.TAR / msgpack / packmisc.c < prev    next >
Encoding:
C/C++ Source or Header  |  1989-05-07  |  1.3 KB  |  69 lines

  1. /*
  2.  * bbscmisc.c 
  3.  *
  4.  * Support routines used by BBSc.c. Mike Kelly 
  5.  *
  6.  * 06/12/83 v1.0    written 07/07/83 v1.0    updated 
  7.  */
  8.  
  9. #include "packdef.h"
  10. #include <sys/types.h>
  11. #include <sys/stat.h>
  12.  
  13. #define LASTDATE  " 07/07/83 "
  14.  
  15. #define PGMNAME "BBSCMISC "
  16. #define VERSION " 1.0 "
  17.  
  18.  
  19. strfill(buf, fillchar, length)    /* fill a string with fillchar */
  20.     char           *buf;    /* for length -1 */
  21.     int             fillchar, length;
  22. {
  23.     while (--length) {    /* really is length -1 */
  24.         *buf++ = fillchar;
  25.     }
  26.     *buf++ = '\0';        /* need room for this */
  27. }
  28.  
  29. substr(from, to, start, length)    /* moves chars from "from" to "to" */
  30.     char           *from, *to;    /* starting at "start" for */
  31. /* "length" number of chars */
  32.     int             start, length;    /* for beginning of string use 1, not
  33.                      * 0 */
  34. {
  35.     int             cnt;
  36.  
  37.     cnt = 0;
  38.  
  39.     while (--start) {    /* adjust sending field pointer */
  40.         from++;
  41.     }
  42.  
  43.     while ((cnt < length) && (*to++ = *from++)) {    /* do the moving */
  44.         cnt++;
  45.     }
  46.  
  47.     *to = '\0';
  48.  
  49. }
  50.  
  51. itoa(str, n)            /* taken from float.c */
  52.     char           *str;
  53. {
  54.     sprintf(str, "%d", n);
  55. }
  56. /* end of function         */
  57.  
  58. seek(fildes, posit, dummy) int 
  59.     fildes, posit, dummy;
  60. {
  61.     long            pos;
  62.     pos = posit * 128L;
  63.     /* return(lseek(fildes,posit << 7,0)) ;    */
  64.     return (lseek(fildes, pos, 0));
  65. }
  66. /* end of function         */
  67.  
  68. /* end of program       */
  69.