Permalink
Browse files

Stubbornly try to report the filename to smlnj

  • Loading branch information...
1 parent 83e7066 commit f0eca82ad0338a32fd0b3d9a1383f16a38fe6698 @robsimmons robsimmons committed Nov 1, 2011
Showing with 16 additions and 16 deletions.
  1. +1 −1 bin/.mkexec
  2. +15 −15 src/main.sml
View
@@ -8,6 +8,6 @@
# $3 = Name of executable (e.g. celf)
cat > "$2/bin/$3" <<EOF
#! /bin/sh
-exec "$1" @SMLload="$2/bin/.heapimg" "\$@"
+exec "$1" @SMLcmdname=\$0 @SMLload="$2/bin/.heapimg" "\$@"
EOF
chmod a+x "$2/bin/$3"
View
@@ -362,7 +362,7 @@ struct
\\tupdate <name>\t\t\tUpdate all packages\n\
\\tunsource <name>\t\t\tRemove a source from sources.local\n"
- exception ArgsError of string
+ exception ArgsError of string * string
fun main (name, args) =
let
val () = Configure.init ()
@@ -383,24 +383,24 @@ struct
runCmd pkg spec rest
end
| ("exec" :: _) =>
- raise ArgsError "exec requires at least two arguments"
+ raise ArgsError ("exec", "requires at least two arguments")
| ["get",pkg] => get true pkg NONE
| ["get",pkg,ver] =>
get true pkg (SOME (SemVer.constrFromString ver))
| ("get" :: _) =>
- raise ArgsError "get expects one or two arguments"
+ raise ArgsError ("get", "requires one or two arguments")
| ["info",pkg] => (info pkg ""; OS.Process.success)
| ["info",pkg,ver] => (info pkg ver; OS.Process.success)
| ("info" :: _) =>
- raise ArgsError "refresh does not expect arguments"
+ raise ArgsError ("refresh", "does not expect arguments")
| ["list"] => (listInstalled(); OS.Process.success)
| ("list" :: _) =>
- raise ArgsError "list does not expect arguments"
+ raise ArgsError ("list", "does not expect arguments")
- | ["make"] => raise ArgsError "make requires arguments"
+ | ["make"] => raise ArgsError ("make", "requires arguments")
| ["make", pkg] =>
runCmd pkg NONE [ "make", "DESTDIR=" ^ !Configure.smackHome]
| ("make" :: pkg :: maybe_spec :: rest) =>
@@ -415,27 +415,27 @@ struct
| ["refresh"] => selfupdate ()
| ("refresh" :: _) =>
- raise ArgsError "refresh does not expect arguments"
+ raise ArgsError ("refresh", "does not expect arguments")
| ["search",pkg] => (search pkg ""; OS.Process.success)
| ["search",pkg,ver] => (search pkg ver; OS.Process.success)
| ("search" :: _) =>
- raise ArgsError "search expects one or two arguments"
+ raise ArgsError ("search", "expects one or two arguments")
| ["source",pkg,prot,url] =>
source pkg (Protocol.fromString (prot ^ " " ^ url))
| ("source" :: _) =>
- raise ArgsError "source expectes exactly three arguments"
+ raise ArgsError ("source", "expectes exactly three arguments")
| ["update"] => update ()
| ("update" :: _) =>
- raise ArgsError "update does not expect arguments"
+ raise ArgsError ("update", "does not expect arguments")
| ["unsource",pkg] => unsource pkg
| ("unsource" :: _) =>
- raise ArgsError "unsource expectes exactly one argument"
+ raise ArgsError ("unsource", "expectes exactly one argument")
- | (str :: _) => raise ArgsError (str ^ " is an unknown command")
+ | (str :: _) => raise ArgsError (str, "is an unknown command")
end handle
(SmackExn s) =>
( TextIO.output (TextIO.stdErr, "ERROR: " ^ s ^ "\n")
@@ -446,10 +446,10 @@ struct
| (Spec.SpecError s) =>
( TextIO.output (TextIO.stdErr, "ERROR: " ^ s ^ "\n")
; OS.Process.failure)
- | (ArgsError s) =>
- ( TextIO.output (TextIO.stdErr, "ERROR: "
+ | (ArgsError (cmd, s)) =>
+ ( TextIO.output (TextIO.stdErr, "ERROR: `"
^ CommandLine.name ()
- ^ " " ^ s ^ "\n")
+ ^ " " ^ cmd ^ "' " ^ s ^ "\n")
; print usage
; OS.Process.failure)
| exn =>

0 comments on commit f0eca82

Please sign in to comment.