home *** CD-ROM | disk | FTP | other *** search
- /*********************
- *
- * st_just.c - string justification routines.
- *
- * Purpose: This file contains functions to justify and center strings.
- *
- * Blackstar C Function Library
- * (c) Copyright 1985,1989 Sterling Castle Software
- *
- *******/
-
- #include <string.h>
- #include "blackstr.h"
- #include "kb_head.h"
-
-
- /********
- *
- * st_movr(str,n) - move string n bytes to right
- *
- **/
-
- void st_movr(char *str, int n)
- {
- int i,l;
-
- l = strlen(str); /* end */
- for(i=0; i<=l; ++i)
- str[l+n-i] = str[l-i];
- for(i=0; i<n; ++i)
- str[i] = BLANK; /* blank fill */
- }
-
-
- /********
- *
- * st_movl(str,n) - move string n bytes to left
- *
- **/
-
- void st_movl(char *str, int n)
- {
- int i,l;
-
- l = strlen(str)-n; /* end */
- for(i=0; i<=l; ++i) {
- str[i] = str[i+n];
- }
- }
-
-
- /********
- *
- * st_jusr(str,n) - justify sting right in n byte field
- *
- **/
-
- void st_jusr(char *str, int n)
- {
- st_movr(str,(n - strlen(str)));
- }
-
-
- /********
- *
- * st_cntr(str,n) - center string in n byte field
- *
- **/
-
- void st_cntr(char *str, int n)
- {
- int i;
-
- i = (n- strlen(str))/2;
- st_movr(str,i);
- while(i--)
- strcat(str," ");
- }
-