Web Images Videos Maps News Groups Gmail more »
Recently Visited Groups | Help | Sign in
Google Groups Home
Message from discussion Mike releases the "home" command under the GPL

View parsed - Show only message text

Path: archiver1.google.com!postnews1.google.com!not-for-mail
From: mikecoxli...@yahoo.com (Mike Cox)
Newsgroups: comp.os.linux.misc,comp.os.linux.advocacy
Subject: Mike releases the "home" command under the GPL
Date: 24 Jan 2004 17:49:42 -0800
Organization: http://groups.google.com
Lines: 51
Message-ID: <3d6111f1.0401241749.22dc5bbd@posting.google.com>
NNTP-Posting-Host: 209.102.127.191
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 8bit
X-Trace: posting.google.com 1074995383 19879 127.0.0.1 (25 Jan 2004 01:49:43 GMT)
X-Complaints-To: groups-abuse@google.com
NNTP-Posting-Date: Sun, 25 Jan 2004 01:49:43 +0000 (UTC)

/*
	********   home command ********
	The 'home'command takes you to your home directory if
	you've been wandering far, and don't want to type so 
	much.  Just type "home" at the shell, and you're immediatly
	transported to /home/yourusername/ 

	(c) 2004 Mike Cox. Released under the GNU GPL License. 
        email:  mikecoxli...@yahoo.com 
	web: www.geocities.com/mikecoxlinux/

	compile instructions:
	g++ -o home home.cpp

	install instructions:
	move it to the /bin directory.

	..Or create a Makefile as follows:
	home: home.cpp
		g++ -o home home.cpp
	install:
		mv home /bin/
	clean:
		rm home
	
		
*/
#include <iostream>

int main()
{
	char* name= new char[strlen(getlogin()) + 1];
	strcpy(name,getlogin());
	if(strcmp(name, "root") == 0)
	{
		std::cout<<"going to home directory...\n";
		FILE* pipe;
	       	pipe =	popen("cd /root/", "w");	
		pclose(pipe);
	} else{
		char* base = "/home/";
		strcat(base, name);
		FILE* bong;
		std::cout<<"going to home directory...\n";
		bong = popen(base,"w");
		pclose(bong);
	}
	
	delete [] name;
	return 0;
}

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2009 Google