bug-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

patch2


From: Bear Giles
Subject: patch2
Date: Tue, 12 Jun 2001 21:39:29 -0600 (MDT)

diff -Naur --recursive cvs.orig/src/CVS/Entries cvs/src/CVS/Entries
--- cvs.orig/src/CVS/Entries    Tue Jun 12 19:42:23 2001
+++ cvs/src/CVS/Entries Tue Jun 12 20:31:45 2001
@@ -9,8 +9,8 @@
 /add.c/1.2/Tue Jun 12 23:43:12 2001/-ko/
 /admin.c/1.1.1.1/Sun Jun 10 04:09:03 2001/-ko/
 /annotate.c/1.1.1.1/Sun Jun 10 04:09:03 2001/-ko/
-/buffer.c/1.2/Tue Jun 12 23:43:12 2001/-ko/
-/buffer.h/1.2/Tue Jun 12 23:43:12 2001/-ko/
+/buffer.c/1.3/Wed Jun 13 02:30:34 2001/-ko/
+/buffer.h/1.3/Wed Jun 13 02:30:34 2001/-ko/
 /build_src.com/1.1.1.1/Sun Jun 10 04:09:10 2001/-ko/
 /checkin.c/1.2/Tue Jun 12 23:43:12 2001/-ko/
 /checkout.c/1.1.1.1/Sun Jun 10 04:09:03 2001/-ko/
@@ -64,7 +64,7 @@
 /run.c/1.1.1.1/Sun Jun 10 04:09:07 2001/-ko/
 /sanity.sh/1.1.1.1/Sun Jun 10 04:09:13 2001/-ko/
 /scramble.c/1.1.1.1/Sun Jun 10 04:09:07 2001/-ko/
-/server.c/1.2/Tue Jun 12 23:43:12 2001/-ko/
+/server.c/1.3/Wed Jun 13 02:30:34 2001/-ko/
 /server.h/1.1.1.1/Sun Jun 10 04:09:09 2001/-ko/
 /stamp-h2.in/1.1.1.1/Sun Jun 10 04:09:02 2001/-ko/
 /status.c/1.1.1.1/Sun Jun 10 04:09:07 2001/-ko/
diff -Naur --recursive cvs.orig/src/buffer.c cvs/src/buffer.c
--- cvs.orig/src/buffer.c       Tue Jun 12 17:43:12 2001
+++ cvs/src/buffer.c    Tue Jun 12 20:30:34 2001
@@ -222,20 +222,23 @@
 
 /* Add a '\0' terminated string to BUF.  */
 
-void
-buf_output0 (buf, string)
-    BUFFER *buf;
+int
+bputs (string, buf)
     const char *string;
+    BUFFER *buf;
 {
-    buf_output (buf, string, strlen (string));
+       size_t count = strlen (string);
+    buf_output (buf, string, count);
+
+       return count;
 }
 
 /* Add a single character to BUF.  */
 
-void
-buf_append_char (buf, ch)
-    BUFFER *buf;
+int
+bputc (ch, buf)
     int ch;
+    BUFFER *buf;
 {
     if (buf->data != NULL
        && (buf->last->text + BUFFER_DATA_SIZE
@@ -251,6 +254,8 @@
        b = ch;
        buf_output (buf, &b, 1);
     }
+
+       return ch;
 }
 
 /*
@@ -995,8 +1000,8 @@
        }
 
        /* Put in the command.  */
-       buf_append_char (outbuf, command);
-       buf_append_char (outbuf, ' ');
+       bputc (command, outbuf);
+       bputc (' ', outbuf);
 
        if (inbuf->data != nldata)
        {
diff -Naur --recursive cvs.orig/src/buffer.h cvs/src/buffer.h
--- cvs.orig/src/buffer.h       Tue Jun 12 17:43:12 2001
+++ cvs/src/buffer.h    Tue Jun 12 20:30:34 2001
@@ -120,8 +120,8 @@
         void (*) (BUFFER *)));
 extern int buf_empty_p PROTO((BUFFER *));
 extern void buf_output PROTO((BUFFER *, const char *, int));
-extern void buf_output0 PROTO((BUFFER *, const char *));
-extern void buf_append_char PROTO((BUFFER *, int));
+extern int bputs PROTO((const char *, BUFFER *));
+extern int bputc PROTO((int, BUFFER *));
 extern int buf_send_output PROTO((BUFFER *));
 extern int buf_flush PROTO((BUFFER *, int));
 extern int set_nonblock PROTO((BUFFER *));
diff -Naur --recursive cvs.orig/src/server.c cvs/src/server.c
--- cvs.orig/src/server.c       Tue Jun 12 17:43:12 2001
+++ cvs/src/server.c    Tue Jun 12 20:30:34 2001
@@ -575,15 +575,15 @@
     char *msg;
     char tmpstr[80];
 
