Note: The default ITS GitLab runner is a shared resource and is subject to slowdowns during heavy usage.
You can run your own GitLab runner that is dedicated just to your group if you need to avoid processing delays.

Commit de1a2b1a authored by Austin Kiekintveld's avatar Austin Kiekintveld
Browse files

Revert "Make `argv` point to `const char`"

This reverts commit 1aceadad.
parent 1aceadad
......@@ -14,8 +14,8 @@
#include <cstdio>
#include <cstring>
inline const char *get_filename_and_move_count(int &optind, const char *argv[], int &move_count);
inline void rotate_argv(int move_count, const char *argv[], int &optind, int &argc);
inline char *get_filename_and_move_count(int &optind, char *argv[], int &move_count);
inline void rotate_argv(int move_count, char *argv[], int &optind, int &argc);
// REQUIRES: argc & argv from main(), and optind from getopt.h (optional)
// MODIFIES: optind is incremented until it equals argc
......@@ -26,8 +26,8 @@ inline void rotate_argv(int move_count, const char *argv[], int &optind, int &ar
// stdin (from < infilename or <infilename),
// stdout (from > outfilename or >outfilename), and/or
// stderr (from 2> errfilename or 2>errfilename).
inline void xcode_redirect(int &argc, const char *argv[], int optind = 1) {
const char *infile = nullptr, *outfile = nullptr, *errfile = nullptr;
inline void xcode_redirect(int &argc, char *argv[], int optind = 1) {
char *infile = nullptr, *outfile = nullptr, *errfile = nullptr;
int move_count = 0;
while (optind < argc) {
switch (*argv[optind]) {
......@@ -64,10 +64,10 @@ inline void xcode_redirect(int &argc, const char *argv[], int optind = 1) {
} // while
} // xcode_redirect()
inline void rotate_argv(int move_count, const char *argv[], int &optind, int &argc) {
inline void rotate_argv(int move_count, char *argv[], int &optind, int &argc) {
int moveind = optind - move_count;
const char *temp_pre1 = argv[moveind];
const char *temp_pre2 = argv[moveind + 1];
char *temp_pre1 = argv[moveind];
char *temp_pre2 = argv[moveind + 1];
while (moveind + move_count < argc) {
argv[moveind] = argv[moveind + move_count];
++moveind;
......@@ -80,7 +80,7 @@ inline void rotate_argv(int move_count, const char *argv[], int &optind, int &ar
argc -= move_count;
} // rotate_argv()
inline const char *get_filename_and_move_count(int &optind, const char *argv[], int &move_count) {
inline char *get_filename_and_move_count(int &optind, char *argv[], int &move_count) {
if (strlen(argv[optind]) > 2) {
move_count = 1;
// Must offset by 1 character (the <), offset by more if they put space(s) before filename
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment