add own program to ports + help with port / program

Polytropon freebsd at edvax.de
Sun Sep 13 19:49:38 UTC 2009


On Sun, 13 Sep 2009 21:38:00 +0200, Stefan Miklosovic <miklosovic.freebsd at gmail.com> wrote:
> I am about writing shell script which adds system account
> by tens (even hundreds).

Interesting and useful tool. I'm sure many sysadmins have
created such tools for their own needs, but it wouldn't be
bad to have one publically available from the ports collection.



> Password are generated by apg program

In order to employ an alternate password generation program
(e. g. pwgen), you could even add an entry to your configuration
file.



> I want to write this program but I do not know if I do it correct and I need
> some
> feedback about programming style or just some info what do you think about
> it.

Style is highly debatable and is discussed ocassionally on this
list. But finally, YOU are the programmer and YOU are the one
who decides about style.

Programming tips to mainly rely on which programming language
you use. For example, if you're using C, I would suggest you to
only use "safe functions" (e. g. no strcpy() function) and
always check return values (e. g. fopen(), fputs() and fclose()
functions, if you use them for accessing files). In case you
are using threads, check that your program is "thread safe".

Testing as much as possible is important because you're writing
a program that is acting on system level (root) when it does
"simply" create user accounts.



> At this time, there is absence of manual, but if you track code, I think
> you understand it.

In order to comply to FreeBSD's philosophy of quality, you should,
if your program is complete, take the time to write a manpage.
As a developer, I always loved FreeBSD for its excellent
documentation. Don't do it "the Linux way" - leave documentation
to the Web, a Wiki, or the users. :-)




-- 
Polytropon
Magdeburg, Germany
Happy FreeBSD user since 4.0
Andra moi ennepe, Mousa, ...


More information about the freebsd-questions mailing list