-    buf_output0 (buf_to_net, "error  ");
+    bputs ("error  ", buf_to_net);
     msg = strerror (status);
     if (msg == NULL)
     {
        sprintf (tmpstr, "unknown error %d", status);
        msg = tmpstr;
     }
-    buf_output0 (buf_to_net, msg);
-    buf_append_char (buf_to_net, '\n');
+    bputs (msg, buf_to_net);
+    bputc ('\n', buf_to_net);
 
     buf_flush (buf_to_net, 0);
 }
@@ -602,12 +602,12 @@
 {
     if (pending_error_text)
     {
-       buf_output0 (buf_to_net, pending_error_text);
-       buf_append_char (buf_to_net, '\n');
+       bputs (pending_error_text, buf_to_net);
+       bputc ('\n', buf_to_net);
        if (pending_error)
            print_error (pending_error);
        else
-           buf_output0 (buf_to_net, "error  \n");
+           bputs ("error  \n", buf_to_net);
 
        buf_flush (buf_to_net, 0);
 
@@ -700,9 +700,9 @@
     {
        if (rs->status == rs_essential)
        {
-           buf_output0 (buf_to_net, "E response `");
-           buf_output0 (buf_to_net, rs->name);
-           buf_output0 (buf_to_net, "' not supported by client\nerror  \n");
+           bputs ("E response `", buf_to_net);
+           bputs (rs->name, buf_to_net);
+           bputs ("' not supported by client\nerror  \n", buf_to_net);
 
            /* FIXME: This call to buf_flush could conceivably
               cause deadlock, as noted in server_cleanup.  */
@@ -2071,20 +2071,20 @@
        notify_do (*notify_list->type, notify_list->filename, getcaller(),
                   notify_list->val, notify_list->watches, repos);
 
-       buf_output0 (buf_to_net, "Notified ");
+       bputs ("Notified ", buf_to_net);
        {
            char *dir = notify_list->dir + strlen (server_temp_dir) + 1;
            if (dir[0] == '\0')
-               buf_append_char (buf_to_net, '.');
+               bputc ('.', buf_to_net);
            else
-               buf_output0 (buf_to_net, dir);
-           buf_append_char (buf_to_net, '/');
-           buf_append_char (buf_to_net, '\n');
-       }
-       buf_output0 (buf_to_net, repos);
-       buf_append_char (buf_to_net, '/');
-       buf_output0 (buf_to_net, notify_list->filename);
-       buf_append_char (buf_to_net, '\n');
+               bputs (dir, buf_to_net);
+           bputc ('/', buf_to_net);
+           bputc ('\n', buf_to_net);
+       }
+       bputs (repos, buf_to_net);
+       bputc ('/', buf_to_net);
+       bputs (notify_list->filename, buf_to_net);
+       bputc ('\n', buf_to_net);
        free (repos);
 
        p = notify_list->next;
@@ -2343,7 +2343,7 @@
 
     if (dir_name == NULL)
     {
-       buf_output0 (buf_to_net, "E Protocol error: 'Directory' missing");
+       bputs ("E Protocol error: 'Directory' missing", buf_to_net);
        return;
     }
 
@@ -2358,10 +2358,10 @@
        update_dir = dir_name + strlen (server_temp_dir) + 1;
        if (!(update_dir[0] == '.' && update_dir[1] == '\0'))
        {
-           buf_output0 (buf_to_net, update_dir);
+           bputs (update_dir, buf_to_net);
            buf_output (buf_to_net, "/", 1);
        }
-       buf_output0 (buf_to_net, arg);
+       bputs (arg, buf_to_net);
        buf_output (buf_to_net, "\n", 1);
     }
 }
@@ -2655,12 +2655,12 @@
        this user.  */
     if (!check_command_legal_p (cmd_name))
     {
-       buf_output0 (buf_to_net, "E ");
-       buf_output0 (buf_to_net, program_name);
-       buf_output0 (buf_to_net, " [server aborted]: \"");
-       buf_output0 (buf_to_net, cmd_name);
-       buf_output0 (buf_to_net, "\" requires write access to the repository\n\
-error  \n");
+       bputs ("E ", buf_to_net);
+       bputs (program_name, buf_to_net);
+       bputs (" [server aborted]: \"", buf_to_net);
+       bputs (cmd_name, buf_to_net);
+       bputs ("\" requires write access to the repository\n\
+error  \n", buf_to_net);
        goto free_args_and_return;
     }
 
@@ -2676,26 +2676,26 @@
 
     if (pipe (stdout_pipe) < 0)
     {
-       buf_output0 (buf_to_net, "E pipe failed\n");
+       bputs ("E pipe failed\n", buf_to_net);
        print_error (errno);
        goto error_exit;
     }
     if (pipe (stderr_pipe) < 0)
     {
-       buf_output0 (buf_to_net, "E pipe failed\n");
+       bputs ("E pipe failed\n", buf_to_net);
        print_error (errno);
        goto error_exit;
     }
     if (pipe (protocol_pipe) < 0)
     {
-       buf_output0 (buf_to_net, "E pipe failed\n");
+       bputs ("E pipe failed\n", buf_to_net);
        print_error (errno);
        goto error_exit;
     }
 #ifdef SERVER_FLOWCONTROL
     if (pipe (flowcontrol_pipe) < 0)
     {
-       buf_output0 (buf_to_net, "E pipe failed\n");
+       bputs ("E pipe failed\n", buf_to_net);
        print_error (errno);
        goto error_exit;
     }
@@ -2706,7 +2706,7 @@
     dev_null_fd = CVS_OPEN (DEVNULL, O_RDONLY);
     if (dev_null_fd < 0)
     {
-       buf_output0 (buf_to_net, "E open /dev/null failed\n");
+       bputs ("E open /dev/null failed\n", buf_to_net);
        print_error (errno);
        goto error_exit;
     }
@@ -2718,12 +2718,12 @@
        way to "handle" them.  */
     if (! buf_empty_p (saved_output))
     {
-       buf_append_char (saved_output, '\n');
+       bputc ('\n', saved_output);
        buf_copy_lines (buf_to_net, saved_output, 'M');
     }
     if (! buf_empty_p (saved_outerr))
     {
-       buf_append_char (saved_outerr, '\n');
+       bputc ('\n', saved_outerr);
        buf_copy_lines (buf_to_net, saved_outerr, 'E');
     }
 
@@ -2734,7 +2734,7 @@
     command_pid = fork ();
     if (command_pid < 0)
     {
-       buf_output0 (buf_to_net, "E fork failed\n");
+       bputs ("E fork failed\n", buf_to_net);
        print_error (errno);
        goto error_exit;
     }
@@ -2797,7 +2797,7 @@
           protocol doesn't support anything better.  */
        if (! buf_empty_p (saved_output))
        {
-           buf_output0 (protocol, supported_response ("MT") ? "MT text " : "M 
");
+           bputs (supported_response ("MT") ? "MT text " : "M ", protocol);
            buf_append_buffer (protocol, saved_output);
            buf_output (protocol, "\n", 1);
            buf_send_counted (protocol);
@@ -2844,9 +2844,8 @@
        ++num_to_check;
        if (num_to_check > FD_SETSIZE)
        {
-           buf_output0 (buf_to_net,
-                        "E internal error: FD_SETSIZE not big enough.\n\
-error  \n");
+           bputs ("E internal error: FD_SETSIZE not big enough.\n\
+error  \n", buf_to_net);
            goto error_exit;
        }
 
@@ -2866,7 +2865,7 @@
 
        if (close (stdout_pipe[1]) < 0)
        {
-           buf_output0 (buf_to_net, "E close failed\n");
+           bputs ("E close failed\n", buf_to_net);
            print_error (errno);
            goto error_exit;
        }
@@ -2874,7 +2873,7 @@
 
        if (close (stderr_pipe[1]) < 0)
        {
-           buf_output0 (buf_to_net, "E close failed\n");
+           bputs ("E close failed\n", buf_to_net);
            print_error (errno);
            goto error_exit;
        }
@@ -2882,7 +2881,7 @@
 
        if (close (protocol_pipe[1]) < 0)
        {
-           buf_output0 (buf_to_net, "E close failed\n");
+           bputs ("E close failed\n", buf_to_net);
            print_error (errno);
            goto error_exit;
        }
@@ -2891,7 +2890,7 @@
 #ifdef SERVER_FLOWCONTROL
        if (close (flowcontrol_pipe[0]) < 0)
        {
-           buf_output0 (buf_to_net, "E close failed\n");
+           bputs ("E close failed\n", buf_to_net);
            print_error (errno);
            goto error_exit;
        }
@@ -2900,7 +2899,7 @@
 
        if (close (dev_null_fd) < 0)
        {
-           buf_output0 (buf_to_net, "E close failed\n");
+           bputs ("E close failed\n", buf_to_net);
            print_error (errno);
            goto error_exit;
        }
@@ -2987,7 +2986,7 @@
                if (numfds < 0
                        && errno != EINTR)
                {
-                   buf_output0 (buf_to_net, "E select failed\n");
+                   bputs ("E select failed\n", buf_to_net);
                    print_error (errno);
                    goto error_exit;
                }
@@ -3020,7 +3019,7 @@
                }
                else if (status > 0)
                {
-                   buf_output0 (buf_to_net, "E buf_input_data failed\n");
+                   bputs ("E buf_input_data failed\n", buf_to_net);
                    print_error (status);
                    goto error_exit;
                }
@@ -3070,8 +3069,8 @@
                    /* If the client supports the 'F' command, we send it. */
                    if (supported_response ("F"))
                    {
-                       buf_append_char (buf_to_net, 'F');
-                       buf_append_char (buf_to_net, '\n');
+                       bputc ('F', buf_to_net);
+                       bputc ('\n', buf_to_net);
                    }
                    cvs_flusherr ();
                    break;
@@ -3094,7 +3093,7 @@
                }
                else if (status > 0)
                {
-                   buf_output0 (buf_to_net, "E buf_input_data failed\n");
+                   bputs ("E buf_input_data failed\n", buf_to_net);
                    print_error (status);
                    goto error_exit;
                }
@@ -3119,7 +3118,7 @@
                }
                else if (status > 0)
                {
-                   buf_output0 (buf_to_net, "E buf_input_data failed\n");
+                   bputs ("E buf_input_data failed\n", buf_to_net);
                    print_error (status);
                    goto error_exit;
                }
