2012年1月23日月曜日

Hoge.c

/*
============================================================================
Name : Hoge.c
Author : M♂DS
Version :
Copyright : M♂DS
Description : Hoge in C, Ansi-style
============================================================================
*/

#include
#include

#define BUFFLEN 256

struct _list {
struct _list *prev;
struct _list *next;
char buff[BUFFLEN];
};

typedef struct _list LIST;

LIST * makeList(LIST *current) {
if (current == (LIST *) NULL) {
current = (LIST *) calloc(1, sizeof(LIST));
current->prev = (LIST *) NULL;
} else {
current->next = (LIST *) calloc(1, sizeof(LIST));
current->next->prev = current;
current = current->next;
}
current->next = (LIST *) NULL;
return current;
}

int main(void) {
LIST *q, *p;
int i;

p = q = (LIST *) NULL;
for (i = 0; i < 100; i++) {
p = makeList(p);
if (q == NULL) {
q = p;
}
snprintf(p->buff, BUFFLEN, "hoge %03d", i);
}

for (p = q; p; p = p->next) {
puts(p->buff);
}
return EXIT_SUCCESS;
}

次の案件に備えて11年ぶりくらいに
C言語を使ってみたが
意外と忘れてなくて良かったε-(´∀`*)ホッ

.screenrc

# -*- shell-script -*-

termcap kterm hs@
terminfo kterm hs@
term ansi
vbell off
bind w windowlist -b
hardstatus alwayslastline "%{= gw} %H %{= wk}%-Lw%{= bw}%n%f* %t%{= wk}%+Lw %{= wk}%=%{= gk} %y/%m/%d %c "
defhstatus I^En:^EtI
shell -$SHELL
startup_message off
autodetach on
defscrollback 5000

bind 'd' setenv DISPLAY
bind w windowlist -b
bind ^p paste
bind p paste

bind r eval 'echo "Resize window"' 'command -c resize'
bind -c resize ^] command
bind -c resize j eval 'resize +1' 'command -c resize'
bind -c resize k eval 'resize -1' 'command -c resize'

bindkey -m > eval "stuff ' '" writebuf 'exec sh -c "xsel -i -b < /tmp/screen-exchange; sleep 0.1"'