* [[http://scottn.us/|Blog]] * [[contact|Contact]]


* [[wrtu54g-tm|WRTU54G-TM OpenWRT]] * [[wrtu54g-tm:info|Device Info]] * [[wrtu54g-tm:otherfirmware|Other firmware]] * [[goflex:start|Seagate GoFlex Home]] * [[goflex:serialport|Serial Port]] * [[xbox360|Xbox 360]] * [[blackberry|Tether BlackBerry Bold 9700 in Linux]] * [[peek|Peek Email Device]] * [[c:start|Programming]]

====== Programming ====== Some things I do. Little snippets of peoples homework and such are here: http://scottn.us/code/ ====== awk ===== I've been messing with awk a lot lately. Some is in the code directory, but the big one is [[c:twitter.awk|my twitter client]]. odd, huh? :) ====== irc bot ===== lot of stuffs to learn in that. http://scottn.us/bot.php ====== Modules example ====== <file - Makefile> all: main module main: main.c $(CC) $(CFLAGS) -o main main.c -ldl module: module.c $(CC) $(CFLAGS) -shared -o module.o module.c clean: -rm -f main module.o </file> <file c common.h> struct s_cmd { char *text; void (*func)(); }; </file> <file c main.c> #include <stdio.h> #include <dlfcn.h> #include "common.h" int main(int argc, char **argv) { void *dll; struct s_cmd *c; void (*func)(); dll = dlopen("./module.o", RTLD_LAZY); if (!dll) { fputs(dlerror(), stderr); return -1; } c = dlsym(dll, "__exports"); if (!c) { fputs("No __exports?\n", stderr); return -1; } while (c->text) { printf("my_command = [%s]\n", c->text); c->func(); c++; } return 0; } </file> <file c module.c> #include <stdio.h> #include "common.h" void cmd_test(); void cmd_again(); struct s_cmd __exports[] = { { "test", &cmd_test }, { "again", &cmd_again }, NULL }; void cmd_test() { printf("This is test1.\n"); } void cmd_again() { printf("And this is another test\n"); } </file>

 
 
c/start.txt ยท Last modified: 2015/09/27 03:43 (external edit)
Recent changes RSS feed Creative Commons License Valid XHTML 1.0 Valid CSS Driven by DokuWiki
Drupal Garland Theme for Dokuwiki