@@ -3136,17 +3135,16 @@
         */
        if (! buf_empty_p (stdoutbuf))
        {
-           buf_append_char (stdoutbuf, '\n');
+           bputc ('\n', stdoutbuf);
            buf_copy_lines (buf_to_net, stdoutbuf, 'M');
        }
        if (! buf_empty_p (stderrbuf))
        {
-           buf_append_char (stderrbuf, '\n');
+           bputc ('\n', stderrbuf);
            buf_copy_lines (buf_to_net, stderrbuf, 'E');
        }
        if (! buf_empty_p (protocol_inbuf))
-           buf_output0 (buf_to_net,
-                        "E Protocol error: uncounted data discarded\n");
+           bputs ("E Protocol error: uncounted data discarded\n", buf_to_net);
 
 #ifdef SERVER_FLOWCONTROL
        close (flowcontrol_pipe[1]);
@@ -3182,17 +3180,17 @@
                 * variety).  But cvs doesn't currently use libiberty...we
                 * could roll our own....  FIXME.
                 */
-               buf_output0 (buf_to_net, "E Terminated with fatal signal ");
+               bputs ("E Terminated with fatal signal ", buf_to_net);
                sprintf (buf, "%d\n", sig);
-               buf_output0 (buf_to_net, buf);
+               bputs (buf, buf_to_net);
 
                /* Test for a core dump.  Is this portable?  */
                if (status & 0x80)
                {
-                   buf_output0 (buf_to_net, "E Core dumped; preserving ");
-                   buf_output0 (buf_to_net, orig_server_temp_dir);
-                   buf_output0 (buf_to_net, " on server.\n\
-E CVS locks may need cleaning up.\n");
+                   bputs ("E Core dumped; preserving ", buf_to_net);
+                   bputs (orig_server_temp_dir, buf_to_net);
+                   bputs (" on server.\n\
+E CVS locks may need cleaning up.\n", buf_to_net);
                    dont_delete_temp = 1;
                }
                ++errs;
