src/lib/edit.c
char *add_commas(char *val, char *buf)
{
   int len, nc;
   char *p, *q;
   int i;

   if (val != buf) {
      strcpy(buf, val);
   }
   len = strlen(buf);
   if (len < 1) {
      len = 1;
   }
   nc = (len - 1) / 3;
   p = buf+len;
   q = p + nc;
   *q-- = *p--;
   for ( ; nc; nc--) {
      for (i=0; i < 3; i++) {
          *q-- = *p--;
      }
      *q-- = ',';
   }
   return buf;
}
/*
 * Add commas to a string, which is presumably
 * a number.
 */
Add commas to a string, which is presumably
a number.
Add commas to a string which is presumably a number .
char *add_commas(char *val, char *buf)
{
   int len, nc;
   char *p, *q;
   int i;
   if (val != buf) {
      strcpy(buf, val);
   }
   len = strlen(buf);
   if (len < 1) {
      len = 1;
   }
   nc = (len - 1) / 3;
   p = buf+len;
   q = p + nc;
   *q-- = *p--;
   for ( ; nc; nc--) {
      for (i=0; i < 3; i++) {
          *q-- = *p--;
      }
      *q-- = ',';
   }
   return buf;
}
char * add_commas ( char * val , char * buf ) { int len , nc ; char * p , * q ; int i ; if ( val != buf ) { strcpy ( buf , val ) ; } len = strlen ( buf ) ; if ( len < 1 ) { len = 1 ; } nc = ( len - 1 ) / 3 ; p = buf + len ; q = p + nc ; * q -- = * p -- ; for ( ; nc ; nc -- ) { for ( i = 0 ; i < 3 ; i ++ ) { * q -- = * p -- ; } * q -- = ' ' ; } return buf ; }
Add commas to a string, which is presumably
 a number.
Add commas to a string which is presumably a number .