Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Brainfuck

Name: Anonymous 2009-12-19 3:12

So I couldn't sleep and out of boredom wrote a brainfuck to C compiler.

http://nopaste.info/73ec0c6fa7_nl.html

Name: HAHAHaruhi !6mHaRuhies 2009-12-19 3:53

ANONIX PUBLIC LICENSE
www

Name: Anonymous 2009-12-19 4:40

ANONUX

Name: Anonymous 2009-12-19 4:54

ANON MY ANIX

Name: Anonymous 2009-12-19 5:57

If you're anonymous, then why bother with licenses? It's not like anybody can claim the copyright to anonymous software.

Name: Anonymous 2009-12-19 6:14

>>5
sudo: this wasn't serious, [b][o][u][i]faggot[/i][/u][/o][/b]

Name: Anonymous 2009-12-19 6:36

DOLPHIN LINUX

Name: Anonymous 2009-12-19 7:21

>>6
cant use BBcode tags inquite ironic

Name: Anonymous 2009-12-19 7:23

>>8
goddamnit how did this happen !
should have used [#] instead of [rem]

Name: Anonymous 2009-12-19 9:29

oh, the BBCODE failure is causing me PHYSICAL PAIN

Name: Anonymous 2009-12-20 0:30

good work. very well done.

Name: Anonymous 2009-12-20 1:20

Next time write it in a real language, like newLISP1.

_________
1. https://gist.github.com/242690/200f563a675b016e4ba56b59335736559eb6feca

Name: Anonymous 2009-12-20 15:06

worst peice of shit I've ever seen OP

Name: Anonymous 2009-12-20 16:05

ANONIX

Name: Anonymous 2009-12-20 19:08

-> #include <getopt.h>
fclose(input) -> fclose(input);
return 0; -> return EXIT_SUCCESS;
return -1; -> return EXIT_FAILURE;

Name: Anonymous 2009-12-20 21:47

This thread has been closed and replaced with the following thread:

Subject: Compiling Brainfuck code with a C compiler
Name:
Email:

It works.

Name: Anonymous 2009-12-21 14:36

>>15
For me, getopt() is in unistd.h

Name: Anonymous 2009-12-21 18:49

>>17

learn2c99

Name: Anonymous 2009-12-21 22:47

Speaking of getopt, what do commercial products use these days for parsing command-line options? getopt is GPL; is there a similar library with a zlib-style license?

Name: RMS Mark Shuttleworth 2009-12-21 22:53

>>19
s/commercial/non-free(as in freedom)/

Name: Anonymous 2009-12-22 0:35

>>19
getopt isn't ``GPL''. As a concept it's part of POSIX, and there are many different implementations under many licenses.
The GNU version does have some GNU-specific extensions (getopt_long and getopt_long_only), and obviously that library is licensed under the GPL. Is that what you were thinking of?

As far as I know, commercial products don't parse command line options at all, and just stick a giant configuration GUI in front of it, or get options from XML.

Name: Anonymous 2009-12-22 0:43

>>21
Ah I see. I didn't realize it was in POSIX. Googling "free getopt" brought me to, fittingly enough, freegetopt.sourceforge.net .

Name: Anonymous 2009-12-22 1:32

>>18
C99 MY ANUS

Name: Anonymous 2009-12-22 2:06

>>19
getopt() is less than 20 lines of C for the full POSIX implementation, and probably takes a few minutes to write.

Name: Anonymous 2009-12-22 5:37

>>24

C:\temp\>wc -l getopt.c
1278 getopt.c

Name: Anonymous 2009-12-22 5:48

>>25
GNU Bloat

Name: Anonymous 2009-12-22 5:52

>>25
GNU also supports long options, which makes parsing a bit less straightforward, and has a few extra functions in there.
Also, like two thirds of that is comments.

Name: Anonymous 2009-12-22 8:09

>>27
So you're off not by a factor of 60 at least, but only by factor of 30 or so? Read the source, there are not so many comments really.

Whatever, I dare you to write your own POSIX-compliant getopt implementation. That would be a "few" minutes well-spent, homosexual!

Name: Anonymous 2009-12-22 9:17

Implement your own standard library.

Name: Anonymous 2009-12-22 9:48

>>24
Implement it and post source for proof.

Name: Anonymous 2009-12-22 11:53

>>28
So you
I don't know who you think you're talking to. POSIX getopt is really straightforward, though. Even /prog/ should be able to write an implementation.

Name: Anonymous 2009-12-22 18:05

>>29
IMPLEMENT MY ANUS

Name: Anonymous 2009-12-23 1:00

>>30

/* @getopt.c */
#include <string.h>
#include <stdio.h>

char *optarg;
int optind=1, opterr, optopt;
static int optoptind=1;



int getopt(int argc, char *const argv[], const char *optstring) {
 char *s, c;
 if(!argv[optind] || *argv[optind]!='-' || !strcmp(argv[optind],"-") || !strcmp(argv[optind++],"--"))
  return -1;
 if(s=strchr(optstring,c=argv[--optind][optoptind++])) {
  if(s[1]==':') {
   optarg = argv[optind++][optoptind]? optoptind=0,&argv[optind][optoptind]:argv[optind++];
   if(optind>argc)
    c= do_opt_err(argv,':',c);
  }
 } else
  c = do_opt_err(argv,'?',c);
 optoptind = argv[optind][optoptind]?optoptind:optind++,1;
 return c;
}



static int do_opt_err(char **argv, char c, char d) {
 fprintf(stderr,"%s: %s %c",c=='?'?"invalid option":"missing argument for option",d);
 return optopt=d;
}

Name: Anonymous 2009-12-23 5:14

>>33

your code's ugliness haunts my very existence

Name: Anonymous 2009-12-23 6:20

>>34
You have much to learn young padawan

Name: Anonymous 2009-12-23 6:49

>>34
There's really no pretty way to write getopt. Options can be passed in disgusting ways.

Name: Anonymous 2009-12-23 8:14

>>33
I'm impressed beyond anything words can convey.
Your tricks are evil and ingenious.
You forgot to check opterr though ;P

Name: Anonymous 2009-12-23 8:57

brb

Name: Anonymous 2009-12-23 9:01

>>38
gt on irc fgt

Name: Anonymous 2009-12-23 10:03

>>39
GET ON MY ANUS

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List