@@ -3217,9 +3215,9 @@
 
     if (errs)
        /* We will have printed an error message already.  */
-       buf_output0 (buf_to_net, "error  \n");
+       bputs ("error  \n", buf_to_net);
     else
-       buf_output0 (buf_to_net, "ok\n");
+       bputs ("ok\n", buf_to_net);
     goto free_args_and_return;
 
  error_exit:
@@ -3302,7 +3300,7 @@
            if (numfds < 0
                && errno != EINTR)
            {
-               buf_output0 (buf_to_net, "E select failed\n");
+               bputs ("E select failed\n", buf_to_net);
                print_error (errno);
                return;
            }
@@ -3348,16 +3346,16 @@
 {
     if (server_dir != NULL)
     {
-       buf_output0 (protocol, server_dir);
-       buf_output0 (protocol, "/");
+       bputs (server_dir, protocol);
+       bputs ("/", protocol);
     }
     if (update_dir[0] == '\0')
-       buf_output0 (protocol, ".");
+       bputs (".", protocol);
     else
-       buf_output0 (protocol, update_dir);
-    buf_output0 (protocol, "/\n");
-    buf_output0 (protocol, repository);
-    buf_output0 (protocol, "/");
+       bputs (update_dir, protocol);
+    bputs ("/\n", protocol);
+    bputs (repository, protocol);
+    bputs ("/", protocol);
 }
 
 /*
@@ -3475,8 +3473,7 @@
 
     if (scratched_file != NULL)
     {
-       buf_output0 (protocol,
-                    "E CVS server internal error: duplicate Scratch_Entry\n");
+       bputs ("E CVS server internal error: duplicate Scratch_Entry\n", 
protocol);
        buf_send_counted (protocol);
        return;
     }
@@ -3496,13 +3493,12 @@
 {
     if (entries_line)
     {
-       buf_output0 (protocol, entries_line);
+       bputs (entries_line, protocol);
        buf_output (protocol, "\n", 1);
     }
     else
        /* Return the error message as the Entries line.  */
