Dre4m Shell
Server IP : 85.214.239.14  /  Your IP : 3.16.50.1
Web Server : Apache/2.4.62 (Debian)
System : Linux h2886529.stratoserver.net 4.9.0 #1 SMP Tue Jan 9 19:45:01 MSK 2024 x86_64
User : www-data ( 33)
PHP Version : 7.4.18
Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
MySQL : OFF  |  cURL : OFF  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : OFF
Directory :  /proc/3/cwd/proc/3/root/usr/share/doc/re2c/examples/c/submatch/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME SHELL ]     

Current File : /proc/3/cwd/proc/3/root/usr/share/doc/re2c/examples/c/submatch/parse_etc_passwd.c
/* Generated by re2c */
// re2c $INPUT -o $OUTPUT -i
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>

#define YYMAXFILL 4


static int lex(const char *YYCURSOR) {
    const char *YYMARKER, *n, *p, *u, *g, *f, *h, *c;
    const char *yyt1;const char *yyt2;const char *yyt3;const char *yyt4;const char *yyt5;const char *yyt6;const char *yyt7;

    for (;;) {
    
{
	char yych;
	yych = *YYCURSOR;
	switch (yych) {
		case 0x00: goto yy1;
		case '\n':
		case ':': goto yy4;
		default:
			yyt1 = YYCURSOR;
			goto yy2;
	}
yy1:
	++YYCURSOR;
	{ return 0; }
yy2:
	yych = *(YYMARKER = ++YYCURSOR);
	switch (yych) {
		case 0x00:
		case '\n': goto yy3;
		default: goto yy6;
	}
yy3:
	{ fprintf(stderr, "error\n"); return 1; }
yy4:
	++YYCURSOR;
	goto yy3;
yy5:
	yych = *++YYCURSOR;
yy6:
	switch (yych) {
		case 0x00:
		case '\n': goto yy7;
		case ':': goto yy8;
		default: goto yy5;
	}
yy7:
	YYCURSOR = YYMARKER;
	goto yy3;
yy8:
	yych = *++YYCURSOR;
	switch (yych) {
		case 0x00:
		case '\n': goto yy7;
		case ':':
			yyt2 = YYCURSOR;
			goto yy10;
		default:
			yyt2 = YYCURSOR;
			goto yy9;
	}
yy9:
	yych = *++YYCURSOR;
	switch (yych) {
		case 0x00:
		case '\n': goto yy7;
		case ':': goto yy10;
		default: goto yy9;
	}
yy10:
	yych = *++YYCURSOR;
	switch (yych) {
		case '0':
		case '1':
		case '2':
		case '3':
		case '4':
		case '5':
		case '6':
		case '7':
		case '8':
		case '9':
			yyt3 = YYCURSOR;
			goto yy11;
		default: goto yy7;
	}
yy11:
	yych = *++YYCURSOR;
	switch (yych) {
		case '0':
		case '1':
		case '2':
		case '3':
		case '4':
		case '5':
		case '6':
		case '7':
		case '8':
		case '9': goto yy11;
		case ':': goto yy12;
		default: goto yy7;
	}
yy12:
	yych = *++YYCURSOR;
	switch (yych) {
		case '0':
		case '1':
		case '2':
		case '3':
		case '4':
		case '5':
		case '6':
		case '7':
		case '8':
		case '9':
			yyt4 = YYCURSOR;
			goto yy13;
		default: goto yy7;
	}
yy13:
	yych = *++YYCURSOR;
	switch (yych) {
		case '0':
		case '1':
		case '2':
		case '3':
		case '4':
		case '5':
		case '6':
		case '7':
		case '8':
		case '9': goto yy13;
		case ':': goto yy14;
		default: goto yy7;
	}
yy14:
	yych = *++YYCURSOR;
	switch (yych) {
		case 0x00:
		case '\n': goto yy7;
		case ':':
			yyt5 = YYCURSOR;
			goto yy16;
		default:
			yyt5 = YYCURSOR;
			goto yy15;
	}
yy15:
	yych = *++YYCURSOR;
	switch (yych) {
		case 0x00:
		case '\n': goto yy7;
		case ':': goto yy16;
		default: goto yy15;
	}
yy16:
	yych = *++YYCURSOR;
	switch (yych) {
		case '/':
			yyt6 = YYCURSOR;
			goto yy17;
		default: goto yy7;
	}
yy17:
	yych = *++YYCURSOR;
	switch (yych) {
		case 0x00:
		case '\n': goto yy7;
		case ':': goto yy18;
		default: goto yy17;
	}
yy18:
	yych = *++YYCURSOR;
	switch (yych) {
		case '/':
			yyt7 = YYCURSOR;
			goto yy19;
		default: goto yy7;
	}
yy19:
	yych = *++YYCURSOR;
	switch (yych) {
		case 0x00:
		case ':': goto yy7;
		case '\n': goto yy20;
		default: goto yy19;
	}
yy20:
	++YYCURSOR;
	n = yyt1;
	p = yyt2;
	u = yyt3;
	g = yyt4;
	f = yyt5;
	h = yyt6;
	c = yyt7;
	{
            fprintf(stderr, "user:     %.*s\n", (int)(p - n) - 1, n);
            fprintf(stderr, "password: %.*s\n", (int)(u - p) - 1, p);
            fprintf(stderr, "UID:      %.*s\n", (int)(g - u) - 1, u);
            fprintf(stderr, "GID:      %.*s\n", (int)(f - g) - 1, g);
            fprintf(stderr, "info:     %.*s\n", (int)(h - f) - 1, f);
            fprintf(stderr, "home:     %.*s\n", (int)(c - h) - 1, h);
            fprintf(stderr, "command:  %.*s\n", (int)(YYCURSOR - c - 1), c);
            fprintf(stderr, "\n");
            continue;
        }
}

    }
}

int main() {
    const char *fname = "etc_passwd";
    FILE *f;

    // prepare input file
    f = fopen(fname, "w");
    fprintf(f,
        "root:x:0:0:root:/root:/bin/bash\n"
        "bin:x:1:1:bin:/bin:/bin/false\n"
        "portage:x:250:250:portage:/var/tmp/portage:/bin/false\n");
    fclose(f);

    // read input file into buffer
    f = fopen(fname, "r");
    fseek(f, 0, SEEK_END);
    const size_t fsize = (size_t) ftell(f);
    fseek(f, 0, SEEK_SET);
    char *buffer = (char*) malloc(fsize + 1);
    fread(buffer, 1, fsize, f);
    buffer[fsize] = 0;
    fclose(f);

    assert(lex(buffer) == 0);

    // cleanup
    remove(fname);
    free(buffer);
    return 0;
}

Anon7 - 2022
AnonSec Team