Name: Anonymous 2008-04-01 13:07
Forget about header files. Just write.
int main(int argc, char *argv[]) {
int main(int argc, char *argv[]) {
return 1;
}
int main(int argc, char *argv[]) {
return EXIT_FAILURE; }
}
system("ghc");
int tmain(void) {
#define return NIGGERS
int main(int argc, char *argv[]) {
NIGGERS 0;
}
Maybe ..
while(true){
}
/* link utility for GNU.
Copyright (C) 2001, 2002, 2004 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
/* Written by Michael Stone */
/* Implementation overview:
Simply call the system 'link' function */
#include <config.h>
#include <stdio.h>
#include <getopt.h>
#include <sys/types.h>
#include "system.h"
#include "error.h"
#include "long-options.h"
#include "quote.h"
/* The official name of this program (e.g., no `g' prefix). */
#define PROGRAM_NAME "link"
#define AUTHORS "Michael Stone"
/* Name this program was run with. */
char *program_name;
void
usage (int status)
{
if (status != EXIT_SUCCESS)
fprintf (stderr, _("Try `%s --help' for more information.\n"),
program_name);
else
{
printf (_("\
Usage: %s FILE1 FILE2\n\
or: %s OPTION\n"), program_name, program_name);
fputs (_("Call the link function to create a link named FILE2\
to an existing FILE1.\n\n"),
stdout);
fputs (HELP_OPTION_DESCRIPTION, stdout);
fputs (VERSION_OPTION_DESCRIPTION, stdout);
printf (_("\nReport bugs to <%s>.\n"), PACKAGE_BUGREPORT);
}
exit (status);
}
int
main (int argc, char **argv)
{
initialize_main (&argc, &argv);
program_name = argv[0];
setlocale (LC_ALL, "");
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);
atexit (close_stdout);
parse_long_options (argc, argv, PROGRAM_NAME, GNU_PACKAGE, VERSION,
usage, AUTHORS, (char const *) NULL);
if (getopt_long (argc, argv, "", NULL, NULL) != -1)
usage (EXIT_FAILURE);
if (argc < optind + 2)
{
if (argc < optind + 1)
error (0, 0, _("missing operand"));
else
error (0, 0, _("missing operand after %s"), quote (argv[optind]));
usage (EXIT_FAILURE);
}
if (optind + 2 < argc)
{
error (0, 0, _("extra operand %s"), quote (argv[optind + 2]));
usage (EXIT_FAILURE);
}
if (link (argv[optind], argv[optind + 1]) != 0)
error (EXIT_FAILURE, errno, _("cannot create link %s to %s"),
quote_n (0, argv[optind + 1]), quote_n (1, argv[optind]));
exit (EXIT_SUCCESS);
}
#include <unistd.h>
#include <stdio.h>
#include <errno.h>
int main(int argc, char **argv) {
if(argc<3) {
fprintf(stderr,"Usage: link file1, file2\n");
return 1;
}
if(link(argv[1],argv[2])) {
fprintf(stderr,"%s: could not create link: %s\n",argv[0],strerror(errno));
return 1;
}
return 0;
}
Prelude> :ihbt
Commands available from the prompt:
<statement> evaluate/run <statement>
: repeat last command
:{\n ..lines.. \n:}\n multiline command
:add <filename> ... add module(s) to the current target set
:browse[!] [[*]<mod>] display the names defined by module <mod>
(!: more details; *: all top-level names)
:cd <dir> change directory to <dir>
:cmd <expr> run the commands returned by <expr>::IO String
:ctags [<file>] create tags file for Vi (default: "tags")
:def <cmd> <expr> define a command :<cmd>
:edit <file> edit file
:edit edit last module
:etags [<file>] create tags file for Emacs (default: "TAGS")
:help, :? display this list of commands
:info [<name> ...] display information about the given names
:kind <type> show the kind of <type>
:load <filename> ... load module(s) and their dependents
:main [<arguments> ...] run the main function with the given arguments
:module [+/-] [*]<mod> ... set the context for expression evaluation
:quit exit GHCi
:reload reload the current module set
:type <expr> show the type of <expr>
:undef <cmd> undefine user-defined command :<cmd>
:!<command> run the shell command <command>
[include <stdio.h>]
[NULL][/NULL][NULL][/NULL][NULL][/NULL][NULL][/NULL][NULL][/NULL][NULL][/NULL]
Abelson and Sussman have written an excellent textbook which may start a revolut
ion in the way programming is taught. Instead of emphasizing a particular progra
mming language, they emphasize standard engineering techniques as they apply to
programming. Still, their textbook is intimately tied to the Scheme dialect of L
isp. I believe that the same approach used in their text, if applied to a langua
ge such as KFC or Haskell, would result in an even better introduction to progra
mming as an engineering discipline. My belief has strengthened as my experience
in teaching with Scheme and with KFC has increased.
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char **argv) {
if(argc != 2) {
fputs("link: missing operand\n");
return EXIT_FAILURE;
}
if(link(argv[1], argv[2]) == -1) {
perror("link");
abort();
}
return 0;
}
LN(1) User Commands LN(1)
NAME
ln - make links between files
SYNOPSIS
ln [OPTION]... [-T] TARGET LINK_NAME (1st form)
ln [OPTION]... TARGET (2nd form)
ln [OPTION]... TARGET... DIRECTORY (3rd form)
ln [OPTION]... -t DIRECTORY TARGET... (4th form)
DESCRIPTION
In the 1st form, create a link to TARGET with the name LINK_NAME. In
the 2nd form, create a link to TARGET in the current directory. In the
3rd and 4th forms, create links to each TARGET in DIRECTORY. Create
hard links by default, symbolic links with --symbolic. When creating
hard links, each TARGET must exist.
Mandatory arguments to long options are mandatory for short options
too.
--backup[=CONTROL]
make a backup of each existing destination file
-b like --backup but does not accept an argument
-d, -F, --directory
allow the superuser to attempt to hard link directories (note:
will probably fail due to system restrictions, even for the
superuser)
-f, --force
remove existing destination files
-n, --no-dereference
treat destination that is a symlink to a directory as if it were
a normal file
-i, --interactive
prompt whether to remove destinations
-s, --symbolic
make symbolic links instead of hard links
-S, --suffix=SUFFIX
override the usual backup suffix
-t, --target-directory=DIRECTORY
specify the DIRECTORY in which to create the links
-T, --no-target-directory
treat LINK_NAME as a normal file
-v, --verbose
print name of each file before linking
--help display this help and exit
--version
output version information and exit
The backup suffix is ‘~’, unless set with --suffix or SIM‐
PLE_BACKUP_SUFFIX. The version control method may be selected via the
--backup option or through the VERSION_CONTROL environment variable.
Here are the values:
none, off
never make backups (even if --backup is given)
numbered, t
make numbered backups
existing, nil
numbered if numbered backups exist, simple otherwise
simple, never
always make simple backups
AUTHOR
Written by Mike Parker and David MacKenzie.
REPORTING BUGS
Report bugs to <bug-coreutils@gnu.org>;.
COPYRIGHT
Copyright © 2006 Free Software Foundation, Inc.
This is free software. You may redistribute copies of it under the
terms of the GNU General Public License
<http://www.gnu.org/licenses/gpl.html>;. There is NO WARRANTY, to the
extent permitted by law.
SEE ALSO
The full documentation for ln is maintained as a Texinfo manual. If
the info and ln programs are properly installed at your site, the com‐
mand
info ln
should give you access to the complete manual.
ln 5.97 September 2007 LN(1)
LN(1) FreeBSD General Commands Manual LN(1)
NAME
ln, link -- make links
SYNOPSIS
ln [-Ffhinsv] source_file [target_file]
ln [-Ffhinsv] source_file ... target_dir
link source_file target_file
DESCRIPTION
The ln utility creates a new directory entry (linked file) which has the
same modes as the original file. It is useful for maintaining multiple
copies of a file in many places at once without using up storage for the
``copies''; instead, a link ``points'' to the original copy. There are
two types of links; hard links and symbolic links. How a link ``points''
to a file is one of the differences between a hard and symbolic link.
The options are as follows:
-f If the target file already exists, then unlink it so that the link
may occur. (The -f option overrides any previous -i options.)
-F If the target file already exists and is a directory, then remove
it so that the link may occur. The -F option should be used with
either -f or -i options. If none is specified, -f is implied. The
-F option is a no-op unless -s option is specified.
-h If the target_file or target_dir is a symbolic link, do not follow
it. This is most useful with the -f option, to replace a symlink
which may point to a directory.
-i Cause ln to write a prompt to standard error if the target file
exists. If the response from the standard input begins with the
character `y' or `Y', then unlink the target file so that the link
may occur. Otherwise, do not attempt the link. (The -i option
overrides any previous -f options.)
-n Same as -h, for compatibility with other ln implementations.
-s Create a symbolic link.
-v Cause ln to be verbose, showing files as they are processed.
By default, ln makes hard links. A hard link to a file is indistinguish-
able from the original directory entry; any changes to a file are effec-
tively independent of the name used to reference the file. Hard links
may not normally refer to directories and may not span file systems.
A symbolic link contains the name of the file to which it is linked. The
referenced file is used when an open(2) operation is performed on the
link. A stat(2) on a symbolic link will return the linked-to file; an
lstat(2) must be done to obtain information about the link. The
readlink(2) call may be used to read the contents of a symbolic link.
Symbolic links may span file systems and may refer to directories.
Given one or two arguments, ln creates a link to an existing file
source_file. If target_file is given, the link has that name;
target_file may also be a directory in which to place the link; otherwise
it is placed in the current directory. If only the directory is speci-
fied, the link will be made to the last component of source_file.
Given more than two arguments, ln makes links in target_dir to all the
named source files. The links made will have the same name as the files
being linked to.
When the utility is called as link, exactly two arguments must be sup-
plied, neither of which may specify a directory. No options may be sup-
plied in this simple mode of operation, which performs a link(2) opera-
tion using the two passed arguments.
COMPATIBILITY
The -h, -i, -n and -v options are non-standard and their use in scripts
is not recommended. They are provided solely for compatibility with
other ln implementations.
The -F option is FreeBSD extention and should not be used in portable
scripts.
SEE ALSO
link(2), lstat(2), readlink(2), stat(2), symlink(2), symlink(7)
STANDARDS
The ln utility conforms to IEEE Std 1003.2-1992 (``POSIX.2'').
The simplified link command conforms to Version 2 of the Single UNIX
Specification (``SUSv2'').
HISTORY
An ln command appeared in Version 1 AT&T UNIX.
FreeBSD 6.2 February 14, 2006 FreeBSD 6.2
repeat "NULL"
Prelude> let unix = True
Prelude> let gnu = gnu == not unix
Prelude> gnu
*** Exception: stack overflow