-       buf_output0 (protocol,
-                    "CVS server internal error: Register missing\n");
+       bputs ("CVS server internal error: Register missing\n", protocol);
     free (entries_line);
     entries_line = NULL;
 }
@@ -3535,17 +3531,17 @@
        }
        else
        {
-           buf_output0 (protocol, "Mode ");
+           bputs ("Mode ", protocol);
            mode_string = mode_to_string (sb.st_mode);
-           buf_output0 (protocol, mode_string);
-           buf_output0 (protocol, "\n");
+           bputs (mode_string, protocol);
+           bputs ("\n", protocol);
            free (mode_string);
        }
     }
 
-    buf_output0 (protocol, "Checked-in ");
+    bputs ("Checked-in ", protocol);
     output_dir (update_dir, repository);
-    buf_output0 (protocol, file);
+    bputs (file, protocol);
     buf_output (protocol, "\n", 1);
     new_entries_line ();
 }
@@ -3564,9 +3560,9 @@
         * This happens if we are now doing a "cvs remove" after a previous
         * "cvs add" (without a "cvs ci" in between).
         */
-       buf_output0 (protocol, "Remove-entry ");
+       bputs ("Remove-entry ", protocol);
        output_dir (update_dir, repository);
-       buf_output0 (protocol, file);
+       bputs (file, protocol);
        buf_output (protocol, "\n", 1);
        free (scratched_file);
        scratched_file = NULL;
@@ -3593,9 +3589,9 @@
     {
        if (!supported_response ("New-entry"))
            return;
-       buf_output0 (protocol, "New-entry ");
+       bputs ("New-entry ", protocol);
        output_dir (update_dir, repository);
-       buf_output0 (protocol, file);
+       bputs (file, protocol);
        buf_output (protocol, "\n", 1);
        new_entries_line ();
     }
@@ -3770,7 +3766,7 @@
     if (!print_pending_error ())
     {
        (void) server_notify ();
-       buf_output0 (buf_to_net, "ok\n");
+       bputs ("ok\n", buf_to_net);
     }
     buf_flush (buf_to_net, 1);
 }
@@ -3845,7 +3841,7 @@
        tempdir = malloc (strlen (server_temp_dir) + 80);
        if (tempdir == NULL)
        {
-           buf_output0 (buf_to_net, "E Out of memory\n");
+           bputs ("E Out of memory\n", buf_to_net);
            return;
        }
        strcpy (tempdir, server_temp_dir);
@@ -3853,9 +3849,9 @@
        status = mkdir_p (tempdir);
        if (status != 0 && status != EEXIST)
        {
-           buf_output0 (buf_to_net, "E Cannot create ");
-           buf_output0 (buf_to_net, tempdir);
-           buf_append_char (buf_to_net, '\n');
+           bputs ("E Cannot create ", buf_to_net);
+           bputs (tempdir, buf_to_net);
+           bputc ('\n', buf_to_net);
            print_error (errno);
            free (tempdir);
            return;
@@ -3863,9 +3859,9 @@
 
        if ( CVS_CHDIR (tempdir) < 0)
        {
-           buf_output0 (buf_to_net, "E Cannot change to directory ");
-           buf_output0 (buf_to_net, tempdir);
-           buf_append_char (buf_to_net, '\n');
+           bputs ("E Cannot change to directory ", buf_to_net);
+           bputs (tempdir, buf_to_net);
+           bputc ('\n', buf_to_net);
            print_error (errno);
            free (tempdir);
            return;
@@ -3907,12 +3903,12 @@
 
     if (!supported_response ("Copy-file"))
        return;
-    buf_output0 (protocol, "Copy-file ");
+    bputs ("Copy-file ", protocol);
     output_dir (update_dir, repository);
-    buf_output0 (protocol, file);
-    buf_output0 (protocol, "\n");
-    buf_output0 (protocol, newfile);
-    buf_output0 (protocol, "\n");
+    bputs (file, protocol);
+    bputs ("\n", protocol);
+    bputs (newfile, protocol);
+    bputs ("\n", protocol);
 }
 
 /* See server.h for description.  */
@@ -3936,9 +3932,9 @@
           circumstances.  */
        return;
     date_to_internet (outdate, date);
-    buf_output0 (protocol, "Mod-time ");
-    buf_output0 (protocol, outdate);
-    buf_output0 (protocol, "\n");
+    bputs ("Mod-time ", protocol);
+    bputs (outdate, protocol);
+    bputs ("\n", protocol);
 }
 
 /* See server.h for description.  */
