toys/vtk-c: . Makefile vtk.c

shadzik cvs at pld-linux.org
Sun Aug 6 23:29:01 CEST 2006


Author: shadzik
Date: Sun Aug  6 23:29:01 2006
New Revision: 7604

Added:
   toys/vtk-c/
   toys/vtk-c/Makefile
   toys/vtk-c/vtk.c
Log:
- new, vtk in C


Added: toys/vtk-c/Makefile
==============================================================================
--- (empty file)
+++ toys/vtk-c/Makefile	Sun Aug  6 23:29:01 2006
@@ -0,0 +1,22 @@
+PREFIX = /usr
+bindir = $(PREFIX)/bin
+DESTDIR =
+SOURCES = vtk.c
+OBJECTS = vtk.o
+TARGET = vtk
+LINK = g++
+CFLAGS  = -pipe -Wall -W -O2
+DEL_FILE = rm -f
+INSTALL = /usr/bin/install -c
+
+all: Makefile $(TARGET)
+$(TARGET):  $(OBJECTS)
+	$(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS)
+
+clean:
+	$(DEL_FILE) $(OBJECTS) $(TARGET)
+
+vtk.o: vtk.c
+
+install:
+	$(INSTALL) $(TARGET) $(DESTDIR)/$(bindir)

Added: toys/vtk-c/vtk.c
==============================================================================
--- (empty file)
+++ toys/vtk-c/vtk.c	Sun Aug  6 23:29:01 2006
@@ -0,0 +1,57 @@
+/* Virtual Tomasz Kłoczko in C
+ * Author: Bartosz 'shadzik' Świątek (shadzik at pld-linux.org)
+ * License: Do what ya want to, as long as you're an PLD Deviloper.
+*/
+#include <stdio.h>
+#include <ctype.h>
+#include <stdlib.h>
+#include <time.h>
+#include <string.h>
+
+int los(void);  // Beautiful ANSI C declaration ;)
+
+/*
+ * Isn't it love ? The main(); function
+*/
+
+int main(void)
+{
+  char ch,str[1000000],temp;
+  int i=0;
+  while((ch = getchar()) != '\n')
+  {
+      str[i]=ch;
+      i++;
+  }
+  for(i=0;i<strlen(str);i++)
+  {
+    if(i!=0)
+    {
+      if((i%los()==0) && (isalpha(str[i])) && (isalpha(str[i+1])))
+      {
+        temp=str[i];
+        str[i]=str[i+1];
+        str[i+1]=temp;
+      }
+    }
+    putchar(str[i]);
+  }
+  printf("\n");
+  return 0;
+}
+
+/*
+ * Choose a random number from 0-9
+*/
+
+int los(void)
+{
+  srand(time(0));
+  int i;
+  i = rand()%10;
+// To get this shit working uncomment the lines beneath
+// it should help getting smaller numbers but actually it just sucks
+  //if(i>6)
+    //i = i/2;
+  return i;
+}


More information about the pld-cvs-commit mailing list