                               SQCB
                                 
                                 
                                 
                   beautifier for C source code
                                 
                     version 2.21 August 1995
                                 
                Copyright 1995 Software-Quelle GmbH
                                 


The  MS-DOS  based command SQCB indents the source code  lines  of
your  C programs according to the program's structure. The use  of
SQCB  will  spare you a lot of trouble and time, if  you  used  to
indent your source code by hand until now.

To  use SQCB, enter the command at the MS-DOS prompt or include it
in a batch file:

SQCB source_file [ /a ] [ /bn | /b:ext ] [ /cn | /ci:n ] [ /i:n  ]
[ /s:n ][ /t:n ]

The  square brackets [] enclose optional parameters; the  vertical
bar | separates alternatives.

parameter       meaning
                
source_file     path to the source file(s): the filename may be
                partially qualified, i.e. it may contain the
                wildcard characters * and ? . SQCB will update all
                files corresponding to source_file.
                
/a              acknowledge: the update of an source file must be
                acknowledged by the user
                
/bn             no backup: the source files will not be saved in
                backup files before being updated
/b:ext          extension for backup file: every source file will
                be saved in a backup file with the name extension
                ext before being updated. If this parameter is
                omitted, ext defaults to BAK
                
/cn             no indentation of comment lines: comment lines
                will not be indented; all lines of a comment,
                which spreads over multiple lines, keep their
                relative positions.
/ci:n           indentation of comments: all continuation lines of
                a comment, which spreads over multiple lines, will
                be indented by n columns relating to the first
                line of this comment. If this parameter is
                omitted, n defaults to 3
                
                
/help           show the description of parameters
                
                
/i:n            indentation value: n stands for the additional
                indentation of all lines between curly braces {}
                or a single statement after if, else, for, etc. n
                may range from 1 .. 9 . If this parameter is
                omitted, n defaults to 4.
                Note: Compiler directives (starting with a # sign)
                will always be left aligned.
                
/s:n            subdirectory search: SQCB searches subdirectories
                up to a level of n to find source files
                corresponding to source_file. If this parameter is
                omitted, subdirectories are not searched
/t:n            tab stops: n stands for the number of columns
                represented by a tab character; every n leading
                spaces in the line will be replaced by a single
                tab character. n may range from 0 .. 8; if n
                equals 0, spaces will not be replaced by tab
                characters. If this parameter is omitted, n
                defaults to 8.


Error messages:

In  case of an error, SQCB prints one of the following messages to
stdout;  you  may redirect these messages to a file  using  the  >
character (see the description of your command interpreter/shell):

message                          meaning
                                 
...                              name of the current source file
                                 
invalid parameter: ...           unknown command parameter or
                                 invalid parameter value
                                 
access error on file: ...        the file cannot be
                                 opened/read/written/erased
                                 
file ... not updated             the source file has not been
                                 updated
                                 
non matching brackets/braces at  SQCB found a } / ) / ] with no
line ..                          matching { / ( / [
                                 
missing brackets/braces at end   
of file                          
non matching #else / #endif at   SQCB found a #else / #endif with
line ...                         no matching #ifdef / #if
                                 
missing #endif at end of file    
                                 


If   you  have  given  the  option  /a,  SQCB  will  request  your
acknowledgment  before overwriting a source  file;  the  following
dialog message will be printed to stderr:

write changes to file? (y=yes, n=no, a=all, q=quit)


Please  enter one of the following keys, followed by the  <return>
key:

y       the source file will be updated
n      the source file will not be updated
a      this  source  file  and any further source  files  will  be
       updated without further acknowledgment
q        the source file will not be updated; no further file will
       be searched for.


Example 1:

SQCB source.c


The file "source.c" will be saved as "source.bak"; the source code
within "source.c" will be indented and look like this:

.....
{
    if (   (a == b)
      || (c == d))
    {
      switch (a)
      {
      case 1:
          c = up1 (a,
                  b,
                  up2 (c,
                      d));
          break;
      case 2:
          /* this is a comment
             spread over multiple lines */
          break;
      default:
          int n;          /* loop counter */
          for (n = 10;
              n > 0;
              n--)
             array [n] = 0;
      }
#ifdef WINDOWS
      wsprintf (szMessage, szFormat, iParam);
      if (MessageBox (hWnd, szMessage, ...))
      {
#else
      printf (szMessage, szFormat, iParam);
      if (fgets (user_input, ...))
      {
#endif
          /* continuation after user response */
          ...
      }
    }
}

Examples 2:

SQCB source.c /b:sav /i:2 /cn


The file "source.c" will be saved as "source.sav"; the source code
within "source.c" will be indented (except comments) and look like
this:

.....
{
  if (   (a == b)
      || (c == d))
  {
    switch (a)
    {
    case 1:
      c = up1 (a,
             b,
             up2 (c,
                 d));
      break;
    case 2:
/* this is a comment
   spread over multiple lines */
      break;
    default:
      int n;        /* loop counter */
      for (n = 10;
         n > 0;
         n--)
      array [n] = 0;
    }
#ifdef WINDOWS
    wsprintf (szMessage, szFormat, iParam);
    if (MessageBox (hWnd, szMessage, ...))
    {
#else
    printf (szMessage, szFormat, iParam);
    if (fgets (user_input, ...))
    {
#endif
/* continuation after user response */
      ...
    }
  }
}





3rd party rights:



This document makes reference to a number of third-party products.
All  copyrights,  trademarks and reserved  rights  held  in  these
products are acknowledged.

