Github user necouchman commented on a diff in the pull request:
https://github.com/apache/guacamole-server/pull/156#discussion_r176917418
--- Diff: src/protocols/ssh/ttymode.c ---
@@ -0,0 +1,59 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#include "config.h"
+#include "ttymode.h"
+
+#include <stdarg.h>
+#include <stdlib.h>
+#include <string.h>
+
+int guac_ssh_ttymodes_init(char opcode_array[], const int array_size,
+ const int num_opcodes, ...) {
+
+ /* Initialize the variable argument list. */
+ va_list args;
+ va_start(args, num_opcodes);
+
+ /* Check to make sure the array has enough space.
+ We need one extra byte at the end for the ending opcode. */
+ if ((num_opcodes * GUAC_SSH_TTY_OPCODE_SIZE) >= (array_size))
+ return 1;
+
+ for (int i = 0; i < num_opcodes; i++) {
+ /* Calculate offset in array */
+ int offset = i * GUAC_SSH_TTY_OPCODE_SIZE;
+
+ /* Get the next argument to this function */
+ guac_ssh_ttymode ttymode = va_arg(args, guac_ssh_ttymode);
--- End diff --
Is it possible to do this by pointer/reference rather than value? I'm not
familiar with the va_arg macro and how to use it - do I just change the
argument to `&guac_ssh_ttymode` and the assignment to `guac_ssh_ttymode*
ttymode`?
---