@@ -4040,13 +4036,13 @@
                int i;
                char buf[3];
 
-               buf_output0 (protocol, "Checksum ");
+               bputs ("Checksum ", protocol);
                for (i = 0; i < 16; i++)
                {
                    sprintf (buf, "%02x", (unsigned int) checksum[i]);
-                   buf_output0 (protocol, buf);
+                   bputs (buf, protocol);
                }
-               buf_append_char (protocol, '\n');
+               bputc ('\n', protocol);
            }
        }
 
@@ -4057,14 +4053,14 @@
 
            if (!(supported_response ("Created")
                  && supported_response ("Update-existing")))
-               buf_output0 (protocol, "Updated ");
+               bputs ("Updated ", protocol);
            else
            {
                assert (vers != NULL);
                if (vers->ts_user == NULL)
-                   buf_output0 (protocol, "Created ");
+                   bputs ("Created ", protocol);
                else
-                   buf_output0 (protocol, "Update-existing ");
+                   bputs ("Update-existing ", protocol);
            }
 
            /* Now munge the entries to say that the file is unmodified,
@@ -4076,15 +4072,15 @@
            entnode->timestamp = xstrdup ("=");
        }
        else if (updated == SERVER_MERGED)
-           buf_output0 (protocol, "Merged ");
+           bputs ("Merged ", protocol);
        else if (updated == SERVER_PATCHED)
-           buf_output0 (protocol, "Patched ");
+           bputs ("Patched ", protocol);
        else if (updated == SERVER_RCS_DIFF)
-           buf_output0 (protocol, "Rcs-diff ");
+           bputs ("Rcs-diff ", protocol);
        else
            abort ();
        output_dir (finfo->update_dir, finfo->repository);
-       buf_output0 (protocol, finfo->file);
+       bputs (finfo->file, protocol);
        buf_output (protocol, "\n", 1);
 
        new_entries_line ();
@@ -4093,8 +4089,8 @@
            char *mode_string;
 
            mode_string = mode_to_string (mode);
-           buf_output0 (protocol, mode_string);
-           buf_output0 (protocol, "\n");
+           bputs (mode_string, protocol);
+           bputs ("\n", protocol);
            free (mode_string);
        }
 
@@ -4147,7 +4143,7 @@
                if (close (fd) < 0)
                    error (1, errno, "reading %s", finfo->fullname);
                /* Prepending length with "z" is flag for using gzip here.  */
-               buf_output0 (protocol, "z");
+               bputs ("z", protocol);
            }
            else if (filebuf == NULL)
            {
@@ -4168,7 +4164,7 @@
        }
 
        sprintf (size_text, "%lu\n", size);
-       buf_output0 (protocol, size_text);
+       bputs (size_text, protocol);
 
        if (file != NULL)
        {
@@ -4216,11 +4212,11 @@
        scratched_file = NULL;
 
        if (kill_scratched_file)
-           buf_output0 (protocol, "Removed ");
+           bputs ("Removed ", protocol);
        else
-           buf_output0 (protocol, "Remove-entry ");
+           bputs ("Remove-entry ", protocol);
        output_dir (finfo->update_dir, finfo->repository);
-       buf_output0 (protocol, finfo->file);
+       bputs (finfo->file, protocol);
        buf_output (protocol, "\n", 1);
        /* keep the vers structure up to date in case we do a join
         * - if there isn't a file, it can't very well have a version number, 
can it?
@@ -4272,9 +4268,9 @@
        set_static_supported = supported_response ("Set-static-directory");
     if (!set_static_supported) return;
 
-    buf_output0 (protocol, "Set-static-directory ");
+    bputs ("Set-static-directory ", protocol);
     output_dir (update_dir, repository);
-    buf_output0 (protocol, "\n");
+    bputs ("\n", protocol);
     buf_send_counted (protocol);
 }
 
@@ -4291,9 +4287,9 @@
     if (noexec)
        return;
 
-    buf_output0 (protocol, "Clear-static-directory ");
+    bputs ("Clear-static-directory ", protocol);
     output_dir (update_dir, repository);
-    buf_output0 (protocol, "\n");
+    bputs ("\n", protocol);
     buf_send_counted (protocol);
 }
 
@@ -4318,29 +4314,29 @@
 
     if (tag == NULL && date == NULL)
     {
-       buf_output0 (protocol, "Clear-sticky ");
+       bputs ("Clear-sticky ", protocol);
        output_dir (update_dir, repository);
-       buf_output0 (protocol, "\n");
+       bputs ("\n", protocol);
     }
     else
     {
-       buf_output0 (protocol, "Set-sticky ");
+       bputs ("Set-sticky ", protocol);
        output_dir (update_dir, repository);
-       buf_output0 (protocol, "\n");
+       bputs ("\n", protocol);
        if (tag != NULL)
        {
            if (nonbranch)
-               buf_output0 (protocol, "N");
+               bputs ("N", protocol);
            else
-               buf_output0 (protocol, "T");
-           buf_output0 (protocol, tag);
+               bputs ("T", protocol);
+           bputs (tag, protocol);
        }
        else
        {
-           buf_output0 (protocol, "D");
-           buf_output0 (protocol, date);
+           bputs ("D", protocol);
+           bputs (date, protocol);
        }
-       buf_output0 (protocol, "\n");
+       bputs ("\n", protocol);
     }
     buf_send_counted (protocol);
 }
@@ -4369,9 +4365,9 @@
     if (!supported_response ("Template"))
        /* Might want to warn the user that the rcsinfo feature won't work.  */
        return 0;
-    buf_output0 (protocol, "Template ");
+    bputs ("Template ", protocol);
     output_dir (data->update_dir, data->repository);
-    buf_output0 (protocol, "\n");
+    bputs ("\n", protocol);
 
     fp = CVS_FOPEN (template, "rb");
     if (fp == NULL)
@@ -4385,7 +4381,7 @@
        return 1;
     }
     sprintf (buf, "%ld\n", (long) sb.st_size);
-    buf_output0 (protocol, buf);
+    bputs (buf, protocol);
     while (!feof (fp))
     {
        n = fread (buf, 1, sizeof buf, fp);
@@ -4461,13 +4457,13 @@
          wrapper_line;
          wrap_unparse_rcs_options (&wrapper_line, 0))
     {
-       buf_output0 (buf_to_net, "Wrapper-rcsOption ");
-       buf_output0 (buf_to_net, wrapper_line);
-       buf_output0 (buf_to_net, "\012");;
+       bputs ("Wrapper-rcsOption ", buf_to_net);
+       bputs (wrapper_line, buf_to_net);
+       bputs ("\012", buf_to_net);;
        free (wrapper_line);
     }
 
-    buf_output0 (buf_to_net, "ok\012");
+    bputs ("ok\012", buf_to_net);
 
     /* The client is waiting for us, so we better send the data now.  */
     buf_flush (buf_to_net, 1);
@@ -4509,19 +4505,19 @@
 
     if (mwhere != NULL)
     {
-       buf_output0 (buf_to_net, "Module-expansion ");
+       bputs ("Module-expansion ", buf_to_net);
        if (server_dir != NULL)
        {
-           buf_output0 (buf_to_net, server_dir);
-           buf_output0 (buf_to_net, "/");
+           bputs (server_dir, buf_to_net);
+           bputs ("/", buf_to_net);
        }
-       buf_output0 (buf_to_net, mwhere);
+       bputs (mwhere, buf_to_net);
        if (mfile != NULL)
        {
-           buf_append_char (buf_to_net, '/');
-           buf_output0 (buf_to_net, mfile);
+           bputc ('/', buf_to_net);
+           bputs (mfile, buf_to_net);
        }
-       buf_append_char (buf_to_net, '\n');
+       bputc ('\n', buf_to_net);
     }
     else
     {
@@ -4529,29 +4525,29 @@
            of aliases before removing */
        if (argc == 1)
        {
-           buf_output0 (buf_to_net, "Module-expansion ");
+           bputs ("Module-expansion ", buf_to_net);
            if (server_dir != NULL)
            {
-               buf_output0 (buf_to_net, server_dir);
-               buf_output0 (buf_to_net, "/");
+               bputs (server_dir, buf_to_net);
+               bputs ("/", buf_to_net);
            }
-           buf_output0 (buf_to_net, dir);
-           buf_append_char (buf_to_net, '\n');
+           bputs (dir, buf_to_net);
+           bputc ('\n', buf_to_net);
        }
        else
        {
            for (i = 1; i < argc; ++i)
            {
-               buf_output0 (buf_to_net, "Module-expansion ");
+               bputs ("Module-expansion ", buf_to_net);
                if (server_dir != NULL)
                {
-                   buf_output0 (buf_to_net, server_dir);
-                   buf_output0 (buf_to_net, "/");
+                   bputs (server_dir, buf_to_net);
+                   bputs ("/", buf_to_net);
                }
-               buf_output0 (buf_to_net, dir);
-               buf_append_char (buf_to_net, '/');
-               buf_output0 (buf_to_net, argv[i]);
-               buf_append_char (buf_to_net, '\n');
+               bputs (dir, buf_to_net);
+               bputc ('/', buf_to_net);
+               bputs (argv[i], buf_to_net);
+               bputc ('\n', buf_to_net);
            }
        }
     }
