Patch to testparm - for makefile usage

Peter Polkinghorne Peter.Polkinghorne at brunel.ac.uk
Wed Mar 8 16:25:19 GMT 2000


Version Info: Samba 2.0.6 on Solaris 2.5.1 & 7, built with Sun C 5.0.

Rationale: It is useful to be able to use testparm as a simple checker for
smb.conf files.  However dumping the entire service definition is not so
helpful.  So the following little patch adds a "-q" flag to stop the service
dump.

I use it in the makefile when I version check the components on the CoW machine
(Centre of the World) before distributing to the servers.

(hope this is the correct formum now for patches ... )

Here is the patch - for testparm.c:

*** testparm.c.orig     Wed Oct 13 06:27:03 1999
--- testparm.c  Fri Jan 28 15:06:44 2000
***************
*** 164,172 ****
  
  static void usage(char *pname)
  {
!       printf("Usage: %s [-sh] [-L servername] [configfilename] [hostname 
hostIP]\n", pname);
        printf("\t-s                  Suppress prompt for enter\n");
        printf("\t-h                  Print usage\n");
        printf("\t-L servername       Set %%L macro to servername\n");
        printf("\tconfigfilename      Configuration file to test\n");
        printf("\thostname hostIP.    Hostname and Host IP address to test\n");
--- 164,173 ----
  
  static void usage(char *pname)
  {
!       printf("Usage: %s [-shq] [-L servername] [configfilename] [hostname 
hostIP]\n", pname);
        printf("\t-s                  Suppress prompt for enter\n");
        printf("\t-h                  Print usage\n");
+       printf("\t-q                  Quiet - no service dump\n");
        printf("\t-L servername       Set %%L macro to servername\n");

        printf("\tconfigfilename      Configuration file to test\n");
        printf("\thostname hostIP.    Hostname and Host IP address to test\n");
***************
*** 183,189 ****
    pstring configfile;
    int opt;
    int s;
!   BOOL silent_mode = False;
    int ret = 0;
  
    TimeInit();
--- 184,190 ----
    pstring configfile;
    int opt;
    int s;
!   BOOL silent_mode = False, quiet_mode = FALSE;
    int ret = 0;
  
    TimeInit();
***************
*** 192,202 ****
    
    charset_initialise();

  
!   while ((opt = getopt(argc, argv,"shL:")) != EOF) {
    switch (opt) {
      case 's':
        silent_mode = True;
        break;
      case 'L':
        fstrcpy(local_machine,optarg);
        break;
--- 193,206 ----
    
    charset_initialise();
  
!   while ((opt = getopt(argc, argv,"sqhL:")) != EOF) {
    switch (opt) {
      case 's':
        silent_mode = True;
        break;
+     case 'q':
+       quiet_mode = True;
+       break;
      case 'L':
        fstrcpy(local_machine,optarg);
        break;
***************
*** 272,278 ****
      }
    }
  
!   if (argc < 3) {
      if (!silent_mode) {
        printf("Press enter to see a dump of your service definitions\n");
        fflush(stdout);
--- 276,282 ----
      }
    }
  
!   if (argc < 3 && !quiet_mode ) {
      if (!silent_mode) {
        printf("Press enter to see a dump of your service definitions\n");
        fflush(stdout);



-- 
-----------------------------------------------------------------------------
| Peter Polkinghorne, Computer Centre, Brunel University, Uxbridge, UB8 3PH,|
| Peter.Polkinghorne at brunel.ac.uk   +44 1895 274000 x2561       UK          |
-----------------------------------------------------------------------------




More information about the samba-technical mailing list