<commit_before>// Copyright 2009 The GoGo Authors. All rights reserved.
// Use of this source code is governed by the MIT
// license that can be found in the LICENSE file.

//
// GoGo library functions
//

package libgogo

var Argv [255]string;
var Argc uint64 = 0;

func GetArgv() {
    var fd uint64;
    var errno uint64;    
    var char string = "#";
    var inArgv uint64 = 0;

    fd = FileOpen("/proc/self/cmdline", 0);
    if fd == 0 {
        ExitError("Error opening /proc/self/cmdline. Currently GoGo is only supported on systems with /proc enabled.", 1);
    }

    for errno = Read(fd, char, 1) ; errno != 0 ; errno = Read(fd, char, 1) {
        if char[0] == 0 {
            inArgv = 1;
            Argc = Argc + 1;
        } else {
            if inArgv == 1 {
                Argv[Argc] += string(char[0]); // (SC) TODO: Remove cast, str append
            }
        }
    }

    errno = FileClose(fd);
    if errno != 0 {<commit_msg>libgogo: Fix GetArgv (Argc index was wrong)<commit_after>// Copyright 2009 The GoGo Authors. All rights reserved.
// Use of this source code is governed by the MIT
// license that can be found in the LICENSE file.

//
// GoGo library functions
//

package libgogo

var Argv [255]string;
var Argc uint64 = 0;

func GetArgv() {
    var fd uint64;
    var errno uint64;    
    var char string = "#";

    fd = FileOpen("/proc/self/cmdline", 0);
    if fd == 0 {
        ExitError("Error opening /proc/self/cmdline. Currently GoGo is only supported on systems with /proc enabled.", 1);
    }

    for errno = Read(fd, char, 1) ; errno != 0 ; errno = Read(fd, char, 1) {
        if char[0] == 0 {
            Argc = Argc + 1;
        } else {
            Argv[Argc] += string(char[0]); // (SC) TODO: Remove cast, str append
        }
    }

    errno = FileClose(fd);
    if errno != 0 {
{'fraction_non_alphanumeric': 0.123773173391494, 'fraction_numerical': 0.029989094874591057, 'mean_word_length': 2.073701842546064, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '318570', 'n_tokens_mistral': 647, 'n_tokens_neox': 582, 'n_words': 219}