@@ -4588,9 +4584,9 @@
     }
     if (err)
        /* We will have printed an error message already.  */
-       buf_output0 (buf_to_net, "error  \n");
+       bputs ("error  \n", buf_to_net);
     else
-       buf_output0 (buf_to_net, "ok\n");
+       bputs ("ok\n", buf_to_net);
 
     /* The client is waiting for the module expansions, so we must
        send the output now.  */
@@ -4605,23 +4601,24 @@
 {
     if (!supported_response ("Set-checkin-prog"))
     {
-       buf_output0 (buf_to_net, "E \
-warning: this client does not support -i or -u flags in the modules file.\n");
+       bputs ("E \
+warning: this client does not support -i or -u flags in the modules file.\n",
+               buf_to_net);
        return;
     }
     switch (which)
     {
        case PROG_CHECKIN:
-           buf_output0 (buf_to_net, "Set-checkin-prog ");
+           bputs ("Set-checkin-prog ", buf_to_net);
            break;
        case PROG_UPDATE:
-           buf_output0 (buf_to_net, "Set-update-prog ");
+           bputs ("Set-update-prog ", buf_to_net);
            break;
     }
-    buf_output0 (buf_to_net, dir);
-    buf_append_char (buf_to_net, '\n');
-    buf_output0 (buf_to_net, name);
-    buf_append_char (buf_to_net, '\n');
+    bputs (dir, buf_to_net);
+    bputc ('\n', buf_to_net);
+    bputs (name, buf_to_net);
+    bputc ('\n', buf_to_net);
 }
 
 static void
@@ -4813,16 +4810,16 @@
     struct request *rq;
     if (print_pending_error ())
        return;
-    buf_output0 (buf_to_net, "Valid-requests");
+    bputs ("Valid-requests", buf_to_net);
     for (rq = requests; rq->name != NULL; rq++)
     {
        if (rq->func != NULL)
        {
-           buf_append_char (buf_to_net, ' ');
-           buf_output0 (buf_to_net, rq->name);
+           bputc (' ', buf_to_net);
+           bputs (rq->name, buf_to_net);
        }
     }
-    buf_output0 (buf_to_net, "\nok\n");
+    bputs ("\nok\n", buf_to_net);
 
     /* The client is waiting for the list of valid requests, so we
        must send the output now.  */
@@ -5187,8 +5184,8 @@
        status = buf_read_line (buf_from_net, &cmd, (int *) NULL);
        if (status == -2)
        {
-           buf_output0 (buf_to_net, "E Fatal server error, aborting.\n\
-error ENOMEM Virtual memory exhausted.\n");
+           bputs ("E Fatal server error, aborting.\n\
+error ENOMEM Virtual memory exhausted.\n", buf_to_net);
            break;
        }
        if (status != 0)
@@ -5241,10 +5238,10 @@
        {
            if (!print_pending_error ())
            {
-               buf_output0 (buf_to_net, "error  unrecognized request `");
-               buf_output0 (buf_to_net, cmd);
-               buf_append_char (buf_to_net, '\'');
-               buf_append_char (buf_to_net, '\n');
+               bputs ("error  unrecognized request `", buf_to_net);
+               bputs (cmd, buf_to_net);
+               bputc ('\'', buf_to_net);
+               bputc ('\n', buf_to_net);
            }
        }
        free (orig_cmd);
@@ -6388,9 +6385,9 @@
            return;
        }
 
-       buf_output0 (buf, "Mbinary\012");
+       bputs ("Mbinary\012", buf);
        sprintf (size_text, "%lu\012", (unsigned long) len);
-       buf_output0 (buf, size_text);
+       bputs (size_text, buf);
 
        /* Not sure what would be involved in using buf_append_data here
           without stepping on the toes of our caller (which is responsible
@@ -6590,12 +6587,12 @@
        else
            buf = protocol;
 
-       buf_output0 (buf, "MT ");
-       buf_output0 (buf, tag);
+       bputs ("MT ", buf);
+       bputs (tag, buf);
        if (text != NULL)
        {
            buf_output (buf, " ", 1);
-           buf_output0 (buf, text);
+           bputs (text, buf);
        }
        buf_output (buf, "\n", 1);
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]